Package org.joml
Class GeometryUtils
- java.lang.Object
-
- org.joml.GeometryUtils
-
public class GeometryUtils extends java.lang.Object
Useful geometry methods.- Author:
- Kai Burjack, Richard Greenlees
-
-
Constructor Summary
Constructors Constructor Description GeometryUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
bitangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f dest)
Calculate the surface bitangent for the three supplied vertices and UV coordinates and store the result indest
.static void
normal(float v0X, float v0Y, float v0Z, float v1X, float v1Y, float v1Z, float v2X, float v2Y, float v2Z, Vector3f dest)
Calculate the normal of a surface defined by points(v1X, v1Y, v1Z)
,(v2X, v2Y, v2Z)
and(v3X, v3Y, v3Z)
and store it indest
.static void
normal(Vector3fc v0, Vector3fc v1, Vector3fc v2, Vector3f dest)
Calculate the normal of a surface defined by pointsv1
,v2
andv3
and store it indest
.static void
perpendicular(float x, float y, float z, Vector3f dest1, Vector3f dest2)
Compute two arbitrary vectors perpendicular to the given normalized vector(x, y, z)
, and store them indest1
anddest2
, respectively.static void
perpendicular(Vector3fc v, Vector3f dest1, Vector3f dest2)
Compute two arbitrary vectors perpendicular to the given normalized vectorv
, and store them indest1
anddest2
, respectively.static void
tangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f dest)
Calculate the surface tangent for the three supplied vertices and UV coordinates and store the result indest
.static void
tangentBitangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f destTangent, Vector3f destBitangent)
Calculate the surface tangent and bitangent for the three supplied vertices and UV coordinates and store the result indest
.
-
-
-
Method Detail
-
perpendicular
public static void perpendicular(float x, float y, float z, Vector3f dest1, Vector3f dest2)
Compute two arbitrary vectors perpendicular to the given normalized vector(x, y, z)
, and store them indest1
anddest2
, respectively.The computed vectors will themselves be perpendicular to each another and normalized. So the tree vectors
(x, y, z)
,dest1
anddest2
form an orthonormal basis.- Parameters:
x
- the x coordinate of the normalized input vectory
- the y coordinate of the normalized input vectorz
- the z coordinate of the normalized input vectordest1
- will hold the first perpendicular vectordest2
- will hold the second perpendicular vector
-
perpendicular
public static void perpendicular(Vector3fc v, Vector3f dest1, Vector3f dest2)
Compute two arbitrary vectors perpendicular to the given normalized vectorv
, and store them indest1
anddest2
, respectively.The computed vectors will themselves be perpendicular to each another and normalized. So the tree vectors
v
,dest1
anddest2
form an orthonormal basis.- Parameters:
v
- thenormalized
input vectordest1
- will hold the first perpendicular vectordest2
- will hold the second perpendicular vector
-
normal
public static void normal(Vector3fc v0, Vector3fc v1, Vector3fc v2, Vector3f dest)
Calculate the normal of a surface defined by pointsv1
,v2
andv3
and store it indest
.- Parameters:
v0
- the first positionv1
- the second positionv2
- the third positiondest
- will hold the result
-
normal
public static void normal(float v0X, float v0Y, float v0Z, float v1X, float v1Y, float v1Z, float v2X, float v2Y, float v2Z, Vector3f dest)
Calculate the normal of a surface defined by points(v1X, v1Y, v1Z)
,(v2X, v2Y, v2Z)
and(v3X, v3Y, v3Z)
and store it indest
.- Parameters:
v0X
- the x coordinate of the first positionv0Y
- the y coordinate of the first positionv0Z
- the z coordinate of the first positionv1X
- the x coordinate of the second positionv1Y
- the y coordinate of the second positionv1Z
- the z coordinate of the second positionv2X
- the x coordinate of the third positionv2Y
- the y coordinate of the third positionv2Z
- the z coordinate of the third positiondest
- will hold the result
-
tangent
public static void tangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f dest)
Calculate the surface tangent for the three supplied vertices and UV coordinates and store the result indest
.- Parameters:
v1
- XYZ of first vertexuv1
- UV of first vertexv2
- XYZ of second vertexuv2
- UV of second vertexv3
- XYZ of third vertexuv3
- UV of third vertexdest
- the tangent will be stored here
-
bitangent
public static void bitangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f dest)
Calculate the surface bitangent for the three supplied vertices and UV coordinates and store the result indest
.- Parameters:
v1
- XYZ of first vertexuv1
- UV of first vertexv2
- XYZ of second vertexuv2
- UV of second vertexv3
- XYZ of third vertexuv3
- UV of third vertexdest
- the binormal will be stored here
-
tangentBitangent
public static void tangentBitangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f destTangent, Vector3f destBitangent)
Calculate the surface tangent and bitangent for the three supplied vertices and UV coordinates and store the result indest
.- Parameters:
v1
- XYZ of first vertexuv1
- UV of first vertexv2
- XYZ of second vertexuv2
- UV of second vertexv3
- XYZ of third vertexuv3
- UV of third vertexdestTangent
- the tangent will be stored heredestBitangent
- the bitangent will be stored here
-
-