Class Point3D
java.lang.Object
com.amalgamasimulation.geometry.geometry3d.Point3D
Class representing a point in 3D space. The point has x, y and z coordinates
of type double. This point can be used as a basic structural element for 3D
geometry operations and is backed by
Point for its x and y
coordinates.
NaNs and infinite coordinates are allowed and there are no checks that prevent from creating points with such coordinates. These coordinates are not supported in most methods which can cause errors; such special cases are not described below.
- Author:
- Andrey Malykhanov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledistanceTo(Point3D other) Returns the distance from this point to the specified point.booleangetCopy()Returns the 2D projection (x and y coordinates) of this point.doublegetX()Returns the x-coordinate (abscissa) of the point.doublegetY()Returns the y-coordinate (ordinate) of the point.doublegetZ()Returns the z-coordinate of the point.inthashCode()toString()
-
Constructor Details
-
Point3D
public Point3D()Creates a new 3D point with (0, 0, 0) coordinates. -
Point3D
Creates a new point with x and y taken from the specified 2D point and the specified z-coordinate.- Parameters:
point- 2DPointproviding x and y coordinatesz- z-coordinate of the point
-
Point3D
public Point3D(double x, double y, double z) Creates a new point with the specified coordinates.- Parameters:
x- x-coordinate of the pointy- y-coordinate of the pointz- z-coordinate of the point
-
-
Method Details
-
getPoint2D
Returns the 2D projection (x and y coordinates) of this point.- Returns:
- 2D projection of this point
-
getX
public double getX()Returns the x-coordinate (abscissa) of the point.- Returns:
- x-coordinate of the point
-
getY
public double getY()Returns the y-coordinate (ordinate) of the point.- Returns:
- y-coordinate of the point
-
getZ
public double getZ()Returns the z-coordinate of the point.- Returns:
- z-coordinate of the point
-
hashCode
public int hashCode() -
equals
-
distanceTo
Returns the distance from this point to the specified point. The returned value cannot be negative.- Parameters:
other- the specified point- Returns:
- distance from this point to the specified point
-
getCopy
-
toString
-
toCodeString
-