graphene.vec2
Module for [Vec2] class
class Vec2
Types 1
classVec2 : gobject.boxed.Boxed
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.
Methods
graphene.vec2.Vec2 alloc()Allocates a new #graphenevec2t structure.void add(graphene.vec2.Vec2 b, out graphene.vec2.Vec2 res)Adds each component of the two passed vectors and places each result into the components of res.void divide(graphene.vec2.Vec2 b, out 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.float dot(graphene.vec2.Vec2 b)Computes the dot product of the two given vectors.bool equal(graphene.vec2.Vec2 v2)Checks whether the two given #graphenevec2t are equal.float getX()Retrieves the X component of the #graphenevec2t. Returns: the value of the X componentfloat getY()Retrieves the Y component of the #graphenevec2t. Returns: the value of the Y componentgraphene.vec2.Vec2 init_(float x, float y)Initializes a #graphenevec2t using the given values.graphene.vec2.Vec2 initFromFloat(float[] src)Initializes `v` with the contents of the given array.graphene.vec2.Vec2 initFromVec2(graphene.vec2.Vec2 src)Copies the contents of src into `v`.void interpolate(graphene.vec2.Vec2 v2, double factor, out graphene.vec2.Vec2 res)Linearly interpolates v1 and v2 using the given factor.float length()Computes the length of the given vector. Returns: the length of the vectorvoid max(graphene.vec2.Vec2 b, out graphene.vec2.Vec2 res)Compares the two given vectors and places the maximum values of each component into res.void min(graphene.vec2.Vec2 b, out graphene.vec2.Vec2 res)Compares the two given vectors and places the minimum values of each component into res.void multiply(graphene.vec2.Vec2 b, out graphene.vec2.Vec2 res)Multiplies each component of the two passed vectors and places each result into the components of res.bool near(graphene.vec2.Vec2 v2, float epsilon)Compares the two given #graphenevec2t vectors and checks whether their values are within the given epsilon.void negate(out graphene.vec2.Vec2 res)Negates the given #graphenevec2t.void normalize(out graphene.vec2.Vec2 res)Computes the normalized vector for the given vector `v`.void scale(float factor, out graphene.vec2.Vec2 res)Multiplies all components of the given vector with the given scalar factor.void subtract(graphene.vec2.Vec2 b, out 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.void toFloat(ref float[] dest)Stores the components of `v` into an array.graphene.vec2.Vec2 one()Retrieves a constant vector with (1, 1) components. Returns: the one vectorgraphene.vec2.Vec2 xAxis()Retrieves a constant vector with (1, 0) components. Returns: the X axis vectorgraphene.vec2.Vec2 yAxis()Retrieves a constant vector with (0, 1) components. Returns: the Y axis vectorgraphene.vec2.Vec2 zero()Retrieves a constant vector with (0, 0) components. Returns: the zero vector