Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
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
- noVec3 :: Maybe 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
- 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
Memory-managed wrapper type.
Methods
Overloaded methods
add
Adds each component of the two given vectors.
Since: 1.0
alloc
:: (HasCallStack, MonadIO m) | |
=> m Vec3 | Returns: the newly allocated |
cross
Computes the cross product of the two given vectors.
Since: 1.0
divide
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
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> Vec3 |
|
-> m Float | Returns: the value of the dot product |
Computes the dot product of the two given vectors.
Since: 1.0
equal
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> Vec3 |
|
-> m Bool | Returns: |
Checks whether the two given Vec3
are equal.
Since: 1.2
free
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> m () |
Frees the resources allocated by v
Since: 1.0
getX
:: (HasCallStack, MonadIO m) | |
=> 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
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> m Vec2 |
getXy0
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> m Vec3 |
getXyz0
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> m Vec4 |
getXyz1
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> m Vec4 |
getXyzw
getY
:: (HasCallStack, MonadIO m) | |
=> 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
:: (HasCallStack, MonadIO m) | |
=> 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
initFromFloat
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> [Float] |
|
-> m Vec3 | Returns: the initialized vector |
Initializes a Vec3
with the values from an array.
Since: 1.0
initFromVec3
length
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> m Float | Returns: the value of the length of the vector |
Retrieves the length of the given vector v
.
Since: 1.0
max
Compares each component of the two given vectors and creates a vector that contains the maximum values.
Since: 1.0
min
Compares each component of the two given vectors and creates a vector that contains the minimum values.
Since: 1.0
multiply
Multiplies each component of the two given vectors.
Since: 1.0
near
:: (HasCallStack, MonadIO m) | |
=> Vec3 |
|
-> Vec3 |
|
-> Float |
|
-> m Bool | Returns: |
Compares the two given Vec3
vectors and checks
whether their values are within the given epsilon
.
Since: 1.2
negate
normalize
one
:: (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
Multiplies all components of the given vector with the given scalar factor
.
Since: 1.2
subtract
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
:: (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
:: (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
:: (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