java.lang.Object
com.github.stephengold.joltjni.Plane
- All Implemented Interfaces:
ConstPlane
A math object used to represent a plane in 3-dimensional space.
-
Constructor Summary
ConstructorsConstructorDescriptionPlane
(float nx, float ny, float nz, float c) Instantiate a plane with specified components.Instantiate a plane with specified components.Plane
(FloatBuffer buffer) Instantiate from a buffer. -
Method Summary
Modifier and TypeMethodDescriptionfloat
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
signedDistance
(Vec3Arg point) Return the signed distance of the specified point.toString()
Return a string representation of the plane, which is unaffected.
-
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 directionny
- the Y component of the desired normal directionnz
- the Z component of the desired normal directionc
- the desired constant
-
Plane
Instantiate from a buffer.- Parameters:
buffer
- the desired component values (not null, unaffected, capacity≥4)
-
Plane
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 directionny
- the desired Y component of the normal directionnz
- the desired Z component of the normal directionc
- the desired constant
-
setConstant
public void setConstant(float c) Alter the constant.- Parameters:
c
- the desired value
-
setNormal
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 interfaceConstPlane
- Returns:
- the constant value
-
getNormal
Copy the normal direction. The plane is unaffected.- Specified by:
getNormal
in interfaceConstPlane
- 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 interfaceConstPlane
- 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 interfaceConstPlane
- 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 interfaceConstPlane
- Returns:
- the component value
-
signedDistance
Return the signed distance of the specified point.- Specified by:
signedDistance
in interfaceConstPlane
- Parameters:
point
- the point to measure (not null, unaffected)- Returns:
- the signed distance
-
toString
Return a string representation of the plane, which is unaffected. For example:Plane{(0.0 1.0 0.0) 0.0}
-