Interface Point

All Superinterfaces:
Serializable
All Known Subinterfaces:
Point1D<Numerical>, Point1DLike<Numerical>, Point2D<Numerical>, Point2DLike<Numerical>
All Known Implementing Classes:
Point2DDouble

public interface Point extends Serializable
An n-dimensional point with coordinates of type Number. Some operations may be dependent on the coordinate system's handedness, in which case a left-handed coordinate system is assumed. This is common in computer graphics, where the x-axis points to the right and the y-axis points down.
Since:
8.4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The dimension of the point, which is the number of coordinates it has.
    byte
    Gets the length of this point as a byte (when interpreted as a vector from the origin).
    double
    Gets the length of this point as a double (when interpreted as a vector from the origin).
    float
    Gets the length of this point as a float (when interpreted as a vector from the origin).
    int
    Gets the length of this point as an int (when interpreted as a vector from the origin).
    long
    Gets the length of this point as a long (when interpreted as a vector from the origin).
    short
    Gets the length of this point as a byte (when interpreted as a vector from the origin).
    Normalizes this point so that its length is 1.
    scale(byte scale)
    Scales this point by the given ratio.
    scale(double scale)
    Scales this point by the given ratio.
    scale(float scale)
    Scales this point by the given ratio.
    scale(int scale)
    Scales this point by the given ratio.
    scale(long scale)
    Scales this point by the given ratio.
    scale(short scale)
    Scales this point by the given ratio.
  • Method Details

    • dimensions

      int dimensions()
      The dimension of the point, which is the number of coordinates it has.
      Returns:
      The dimensionality of the point.
    • lengthByte

      byte lengthByte()
      Gets the length of this point as a byte (when interpreted as a vector from the origin).
      Returns:
      The length of this point as a byte.
    • lengthDouble

      double lengthDouble()
      Gets the length of this point as a double (when interpreted as a vector from the origin).
      Returns:
      The length of this point as a double.
    • lengthFloat

      float lengthFloat()
      Gets the length of this point as a float (when interpreted as a vector from the origin).
      Returns:
      The length of this point as a float.
    • lengthInt

      int lengthInt()
      Gets the length of this point as an int (when interpreted as a vector from the origin).
      Returns:
      The length of this point as an int.
    • lengthLong

      long lengthLong()
      Gets the length of this point as a long (when interpreted as a vector from the origin).
      Returns:
      The length of this point as a double.
    • lengthShort

      short lengthShort()
      Gets the length of this point as a byte (when interpreted as a vector from the origin).
      Returns:
      The length of this point as a short.
    • normalize

      Point normalize()
      Normalizes this point so that its length is 1. When its length is 0, returns this point unchanged.
      Returns:
      The normalized point with length 1, or this point unchanged if its length is 0.
    • scale

      Point scale(byte scale)
      Scales this point by the given ratio.
      Parameters:
      scale - The ratio in all directions to scale by.
      Returns:
      A new point that is the result of the scaling.
    • scale

      Point scale(int scale)
      Scales this point by the given ratio.
      Parameters:
      scale - The ratio in all directions to scale by.
      Returns:
      A new point that is the result of the scaling.
    • scale

      Point scale(long scale)
      Scales this point by the given ratio.
      Parameters:
      scale - The ratio in all directions to scale by.
      Returns:
      A new point that is the result of the scaling.
    • scale

      Point scale(float scale)
      Scales this point by the given ratio.
      Parameters:
      scale - The ratio in all directions to scale by.
      Returns:
      A new point that is the result of the scaling.
    • scale

      Point scale(double scale)
      Scales this point by the given ratio.
      Parameters:
      scale - The ratio in all directions to scale by.
      Returns:
      A new point that is the result of the scaling.
    • scale

      Point scale(short scale)
      Scales this point by the given ratio.
      Parameters:
      scale - The ratio in all directions to scale by.
      Returns:
      A new point that is the result of the scaling.