Package primitives
Class Point
java.lang.Object
primitives.Triple
primitives.Point
public class Point extends Triple
-
Field Summary
Fields Modifier and Type Field Description static PointNEGATIVE_INFINITYThe point (-INF, -INF, -INF).static PointORIGINThe point (0, 0, 0).static PointPOSITIVE_INFINITYThe point (INF, INF, INF). -
Constructor Summary
-
Method Summary
Modifier and Type Method Description Pointadd(Vector vector)doubledistance(Point target)booleanisFinite()Determine if a point has finite values in each of its coordinates.NonZeroVectornonZeroVectorTo(Point target)doublesquareDistance(Point target)Pointsubtract(Vector vector)java.lang.StringtoString()Returns theTripleas a string in the cartesian representation, e.g.VectorvectorTo(Point target)Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
ORIGIN
The point (0, 0, 0). -
NEGATIVE_INFINITY
The point (-INF, -INF, -INF). -
POSITIVE_INFINITY
The point (INF, INF, INF).
-
-
Constructor Details
-
Point
public Point(double x, double y, double z)Constructs aPointfrom three coordinates.- Parameters:
x- The x-coordinate.y- The y-coordinate.z- The z-coordinate.
-
-
Method Details
-
add
- Parameters:
vector- TheVectorto add to thisPoint.- Returns:
- The
Pointresulting from adding theNonZeroVectorto thisPoint.
-
subtract
-
vectorTo
-
nonZeroVectorTo
- Parameters:
target- The coordinate where theNonZeroVectoris to end, if it were to start from thisPoint.- Returns:
- The
NonZeroVectorfrom thisPointto the givenPoint. - Throws:
ZeroVectorException- if the target is equal to thisPoint.
-
distance
-
squareDistance
The square of the distance between thisPointand the targetPoint. This number is much more efficient to compute thandistance(primitives.Point)since it does not involve a square root. -
isFinite
public boolean isFinite()Determine if a point has finite values in each of its coordinates.- Returns:
- true if all coordinates are finite, or false if at least one coordinate is infinite.
-
toString
public java.lang.String toString()Description copied from class:TripleReturns theTripleas a string in the cartesian representation, e.g. "(0, 0, 0)"
-