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.

Members

Functions

add
void add(graphene.vec2.Vec2 b, graphene.vec2.Vec2 res)

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

divide
void divide(graphene.vec2.Vec2 b, graphene.vec2.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(graphene.vec2.Vec2 b)

Computes the dot product of the two given vectors.

equal
bool equal(graphene.vec2.Vec2 v2)

Checks whether the two given #graphene_vec2_t are equal.

getX
float getX()

Retrieves the X component of the #graphene_vec2_t.

getY
float getY()

Retrieves the Y component of the #graphene_vec2_t.

initFromFloat
graphene.vec2.Vec2 initFromFloat(float[] src)

Initializes v with the contents of the given array.

initFromVec2
graphene.vec2.Vec2 initFromVec2(graphene.vec2.Vec2 src)

Copies the contents of src into v.

init_
graphene.vec2.Vec2 init_(float x, float y)

Initializes a #graphene_vec2_t using the given values.

interpolate
void interpolate(graphene.vec2.Vec2 v2, double factor, graphene.vec2.Vec2 res)

Linearly interpolates v1 and v2 using the given factor.

length
float length()

Computes the length of the given vector.

max
void max(graphene.vec2.Vec2 b, graphene.vec2.Vec2 res)

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

min
void min(graphene.vec2.Vec2 b, graphene.vec2.Vec2 res)

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

multiply
void multiply(graphene.vec2.Vec2 b, graphene.vec2.Vec2 res)

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

near
bool near(graphene.vec2.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(graphene.vec2.Vec2 res)

Negates the given #graphene_vec2_t.

normalize
void normalize(graphene.vec2.Vec2 res)

Computes the normalized vector for the given vector v.

scale
void scale(float factor, graphene.vec2.Vec2 res)

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

subtract
void subtract(graphene.vec2.Vec2 b, graphene.vec2.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[] dest)

Stores the components of v into an array.

Static functions

alloc
graphene.vec2.Vec2 alloc()

Allocates a new #graphene_vec2_t structure.

one
graphene.vec2.Vec2 one()

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

xAxis
graphene.vec2.Vec2 xAxis()

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

yAxis
graphene.vec2.Vec2 yAxis()

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

zero
graphene.vec2.Vec2 zero()

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

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.