Class Plane

All Implemented Interfaces:
PointerInterface

public class Plane extends Record
A 2D plane that extends infinitely in a 3D volume.

The contents of the `graphene_plane_t` are private, and should not be
modified directly.

https://ebassi.github.io/graphene/docs/

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getFieldConstant

      public float getFieldConstant()
    • allocPlane

      public static Plane allocPlane()
      Allocates a new #graphene_plane_t structure.

      The contents of the returned structure are undefined.
      Returns:
      the newly allocated #graphene_plane_t. Use graphene_plane_free() to free the resources allocated by this function
    • distance

      public float distance(@Nonnull Point3D point)
      Computes the distance of @point from a #graphene_plane_t.
      Parameters:
      point - a #graphene_point3d_t
      Returns:
      the distance of the given #graphene_point3d_t from the plane
    • equal

      public boolean equal(@Nonnull Plane b)
      Checks whether the two given #graphene_plane_t are equal.
      Parameters:
      b - a #graphene_plane_t
      Returns:
      `true` if the given planes are equal
    • free

      public void free()
      Frees the resources allocated by graphene_plane_alloc().
    • getConstant

      public float getConstant()
      Retrieves the distance along the normal vector of the
      given #graphene_plane_t from the origin.
      Returns:
      the constant value of the plane
    • getNormal

      public void getNormal(@Nonnull Vec3 normal)
      Retrieves the normal vector pointing towards the origin of the
      given #graphene_plane_t.
      Parameters:
      normal - return location for the normal vector
    • init

      public Plane init(@Nullable Vec3 normal, float constant)
      Initializes the given #graphene_plane_t using the given @normal vector
      and @constant values.
      Parameters:
      normal - a unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by default
      constant - the distance from the origin to the plane along the normal vector; the sign determines the half-space occupied by the plane
      Returns:
      the initialized plane
    • initFromPlane

      public Plane initFromPlane(@Nonnull Plane src)
      Initializes the given #graphene_plane_t using the normal
      vector and constant of another #graphene_plane_t.
      Parameters:
      src - a #graphene_plane_t
      Returns:
      the initialized plane
    • initFromPoint

      public Plane initFromPoint(@Nonnull Vec3 normal, @Nonnull Point3D point)
      Initializes the given #graphene_plane_t using the given normal vector
      and an arbitrary co-planar point.
      Parameters:
      normal - a normal vector defining the plane pointing towards the origin
      point - a #graphene_point3d_t
      Returns:
      the initialized plane
    • initFromPoints

      public Plane initFromPoints(@Nonnull Point3D a, @Nonnull Point3D b, @Nonnull Point3D c)
      Initializes the given #graphene_plane_t using the 3 provided co-planar
      points.

      The winding order is counter-clockwise, and determines which direction
      the normal vector will point.
      Parameters:
      a - a #graphene_point3d_t
      b - a #graphene_point3d_t
      c - a #graphene_point3d_t
      Returns:
      the initialized plane
    • initFromVec4

      public Plane initFromVec4(@Nonnull Vec4 src)
      Initializes the given #graphene_plane_t using the components of
      the given #graphene_vec4_t vector.
      Parameters:
      src - a #graphene_vec4_t containing the normal vector in its first three components, and the distance in its fourth component
      Returns:
      the initialized plane
    • negate

      public void negate(@Nonnull Plane res)
      Negates the normal vector and constant of a #graphene_plane_t, effectively
      mirroring the plane across the origin.
      Parameters:
      res - return location for the negated plane
    • normalize

      public void normalize(@Nonnull Plane res)
      Normalizes the vector of the given #graphene_plane_t,
      and adjusts the constant accordingly.
      Parameters:
      res - return location for the normalized plane
    • transform

      public void transform(@Nonnull Matrix matrix, @Nullable Matrix normal_matrix, @Nonnull Plane res)
      Transforms a #graphene_plane_t @p using the given @matrix
      and @normal_matrix.

      If @normal_matrix is %NULL, a transformation matrix for the plane
      normal will be computed from @matrix. If you are transforming
      multiple planes using the same @matrix it's recommended to compute
      the normal matrix beforehand to avoid incurring in the cost of
      recomputing it every time.
      Parameters:
      matrix - a #graphene_matrix_t
      normal_matrix - a #graphene_matrix_t
      res - the transformed plane
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()