Class Euler
- All Implemented Interfaces:
Proxy
The contents of the graphene_euler_t
structure are private
and should never be accessed directly.
-
Constructor Summary
ConstructorDescriptionEuler()
Allocate a new Euler.Allocate a new Euler.Euler
(MemorySegment address) Create a Euler proxy instance for the provided memory address.Euler
(Vec3 angles, EulerOrder order) Allocate a new Euler with the fields set to the provided values.Euler
(Vec3 angles, EulerOrder order, Arena arena) Allocate a new Euler with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic Euler
alloc()
Allocates a newgraphene_euler_t
.boolean
Checks if twographene_euler_t
are equal.void
free()
Frees the resources allocated by graphene_euler_alloc().float
getAlpha()
Retrieves the first component of the Euler angle vector, depending on the order of rotation.float
getBeta()
Retrieves the second component of the Euler angle vector, depending on the order of rotation.float
getGamma()
Retrieves the third component of the Euler angle vector, depending on the order of rotation.static MemoryLayout
The memory layout of the native struct.getOrder()
Retrieves the order used to apply the rotations described in thegraphene_euler_t
structure, when converting to and from other structures, likegraphene_quaternion_t
andgraphene_matrix_t
.static Type
getType()
Get the GType of the Euler classfloat
getX()
Retrieves the rotation angle on the X axis, in degrees.float
getY()
Retrieves the rotation angle on the Y axis, in degrees.float
getZ()
Retrieves the rotation angle on the Z axis, in degrees.init
(float x, float y, float z) Initializes agraphene_euler_t
using the given angles.initFromEuler
(@Nullable Euler src) Initializes agraphene_euler_t
using the angles and order of anothergraphene_euler_t
.initFromMatrix
(@Nullable Matrix m, EulerOrder order) Initializes agraphene_euler_t
using the given rotation matrix.initFromQuaternion
(@Nullable Quaternion q, EulerOrder order) Initializes agraphene_euler_t
using the given normalized quaternion.initFromRadians
(float x, float y, float z, EulerOrder order) Initializes agraphene_euler_t
using the given angles and order of rotation.initFromVec3
(@Nullable Vec3 v, EulerOrder order) Initializes agraphene_euler_t
using the angles contained in agraphene_vec3_t
.initWithOrder
(float x, float y, float z, EulerOrder order) Initializes agraphene_euler_t
with the given angles andorder
.Read the value of the fieldangles
.Read the value of the fieldorder
.void
reorder
(EulerOrder order, Euler res) Reorders agraphene_euler_t
usingorder
.void
Converts agraphene_euler_t
into a transformation matrix expressing the extrinsic composition of rotations described by the Euler angles.void
toQuaternion
(Quaternion res) Converts agraphene_euler_t
into agraphene_quaternion_t
.void
Retrieves the angles of agraphene_euler_t
and initializes agraphene_vec3_t
with them.void
writeAngles
(Vec3 angles) Write a value in the fieldangles
.void
writeOrder
(EulerOrder order) Write a value in the fieldorder
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Euler
Create a Euler proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Euler
Allocate a new Euler.- Parameters:
arena
- to control the memory allocation scope
-
Euler
public Euler()Allocate a new Euler. The memory is allocated withArena.ofAuto()
. -
Euler
Allocate a new Euler with the fields set to the provided values.- Parameters:
angles
- value for the fieldangles
order
- value for the fieldorder
arena
- to control the memory allocation scope
-
Euler
Allocate a new Euler with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
angles
- value for the fieldangles
order
- value for the fieldorder
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readAngles
-
writeAngles
Write a value in the fieldangles
.- Parameters:
angles
- The new value for the fieldangles
-
readOrder
Read the value of the fieldorder
.- Returns:
- The value of the field
order
-
writeOrder
Write a value in the fieldorder
.- Parameters:
order
- The new value for the fieldorder
-
alloc
Allocates a newgraphene_euler_t
.The contents of the returned structure are undefined.
- Returns:
- the newly allocated
graphene_euler_t
-
equal
Checks if twographene_euler_t
are equal.- Parameters:
b
- agraphene_euler_t
- Returns:
true
if the twographene_euler_t
are equal
-
free
public void free()Frees the resources allocated by graphene_euler_alloc(). -
getAlpha
public float getAlpha()Retrieves the first component of the Euler angle vector, depending on the order of rotation.See also: graphene_euler_get_x()
- Returns:
- the first component of the Euler angle vector, in radians
-
getBeta
public float getBeta()Retrieves the second component of the Euler angle vector, depending on the order of rotation.See also: graphene_euler_get_y()
- Returns:
- the second component of the Euler angle vector, in radians
-
getGamma
public float getGamma()Retrieves the third component of the Euler angle vector, depending on the order of rotation.See also: graphene_euler_get_z()
- Returns:
- the third component of the Euler angle vector, in radians
-
getOrder
Retrieves the order used to apply the rotations described in thegraphene_euler_t
structure, when converting to and from other structures, likegraphene_quaternion_t
andgraphene_matrix_t
.This function does not return the
EulerOrder.DEFAULT
enumeration value; it will return the effective order of rotation instead.- Returns:
- the order used to apply the rotations
-
getX
public float getX()Retrieves the rotation angle on the X axis, in degrees.- Returns:
- the rotation angle
-
getY
public float getY()Retrieves the rotation angle on the Y axis, in degrees.- Returns:
- the rotation angle
-
getZ
public float getZ()Retrieves the rotation angle on the Z axis, in degrees.- Returns:
- the rotation angle
-
init
Initializes agraphene_euler_t
using the given angles.The order of the rotations is
EulerOrder.DEFAULT
.- Parameters:
x
- rotation angle on the X axis, in degreesy
- rotation angle on the Y axis, in degreesz
- rotation angle on the Z axis, in degrees- Returns:
- the initialized
graphene_euler_t
-
initFromEuler
Initializes agraphene_euler_t
using the angles and order of anothergraphene_euler_t
.If the
graphene_euler_t
src
isnull
, this function is equivalent to calling graphene_euler_init() with all angles set to 0.- Parameters:
src
- agraphene_euler_t
- Returns:
- the initialized
graphene_euler_t
-
initFromMatrix
Initializes agraphene_euler_t
using the given rotation matrix.If the
graphene_matrix_t
m
isnull
, thegraphene_euler_t
will be initialized with all angles set to 0.- Parameters:
m
- a rotation matrixorder
- the order used to apply the rotations- Returns:
- the initialized
graphene_euler_t
-
initFromQuaternion
Initializes agraphene_euler_t
using the given normalized quaternion.If the
graphene_quaternion_t
q
isnull
, thegraphene_euler_t
will be initialized with all angles set to 0.- Parameters:
q
- a normalizedgraphene_quaternion_t
order
- the order used to apply the rotations- Returns:
- the initialized
graphene_euler_t
-
initFromRadians
Initializes agraphene_euler_t
using the given angles and order of rotation.- Parameters:
x
- rotation angle on the X axis, in radiansy
- rotation angle on the Y axis, in radiansz
- rotation angle on the Z axis, in radiansorder
- order of rotations- Returns:
- the initialized
graphene_euler_t
-
initFromVec3
Initializes agraphene_euler_t
using the angles contained in agraphene_vec3_t
.If the
graphene_vec3_t
v
isnull
, thegraphene_euler_t
will be initialized with all angles set to 0.- Parameters:
v
- agraphene_vec3_t
containing the rotation angles in degreesorder
- the order used to apply the rotations- Returns:
- the initialized
graphene_euler_t
-
initWithOrder
Initializes agraphene_euler_t
with the given angles andorder
.- Parameters:
x
- rotation angle on the X axis, in degreesy
- rotation angle on the Y axis, in degreesz
- rotation angle on the Z axis, in degreesorder
- the order used to apply the rotations- Returns:
- the initialized
graphene_euler_t
-
reorder
Reorders agraphene_euler_t
usingorder
.This function is equivalent to creating a
graphene_quaternion_t
from the givengraphene_euler_t
, and then converting the quaternion into anothergraphene_euler_t
.- Parameters:
order
- the new orderres
- return location for the reorderedgraphene_euler_t
-
toMatrix
Converts agraphene_euler_t
into a transformation matrix expressing the extrinsic composition of rotations described by the Euler angles.The rotations are applied over the reference frame axes in the order associated with the
graphene_euler_t
; for instance, if the order used to initialize this Euler isEulerOrder.XYZ
:- the first rotation moves the body around the X axis with an angle φ
- the second rotation moves the body around the Y axis with an angle of ϑ
- the third rotation moves the body around the Z axis with an angle of ψ
The rotation sign convention is right-handed, to preserve compatibility between Euler-based, quaternion-based, and angle-axis-based rotations.
- Parameters:
res
- return location for agraphene_matrix_t
-
toQuaternion
Converts agraphene_euler_t
into agraphene_quaternion_t
.- Parameters:
res
- return location for agraphene_quaternion_t
-
toVec3
Retrieves the angles of agraphene_euler_t
and initializes agraphene_vec3_t
with them.- Parameters:
res
- return location for agraphene_vec3_t
-