Class Point3D

All Implemented Interfaces:
PointerInterface

public class Point3D extends Record
A point with three components: X, Y, and Z.

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

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • setFieldX

      public void setFieldX(float x)
      the X coordinate
    • getFieldX

      public float getFieldX()
      the X coordinate
    • setFieldY

      public void setFieldY(float y)
      the Y coordinate
    • getFieldY

      public float getFieldY()
      the Y coordinate
    • setFieldZ

      public void setFieldZ(float z)
      the Z coordinate
    • getFieldZ

      public float getFieldZ()
      the Z coordinate
    • allocPoint3D

      public static Point3D allocPoint3D()
      Allocates a #graphene_point3d_t structure.
      Returns:
      the newly allocated structure. Use graphene_point3d_free() to free the resources allocated by this function.
    • cross

      public void cross(@Nonnull Point3D b, @Nonnull Point3D res)
      Computes the cross product of the two given #graphene_point3d_t.
      Parameters:
      b - a #graphene_point3d_t
      res - return location for the cross product
    • distance

      public float distance(@Nonnull Point3D b, @Nullable Vec3 delta)
      Computes the distance between the two given #graphene_point3d_t.
      Parameters:
      b - a #graphene_point3d_t
      delta - return location for the distance components on the X, Y, and Z axis
      Returns:
      the distance between two points
    • dot

      public float dot(@Nonnull Point3D b)
      Computes the dot product of the two given #graphene_point3d_t.
      Parameters:
      b - a #graphene_point3d_t
      Returns:
      the value of the dot product
    • equal

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

      public void free()
      Frees the resources allocated via graphene_point3d_alloc().
    • init

      public Point3D init(float x, float y, float z)
      Initializes a #graphene_point3d_t with the given coordinates.
      Parameters:
      x - the X coordinate of the point
      y - the Y coordinate of the point
      z - the Z coordinate of the point
      Returns:
      the initialized #graphene_point3d_t
    • initFromPoint

      public Point3D initFromPoint(@Nonnull Point3D src)
      Initializes a #graphene_point3d_t using the coordinates of
      another #graphene_point3d_t.
      Parameters:
      src - a #graphene_point3d_t
      Returns:
      the initialized point
    • initFromVec3

      public Point3D initFromVec3(@Nonnull Vec3 v)
      Initializes a #graphene_point3d_t using the components
      of a #graphene_vec3_t.
      Parameters:
      v - a #graphene_vec3_t
      Returns:
      the initialized #graphene_point3d_t
    • interpolate

      public void interpolate(@Nonnull Point3D b, double factor, @Nonnull Point3D res)
      Linearly interpolates each component of @a and @b using the
      provided @factor, and places the result in @res.
      Parameters:
      b - a #graphene_point3d_t
      factor - the interpolation factor
      res - the return location for the interpolated #graphene_point3d_t
    • length

      public float length()
      Computes the length of the vector represented by the
      coordinates of the given #graphene_point3d_t.
      Returns:
      the length of the vector represented by the point
    • near

      public boolean near(@Nonnull Point3D b, float epsilon)
      Checks whether the two points are near each other, within
      an @epsilon factor.
      Parameters:
      b - a #graphene_point3d_t
      epsilon - fuzzyness factor
      Returns:
      `true` if the points are near each other
    • normalize

      public void normalize(@Nonnull Point3D res)
      Computes the normalization of the vector represented by the
      coordinates of the given #graphene_point3d_t.
      Parameters:
      res - return location for the normalized #graphene_point3d_t
    • normalizeViewport

      public void normalizeViewport(@Nonnull Rect viewport, float z_near, float z_far, @Nonnull Point3D res)
      Normalizes the coordinates of a #graphene_point3d_t using the
      given viewport and clipping planes.

      The coordinates of the resulting #graphene_point3d_t will be
      in the [ -1, 1 ] range.
      Parameters:
      viewport - a #graphene_rect_t representing a viewport
      z_near - the coordinate of the near clipping plane, or 0 for the default near clipping plane
      z_far - the coordinate of the far clipping plane, or 1 for the default far clipping plane
      res - the return location for the normalized #graphene_point3d_t
    • scale

      public void scale(float factor, @Nonnull Point3D res)
      Scales the coordinates of the given #graphene_point3d_t by
      the given @factor.
      Parameters:
      factor - the scaling factor
      res - return location for the scaled point
    • toVec3

      public void toVec3(@Nonnull Vec3 v)
      Stores the coordinates of a #graphene_point3d_t into a
      #graphene_vec3_t.
      Parameters:
      v - return location for a #graphene_vec3_t
    • zero

      public static Point3D zero()
      Retrieves a constant point with all three coordinates set to 0.
      Returns:
      a zero point
    • 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()