-
Notifications
You must be signed in to change notification settings - Fork 0
Geometry Utilities
ExodusCoder9 edited this page Jun 20, 2026
·
1 revision
GeometryUtils provides static methods for common mesh processing operations.
// From triangle vertices + UV coordinates
Vector3f tangent = GeometryUtils.computeTangent(v0, v1, v2, uv0, uv1, uv2);
Vector3f bitangent = GeometryUtils.computeBitangent(v0, v1, v2, uv0, uv1, uv2);
Vector3f[] tb = GeometryUtils.computeTangentBitangent(v0, v1, v2, uv0, uv1, uv2);
Face Normal
Vector3f normal = GeometryUtils.computeNormal(v0, v1, v2);
// double version also available
Barycentric Coordinates
Vector3f bary = GeometryUtils.barycentric(point, v0, v1, v2);
float interpolated = GeometryUtils.interpolateBarycentric(v0, v1, v2, u, v, w);
Triangle Area & Centroid
float area = GeometryUtils.areaTriangle(v0, v1, v2);
Vector3f center = GeometryUtils.centroid(v0, v1, v2);
Orthonormal Basis
Vector3f[] basis = GeometryUtils.orthonormalBasis(normal);
// returns [tangent, bitangent, normal]
Normal Transform (inverse-transpose)
Vector3f transformed = GeometryUtils.transformNormal(matrix, normal);
Vector3f transformed = GeometryUtils.transformNormal(matrix, x, y, z);
// works with Matrix4f, Matrix4d, Matrix3f, Matrix3d
Rotation Matrix from Vectors
Matrix3f rot = GeometryUtils.rotationMatrix(from, to);