Package com.j3d.engine.math.plane
Record Class NormalPlane
java.lang.Object
java.lang.Record
com.j3d.engine.math.plane.NormalPlane
- Record Components:
origin- The point on the planenormal- The normal vector pointing outwards from the plane
A plane is defined by a normal vector and a point on the plane (origin).
- Author:
- Lehlogonolo Poole
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNormalPlane(Vector3 origin, Vector3 normal) Creates an instance of aNormalPlanerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.static NormalPlaneCreates aNormalPlanefrom three points in 3D space.static NormalPlaneCreates aNormalPlanefrom aGTri(triangle).inthashCode()Returns a hash code value for this object.normal()Returns the value of thenormalrecord component.booleanChecks if a given 3D point lies on this plane.origin()Returns the value of theoriginrecord component.pair()Returns aSamePaircontaining two references to thisNormalPlane.Converts thisNormalPlaneinto anAxisPlane.toString()Returns a string representation of this record class.static NormalPlaneCreates aNormalPlanethat is parallel to the XY-plane.static NormalPlaneCreates aNormalPlanethat is parallel to the XZ-plane.static NormalPlaneCreates aNormalPlanethat is parallel to the ZY-plane (or YZ-plane).
-
Field Details
-
Constructor Details
-
Method Details
-
toAxisPlane
Converts thisNormalPlaneinto anAxisPlane. This method calculates two orthogonal vectors (x and y) that lie within the plane, forming a local coordinate system for the plane.- Returns:
- A new
AxisPlanerepresenting the same plane.
-
onPlane
Checks if a given 3D point lies on this plane.- Parameters:
pos- The 3D point to check.- Returns:
trueif the point is on the plane (within a small epsilon tolerance),falseotherwise.
-
pair
Returns aSamePaircontaining two references to thisNormalPlane. This can be useful in contexts where a pair of identical objects is required.- Returns:
- A
SamePairwith both elements being thisNormalPlane.
-
from
Creates aNormalPlanefrom three points in 3D space. The normal vector is calculated using the cross product of two vectors formed by the points, and is then normalised. The origin of the plane is set to point A.- Parameters:
A- The first point.B- The second point.C- The third point.- Returns:
- A new
NormalPlanedefined by the three points.
-
from
Creates aNormalPlanefrom aGTri(triangle). The origin of the plane is set to the pivot point of the first leg's first point of the triangle, and the normal vector is taken directly from the triangle's normal.- Parameters:
tri- TheGTrifrom which to create theNormalPlane.- Returns:
- A new
NormalPlanedefined by the triangle.
-
XZ
Creates aNormalPlanethat is parallel to the XZ-plane. The normal vector isVector3.Y(pointing along the positive Y-axis).- Parameters:
origin- The origin point on the plane.- Returns:
- A new
NormalPlaneparallel to the XZ-plane.
-
XY
Creates aNormalPlanethat is parallel to the XY-plane. The normal vector isVector3.Z(pointing along the positive Z-axis).- Parameters:
origin- The origin point on the plane.- Returns:
- A new
NormalPlaneparallel to the XY-plane.
-
ZY
Creates aNormalPlanethat is parallel to the ZY-plane (or YZ-plane). The normal vector isVector3.X(pointing along the positive X-axis).- Parameters:
origin- The origin point on the plane.- Returns:
- A new
NormalPlaneparallel to the ZY-plane.
-
equals
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 withObjects::equals(Object,Object). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. -
origin
Returns the value of theoriginrecord component.- Returns:
- the value of the
originrecord component
-
normal
Returns the value of thenormalrecord component.- Returns:
- the value of the
normalrecord component
-