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.Vec4

Contents

- Exported types
- Methods
  - add
  - alloc
  - divide
  - dot
  - equal
  - free
  - getW
  - getX
  - getXy
  - getXyz
  - getY
  - getZ
  - init
  - initFromFloat
  - initFromVec2
  - initFromVec3
  - initFromVec4
  - interpolate
  - length
  - max
  - min
  - multiply
  - near
  - negate
  - normalize
  - one
  - scale
  - subtract
  - wAxis
  - xAxis
  - yAxis
  - zAxis
  - zero

Description

A structure capable of holding a vector with four dimensions: x, y, z, and w.

The contents of the `Vec4` structure are private and should never be accessed directly.

Synopsis

- newtype Vec4 = Vec4 (ManagedPtr Vec4)
- newZeroVec4 :: MonadIO m => m Vec4
- vec4Add :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Vec4
- vec4Alloc :: (HasCallStack, MonadIO m) => m Vec4
- vec4Divide :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Vec4
- vec4Dot :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Float
- vec4Equal :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Bool
- vec4Free :: (HasCallStack, MonadIO m) => Vec4 -> m ()
- vec4GetW :: (HasCallStack, MonadIO m) => Vec4 -> m Float
- vec4GetX :: (HasCallStack, MonadIO m) => Vec4 -> m Float
- vec4GetXy :: (HasCallStack, MonadIO m) => Vec4 -> m Vec2
- vec4GetXyz :: (HasCallStack, MonadIO m) => Vec4 -> m Vec3
- vec4GetY :: (HasCallStack, MonadIO m) => Vec4 -> m Float
- vec4GetZ :: (HasCallStack, MonadIO m) => Vec4 -> m Float
- vec4Init :: (HasCallStack, MonadIO m) => Vec4 -> Float -> Float -> Float -> Float -> m Vec4
- vec4InitFromFloat :: (HasCallStack, MonadIO m) => Vec4 -> [Float] -> m Vec4
- vec4InitFromVec2 :: (HasCallStack, MonadIO m) => Vec4 -> Vec2 -> Float -> Float -> m Vec4
- vec4InitFromVec3 :: (HasCallStack, MonadIO m) => Vec4 -> Vec3 -> Float -> m Vec4
- vec4InitFromVec4 :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Vec4
- vec4Interpolate :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> Double -> m Vec4
- vec4Length :: (HasCallStack, MonadIO m) => Vec4 -> m Float
- vec4Max :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Vec4
- vec4Min :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Vec4
- vec4Multiply :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Vec4
- vec4Near :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> Float -> m Bool
- vec4Negate :: (HasCallStack, MonadIO m) => Vec4 -> m Vec4
- vec4Normalize :: (HasCallStack, MonadIO m) => Vec4 -> m Vec4
- vec4One :: (HasCallStack, MonadIO m) => m Vec4
- vec4Scale :: (HasCallStack, MonadIO m) => Vec4 -> Float -> m Vec4
- vec4Subtract :: (HasCallStack, MonadIO m) => Vec4 -> Vec4 -> m Vec4
- vec4WAxis :: (HasCallStack, MonadIO m) => m Vec4
- vec4XAxis :: (HasCallStack, MonadIO m) => m Vec4
- vec4YAxis :: (HasCallStack, MonadIO m) => m Vec4
- vec4ZAxis :: (HasCallStack, MonadIO m) => m Vec4
- vec4Zero :: (HasCallStack, MonadIO m) => m Vec4

# Exported types

newtype Vec4 Source #

Memory-managed wrapper type.

Constructors

Vec4 (ManagedPtr Vec4) |

#### Instances

Instances details

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

newZeroVec4 :: MonadIO m => m Vec4 Source #

Construct a `Vec4` struct initialized to zero.

# Methods

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

Expand

#### Methods

add, divide, dot, equal, free, init, initFromFloat, initFromVec2, initFromVec3, initFromVec4, interpolate, length, max, min, multiply, near, negate, normalize, scale, subtract.

#### Getters

getW, getX, getXy, getXyz, getY, getZ.

#### Setters

None.

## add

vec4Add Source #

Arguments

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

Adds each component of the two given vectors.

Since: 1.0

## alloc

vec4Alloc Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Vec4 | Returns: the newly allocated `Vec4` structure. Use `vec4Free` to free the resources allocated by this function.

Allocates a new `Vec4` structure.

The contents of the returned structure are undefined.

Use `vec4Init` to initialize the vector.

Since: 1.0

## divide

vec4Divide Source #

Arguments

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

Divides each component of the first operand `a` by the corresponding component of the second operand `b`, and places the results into the vector `res`.

Since: 1.0

## dot

vec4Dot Source #

Arguments

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

Computes the dot product of the two given vectors.

Since: 1.0

## equal

vec4Equal Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v1`: a `Vec4`
-> Vec4 | `v2`: a `Vec4`
-> m Bool | Returns: `true` if the two vectors are equal, and false otherwise

Checks whether the two given `Vec4` are equal.

Since: 1.2

## free

vec4Free Source #

Arguments

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

Frees the resources allocated by `v`

Since: 1.0

## getW

vec4GetW Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> m Float | Returns: the value of the fourth component

Retrieves the value of the fourth component of the given `Vec4`.

Since: 1.0

## getX

vec4GetX Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> m Float | Returns: the value of the first component

Retrieves the value of the first component of the given `Vec4`.

Since: 1.0

## getXy

vec4GetXy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> m Vec2 |

Creates a `Vec2` that contains the first two components of the given `Vec4`.

Since: 1.0

## getXyz

vec4GetXyz Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> m Vec3 |

Creates a `Vec3` that contains the first three components of the given `Vec4`.

Since: 1.0

## getY

vec4GetY Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> m Float | Returns: the value of the second component

Retrieves the value of the second component of the given `Vec4`.

Since: 1.0

## getZ

vec4GetZ Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> m Float | Returns: the value of the third component

Retrieves the value of the third component of the given `Vec4`.

Since: 1.0

## init

vec4Init Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> Float | `x`: the X field of the vector
-> Float | `y`: the Y field of the vector
-> Float | `z`: the Z field of the vector
-> Float | `w`: the W field of the vector
-> m Vec4 | Returns: a pointer to the initialized vector

Initializes a `Vec4` using the given values.

This function can be called multiple times.

Since: 1.0

## initFromFloat

vec4InitFromFloat Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> [Float] | `src`: an array of four floating point values
-> m Vec4 | Returns: the initialized vector

Initializes a `Vec4` with the values inside the given array.

Since: 1.0

## initFromVec2

vec4InitFromVec2 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> Vec2 | `src`: a `Vec2`
-> Float | `z`: the value for the third component of `v`
-> Float | `w`: the value for the fourth component of `v`
-> m Vec4 | Returns: the initialized vector

Initializes a `Vec4` using the components of a `Vec2` and the values of `z` and `w`.

Since: 1.0

## initFromVec3

vec4InitFromVec3 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> Vec3 | `src`: a `Vec3`
-> Float | `w`: the value for the fourth component of `v`
-> m Vec4 | Returns: the initialized vector

Initializes a `Vec4` using the components of a `Vec3` and the value of `w`.

Since: 1.0

## initFromVec4

vec4InitFromVec4 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> Vec4 | `src`: a `Vec4`
-> m Vec4 | Returns: the initialized vector

Initializes a `Vec4` using the components of another `Vec4`.

Since: 1.0

## interpolate

vec4Interpolate Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v1`: a `Vec4`
-> Vec4 | `v2`: a `Vec4`
-> Double | `factor`: the interpolation factor
-> m Vec4 |

Linearly interpolates `v1` and `v2` using the given `factor`.

Since: 1.10

## length

vec4Length Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> m Float | Returns: the length of the vector

Computes the length of the given `Vec4`.

Since: 1.0

## max

vec4Max Source #

Arguments

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

Compares each component of the two given vectors and creates a vector that contains the maximum values.

Since: 1.0

## min

vec4Min Source #

Arguments

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

Compares each component of the two given vectors and creates a vector that contains the minimum values.

Since: 1.0

## multiply

vec4Multiply Source #

Arguments

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

Multiplies each component of the two given vectors.

Since: 1.0

## near

vec4Near Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v1`: a `Vec4`
-> Vec4 | `v2`: a `Vec4`
-> Float | `epsilon`: the threshold between the two vectors
-> m Bool | Returns: `true` if the two vectors are near each other

Compares the two given `Vec4` vectors and checks whether their values are within the given `epsilon`.

Since: 1.2

## negate

vec4Negate Source #

Arguments

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

Negates the given `Vec4`.

Since: 1.2

## normalize

vec4Normalize Source #

Arguments

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

Normalizes the given `Vec4`.

Since: 1.0

## one

vec4One Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Vec4 | Returns: a constant vector

Retrieves a pointer to a `Vec4` with all its components set to 1.

Since: 1.0

## scale

vec4Scale Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Vec4 | `v`: a `Vec4`
-> Float | `factor`: the scalar factor
-> m Vec4 |

Multiplies all components of the given vector with the given scalar `factor`.

Since: 1.2

## subtract

vec4Subtract Source #

Arguments

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

Subtracts from each component of the first operand `a` the corresponding component of the second operand `b` and places each result into the components of `res`.

Since: 1.0

## wAxis

vec4WAxis Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Vec4 | Returns: a constant vector

Retrieves a pointer to a `Vec4` with its components set to (0, 0, 0, 1).

Since: 1.0

## xAxis

vec4XAxis Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Vec4 | Returns: a constant vector

Retrieves a pointer to a `Vec4` with its components set to (1, 0, 0, 0).

Since: 1.0

## yAxis

vec4YAxis Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Vec4 | Returns: a constant vector

Retrieves a pointer to a `Vec4` with its components set to (0, 1, 0, 0).

Since: 1.0

## zAxis

vec4ZAxis Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Vec4 | Returns: a constant vector

Retrieves a pointer to a `Vec4` with its components set to (0, 0, 1, 0).

Since: 1.0

## zero

vec4Zero Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Vec4 | Returns: a constant vector

Retrieves a pointer to a `Vec4` with all its components set to 0.

Since: 1.0