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.Plane
(ConstPlane original) Instantiate a copy of the argument.Instantiate a plane with specified components.Plane
(FloatBuffer buffer) Instantiate from a buffer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
copyTo
(FloatBuffer storeFloats) Write all 4 components to the start of the specified buffer.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
put
(FloatBuffer storeBuffer) Write all 4 components to the specified buffer and advance the buffer's position by 4.void
set
(float nx, float ny, float nz, float c) Set all 4 components to specified values.void
set
(ConstPlane source) Set all 4 components from the argument.void
set
(FloatBuffer buffer) Set all 4 components from the specified buffer.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
Instantiate a copy of the argument.- Parameters:
original
- the plane to copy (not null, unaffected)
-
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
Set all 4 components from the argument.- Parameters:
source
- the plane to copy (not null, unaffected)
-
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
-
set
Set all 4 components from the specified buffer.- Parameters:
buffer
- the desired component values (not null, length≥4, unaffected)
-
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)
-
copyTo
Write all 4 components to the start of the specified buffer. The plane is unaffected.- Specified by:
copyTo
in interfaceConstPlane
- Parameters:
storeFloats
- the destination buffer (not null, capacity≥4)
-
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
-
put
Write all 4 components to the specified buffer and advance the buffer's position by 4. The plane is unaffected.- Specified by:
put
in interfaceConstPlane
- Parameters:
storeBuffer
- the destination buffer (not null)
-
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}
-