Record Class Point3D

java.lang.Object
java.lang.Record
nl.colorize.multimedialib.math.Point3D

public record Point3D(float x, float y, float z) extends Record
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
    Modifier and Type
    Field
    Description
    static final float
     
    static final Point3D
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Point3D(float x, float y, float z)
    Creates an instance of a Point3D record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the distance between this point and the specified other point.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns a new point that is positioned in the center between this point and the specified other point.
    final int
    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.
    boolean
     
    move(float deltaX, float deltaY, float deltaZ)
    Returns a new point that starts from this point and then adds the specified offset.
    move(Point3D other)
    Returns a new point that starts from this point and then adds the specified offset.
    Returns a new point that has X/Y/Z values that are the inverse of this point's X/Y/Z values.
    Returns a string representation of this record class.
    float
    x()
    Returns the value of the x record component.
    float
    y()
    Returns the value of the y record component.
    float
    z()
    Returns the value of the z record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Point3D

      public Point3D(float x, float y, float z)
      Creates an instance of a Point3D record class.
      Parameters:
      x - the value for the x record component
      y - the value for the y record component
      z - the value for the z record component
  • Method Details

    • isOrigin

      public boolean isOrigin()
    • distanceTo

      public float distanceTo(Point3D other)
      Returns the distance between this point and the specified other point.
    • findCenter

      public Point3D findCenter(Point3D other)
      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

      public Point3D interpolate(Point3D other, float delta)
      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

      public Point3D move(float deltaX, float deltaY, float deltaZ)
      Returns a new point that starts from this point and then adds the specified offset.
    • move

      public Point3D move(Point3D other)
      Returns a new point that starts from this point and then adds the specified offset.
    • negate

      public Point3D 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

      public String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • x

      public float x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public float y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • z

      public float z()
      Returns the value of the z record component.
      Returns:
      the value of the z record component