gi-graphene-1.0.8: Graphene bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Graphene.Structs.Quaternion

Contents

- Exported types
- Methods
  - add
  - alloc
  - dot
  - equal
  - free
  - init
  - initFromAngleVec3
  - initFromAngles
  - initFromEuler
  - initFromMatrix
  - initFromQuaternion
  - initFromRadians
  - initFromVec4
  - initIdentity
  - invert
  - multiply
  - normalize
  - scale
  - slerp
  - toAngleVec3
  - toAngles
  - toMatrix
  - toRadians
  - toVec4

Description

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.

Constructors

Quaternion (ManagedPtr Quaternion) |

#### Instances

Instances details

Eq Quaternion Source # |
Instance details Defined in GI.Graphene.Structs.Quaternion Methods (==) :: Quaternion -> Quaternion -> Bool Source # (/=) :: Quaternion -> Quaternion -> Bool Source #
GBoxed Quaternion Source # |
Instance details Defined in GI.Graphene.Structs.Quaternion
ManagedPtrNewtype Quaternion Source # |
Instance details Defined in GI.Graphene.Structs.Quaternion Methods toManagedPtr :: Quaternion -> ManagedPtr Quaternion Source #
TypedObject Quaternion Source # |
Instance details Defined in GI.Graphene.Structs.Quaternion Methods glibType :: IO GType Source #
HasParentTypes Quaternion Source # |
Instance details Defined in GI.Graphene.Structs.Quaternion
tag ~ 'AttrSet => Constructible Quaternion tag Source # |
Instance details Defined in GI.Graphene.Structs.Quaternion Methods new :: MonadIO m => (ManagedPtr Quaternion -> Quaternion) -> [AttrOp Quaternion tag] -> m Quaternion Source #
IsGValue (Maybe Quaternion) Source # | Convert `Quaternion` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Graphene.Structs.Quaternion Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Quaternion -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Quaternion) Source #
type ParentTypes Quaternion Source # |
Instance details Defined in GI.Graphene.Structs.Quaternion type ParentTypes Quaternion = '[] :: [Type]

newZeroQuaternion :: MonadIO m => m Quaternion Source #

Construct a `Quaternion` struct initialized to zero.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### 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

quaternionAdd Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `a`: a `Quaternion`
-> Quaternion | `b`: a `Quaternion`
-> m Quaternion |

Adds two `Quaternion` `a` and `b`.

Since: 1.10

## alloc

quaternionAlloc Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Quaternion | Returns: the newly allocated `Quaternion`

Allocates a new `Quaternion`.

The contents of the returned value are undefined.

Since: 1.0

## dot

quaternionDot Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `a`: a `Quaternion`
-> Quaternion | `b`: a `Quaternion`
-> m Float | Returns: the value of the dot products

Computes the dot product of two `Quaternion`.

Since: 1.0

## equal

quaternionEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `a`: a `Quaternion`
-> Quaternion | `b`: a `Quaternion`
-> m Bool | Returns: `true` if the quaternions are equal

Checks whether the given quaternions are equal.

Since: 1.0

## free

quaternionFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m () |

Releases the resources allocated by `quaternionAlloc`.

Since: 1.0

## init

quaternionInit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> Float | `x`: the first component of the quaternion
-> Float | `y`: the second component of the quaternion
-> Float | `z`: the third component of the quaternion
-> Float | `w`: the fourth component of the quaternion
-> m Quaternion | Returns: the initialized quaternion

Initializes a `Quaternion` using the given four values.

Since: 1.0

## initFromAngleVec3

quaternionInitFromAngleVec3 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> Float | `angle`: the rotation on a given axis, in degrees
-> Vec3 | `axis`: the axis of rotation, expressed as a vector
-> m Quaternion | Returns: the initialized quaternion

Initializes a `Quaternion` using an `angle` on a specific `axis`.

Since: 1.0

## initFromAngles

quaternionInitFromAngles Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> Float | `degX`: rotation angle on the X axis (yaw), in degrees
-> Float | `degY`: rotation angle on the Y axis (pitch), in degrees
-> Float | `degZ`: rotation angle on the Z axis (roll), in degrees
-> 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 #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: the `Quaternion` to initialize
-> Euler | `e`: a `Euler`
-> m Quaternion | Returns: the initialized `Quaternion`

Initializes a `Quaternion` using the given `Euler`.

Since: 1.2

## initFromMatrix

quaternionInitFromMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> Matrix | `m`: a `Matrix`
-> m Quaternion | Returns: the initialized quaternion

Initializes a `Quaternion` using the rotation components of a transformation matrix.

Since: 1.0

## initFromQuaternion

quaternionInitFromQuaternion Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> Quaternion | `src`: a `Quaternion`
-> m Quaternion | Returns: the initialized quaternion

Initializes a `Quaternion` with the values from `src`.

Since: 1.0

## initFromRadians

quaternionInitFromRadians Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> Float | `radX`: rotation angle on the X axis (yaw), in radians
-> Float | `radY`: rotation angle on the Y axis (pitch), in radians
-> Float | `radZ`: rotation angle on the Z axis (roll), in radians
-> 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 #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> Vec4 | `src`: a `Vec4`
-> m Quaternion | Returns: the initialized quaternion

Initializes a `Quaternion` with the values from `src`.

Since: 1.0

## initIdentity

quaternionInitIdentity Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m Quaternion | Returns: the initialized quaternion

Initializes a `Quaternion` using the identity transformation.

Since: 1.0

## invert

quaternionInvert Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m Quaternion |

Inverts a `Quaternion`, and returns the conjugate quaternion of `q`.

Since: 1.0

## multiply

quaternionMultiply Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `a`: a `Quaternion`
-> Quaternion | `b`: a `Quaternion`
-> m Quaternion |

Multiplies two `Quaternion` `a` and `b`.

Since: 1.10

## normalize

quaternionNormalize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m Quaternion |

Normalizes a `Quaternion`.

Since: 1.0

## scale

quaternionScale Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> Float | `factor`: a scaling factor
-> m Quaternion |

Scales all the elements of a `Quaternion` `q` using the given scalar factor.

Since: 1.10

## slerp

quaternionSlerp Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `a`: a `Quaternion`
-> Quaternion | `b`: a `Quaternion`
-> Float | `factor`: the linear interpolation factor
-> 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 #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m (Float, Vec3) |

Converts a quaternion into an `angle`, `axis` pair.

Since: 1.0

## toAngles

quaternionToAngles Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m (Float, Float, Float) |

Converts a `Quaternion` to its corresponding rotations on the Euler angles on each axis.

Since: 1.2

## toMatrix

quaternionToMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m Matrix |

Converts a quaternion into a transformation matrix expressing the rotation defined by the `Quaternion`.

Since: 1.0

## toRadians

quaternionToRadians Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m (Float, Float, Float) |

Converts a `Quaternion` to its corresponding rotations on the Euler angles on each axis.

Since: 1.2

## toVec4

quaternionToVec4 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Quaternion | `q`: a `Quaternion`
-> m Vec4 |

Copies the components of a `Quaternion` into a `Vec4`.

Since: 1.0