MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / center

Method center

src/org/opensourcephysics/media/core/TPoint.java:582–586  ·  view source on GitHub ↗

Centers this TPoint between the two specified points. Note that this method does not call setXY. @param pt1 the first Point2D @param pt2 the second Point2D

(Point2D.Double pt1, Point2D.Double pt2)

Source from the content-addressed store, hash-verified

580 * @param pt2 the second Point2D
581 */
582 public void center(Point2D.Double pt1, Point2D.Double pt2) {
583 double x = (pt1.x + pt2.x) / 2.0;
584 double y = (pt1.y + pt2.y) / 2.0;
585 setLocation(x, y);
586 }
587
588 /**
589 * Translates this TPoint by the specified displacement.

Callers 2

getShapeMethod · 0.80
getShapeMethod · 0.80

Calls 1

setLocationMethod · 0.95

Tested by

no test coverage detected