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.Vec2
Description
A structure capable of holding a vector with two dimensions, x and y.
The contents of the Vec2
structure are private and should
never be accessed directly.
Synopsis
- newtype Vec2 = Vec2 (ManagedPtr Vec2)
- newZeroVec2 :: MonadIO m => m Vec2
- vec2Add :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Vec2
- vec2Alloc :: (HasCallStack, MonadIO m) => m Vec2
- vec2Divide :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Vec2
- vec2Dot :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Float
- vec2Equal :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Bool
- vec2Free :: (HasCallStack, MonadIO m) => Vec2 -> m ()
- vec2GetX :: (HasCallStack, MonadIO m) => Vec2 -> m Float
- vec2GetY :: (HasCallStack, MonadIO m) => Vec2 -> m Float
- vec2Init :: (HasCallStack, MonadIO m) => Vec2 -> Float -> Float -> m Vec2
- vec2InitFromFloat :: (HasCallStack, MonadIO m) => Vec2 -> [Float] -> m Vec2
- vec2InitFromVec2 :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Vec2
- vec2Interpolate :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> Double -> m Vec2
- vec2Length :: (HasCallStack, MonadIO m) => Vec2 -> m Float
- vec2Max :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Vec2
- vec2Min :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Vec2
- vec2Multiply :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Vec2
- vec2Near :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> Float -> m Bool
- vec2Negate :: (HasCallStack, MonadIO m) => Vec2 -> m Vec2
- vec2Normalize :: (HasCallStack, MonadIO m) => Vec2 -> m Vec2
- vec2One :: (HasCallStack, MonadIO m) => m Vec2
- vec2Scale :: (HasCallStack, MonadIO m) => Vec2 -> Float -> m Vec2
- vec2Subtract :: (HasCallStack, MonadIO m) => Vec2 -> Vec2 -> m Vec2
- vec2XAxis :: (HasCallStack, MonadIO m) => m Vec2
- vec2YAxis :: (HasCallStack, MonadIO m) => m Vec2
- vec2Zero :: (HasCallStack, MonadIO m) => m Vec2
Exported types
Memory-managed wrapper type.
Constructors
Vec2 (ManagedPtr Vec2) |
Instances
Eq Vec2 Source # | |
GBoxed Vec2 Source # | |
Defined in GI.Graphene.Structs.Vec2 | |
ManagedPtrNewtype Vec2 Source # | |
Defined in GI.Graphene.Structs.Vec2 Methods toManagedPtr :: Vec2 -> ManagedPtr Vec2 # | |
TypedObject Vec2 Source # | |
Defined in GI.Graphene.Structs.Vec2 | |
HasParentTypes Vec2 Source # | |
Defined in GI.Graphene.Structs.Vec2 | |
tag ~ 'AttrSet => Constructible Vec2 tag Source # | |
Defined in GI.Graphene.Structs.Vec2 | |
IsGValue (Maybe Vec2) Source # | Convert |
Defined in GI.Graphene.Structs.Vec2 Methods gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe Vec2 -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe Vec2) # | |
type ParentTypes Vec2 Source # | |
Defined in GI.Graphene.Structs.Vec2 type ParentTypes Vec2 = '[] :: [Type] |
newZeroVec2 :: MonadIO m => m Vec2 Source #
Construct a Vec2
struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
add
Adds each component of the two passed vectors and places
each result into the components of res
.
Since: 1.0
alloc
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
Arguments
:: (HasCallStack, MonadIO m) | |
=> Vec2 |
|
-> Vec2 |
|
-> m Float | Returns: the dot product of the vectors |
Computes the dot product of the two given vectors.
Since: 1.0
equal
Arguments
:: (HasCallStack, MonadIO m) | |
=> Vec2 |
|
-> Vec2 |
|
-> m Bool | Returns: |
Checks whether the two given Vec2
are equal.
Since: 1.2
free
Frees the resources allocated by v
Since: 1.0
getX
Arguments
:: (HasCallStack, MonadIO m) | |
=> Vec2 |
|
-> m Float | Returns: the value of the X component |
Retrieves the X component of the Vec2
.
Since: 1.0
getY
Arguments
:: (HasCallStack, MonadIO m) | |
=> Vec2 |
|
-> m Float | Returns: the value of the Y component |
Retrieves the Y component of the Vec2
.
Since: 1.0
init
initFromFloat
Arguments
:: (HasCallStack, MonadIO m) | |
=> Vec2 |
|
-> [Float] |
|
-> m Vec2 | Returns: the initialized vector |
Initializes v
with the contents of the given array.
Since: 1.0
initFromVec2
Arguments
:: (HasCallStack, MonadIO m) | |
=> Vec2 |
|
-> Vec2 |
|
-> m Vec2 | Returns: the initialized vector |
Copies the contents of src
into v
.
Since: 1.0
interpolate
Arguments
:: (HasCallStack, MonadIO m) | |
=> Vec2 |
|
-> Vec2 |
|
-> Double |
|
-> m Vec2 |
Linearly interpolates v1
and v2
using the given factor
.
Since: 1.10
length
Computes the length of the given vector.
Since: 1.0
max
Compares the two given vectors and places the maximum
values of each component into res
.
Since: 1.0
min
Compares the two given vectors and places the minimum
values of each component into res
.
Since: 1.0
multiply
Multiplies each component of the two passed vectors and places
each result into the components of res
.
Since: 1.0
near
Arguments
:: (HasCallStack, MonadIO m) | |
=> Vec2 |
|
-> Vec2 |
|
-> Float |
|
-> m Bool | Returns: |
Compares the two given Vec2
vectors and checks
whether their values are within the given epsilon
.
Since: 1.2
negate
Negates the given Vec2
.
Since: 1.2
normalize
Computes the normalized vector for the given vector v
.
Since: 1.0
one
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Vec2 | Returns: the one vector |
Retrieves a constant vector with (1, 1) components.
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
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Vec2 | Returns: the X axis vector |
Retrieves a constant vector with (1, 0) components.
Since: 1.0
yAxis
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Vec2 | Returns: the Y axis vector |
Retrieves a constant vector with (0, 1) components.
Since: 1.0