pythagoras.d

## Class AbstractPoint

• All Implemented Interfaces:
Cloneable, IPoint, XY
Direct Known Subclasses:
Point

```public abstract class AbstractPoint
extends Object
implements IPoint```
Provides most of the implementation of `IPoint`, obtaining only the location from the derived class.
• ### Constructor Summary

Constructors
Constructor and Description
`AbstractPoint()`
• ### 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.
`boolean` `equals(Object obj)`
`int` `hashCode()`
`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`.
`String` `toString()`
• ### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`
• ### Methods inherited from interface pythagoras.d.XY

`x, y`
• ### Constructor Detail

• #### AbstractPoint

`public AbstractPoint()`
• ### Method Detail

• #### distanceSq

```public double distanceSq(double px,
double py)```
Description copied from interface: `IPoint`
Returns the squared Euclidian distance between this point and the specified point.
Specified by:
`distanceSq` in interface `IPoint`
• #### distanceSq

`public double distanceSq(XY p)`
Description copied from interface: `IPoint`
Returns the squared Euclidian distance between this point and the supplied point.
Specified by:
`distanceSq` in interface `IPoint`
• #### distance

```public double distance(double px,
double py)```
Description copied from interface: `IPoint`
Returns the Euclidian distance between this point and the specified point.
Specified by:
`distance` in interface `IPoint`
• #### distance

`public double distance(XY p)`
Description copied from interface: `IPoint`
Returns the Euclidian distance between this point and the supplied point.
Specified by:
`distance` in interface `IPoint`
• #### direction

`public double direction(XY other)`
Description copied from interface: `IPoint`
Returns the angle (in radians) of the vector starting at this point and ending at the supplied other point.
Specified by:
`direction` in interface `IPoint`
• #### mult

`public Point mult(double s)`
Description copied from interface: `IPoint`
Multiplies this point by a scale factor.
Specified by:
`mult` in interface `IPoint`
Returns:
a new point containing the result.
• #### mult

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

```public Point add(double x,
double y)```
Description copied from interface: `IPoint`
Translates this point by the specified offset.
Specified by:
`add` in interface `IPoint`
Returns:
a new point containing the result.

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

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

```public Point subtract(double x,
double y)```
Description copied from interface: `IPoint`
Subtracts the supplied point from `this`.
Specified by:
`subtract` in interface `IPoint`
Returns:
a new point containing the result.
• #### subtract

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

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

`public Point rotate(double angle)`
Description copied from interface: `IPoint`
Rotates this point around the origin by the specified angle.
Specified by:
`rotate` in interface `IPoint`
Returns:
a new point containing the result.
• #### rotate

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

`public Point clone()`
Description copied from interface: `IPoint`
Returns a mutable copy of this point.
Specified by:
`clone` in interface `IPoint`
Overrides:
`clone` in class `Object`
• #### equals

`public boolean equals(Object obj)`
Overrides:
`equals` in class `Object`
• #### hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`