Vec2

A structure capable of holding a vector with two dimensions, x and y.

The contents of the #graphene_vec2_t structure are private and should never be accessed directly.

Constructors

this
this(graphene_vec2_t* graphene_vec2, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Allocates a new #graphene_vec2_t structure.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

add
void add(Vec2 b, Vec2 res)

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

divide
void divide(Vec2 b, Vec2 res)

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.

dot
float dot(Vec2 b)

Computes the dot product of the two given vectors.

equal
bool equal(Vec2 v2)

Checks whether the two given #graphene_vec2_t are equal.

free
void free()

Frees the resources allocated by @v

getStruct
void* getStruct()

the main Gtk struct as a void*

getVec2Struct
graphene_vec2_t* getVec2Struct(bool transferOwnership)

Get the main Gtk struct

getX
float getX()

Retrieves the X component of the #graphene_vec2_t.

getY
float getY()

Retrieves the Y component of the #graphene_vec2_t.

init
Vec2 init(float x, float y)

Initializes a #graphene_vec2_t using the given values.

initFromFloat
Vec2 initFromFloat(float[2] src)

Initializes @v with the contents of the given array.

initFromVec2
Vec2 initFromVec2(Vec2 src)

Copies the contents of @src into @v.

interpolate
void interpolate(Vec2 v2, double factor, Vec2 res)

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

length
float length()

Computes the length of the given vector.

max
void max(Vec2 b, Vec2 res)

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

min
void min(Vec2 b, Vec2 res)

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

multiply
void multiply(Vec2 b, Vec2 res)

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

near
bool near(Vec2 v2, float epsilon)

Compares the two given #graphene_vec2_t vectors and checks whether their values are within the given @epsilon.

negate
void negate(Vec2 res)

Negates the given #graphene_vec2_t.

normalize
void normalize(Vec2 res)

Computes the normalized vector for the given vector @v.

scale
void scale(float factor, Vec2 res)

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

subtract
void subtract(Vec2 b, Vec2 res)

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.

toFloat
void toFloat(float[2] dest)

Stores the components of @v into an array.

Static functions

getType
GType getType()
one
Vec2 one()

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

xAxis
Vec2 xAxis()

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

yAxis
Vec2 yAxis()

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

zero
Vec2 zero()

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

Variables

graphene_vec2
graphene_vec2_t* graphene_vec2;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta