Package ch.bailu.gtk.graphene
Class Point
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.graphene.Point
- All Implemented Interfaces:
PointerInterface
A point with two coordinates.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Point
Allocates a new #graphene_point_t structure.float
Computes the distance between @a and @b.boolean
Checks if the two points @a and @b point to the same
coordinates.void
free()
Frees the resources allocated by graphene_point_alloc().static ClassHandler
float
the X coordinate of the pointfloat
the Y coordinate of the pointstatic int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
init
(float x, float y) Initializes @p to the given @x and @y coordinates.initFromPoint
(Point src) Initializes @p with the same coordinates of @src.initFromVec2
(Vec2 src) Initializes @p with the coordinates inside the given #graphene_vec2_t.void
interpolate
(Point b, double factor, Point res) Linearly interpolates the coordinates of @a and @b using the
given @factor.boolean
Checks whether the two points @a and @b are within
the threshold of @epsilon.void
setFieldX
(float x) the X coordinate of the pointvoid
setFieldY
(float y) the Y coordinate of the pointvoid
Stores the coordinates of the given #graphene_point_t into a
#graphene_vec2_t.static Point
zero()
Returns a point fixed at (0, 0).Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
X
the X coordinate of the point- See Also:
-
Y
the Y coordinate of the point- See Also:
-
-
Constructor Details
-
Point
-
Point
public Point()
-
-
Method Details
-
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
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
Computes the distance between @a and @b.- Parameters:
b
- a #graphene_point_td_x
- distance component on the X axisd_y
- distance component on the Y axis- Returns:
- the distance between the two points
-
equal
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
Initializes @p to the given @x and @y coordinates.
It's safe to call this function multiple times.- Parameters:
x
- the X coordinatey
- the Y coordinate- Returns:
- the initialized point
-
initFromPoint
Initializes @p with the same coordinates of @src.- Parameters:
src
- the #graphene_point_t to use- Returns:
- the initialized point
-
initFromVec2
Initializes @p with the coordinates inside the given #graphene_vec2_t.- Parameters:
src
- a #graphene_vec2_t- Returns:
- the initialized point
-
interpolate
Linearly interpolates the coordinates of @a and @b using the
given @factor.- Parameters:
b
- a #graphene_point_tfactor
- the linear interpolation factorres
- return location for the interpolated point
-
near
Checks whether the two points @a and @b are within
the threshold of @epsilon.- Parameters:
b
- a #graphene_point_tepsilon
- threshold between the two points- Returns:
- `true` if the distance is within @epsilon
-
toVec2
Stores the coordinates of the given #graphene_point_t into a
#graphene_vec2_t.- Parameters:
v
- return location for the vertex
-
zero
Returns a point fixed at (0, 0).- Returns:
- a fixed point
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-