pythagoras.d

## Interface IPoint

• ### Method Summary

All Methods
Modifier and Type Method and Description
`Point` ```add(double x, double y)```
Translates this point by the specified offset.
`Point` ```add(double x, double y, Point result)```
Translates this point by the specified offset and stores the result in the object provided.
`Point` ```add(XY other, Point result)```
Translates this point by the specified offset and stores the result in the object provided.
`Point` `clone()`
Returns a mutable copy of this point.
`double` `direction(XY other)`
Returns the angle (in radians) of the vector starting at this point and ending at the supplied other point.
`double` ```distance(double px, double py)```
Returns the Euclidian distance between this point and the specified point.
`double` `distance(XY p)`
Returns the Euclidian distance between this point and the supplied point.
`double` ```distanceSq(double px, double py)```
Returns the squared Euclidian distance between this point and the specified point.
`double` `distanceSq(XY p)`
Returns the squared Euclidian distance between this point and the supplied point.
`Point` `mult(double s)`
Multiplies this point by a scale factor.
`Point` ```mult(double s, Point result)```
Multiplies this point by a scale factor and places the result in the supplied object.
`Point` `rotate(double angle)`
Rotates this point around the origin by the specified angle.
`Point` ```rotate(double angle, Point result)```
Rotates this point around the origin by the specified angle, storing the result in the point provided.
`Point` ```subtract(double x, double y)```
Subtracts the supplied point from `this`.
`Point` ```subtract(double x, double y, Point result)```
Subtracts the supplied point from `this` and stores the result in `result`.
`Point` ```subtract(XY other, Point result)```
Subtracts the supplied point from `this` and stores the result in `result`.
• ### Methods inherited from interface pythagoras.d.XY

`x, y`
• ### Method Detail

• #### distanceSq

```double distanceSq(double px,
double py)```
Returns the squared Euclidian distance between this point and the specified point.
• #### distanceSq

`double distanceSq(XY p)`
Returns the squared Euclidian distance between this point and the supplied point.
• #### distance

```double distance(double px,
double py)```
Returns the Euclidian distance between this point and the specified point.
• #### distance

`double distance(XY p)`
Returns the Euclidian distance between this point and the supplied point.
• #### direction

`double direction(XY other)`
Returns the angle (in radians) of the vector starting at this point and ending at the supplied other point.
• #### mult

`Point mult(double s)`
Multiplies this point by a scale factor.
Returns:
a new point containing the result.
• #### mult

```Point mult(double s,
Point result)```
Multiplies this point by a scale factor and places the result in the supplied object.
Returns:
a reference to the result, for chaining.

```Point add(double x,
double y)```
Translates this point by the specified offset.
Returns:
a new point containing the result.

```Point add(double x,
double y,
Point result)```
Translates this point by the specified offset and stores the result in the object provided.
Returns:
a reference to the result, for chaining.

```Point add(XY other,
Point result)```
Translates this point by the specified offset and stores the result in the object provided.
Returns:
a reference to the result, for chaining.
• #### subtract

```Point subtract(double x,
double y)```
Subtracts the supplied point from `this`.
Returns:
a new point containing the result.
• #### subtract

```Point subtract(double x,
double y,
Point result)```
Subtracts the supplied point from `this` and stores the result in `result`.
Returns:
a reference to the result, for chaining.
• #### subtract

```Point subtract(XY other,
Point result)```
Subtracts the supplied point from `this` and stores the result in `result`.
Returns:
a reference to the result, for chaining.
• #### rotate

`Point rotate(double angle)`
Rotates this point around the origin by the specified angle.
Returns:
a new point containing the result.
• #### rotate

```Point rotate(double angle,
Point result)```
Rotates this point around the origin by the specified angle, storing the result in the point provided.
Returns:
a reference to the result point, for chaining.
• #### clone

`Point clone()`
Returns a mutable copy of this point.