Point3D
Source: point.js:118
Immutable 3D point.
Constructor
new Point3D(x: number, y: number, z: number): Point3DParameters
x(number) — The X coordinate for the point.y(number) — The Y coordinate for the point.z(number) — The Z coordinate for the point.
Instance Methods
getX(): number
Get the X position of the point.
Returns
number— The X position of the point.
getY(): number
Get the Y position of the point.
Returns
number— The Y position of the point.
getZ(): number
Get the Z position of the point.
Returns
number— The Z position of the point.
getValues(): Array.<number>
Get the values of this point.
Returns
Array.<number>— The array of values.
equals(rhs: Point3D): boolean
Check for Point3D equality.
Parameters
rhs(Point3D) — The other point to compare to.
Returns
boolean— True if both points are equal.
isSimilar(rhs: Point3D, tol?: number): boolean
Check for Point3D similarity.
Parameters
rhs(Point3D) — The other point to compare to.tol(number, optional) — Optional number comparison tolerance, defaults to Number.EPSILON.
Returns
boolean— True if both points are similar.
toString(): string
Get a string representation of the Point3D.
Returns
string— The point as a string.
getDistance(point3D: Point3D): number
Get the distance to another Point3D.
Parameters
point3D(Point3D) — The input point.
Returns
number— Ths distance to the input point.
getClosest(pointList: Array.<Point3D>): number
Get the closest point to this in a Point3D list.
Parameters
pointList(Array.<Point3D>) — The list to check.
Returns
number— The index of the closest point in the input list.
minus(point3D: Point3D): Vector3D
Get the difference to another Point3D.
Parameters
point3D(Point3D) — The input point.
Returns
Vector3D— The 3D vector from the input point to this one.