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 Point
NEGATIVE_INFINITY
The point (-INF, -INF, -INF).static Point
ORIGIN
The point (0, 0, 0).static Point
POSITIVE_INFINITY
The point (INF, INF, INF). -
Constructor Summary
-
Method Summary
Modifier and Type Method Description Point
add(Vector vector)
double
distance(Point target)
boolean
isFinite()
Determine if a point has finite values in each of its coordinates.NonZeroVector
nonZeroVectorTo(Point target)
double
squareDistance(Point target)
Point
subtract(Vector vector)
java.lang.String
toString()
Returns theTriple
as a string in the cartesian representation, e.g.Vector
vectorTo(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 aPoint
from three coordinates.- Parameters:
x
- The x-coordinate.y
- The y-coordinate.z
- The z-coordinate.
-
-
Method Details
-
add
- Parameters:
vector
- TheVector
to add to thisPoint
.- Returns:
- The
Point
resulting from adding theNonZeroVector
to thisPoint
.
-
subtract
-
vectorTo
-
nonZeroVectorTo
- Parameters:
target
- The coordinate where theNonZeroVector
is to end, if it were to start from thisPoint
.- Returns:
- The
NonZeroVector
from thisPoint
to the givenPoint
. - Throws:
ZeroVectorException
- if the target is equal to thisPoint
.
-
distance
-
squareDistance
The square of the distance between thisPoint
and 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:Triple
Returns theTriple
as a string in the cartesian representation, e.g. "(0, 0, 0)"
-