Package nl.colorize.multimedialib.math
Record Class Point3D
java.lang.Object
java.lang.Record
nl.colorize.multimedialib.math.Point3D
Immutable point within a three-dimensional space, with its X, Y, and Z
coordinates defined with float precision. Negative coordinates are
permitted.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPoint3D(float x, float y, float z) Creates an instance of aPoint3Drecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatdistanceTo(Point3D other) Returns the distance between this point and the specified other point.final booleanIndicates whether some other object is "equal to" this one.findCenter(Point3D other) Returns a new point that is positioned in the center between this point and the specified other point.final inthashCode()Returns a hash code value for this object.interpolate(Point3D other, float delta) Returns a new point with a position that uses linear interpolation between this point and the specified other point.interpolate(Point3D other, float delta, nl.colorize.util.animation.Interpolation method) Returns a new point with a position that is interpolated between this point and the specified other point.booleanisOrigin()move(float deltaX, float deltaY, float deltaZ) Returns a new point that starts from this point and then adds the specified offset.Returns a new point that starts from this point and then adds the specified offset.negate()Returns a new point that has X/Y/Z values that are the inverse of this point's X/Y/Z values.toString()Returns a string representation of this record class.floatx()Returns the value of thexrecord component.floaty()Returns the value of theyrecord component.floatz()Returns the value of thezrecord component.
-
Field Details
-
ORIGIN
-
EPSILON
public static final float EPSILON- See Also:
-
-
Constructor Details
-
Point3D
public Point3D(float x, float y, float z) Creates an instance of aPoint3Drecord class.- Parameters:
x- the value for thexrecord componenty- the value for theyrecord componentz- the value for thezrecord component
-
-
Method Details
-
isOrigin
public boolean isOrigin() -
distanceTo
Returns the distance between this point and the specified other point. -
findCenter
Returns a new point that is positioned in the center between this point and the specified other point. -
interpolate
public Point3D interpolate(Point3D other, float delta, nl.colorize.util.animation.Interpolation method) Returns a new point with a position that is interpolated between this point and the specified other point. The delta is represented by a number between 0.0 (position of this point) and 1.0 (position of the other point). -
interpolate
Returns a new point with a position that uses linear interpolation between this point and the specified other point. The delta is represented by a number between 0.0 (position of this point) and 1.0 (position of the other point). -
move
Returns a new point that starts from this point and then adds the specified offset. -
move
Returns a new point that starts from this point and then adds the specified offset. -
negate
Returns a new point that has X/Y/Z values that are the inverse of this point's X/Y/Z values. Negating the result will result in the original point, i.e.point.negate().negate().equals(point). -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
x
public float x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public float y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
z
public float z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-