java.lang.Object
javafx.geometry.Point3D
- All Implemented Interfaces:
- Interpolatable<Point3D>
public class Point3D extends Object implements Interpolatable<Point3D>
A 3D geometric point that usually represents the x, y, z coordinates.
 It can also represent a relative magnitude vector's x, y, z magnitudes.
- Since:
- JavaFX 2.0
- 
Field Summary
- 
Constructor SummaryConstructors Constructor Description Point3D(double x, double y, double z)Creates a new instance ofPoint3D.
- 
Method SummaryModifier and Type Method Description Point3Dadd(double x, double y, double z)Returns a point with the specified coordinates added to the coordinates of this point.Point3Dadd(Point3D point)Returns a point with the coordinates of the specified point added to the coordinates of this point.doubleangle(double x, double y, double z)Computes the angle (in degrees) between the vector represented by this point and the specified vector.doubleangle(Point3D point)Computes the angle (in degrees) between the vector represented by this point and the vector represented by the specified point.doubleangle(Point3D p1, Point3D p2)Computes the angle (in degrees) between the three points with this point as a vertex.Point3DcrossProduct(double x, double y, double z)Computes cross product of the vector represented by this instance and the specified vector.Point3DcrossProduct(Point3D vector)Computes cross product of the vector represented by this instance and the specified vector.doubledistance(double x1, double y1, double z1)Computes the distance between this point and point(x1, y1, z1).doubledistance(Point3D point)Computes the distance between this point and the specifiedpoint.doubledotProduct(double x, double y, double z)Computes dot (scalar) product of the vector represented by this instance and the specified vector.doubledotProduct(Point3D vector)Computes dot (scalar) product of the vector represented by this instance and the specified vector.booleanequals(Object obj)Returns a hash code value for the point.doublegetX()The x coordinate.doublegetY()The y coordinate.doublegetZ()The z coordinate.inthashCode()Returns a hash code for thisPoint3Dobject.Point3Dinterpolate(Point3D endValue, double t)The function calculates an interpolated value along the fractiontbetween0.0and1.0.doublemagnitude()Computes magnitude (length) of the relative magnitude vector represented by this instance.Point3Dmidpoint(double x, double y, double z)Returns a point which lies in the middle between this point and the specified coordinates.Point3Dmidpoint(Point3D point)Returns a point which lies in the middle between this point and the specified point.Point3Dmultiply(double factor)Returns a point with the coordinates of this point multiplied by the specified factorPoint3Dnormalize()Normalizes the relative magnitude vector represented by this instance.Point3Dsubtract(double x, double y, double z)Returns a point with the specified coordinates subtracted from the coordinates of this point.Point3Dsubtract(Point3D point)Returns a point with the coordinates of the specified point subtracted from the coordinates of this point.StringtoString()Returns a string representation of thisPoint3D.
- 
Field Details- 
ZEROPoint or vector with all three coordinates set to 0.
 
- 
- 
Constructor Details- 
Point3Dpublic Point3D(double x, double y, double z)Creates a new instance ofPoint3D.- Parameters:
- x- The X coordinate of the- Point3D
- y- The Y coordinate of the- Point3D
- z- The Z coordinate of the- Point3D
 
 
- 
- 
Method Details- 
getXpublic final double getX()The x coordinate.- Returns:
- the x coordinate
 
- 
getYpublic final double getY()The y coordinate.- Returns:
- the y coordinate
 
- 
getZpublic final double getZ()The z coordinate.- Returns:
- the z coordinate
 
- 
distancepublic double distance(double x1, double y1, double z1)Computes the distance between this point and point(x1, y1, z1).- Parameters:
- x1- the x coordinate of other point
- y1- the y coordinate of other point
- z1- the z coordinate of other point
- Returns:
- the distance between this point and point (x1, y1, z1).
 
- 
distanceComputes the distance between this point and the specifiedpoint.- Parameters:
- point- the other point
- Returns:
- the distance between this point and the specified point.
- Throws:
- NullPointerException- if the specified- pointis null
 
- 
addReturns a point with the specified coordinates added to the coordinates of this point.- Parameters:
- x- the X coordinate addition
- y- the Y coordinate addition
- z- the Z coordinate addition
- Returns:
- the point with added coordinates
- Since:
- JavaFX 8.0
 
- 
addReturns a point with the coordinates of the specified point added to the coordinates of this point.- Parameters:
- point- the point whose coordinates are to be added
- Returns:
- the point with added coordinates
- Throws:
- NullPointerException- if the specified- pointis null
- Since:
- JavaFX 8.0
 
- 
subtractReturns a point with the specified coordinates subtracted from the coordinates of this point.- Parameters:
- x- the X coordinate subtraction
- y- the Y coordinate subtraction
- z- the Z coordinate subtraction
- Returns:
- the point with subtracted coordinates
- Since:
- JavaFX 8.0
 
- 
subtractReturns a point with the coordinates of the specified point subtracted from the coordinates of this point.- Parameters:
- point- the point whose coordinates are to be subtracted
- Returns:
- the point with subtracted coordinates
- Throws:
- NullPointerException- if the specified- pointis null
- Since:
- JavaFX 8.0
 
- 
multiplyReturns a point with the coordinates of this point multiplied by the specified factor- Parameters:
- factor- the factor multiplying the coordinates
- Returns:
- the point with multiplied coordinates
- Since:
- JavaFX 8.0
 
- 
normalizeNormalizes the relative magnitude vector represented by this instance. Returns a vector with the same direction and magnitude equal to 1. If this is a zero vector, a zero vector is returned.- Returns:
- the normalized vector represented by a Point3Dinstance
- Since:
- JavaFX 8.0
 
- 
midpointReturns a point which lies in the middle between this point and the specified coordinates.- Parameters:
- x- the X coordinate of the second endpoint
- y- the Y coordinate of the second endpoint
- z- the Z coordinate of the second endpoint
- Returns:
- the point in the middle
- Since:
- JavaFX 8.0
 
- 
midpointReturns a point which lies in the middle between this point and the specified point.- Parameters:
- point- the other endpoint
- Returns:
- the point in the middle
- Throws:
- NullPointerException- if the specified- pointis null
- Since:
- JavaFX 8.0
 
- 
anglepublic double angle(double x, double y, double z)Computes the angle (in degrees) between the vector represented by this point and the specified vector.- Parameters:
- x- the X magnitude of the other vector
- y- the Y magnitude of the other vector
- z- the Z magnitude of the other vector
- Returns:
- the angle between the two vectors measured in degrees
- Since:
- JavaFX 8.0
 
- 
angleComputes the angle (in degrees) between the vector represented by this point and the vector represented by the specified point.- Parameters:
- point- the other vector
- Returns:
- the angle between the two vectors measured in degrees,
         NaNif any of the two vectors is a zero vector
- Throws:
- NullPointerException- if the specified- pointis null
- Since:
- JavaFX 8.0
 
- 
angleComputes the angle (in degrees) between the three points with this point as a vertex.- Parameters:
- p1- one point
- p2- other point
- Returns:
- angle between the vectors (this, p1) and (this, p2) measured
         in degrees, NaNif the three points are not different from one another
- Throws:
- NullPointerException- if the- p1or- p2is null
- Since:
- JavaFX 8.0
 
- 
magnitudepublic double magnitude()Computes magnitude (length) of the relative magnitude vector represented by this instance.- Returns:
- magnitude of the vector
- Since:
- JavaFX 8.0
 
- 
dotProductpublic double dotProduct(double x, double y, double z)Computes dot (scalar) product of the vector represented by this instance and the specified vector.- Parameters:
- x- the X magnitude of the other vector
- y- the Y magnitude of the other vector
- z- the Z magnitude of the other vector
- Returns:
- the dot product of the two vectors
- Since:
- JavaFX 8.0
 
- 
dotProductComputes dot (scalar) product of the vector represented by this instance and the specified vector.- Parameters:
- vector- the other vector
- Returns:
- the dot product of the two vectors
- Throws:
- NullPointerException- if the specified- vectoris null
- Since:
- JavaFX 8.0
 
- 
crossProductComputes cross product of the vector represented by this instance and the specified vector.- Parameters:
- x- the X magnitude of the other vector
- y- the Y magnitude of the other vector
- z- the Z magnitude of the other vector
- Returns:
- the cross product of the two vectors
- Since:
- JavaFX 8.0
 
- 
crossProductComputes cross product of the vector represented by this instance and the specified vector.- Parameters:
- vector- the other vector
- Returns:
- the cross product of the two vectors
- Throws:
- NullPointerException- if the specified- vectoris null
- Since:
- JavaFX 8.0
 
- 
interpolateThe function calculates an interpolated value along the fractiontbetween0.0and1.0. Whent= 1.0,endValis returned.- Specified by:
- interpolatein interface- Interpolatable<Point3D>
- Parameters:
- endValue- target value
- t- fraction between- 0.0and- 1.0
- Returns:
- interpolated value
- Since:
- 13
 
- 
equalsReturns a hash code value for the point.
- 
hashCodepublic int hashCode()Returns a hash code for thisPoint3Dobject.
- 
toStringReturns a string representation of thisPoint3D. This method is intended to be used only for informational purposes. The content and format of the returned string might vary between implementations. The returned string might be empty but cannot benull.
 
-