Package org.joml
Class Planed
- java.lang.Object
-
- org.joml.Planed
-
- All Implemented Interfaces:
Externalizable,Serializable
public class Planed extends Object implements Externalizable
Represents a 3D plane using double-precision floating-point numbers.- Author:
- Kai Burjack
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description doubleaThe factorain the plane equationa*x + b*y + c*z + d = 0.doublebThe factorbin the plane equationa*x + b*y + c*z + d = 0.doublecThe factorcin the plane equationa*x + b*y + c*z + d = 0.doubledThe constantdin the plane equationa*x + b*y + c*z + d = 0.
-
Constructor Summary
Constructors Constructor Description Planed()Create a new undefinedPlaned.Planed(double a, double b, double c, double d)Create a newPlanedwith the plane equationa*x + b*y + c*z + d = 0.Planed(Planed source)Create a newPlanedas a copy of the givensource.Planed(Vector3dc point, Vector3dc normal)Planed(Vector3dc pointA, Vector3dc pointB, Vector3dc pointC)Create a newPlaneffrom the given three points lying on the plane.Planed(Vector3fc pointA, Vector3fc pointB, Vector3fc pointC)Create a newPlaneffrom the given three points lying on the plane.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistance(double x, double y, double z)Compute the signed distance between this plane and the given point.booleanequals(Object obj)static Vector4dequationFromPoints(double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, Vector4d dest)Compute the factorsa,b,canddin the plane equationa*x + b*y + c*z + d = 0from the three points(v0X, v0Y, v0Z),(v1X, v1Y, v1Z)and(v2X, v2Y, v2Z)on the plane, and write the values to thex,y,zandwcomponents, respectively, of the givendestvector.static Vector4dequationFromPoints(Vector3d v0, Vector3d v1, Vector3d v2, Vector4d dest)Compute the factorsa,b,canddin the plane equationa*x + b*y + c*z + d = 0from the given three points on the plane, and write the values to thex,y,zandwcomponents, respectively, of the givendestvector.inthashCode()Planednormalize()Normalize this plane.Planednormalize(Planed dest)Normalize this plane and store the result indest.voidreadExternal(ObjectInput in)Planedset(double a, double b, double c, double d)Set the components of this plane.StringtoString()Return a string representation of this plane.StringtoString(NumberFormat formatter)Return a string representation of this plane by formatting the components with the givenNumberFormat.voidwriteExternal(ObjectOutput out)
-
-
-
Field Detail
-
a
public double a
The factorain the plane equationa*x + b*y + c*z + d = 0.
-
b
public double b
The factorbin the plane equationa*x + b*y + c*z + d = 0.
-
c
public double c
The factorcin the plane equationa*x + b*y + c*z + d = 0.
-
d
public double d
The constantdin the plane equationa*x + b*y + c*z + d = 0.
-
-
Constructor Detail
-
Planed
public Planed()
Create a new undefinedPlaned.
-
Planed
public Planed(Planed source)
Create a newPlanedas a copy of the givensource.- Parameters:
source- thePlanedto copy from
-
Planed
public Planed(Vector3dc point, Vector3dc normal)
- Parameters:
point- any point lying on the planenormal- the normal of the plane
-
Planed
public Planed(double a, double b, double c, double d)Create a newPlanedwith the plane equationa*x + b*y + c*z + d = 0.- Parameters:
a- the x factor in the plane equationb- the y factor in the plane equationc- the z factor in the plane equationd- the constant in the plane equation
-
Planed
public Planed(Vector3dc pointA, Vector3dc pointB, Vector3dc pointC)
Create a newPlaneffrom the given three points lying on the plane.The resulting plane is not necessarily
normalized.- Parameters:
pointA- the first pointpointB- the second pointpointC- the third point
-
Planed
public Planed(Vector3fc pointA, Vector3fc pointB, Vector3fc pointC)
Create a newPlaneffrom the given three points lying on the plane.The resulting plane is not necessarily
normalized.- Parameters:
pointA- the first pointpointB- the second pointpointC- the third point
-
-
Method Detail
-
set
public Planed set(double a, double b, double c, double d)
Set the components of this plane.- Parameters:
a- the x factor in the plane equationb- the y factor in the plane equationc- the z factor in the plane equationd- the constant in the plane equation- Returns:
- this
-
normalize
public Planed normalize()
Normalize this plane.- Returns:
- this
-
normalize
public Planed normalize(Planed dest)
Normalize this plane and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
distance
public double distance(double x, double y, double z)Compute the signed distance between this plane and the given point.- Parameters:
x- the x coordinate of the pointy- the y coordinate of the pointz- the z coordinate of the point- Returns:
- the signed distance between this plane and the point
-
equationFromPoints
public static Vector4d equationFromPoints(Vector3d v0, Vector3d v1, Vector3d v2, Vector4d dest)
Compute the factorsa,b,canddin the plane equationa*x + b*y + c*z + d = 0from the given three points on the plane, and write the values to thex,y,zandwcomponents, respectively, of the givendestvector.- Parameters:
v0- the first point on the planev1- the second point on the planev2- the third point on the planedest- will hold the result- Returns:
- dest
-
equationFromPoints
public static Vector4d equationFromPoints(double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, Vector4d dest)
Compute the factorsa,b,canddin the plane equationa*x + b*y + c*z + d = 0from the three points(v0X, v0Y, v0Z),(v1X, v1Y, v1Z)and(v2X, v2Y, v2Z)on the plane, and write the values to thex,y,zandwcomponents, respectively, of the givendestvector.- Parameters:
v0X- the x coordinate of the first point on the planev0Y- the y coordinate of the first point on the planev0Z- the z coordinate of the first point on the planev1X- the x coordinate of the second point on the planev1Y- the y coordinate of the second point on the planev1Z- the z coordinate of the second point on the planev2X- the x coordinate of the third point on the planev2Y- the y coordinate of the third point on the planev2Z- the z coordinate of the third point on the planedest- will hold the result- Returns:
- dest
-
toString
public String toString()
Return a string representation of this plane.This method creates a new
DecimalFormaton every invocation with the format string "0.000E0;-".
-
toString
public String toString(NumberFormat formatter)
Return a string representation of this plane by formatting the components with the givenNumberFormat.- Parameters:
formatter- theNumberFormatused to format the components with- Returns:
- the string representation
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
-