gi-graphene-1.0.7: Graphene bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Exported types

newtype Vec2 Source #

Memory-managed wrapper type.

Constructors

Vec2 (ManagedPtr Vec2) 

Instances

Instances details
Eq Vec2 Source # 
Instance details

Defined in GI.Graphene.Structs.Vec2

Methods

(==) :: Vec2 -> Vec2 -> Bool #

(/=) :: Vec2 -> Vec2 -> Bool #

GBoxed Vec2 Source # 
Instance details

Defined in GI.Graphene.Structs.Vec2

ManagedPtrNewtype Vec2 Source # 
Instance details

Defined in GI.Graphene.Structs.Vec2

Methods

toManagedPtr :: Vec2 -> ManagedPtr Vec2

TypedObject Vec2 Source # 
Instance details

Defined in GI.Graphene.Structs.Vec2

Methods

glibType :: IO GType

HasParentTypes Vec2 Source # 
Instance details

Defined in GI.Graphene.Structs.Vec2

tag ~ 'AttrSet => Constructible Vec2 tag Source # 
Instance details

Defined in GI.Graphene.Structs.Vec2

Methods

new :: MonadIO m => (ManagedPtr Vec2 -> Vec2) -> [AttrOp Vec2 tag] -> m Vec2

IsGValue (Maybe Vec2) Source #

Convert Vec2 to and from GValue. See toGValue and fromGValue.

Instance details

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

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

Expand

Methods

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

Getters

getX, getY.

Setters

None.

add

vec2Add Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

a: a Vec2

-> Vec2

b: a Vec2

-> m Vec2 

Adds each component of the two passed vectors and places each result into the components of res.

Since: 1.0

alloc

vec2Alloc Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Vec2

Returns: the newly allocated Vec2 structure. Use vec2Free to free the resources allocated by this function.

Allocates a new Vec2 structure.

The contents of the returned structure are undefined.

Use vec2Init to initialize the vector.

Since: 1.0

divide

vec2Divide Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

a: a Vec2

-> Vec2

b: a Vec2

-> m Vec2 

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

vec2Dot Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

a: a Vec2

-> Vec2

b: a Vec2

-> m Float

Returns: the dot product of the vectors

Computes the dot product of the two given vectors.

Since: 1.0

equal

vec2Equal Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v1: a Vec2

-> Vec2

v2: a Vec2

-> m Bool

Returns: true if the two vectors are equal, and false otherwise

Checks whether the two given Vec2 are equal.

Since: 1.2

free

vec2Free Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> m () 

Frees the resources allocated by v

Since: 1.0

getX

vec2GetX Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> m Float

Returns: the value of the X component

Retrieves the X component of the Vec2.

Since: 1.0

getY

vec2GetY Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> m Float

Returns: the value of the Y component

Retrieves the Y component of the Vec2.

Since: 1.0

init

vec2Init Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> Float

x: the X field of the vector

-> Float

y: the Y field of the vector

-> m Vec2

Returns: the initialized vector

Initializes a Vec2 using the given values.

This function can be called multiple times.

Since: 1.0

initFromFloat

vec2InitFromFloat Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> [Float]

src: an array of floating point values with at least two elements

-> m Vec2

Returns: the initialized vector

Initializes v with the contents of the given array.

Since: 1.0

initFromVec2

vec2InitFromVec2 Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> Vec2

src: a Vec2

-> m Vec2

Returns: the initialized vector

Copies the contents of src into v.

Since: 1.0

interpolate

vec2Interpolate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v1: a Vec2

-> Vec2

v2: a Vec2

-> Double

factor: the interpolation factor

-> m Vec2 

Linearly interpolates v1 and v2 using the given factor.

Since: 1.10

length

vec2Length Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> m Float

Returns: the length of the vector

Computes the length of the given vector.

Since: 1.0

max

vec2Max Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

a: a Vec2

-> Vec2

b: a Vec2

-> m Vec2 

Compares the two given vectors and places the maximum values of each component into res.

Since: 1.0

min

vec2Min Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

a: a Vec2

-> Vec2

b: a Vec2

-> m Vec2 

Compares the two given vectors and places the minimum values of each component into res.

Since: 1.0

multiply

vec2Multiply Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

a: a Vec2

-> Vec2

b: a Vec2

-> m Vec2 

Multiplies each component of the two passed vectors and places each result into the components of res.

Since: 1.0

near

vec2Near Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v1: a Vec2

-> Vec2

v2: a Vec2

-> Float

epsilon: the threshold between the two vectors

-> m Bool

Returns: true if the two vectors are near each other

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

Since: 1.2

negate

vec2Negate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> m Vec2 

Negates the given Vec2.

Since: 1.2

normalize

vec2Normalize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> m Vec2 

Computes the normalized vector for the given vector v.

Since: 1.0

one

vec2One Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Vec2

Returns: the one vector

Retrieves a constant vector with (1, 1) components.

Since: 1.0

scale

vec2Scale Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

v: a Vec2

-> Float

factor: the scalar factor

-> m Vec2 

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

Since: 1.2

subtract

vec2Subtract Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Vec2

a: a Vec2

-> Vec2

b: a Vec2

-> m Vec2 

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

vec2XAxis Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Vec2

Returns: the X axis vector

Retrieves a constant vector with (1, 0) components.

Since: 1.0

yAxis

vec2YAxis Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Vec2

Returns: the Y axis vector

Retrieves a constant vector with (0, 1) components.

Since: 1.0

zero

vec2Zero Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Vec2

Returns: the zero vector

Retrieves a constant vector with (0, 0) components.

Since: 1.0