java.lang.Object
com.github.stephengold.joltjni.Plane
All Implemented Interfaces:
ConstPlane

public final class Plane extends Object implements ConstPlane
A math object used to represent a plane in 3-dimensional space.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Plane(float nx, float ny, float nz, float c)
    Instantiate a plane with specified components.
    Plane(Vec3Arg normal, float c)
    Instantiate a plane with specified components.
    Instantiate from a buffer.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Return the constant in single precision.
    Copy the normal direction.
    float
    Return the first (X) component of the normal direction.
    float
    Return the 2nd (Y) component of the normal direction.
    float
    Return the 3rd (Z) component of the normal direction.
    void
    set(float nx, float ny, float nz, float c)
    Set all 4 components to specified values.
    void
    setConstant(float c)
    Alter the constant.
    void
    Alter the normal direction.
    float
    Return the signed distance of the specified point.
    Return a string representation of the plane, which is unaffected.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Plane

      public Plane(float nx, float ny, float nz, float c)
      Instantiate a plane with specified components.
      Parameters:
      nx - the X component of the desired normal direction
      ny - the Y component of the desired normal direction
      nz - the Z component of the desired normal direction
      c - the desired constant
    • Plane

      public Plane(FloatBuffer buffer)
      Instantiate from a buffer.
      Parameters:
      buffer - the desired component values (not null, unaffected, capacity≥4)
    • Plane

      public Plane(Vec3Arg normal, float c)
      Instantiate a plane with specified components.
      Parameters:
      normal - the desired normal direction (not null, unaffected)
      c - the desired constant
  • Method Details

    • set

      public void set(float nx, float ny, float nz, float c)
      Set all 4 components to specified values.
      Parameters:
      nx - the desired X component of the normal direction
      ny - the desired Y component of the normal direction
      nz - the desired Z component of the normal direction
      c - the desired constant
    • setConstant

      public void setConstant(float c)
      Alter the constant.
      Parameters:
      c - the desired value
    • setNormal

      public void setNormal(Vec3Arg normal)
      Alter the normal direction.
      Parameters:
      normal - the desired direction (not null, unaffected)
    • getConstant

      public float getConstant()
      Return the constant in single precision. The plane is unaffected.
      Specified by:
      getConstant in interface ConstPlane
      Returns:
      the constant value
    • getNormal

      public Vec3 getNormal()
      Copy the normal direction. The plane is unaffected.
      Specified by:
      getNormal in interface ConstPlane
      Returns:
      a new direction vector
    • getNormalX

      public float getNormalX()
      Return the first (X) component of the normal direction. The plane is unaffected.
      Specified by:
      getNormalX in interface ConstPlane
      Returns:
      the component value
    • getNormalY

      public float getNormalY()
      Return the 2nd (Y) component of the normal direction. The plane is unaffected.
      Specified by:
      getNormalY in interface ConstPlane
      Returns:
      the component value
    • getNormalZ

      public float getNormalZ()
      Return the 3rd (Z) component of the normal direction. The plane is unaffected.
      Specified by:
      getNormalZ in interface ConstPlane
      Returns:
      the component value
    • signedDistance

      public float signedDistance(Vec3Arg point)
      Return the signed distance of the specified point.
      Specified by:
      signedDistance in interface ConstPlane
      Parameters:
      point - the point to measure (not null, unaffected)
      Returns:
      the signed distance
    • toString

      public String toString()
      Return a string representation of the plane, which is unaffected. For example:
       Plane{(0.0 1.0 0.0) 0.0}
       
      Overrides:
      toString in class Object
      Returns:
      the string representation (not null, not empty)