Point2D represents a 2-D point with (x,y) coordinates. It can also be used to represent a 2-D vector from (0,0) to (x,y).
The Point2D class provides several methods related to linear algebra, e.g.:
|plus||A + B|
|minus||A - B|
|times|| f * A|
scalar times vector, i.e. (f * x, f * y)
|div|| A / f|
vector divided by scalar, i.e. (x/f, y/f)
i.e. sqrt(x*x + y*y)
|getAngle||angle between the positive X-axis and this vector|
a.k.a. normalized version of A
same direction as A with length 1
|rotate(alpha)|| rotates the vector |
|perpendicular|| A' ⊥ A|
returns vector A' perpendicular to A
(basically rotates A by 90 degrees counter clockwise)
None of the above methods modify the Point2D object that the method is invoked on.
To modify a Point2D object in place (in situ) use one of these methods:
plusInSitu, minusInSitu, timesInSitu, divInSitu, unitInSitu, rotateInSitu.
See also Transform