Class Point3D

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Point3D extends ProxyInstance
A point with three components: X, Y, and Z.
Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Allocate a new Point3D.
    Point3D(float x, float y, float z)
    Allocate a new Point3D with the fields set to the provided values.
    Point3D(float x, float y, float z, Arena arena)
    Allocate a new Point3D with the fields set to the provided values.
    Point3D(Arena arena)
    Allocate a new Point3D.
    Create a Point3D proxy instance for the provided memory address.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Point3D
    Allocates a graphene_point3d_t structure.
    void
    Computes the cross product of the two given graphene_point3d_t.
    float
    distance(Point3D b, @Nullable Vec3 delta)
    Computes the distance between the two given graphene_point3d_t.
    float
    Computes the dot product of the two given graphene_point3d_t.
    boolean
    Checks whether two given points are equal.
    void
    Frees the resources allocated via graphene_point3d_alloc().
    The memory layout of the native struct.
    static @Nullable Type
    Get the GType of the Point3D class.
    init(float x, float y, float z)
    Initializes a graphene_point3d_t with the given coordinates.
    Initializes a graphene_point3d_t using the coordinates of another graphene_point3d_t.
    Initializes a graphene_point3d_t using the components of a graphene_vec3_t.
    void
    interpolate(Point3D b, double factor, Point3D res)
    Linearly interpolates each component of this Point3D and b using the provided factor, and places the result in res.
    float
    Computes the length of the vector represented by the coordinates of the given graphene_point3d_t.
    boolean
    near(Point3D b, float epsilon)
    Checks whether the two points are near each other, within an epsilon factor.
    void
    Computes the normalization of the vector represented by the coordinates of the given graphene_point3d_t.
    void
    normalizeViewport(Rect viewport, float zNear, float zFar, Point3D res)
    Normalizes the coordinates of a graphene_point3d_t using the given viewport and clipping planes.
    float
    Read the value of the field x.
    float
    Read the value of the field y.
    float
    Read the value of the field z.
    void
    scale(float factor, Point3D res)
    Scales the coordinates of the given graphene_point3d_t by the given factor.
    void
    Stores the coordinates of a graphene_point3d_t into a graphene_vec3_t.
    void
    writeX(float x)
    Write a value in the field x.
    void
    writeY(float y)
    Write a value in the field y.
    void
    writeZ(float z)
    Write a value in the field z.
    static Point3D
    Retrieves a constant point with all three coordinates set to 0.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Point3D

      public Point3D(MemorySegment address)
      Create a Point3D proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Point3D

      public Point3D(Arena arena)
      Allocate a new Point3D.
      Parameters:
      arena - to control the memory allocation scope
    • Point3D

      public Point3D()
      Allocate a new Point3D. The memory is allocated with Arena.ofAuto().
    • Point3D

      public Point3D(float x, float y, float z, Arena arena)
      Allocate a new Point3D with the fields set to the provided values.
      Parameters:
      x - value for the field x
      y - value for the field y
      z - value for the field z
      arena - to control the memory allocation scope
    • Point3D

      public Point3D(float x, float y, float z)
      Allocate a new Point3D with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      x - value for the field x
      y - value for the field y
      z - value for the field z
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Point3D class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readX

      public float readX()
      Read the value of the field x.
      Returns:
      The value of the field x
    • writeX

      public void writeX(float x)
      Write a value in the field x.
      Parameters:
      x - The new value for the field x
    • readY

      public float readY()
      Read the value of the field y.
      Returns:
      The value of the field y
    • writeY

      public void writeY(float y)
      Write a value in the field y.
      Parameters:
      y - The new value for the field y
    • readZ

      public float readZ()
      Read the value of the field z.
      Returns:
      The value of the field z
    • writeZ

      public void writeZ(float z)
      Write a value in the field z.
      Parameters:
      z - The new value for the field z
    • alloc

      public static Point3D alloc()
      Allocates a graphene_point3d_t structure.
      Returns:
      the newly allocated structure. Use graphene_point3d_free() to free the resources allocated by this function.
      Since:
      1.0
    • zero

      public static Point3D zero()
      Retrieves a constant point with all three coordinates set to 0.
      Returns:
      a zero point
      Since:
      1.0
    • cross

      public void cross(Point3D b, 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
      Since:
      1.0
    • distance

      public float distance(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
      Since:
      1.4
    • dot

      public float dot(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
      Since:
      1.0
    • equal

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

      public void free()
      Frees the resources allocated via graphene_point3d_alloc().
      Since:
      1.0
    • 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
      Since:
      1.0
    • initFromPoint

      public Point3D initFromPoint(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
      Since:
      1.0
    • initFromVec3

      public Point3D initFromVec3(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
      Since:
      1.0
    • interpolate

      public void interpolate(Point3D b, double factor, Point3D res)
      Linearly interpolates each component of this Point3D 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
      Since:
      1.0
    • 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
      Since:
      1.0
    • near

      public boolean near(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
      Since:
      1.0
    • normalize

      public void normalize(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
      Since:
      1.0
    • normalizeViewport

      public void normalizeViewport(Rect viewport, float zNear, float zFar, 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
      zNear - the coordinate of the near clipping plane, or 0 for the default near clipping plane
      zFar - 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
      Since:
      1.4
    • scale

      public void scale(float factor, 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
      Since:
      1.0
    • toVec3

      public void toVec3(Vec3 v)
      Stores the coordinates of a graphene_point3d_t into a graphene_vec3_t.
      Parameters:
      v - return location for a graphene_vec3_t
      Since:
      1.0