Class Point

All Implemented Interfaces:
PointerInterface

public class Point extends Record
A point with two coordinates.

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 of the point
    • getFieldX

      public float getFieldX()
      the X coordinate of the point
    • setFieldY

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

      public float getFieldY()
      the Y coordinate of the point
    • allocPoint

      public static Point allocPoint()
      Allocates a new #graphene_point_t structure.

      The coordinates of the returned point are (0, 0).

      It's possible to chain this function with graphene_point_init()
      or graphene_point_init_from_point(), e.g.:
      <!-- language="C" -->
         graphene_point_t *
         point_new (float x, float y)
         {
           return graphene_point_init (graphene_point_alloc (), x, y);
         }
       
         graphene_point_t *
         point_copy (const graphene_point_t *p)
         {
           return graphene_point_init_from_point (graphene_point_alloc (), p);
         }
       
      Returns:
      the newly allocated #graphene_point_t. Use graphene_point_free() to free the resources allocated by this function.
    • distance

      public float distance(@Nonnull Point b, @Nullable Flt d_x, @Nullable Flt d_y)
      Computes the distance between @a and @b.
      Parameters:
      b - a #graphene_point_t
      d_x - distance component on the X axis
      d_y - distance component on the Y axis
      Returns:
      the distance between the two points
    • equal

      public boolean equal(@Nonnull Point b)
      Checks if the two points @a and @b point to the same
      coordinates.

      This function accounts for floating point fluctuations; if
      you want to control the fuzziness of the match, you can use
      graphene_point_near() instead.
      Parameters:
      b - a #graphene_point_t
      Returns:
      `true` if the points have the same coordinates
    • free

      public void free()
      Frees the resources allocated by graphene_point_alloc().
    • init

      public Point init(float x, float y)
      Initializes @p to the given @x and @y coordinates.

      It's safe to call this function multiple times.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      Returns:
      the initialized point
    • initFromPoint

      public Point initFromPoint(@Nonnull Point src)
      Initializes @p with the same coordinates of @src.
      Parameters:
      src - the #graphene_point_t to use
      Returns:
      the initialized point
    • initFromVec2

      public Point initFromVec2(@Nonnull Vec2 src)
      Initializes @p with the coordinates inside the given #graphene_vec2_t.
      Parameters:
      src - a #graphene_vec2_t
      Returns:
      the initialized point
    • interpolate

      public void interpolate(@Nonnull Point b, double factor, @Nonnull Point res)
      Linearly interpolates the coordinates of @a and @b using the
      given @factor.
      Parameters:
      b - a #graphene_point_t
      factor - the linear interpolation factor
      res - return location for the interpolated point
    • near

      public boolean near(@Nonnull Point b, float epsilon)
      Checks whether the two points @a and @b are within
      the threshold of @epsilon.
      Parameters:
      b - a #graphene_point_t
      epsilon - threshold between the two points
      Returns:
      `true` if the distance is within @epsilon
    • toVec2

      public void toVec2(@Nonnull Vec2 v)
      Stores the coordinates of the given #graphene_point_t into a
      #graphene_vec2_t.
      Parameters:
      v - return location for the vertex
    • zero

      public static Point zero()
      Returns a point fixed at (0, 0).
      Returns:
      a fixed 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()