Package ch.bailu.gtk.graphene
Class Point3D
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.graphene.Point3D
- All Implemented Interfaces:
PointerInterface
A point with three components: X, Y, and Z.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Point3D
Allocates a #graphene_point3d_t structure.void
Computes the cross product of the two given #graphene_point3d_t.float
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
free()
Frees the resources allocated via graphene_point3d_alloc().static ClassHandler
float
the X coordinatefloat
the Y coordinatefloat
the Z coordinatestatic int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
init
(float x, float y, float z) Initializes a #graphene_point3d_t with the given coordinates.initFromPoint
(Point3D src) Initializes a #graphene_point3d_t using the coordinates of
another #graphene_point3d_t.initFromVec3
(Vec3 v) 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 @a and @b using the
provided @factor, and places the result in @res.float
length()
Computes the length of the vector represented by the
coordinates of the given #graphene_point3d_t.boolean
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 z_near, float z_far, Point3D res) Normalizes the coordinates of a #graphene_point3d_t using the
given viewport and clipping planes.void
Scales the coordinates of the given #graphene_point3d_t by
the given @factor.void
setFieldX
(float x) the X coordinatevoid
setFieldY
(float y) the Y coordinatevoid
setFieldZ
(float z) the Z coordinatevoid
Stores the coordinates of a #graphene_point3d_t into a
#graphene_vec3_t.static Point3D
zero()
Retrieves a constant point with all three coordinates set to 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- See Also:
-
Y
the Y coordinate- See Also:
-
Z
the Z coordinate- See Also:
-
-
Constructor Details
-
Point3D
-
Point3D
public Point3D()
-
-
Method Details
-
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
Allocates a #graphene_point3d_t structure.- Returns:
- the newly allocated structure. Use graphene_point3d_free() to free the resources allocated by this function.
-
cross
Computes the cross product of the two given #graphene_point3d_t.- Parameters:
b
- a #graphene_point3d_tres
- return location for the cross product
-
distance
Computes the distance between the two given #graphene_point3d_t.- Parameters:
b
- a #graphene_point3d_tdelta
- return location for the distance components on the X, Y, and Z axis- Returns:
- the distance between two points
-
dot
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
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
Initializes a #graphene_point3d_t with the given coordinates.- Parameters:
x
- the X coordinate of the pointy
- the Y coordinate of the pointz
- the Z coordinate of the point- Returns:
- the initialized #graphene_point3d_t
-
initFromPoint
Initializes a #graphene_point3d_t using the coordinates of
another #graphene_point3d_t.- Parameters:
src
- a #graphene_point3d_t- Returns:
- the initialized point
-
initFromVec3
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
Linearly interpolates each component of @a and @b using the
provided @factor, and places the result in @res.- Parameters:
b
- a #graphene_point3d_tfactor
- the interpolation factorres
- 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
Checks whether the two points are near each other, within
an @epsilon factor.- Parameters:
b
- a #graphene_point3d_tepsilon
- fuzzyness factor- Returns:
- `true` if the points are near each other
-
normalize
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 viewportz_near
- the coordinate of the near clipping plane, or 0 for the default near clipping planez_far
- the coordinate of the far clipping plane, or 1 for the default far clipping planeres
- the return location for the normalized #graphene_point3d_t
-
scale
Scales the coordinates of the given #graphene_point3d_t by
the given @factor.- Parameters:
factor
- the scaling factorres
- return location for the scaled point
-
toVec3
Stores the coordinates of a #graphene_point3d_t into a
#graphene_vec3_t.- Parameters:
v
- return location for a #graphene_vec3_t
-
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
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-