Package org.joml

Class GeometryUtils

java.lang.Object
org.joml.GeometryUtils

public class GeometryUtils extends Object
Useful geometry methods.
Author:
Kai Burjack, Richard Greenlees
  • Constructor Details

    • GeometryUtils

      public GeometryUtils()
  • Method Details

    • 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 in dest1 and dest2, respectively.

      The computed vectors will themselves be perpendicular to each another and normalized. So the tree vectors (x, y, z), dest1 and dest2 form an orthonormal basis.

      Parameters:
      x - the x coordinate of the normalized input vector
      y - the y coordinate of the normalized input vector
      z - the z coordinate of the normalized input vector
      dest1 - will hold the first perpendicular vector
      dest2 - 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 vector v, and store them in dest1 and dest2, respectively.

      The computed vectors will themselves be perpendicular to each another and normalized. So the tree vectors v, dest1 and dest2 form an orthonormal basis.

      Parameters:
      v - the normalized input vector
      dest1 - will hold the first perpendicular vector
      dest2 - 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 points v1, v2 and v3 and store it in dest.
      Parameters:
      v0 - the first position
      v1 - the second position
      v2 - the third position
      dest - 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 in dest.
      Parameters:
      v0X - the x coordinate of the first position
      v0Y - the y coordinate of the first position
      v0Z - the z coordinate of the first position
      v1X - the x coordinate of the second position
      v1Y - the y coordinate of the second position
      v1Z - the z coordinate of the second position
      v2X - the x coordinate of the third position
      v2Y - the y coordinate of the third position
      v2Z - the z coordinate of the third position
      dest - 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 in dest.
      Parameters:
      v1 - XYZ of first vertex
      uv1 - UV of first vertex
      v2 - XYZ of second vertex
      uv2 - UV of second vertex
      v3 - XYZ of third vertex
      uv3 - UV of third vertex
      dest - 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 in dest.
      Parameters:
      v1 - XYZ of first vertex
      uv1 - UV of first vertex
      v2 - XYZ of second vertex
      uv2 - UV of second vertex
      v3 - XYZ of third vertex
      uv3 - UV of third vertex
      dest - 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 in dest.
      Parameters:
      v1 - XYZ of first vertex
      uv1 - UV of first vertex
      v2 - XYZ of second vertex
      uv2 - UV of second vertex
      v3 - XYZ of third vertex
      uv3 - UV of third vertex
      destTangent - the tangent will be stored here
      destBitangent - the bitangent will be stored here