Point3d
classin packageklyn.math.geometry
public class Point3d<NUMBER extends AbstractNumber = Double>
Point3d

Three-dimensional position, distinct from a displacement (Vector3d). Coordinates retain their numeric type; distances are computed as Double.

Example
import klyn.math.geometry
position = Point3d<Double>(1.0, 2.0, 3.0)
moved = position + Vector3d<Double>(4.0, 0.0, -1.0)
assert moved.z == 2.0
Properties
Modifier and Type Member Description
public property x
x as NUMBER
X coordinate.
public propert y
y y as NUMBER
Y coordinate.
public property z
z as NUMBER
Z coordinate.
Constructors
Modifier and Type Member Description
public Point3d
Point3d(x as NUMBER = 0, y as NUMBER = 0, z as NUMBER = 0)
Creates a position, defaulting to the origin.
Methods
Modifier and Type Member Description
public distanceTo
distanceTo(notnull other as Point3d<NUMBER>) as Double
Computes the Euclidean distance using scaled hypot operations.
public override toString
toString() as String
Returns coordinates in Point3d(x, y, z) form.
Operators
Modifier and Type Member Description
public operator+(notnull displacement as Vector3d<NUMBER>) as Point3d<NUMBER> Translates this position without modifying it.
public operator+=(notnull displacement as Vector3d<NUMBER>) as Void Applies a translation in place.
public operator-(notnull displacement as Vector3d<NUMBER>) as Point3d<NUMBER> Translates this position in the opposite direction without modifying it.
public operator-=(notnull displacement as Vector3d<NUMBER>) as Void Applies the opposite translation in place.