Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A quaternion.
The contents of the Quaternion
structure are private
and should never be accessed directly.
Since: 1.0
Synopsis
- newtype Quaternion = Quaternion (ManagedPtr Quaternion)
- newZeroQuaternion :: MonadIO m => m Quaternion
- quaternionAdd :: (HasCallStack, MonadIO m) => Quaternion -> Quaternion -> m Quaternion
- quaternionAlloc :: (HasCallStack, MonadIO m) => m Quaternion
- quaternionDot :: (HasCallStack, MonadIO m) => Quaternion -> Quaternion -> m Float
- quaternionEqual :: (HasCallStack, MonadIO m) => Quaternion -> Quaternion -> m Bool
- quaternionFree :: (HasCallStack, MonadIO m) => Quaternion -> m ()
- quaternionInit :: (HasCallStack, MonadIO m) => Quaternion -> Float -> Float -> Float -> Float -> m Quaternion
- quaternionInitFromAngleVec3 :: (HasCallStack, MonadIO m) => Quaternion -> Float -> Vec3 -> m Quaternion
- quaternionInitFromAngles :: (HasCallStack, MonadIO m) => Quaternion -> Float -> Float -> Float -> m Quaternion
- quaternionInitFromEuler :: (HasCallStack, MonadIO m) => Quaternion -> Euler -> m Quaternion
- quaternionInitFromMatrix :: (HasCallStack, MonadIO m) => Quaternion -> Matrix -> m Quaternion
- quaternionInitFromQuaternion :: (HasCallStack, MonadIO m) => Quaternion -> Quaternion -> m Quaternion
- quaternionInitFromRadians :: (HasCallStack, MonadIO m) => Quaternion -> Float -> Float -> Float -> m Quaternion
- quaternionInitFromVec4 :: (HasCallStack, MonadIO m) => Quaternion -> Vec4 -> m Quaternion
- quaternionInitIdentity :: (HasCallStack, MonadIO m) => Quaternion -> m Quaternion
- quaternionInvert :: (HasCallStack, MonadIO m) => Quaternion -> m Quaternion
- quaternionMultiply :: (HasCallStack, MonadIO m) => Quaternion -> Quaternion -> m Quaternion
- quaternionNormalize :: (HasCallStack, MonadIO m) => Quaternion -> m Quaternion
- quaternionScale :: (HasCallStack, MonadIO m) => Quaternion -> Float -> m Quaternion
- quaternionSlerp :: (HasCallStack, MonadIO m) => Quaternion -> Quaternion -> Float -> m Quaternion
- quaternionToAngleVec3 :: (HasCallStack, MonadIO m) => Quaternion -> m (Float, Vec3)
- quaternionToAngles :: (HasCallStack, MonadIO m) => Quaternion -> m (Float, Float, Float)
- quaternionToMatrix :: (HasCallStack, MonadIO m) => Quaternion -> m Matrix
- quaternionToRadians :: (HasCallStack, MonadIO m) => Quaternion -> m (Float, Float, Float)
- quaternionToVec4 :: (HasCallStack, MonadIO m) => Quaternion -> m Vec4
Exported types
newtype Quaternion Source #
Memory-managed wrapper type.
Quaternion (ManagedPtr Quaternion) |
Instances
newZeroQuaternion :: MonadIO m => m Quaternion Source #
Construct a Quaternion
struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
Methods
add, dot, equal, free, init, initFromAngleVec3, initFromAngles, initFromEuler, initFromMatrix, initFromQuaternion, initFromRadians, initFromVec4, initIdentity, invert, multiply, normalize, scale, slerp, toAngleVec3, toAngles, toMatrix, toRadians, toVec4.
Getters
None.
Setters
None.
add
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Quaternion |
|
-> m Quaternion |
Adds two Quaternion
a
and b
.
Since: 1.10
alloc
:: (HasCallStack, MonadIO m) | |
=> m Quaternion | Returns: the newly allocated |
dot
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Quaternion |
|
-> m Float | Returns: the value of the dot products |
Computes the dot product of two Quaternion
.
Since: 1.0
equal
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Quaternion |
|
-> m Bool | Returns: |
Checks whether the given quaternions are equal.
Since: 1.0
free
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m () |
Releases the resources allocated by quaternionAlloc
.
Since: 1.0
init
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m Quaternion | Returns: the initialized quaternion |
Initializes a Quaternion
using the given four values.
Since: 1.0
initFromAngleVec3
quaternionInitFromAngleVec3 Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Float |
|
-> Vec3 |
|
-> m Quaternion | Returns: the initialized quaternion |
Initializes a Quaternion
using an angle
on a
specific axis
.
Since: 1.0
initFromAngles
quaternionInitFromAngles Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m Quaternion | Returns: the initialized quaternion |
Initializes a Quaternion
using the values of
the Euler angles
on each axis.
See also: quaternionInitFromEuler
Since: 1.0
initFromEuler
quaternionInitFromEuler Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Euler |
|
-> m Quaternion | Returns: the initialized |
Initializes a Quaternion
using the given Euler
.
Since: 1.2
initFromMatrix
quaternionInitFromMatrix Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Matrix |
|
-> m Quaternion | Returns: the initialized quaternion |
Initializes a Quaternion
using the rotation components
of a transformation matrix.
Since: 1.0
initFromQuaternion
quaternionInitFromQuaternion Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Quaternion |
|
-> m Quaternion | Returns: the initialized quaternion |
Initializes a Quaternion
with the values from src
.
Since: 1.0
initFromRadians
quaternionInitFromRadians Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m Quaternion | Returns: the initialized quaternion |
Initializes a Quaternion
using the values of
the Euler angles
on each axis.
See also: quaternionInitFromEuler
Since: 1.0
initFromVec4
quaternionInitFromVec4 Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Vec4 |
|
-> m Quaternion | Returns: the initialized quaternion |
Initializes a Quaternion
with the values from src
.
Since: 1.0
initIdentity
quaternionInitIdentity Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m Quaternion | Returns: the initialized quaternion |
Initializes a Quaternion
using the identity
transformation.
Since: 1.0
invert
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m Quaternion |
Inverts a Quaternion
, and returns the conjugate
quaternion of q
.
Since: 1.0
multiply
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Quaternion |
|
-> m Quaternion |
Multiplies two Quaternion
a
and b
.
Since: 1.10
normalize
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m Quaternion |
Normalizes a Quaternion
.
Since: 1.0
scale
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Float |
|
-> m Quaternion |
Scales all the elements of a Quaternion
q
using
the given scalar factor.
Since: 1.10
slerp
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> Quaternion |
|
-> Float |
|
-> m Quaternion |
Interpolates between the two given quaternions using a spherical
linear interpolation, or SLERP,
using the given interpolation factor
.
Since: 1.0
toAngleVec3
quaternionToAngleVec3 Source #
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m (Float, Vec3) |
Converts a quaternion into an angle
, axis
pair.
Since: 1.0
toAngles
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m (Float, Float, Float) |
Converts a Quaternion
to its corresponding rotations
on the Euler angles
on each axis.
Since: 1.2
toMatrix
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m Matrix |
Converts a quaternion into a transformation matrix expressing
the rotation defined by the Quaternion
.
Since: 1.0
toRadians
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m (Float, Float, Float) |
Converts a Quaternion
to its corresponding rotations
on the Euler angles
on each axis.
Since: 1.2
toVec4
:: (HasCallStack, MonadIO m) | |
=> Quaternion |
|
-> m Vec4 |
Copies the components of a Quaternion
into a
Vec4
.
Since: 1.0