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

Contents

- Exported types
- Methods
  - add
  - alloc
  - cross
  - divide
  - dot
  - equal
  - free
  - getX
  - getXy
  - getXy0
  - getXyz0
  - getXyz1
  - getXyzw
  - getY
  - getZ
  - init
  - initFromFloat
  - initFromVec3
  - interpolate
  - length
  - max
  - min
  - multiply
  - near
  - negate
  - normalize
  - one
  - scale
  - subtract
  - xAxis
  - yAxis
  - zAxis
  - zero

Description

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

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

Synopsis

- newtype Vec3 = Vec3 (ManagedPtr Vec3)
- newZeroVec3 :: MonadIO m => m Vec3
- vec3Add :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Vec3
- vec3Alloc :: (HasCallStack, MonadIO m) => m Vec3
- vec3Cross :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Vec3
- vec3Divide :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Vec3
- vec3Dot :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Float
- vec3Equal :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Bool
- vec3Free :: (HasCallStack, MonadIO m) => Vec3 -> m ()
- vec3GetX :: (HasCallStack, MonadIO m) => Vec3 -> m Float
- vec3GetXy :: (HasCallStack, MonadIO m) => Vec3 -> m Vec2
- vec3GetXy0 :: (HasCallStack, MonadIO m) => Vec3 -> m Vec3
- vec3GetXyz0 :: (HasCallStack, MonadIO m) => Vec3 -> m Vec4
- vec3GetXyz1 :: (HasCallStack, MonadIO m) => Vec3 -> m Vec4
- vec3GetXyzw :: (HasCallStack, MonadIO m) => Vec3 -> Float -> m Vec4
- vec3GetY :: (HasCallStack, MonadIO m) => Vec3 -> m Float
- vec3GetZ :: (HasCallStack, MonadIO m) => Vec3 -> m Float
- vec3Init :: (HasCallStack, MonadIO m) => Vec3 -> Float -> Float -> Float -> m Vec3
- vec3InitFromFloat :: (HasCallStack, MonadIO m) => Vec3 -> [Float] -> m Vec3
- vec3InitFromVec3 :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Vec3
- vec3Interpolate :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> Double -> m Vec3
- vec3Length :: (HasCallStack, MonadIO m) => Vec3 -> m Float
- vec3Max :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Vec3
- vec3Min :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Vec3
- vec3Multiply :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Vec3
- vec3Near :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> Float -> m Bool
- vec3Negate :: (HasCallStack, MonadIO m) => Vec3 -> m Vec3
- vec3Normalize :: (HasCallStack, MonadIO m) => Vec3 -> m Vec3
- vec3One :: (HasCallStack, MonadIO m) => m Vec3
- vec3Scale :: (HasCallStack, MonadIO m) => Vec3 -> Float -> m Vec3
- vec3Subtract :: (HasCallStack, MonadIO m) => Vec3 -> Vec3 -> m Vec3
- vec3XAxis :: (HasCallStack, MonadIO m) => m Vec3
- vec3YAxis :: (HasCallStack, MonadIO m) => m Vec3
- vec3ZAxis :: (HasCallStack, MonadIO m) => m Vec3
- vec3Zero :: (HasCallStack, MonadIO m) => m Vec3

# Exported types

newtype Vec3 Source #

Memory-managed wrapper type.

Constructors

Vec3 (ManagedPtr Vec3) |

#### Instances

Instances details

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

newZeroVec3 :: MonadIO m => m Vec3 Source #

Construct a `Vec3` struct initialized to zero.

# Methods

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

Expand

#### Methods

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

#### Getters

getX, getXy, getXy0, getXyz0, getXyz1, getXyzw, getY, getZ.

#### Setters

None.

## add

vec3Add Source #

Arguments

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

Adds each component of the two given vectors.

Since: 1.0

## alloc

vec3Alloc Source #

Arguments

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

Allocates a new `Vec3` structure.

The contents of the returned structure are undefined.

Use `vec3Init` to initialize the vector.

Since: 1.0

## cross

vec3Cross Source #

Arguments

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

Computes the cross product of the two given vectors.

Since: 1.0

## divide

vec3Divide Source #

Arguments

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

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

vec3Dot Source #

Arguments

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

Computes the dot product of the two given vectors.

Since: 1.0

## equal

vec3Equal Source #

Arguments

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

Checks whether the two given `Vec3` are equal.

Since: 1.2

## free

vec3Free Source #

Arguments

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

Frees the resources allocated by `v`

Since: 1.0

## getX

vec3GetX Source #

Arguments

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

Retrieves the first component of the given vector `v`.

Since: 1.0

## getXy

vec3GetXy Source #

Arguments

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

Creates a `Vec2` that contains the first and second components of the given `Vec3`.

Since: 1.0

## getXy0

vec3GetXy0 Source #

Arguments

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

Creates a `Vec3` that contains the first two components of the given `Vec3`, and the third component set to 0.

Since: 1.0

## getXyz0

vec3GetXyz0 Source #

Arguments

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

Converts a `Vec3` in a `Vec4` using 0.0 as the value for the fourth component of the resulting vector.

Since: 1.0

## getXyz1

vec3GetXyz1 Source #

Arguments

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

Converts a `Vec3` in a `Vec4` using 1.0 as the value for the fourth component of the resulting vector.

Since: 1.0

## getXyzw

vec3GetXyzw Source #

Arguments

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

Converts a `Vec3` in a `Vec4` using `w` as the value of the fourth component of the resulting vector.

Since: 1.0

## getY

vec3GetY Source #

Arguments

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

Retrieves the second component of the given vector `v`.

Since: 1.0

## getZ

vec3GetZ Source #

Arguments

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

Retrieves the third component of the given vector `v`.

Since: 1.0

## init

vec3Init Source #

Arguments

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

Initializes a `Vec3` using the given values.

This function can be called multiple times.

Since: 1.0

## initFromFloat

vec3InitFromFloat Source #

Arguments

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

Initializes a `Vec3` with the values from an array.

Since: 1.0

## initFromVec3

vec3InitFromVec3 Source #

Arguments

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

Initializes a `Vec3` with the values of another `Vec3`.

Since: 1.0

## interpolate

vec3Interpolate Source #

Arguments

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

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

Since: 1.10

## length

vec3Length Source #

Arguments

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

Retrieves the length of the given vector `v`.

Since: 1.0

## max

vec3Max Source #

Arguments

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

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

Since: 1.0

## min

vec3Min Source #

Arguments

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

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

Since: 1.0

## multiply

vec3Multiply Source #

Arguments

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

Multiplies each component of the two given vectors.

Since: 1.0

## near

vec3Near Source #

Arguments

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

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

Since: 1.2

## negate

vec3Negate Source #

Arguments

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

Negates the given `Vec3`.

Since: 1.2

## normalize

vec3Normalize Source #

Arguments

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

Normalizes the given `Vec3`.

Since: 1.0

## one

vec3One Source #

Arguments

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

Provides a constant pointer to a vector with three components, all sets to 1.

Since: 1.0

## scale

vec3Scale Source #

Arguments

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

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

Since: 1.2

## subtract

vec3Subtract Source #

Arguments

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

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

## xAxis

vec3XAxis Source #

Arguments

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

Provides a constant pointer to a vector with three components with values set to (1, 0, 0).

Since: 1.0

## yAxis

vec3YAxis Source #

Arguments

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

Provides a constant pointer to a vector with three components with values set to (0, 1, 0).

Since: 1.0

## zAxis

vec3ZAxis Source #

Arguments

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

Provides a constant pointer to a vector with three components with values set to (0, 0, 1).

Since: 1.0

## zero

vec3Zero Source #

Arguments

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

Provides a constant pointer to a vector with three components, all sets to 0.

Since: 1.0