Point
classin packageklyn.math.geometry
public class Point<NUMBER extends AbstractNumber = Double> extends Object:
Point

Represents a two-dimensional point.

A point stores an absolute location while Vector represents a displacement.

Example:

p = Point<Double>(10.0, 20.0)
moved = p + Vector<Double>(5.0, -2.0)
Properties
Modifier and Type Member Description
public property x
x as NUMBER
Horizontal coordinate.
public propert y
y y as NUMBER
Vertical coordinate.
Constructors
Modifier and Type Member Description
public Point
Point(x as NUMBER = 0, y as NUMBER = 0):
Creates a point from its coordinates.
Methods
Modifier and Type Member Description
public method distanceTo
distanceTo(other as Point<NUMBER>) as Double:
Computes the Euclidean distance to another point.
public override toString
toString() as String:
Returns a readable representation of the point.
Operators
Modifier and Type Member Description
public operator+(vect as Vector<NUMBER>) as Point<NUMBER>: Returns a translated point.
public operator+=(vect as Vector<NUMBER>) as Void: Translates this point in place.
public operator-(vect as Vector<NUMBER>) as Point<NUMBER>: Returns a point translated in the opposite direction.
public operator-=(vect as Vector<NUMBER>) as Void: Translates this point in place in the opposite direction.