N-Euler

#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------

Gnome::Graphene::N-Euler

Description

Describe a rotation using Euler angles.

The contents of the Gnome::Graphene::N-Euler structure are private and should never be accessed directly.

#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

#-------------------------------------------------------------------------------

alloc

Allocates a new Gnome::Graphene::N-Euler.

The contents of the returned structure are undefined.

method alloc ( --> Gnome::Graphene::Euler \)

#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------

Methods

#-------------------------------------------------------------------------------

equal

Checks if two Gnome::Graphene::N-Euler are equal.

method equal ( N-Object $b --> gboolean )
  • $b; a Gnome::Graphene::N-Euler

Return value; true if the two Gnome::Graphene::N-Euler are equal.

#-------------------------------------------------------------------------------

free

Frees the resources allocated by .alloc().

method free ( )

#-------------------------------------------------------------------------------

get-alpha

Retrieves the first component of the Euler angle vector, depending on the order of rotation.

See also: .get-x()

method get-alpha (--> Num )

Return value; the first component of the Euler angle vector, in radians.

#-------------------------------------------------------------------------------

get-beta

Retrieves the second component of the Euler angle vector, depending on the order of rotation.

See also: .get-y()

method get-beta (--> Num )

Return value; the second component of the Euler angle vector, in radians.

#-------------------------------------------------------------------------------

get-gamma

Retrieves the third component of the Euler angle vector, depending on the order of rotation.

See also: .get-z()

method get-gamma (--> Num )

Return value; the third component of the Euler angle vector, in radians.

#-------------------------------------------------------------------------------

get-order

Retrieves the order used to apply the rotations described in the Gnome::Graphene::N-Euler structure, when converting to and from other structures, like Gnome::Graphene::N-Quaternion and Gnome::Graphene::N-Matrix.

This function does not return the GRAPHENE_EULER_ORDER_DEFAULT enumeration value; it will return the effective order of rotation instead.

method get-order (--> graphene_euler_order_t )

Return value; the order used to apply the rotations.

#-------------------------------------------------------------------------------

get-x

Retrieves the rotation angle on the X axis, in degrees.

method get-x (--> Num )

Return value; the rotation angle.

#-------------------------------------------------------------------------------

get-y

Retrieves the rotation angle on the Y axis, in degrees.

method get-y (--> Num )

Return value; the rotation angle.

#-------------------------------------------------------------------------------

get-z

Retrieves the rotation angle on the Z axis, in degrees.

method get-z (--> Num )

Return value; the rotation angle.

#-------------------------------------------------------------------------------

init

Initializes a Gnome::Graphene::N-Euler using the given angles.

The order of the rotations is GRAPHENE_EULER_ORDER_DEFAULT.

method init ( Num() $x, Num() $y, Num() $z --> N-Object )
  • $x; rotation angle on the X axis, in degrees.

  • $y; rotation angle on the Y axis, in degrees.

  • $z; rotation angle on the Z axis, in degrees.

Return value; the initialized Gnome::Graphene::N-Euler.

#-------------------------------------------------------------------------------

init-from-euler

Initializes a Gnome::Graphene::N-Euler using the angles and order of another Gnome::Graphene::N-Euler.

If the Gnome::Graphene::N-Euler $src is undefined, this function is equivalent to calling .init() with all angles set to 0.

method init-from-euler ( N-Object $src --> N-Object )
  • $src; a Gnome::Graphene::N-Euler

Return value; the initialized Gnome::Graphene::N-Euler.

#-------------------------------------------------------------------------------

init-from-matrix

Initializes a Gnome::Graphene::N-Euler using the given rotation matrix.

If the Gnome::Graphene::N-Matrix $m is undefined, the Gnome::Graphene::N-Euler will be initialized with all angles set to 0.

method init-from-matrix ( N-Object $m, graphene_euler_order_t $order --> N-Object )
  • $m; a rotation matrix

  • $order; the order used to apply the rotations.

Return value; the initialized Gnome::Graphene::N-Euler.

#-------------------------------------------------------------------------------

init-from-quaternion

Initializes a Gnome::Graphene::N-Euler using the given normalized quaternion.

If the Gnome::Graphene::N-Quaternion $q is undefined, the Gnome::Graphene::N-Euler will be initialized with all angles set to 0.

method init-from-quaternion ( N-Object $q, graphene_euler_order_t $order --> N-Object )
  • $q; a normalized Gnome::Graphene::N-Quaternion

  • $order; the order used to apply the rotations.

Return value; the initialized Gnome::Graphene::N-Euler.

#-------------------------------------------------------------------------------

init-from-radians

Initializes a Gnome::Graphene::N-Euler using the given angles and order of rotation.

method init-from-radians ( Num() $x, Num() $y, Num() $z, graphene_euler_order_t $order --> N-Object )
  • $x; rotation angle on the X axis, in radians.

  • $y; rotation angle on the Y axis, in radians.

  • $z; rotation angle on the Z axis, in radians.

  • $order; order of rotations.

Return value; the initialized Gnome::Graphene::N-Euler.

#-------------------------------------------------------------------------------

init-from-vec3

Initializes a Gnome::Graphene::N-Euler using the angles contained in a graphene_vec3_t.

If the graphene_vec3_t $v is undefined, the Gnome::Graphene::N-Euler will be initialized with all angles set to 0.

method init-from-vec3 ( N-Object $v, graphene_euler_order_t $order --> N-Object )
  • $v; a graphene_vec3_t containing the rotation angles in degrees

  • $order; the order used to apply the rotations.

Return value; the initialized Gnome::Graphene::N-Euler.

#-------------------------------------------------------------------------------

init-with-order

Initializes a Gnome::Graphene::N-Euler with the given angles and $order.

method init-with-order ( Num() $x, Num() $y, Num() $z, graphene_euler_order_t $order --> N-Object )
  • $x; rotation angle on the X axis, in degrees.

  • $y; rotation angle on the Y axis, in degrees.

  • $z; rotation angle on the Z axis, in degrees.

  • $order; the order used to apply the rotations.

Return value; the initialized Gnome::Graphene::N-Euler.

#-------------------------------------------------------------------------------

reorder

Reorders a Gnome::Graphene::N-Euler using $order.

This function is equivalent to creating a Gnome::Graphene::N-Quaternion from the given Gnome::Graphene::N-Euler, and then converting the quaternion into another Gnome::Graphene::N-Euler.

method reorder ( graphene_euler_order_t $order, N-Object $res )
  • $order; the new order.

  • $res; return location for the reordered Gnome::Graphene::N-Euler

#-------------------------------------------------------------------------------

to-matrix

Converts a Gnome::Graphene::N-Euler 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 Gnome::Graphene::N-Euler; for instance, if the order used to initialize $e is GRAPHENE_EULER_ORDER_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.

method to-matrix ( N-Object $res )
  • $res; return location for a Gnome::Graphene::N-Matrix

#-------------------------------------------------------------------------------

to-quaternion

Converts a Gnome::Graphene::N-Euler into a Gnome::Graphene::N-Quaternion.

method to-quaternion ( N-Object $res )
  • $res; return location for a Gnome::Graphene::N-Quaternion

#-------------------------------------------------------------------------------

to-vec3

Retrieves the angles of a Gnome::Graphene::N-Euler and initializes a graphene_vec3_t with them.

method to-vec3 ( N-Object $res )
  • $res; return location for a graphene_vec3_t

Gnome::Graphene v0.1.11

Graphene is a library of data types commonly used to implement 2D-in-3D or full 3D canvases

Authors

  • Marcel Timmerman

License

Artistic-2.0

Dependencies

Gnome::GObject:api<2>Gnome::Glib:api<2>Gnome::N:api<2>

Test Dependencies

Provides

  • Gnome::Graphene::N-Box
  • Gnome::Graphene::N-Euler
  • Gnome::Graphene::N-Frustum
  • Gnome::Graphene::N-Matrix
  • Gnome::Graphene::N-Plane
  • Gnome::Graphene::N-Point
  • Gnome::Graphene::N-Point3D
  • Gnome::Graphene::N-Quad
  • Gnome::Graphene::N-Quaternion
  • Gnome::Graphene::N-Ray
  • Gnome::Graphene::N-Rect
  • Gnome::Graphene::N-Size
  • Gnome::Graphene::N-Sphere
  • Gnome::Graphene::N-Triangle
  • Gnome::Graphene::N-Vec2
  • Gnome::Graphene::N-Vec3
  • Gnome::Graphene::N-Vec4
  • Gnome::Graphene::T-box
  • Gnome::Graphene::T-config
  • Gnome::Graphene::T-euler
  • Gnome::Graphene::T-frustum
  • Gnome::Graphene::T-matrix
  • Gnome::Graphene::T-plane
  • Gnome::Graphene::T-point
  • Gnome::Graphene::T-point3d
  • Gnome::Graphene::T-quad
  • Gnome::Graphene::T-quaternion
  • Gnome::Graphene::T-ray
  • Gnome::Graphene::T-rect
  • Gnome::Graphene::T-size
  • Gnome::Graphene::T-sphere
  • Gnome::Graphene::T-triangle
  • Gnome::Graphene::T-vec

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.