graphene.vec2

Module for [Vec2] class

class Vec2

Types 1

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
void * _cPtr(Flag!"Dup" dup = No.Dup) nothrow
GType _getGType() static nothrow
GType _gType() @property nothrow
Vec2 self() nothrowReturns `this`, for use in `with` statements.
graphene.vec2.Vec2 alloc() static nothrowAllocates a new #graphene_vec2_t structure.
void add(graphene.vec2.Vec2 b, out graphene.vec2.Vec2 res) nothrowAdds 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) nothrowDivides 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) nothrowComputes the dot product of the two given vectors.
bool equal(graphene.vec2.Vec2 v2) nothrowChecks whether the two given #graphene_vec2_t are equal.
float getX() nothrowRetrieves the X component of the #graphene_vec2_t. Returns: the value of the X component
float getY() nothrowRetrieves the Y component of the #graphene_vec2_t. Returns: the value of the Y component
graphene.vec2.Vec2 init_(float x, float y) nothrowInitializes a #graphene_vec2_t using the given values.
graphene.vec2.Vec2 initFromFloat(float[] src) nothrowInitializes `v` with the contents of the given array.
graphene.vec2.Vec2 initFromVec2(graphene.vec2.Vec2 src) nothrowCopies the contents of src into `v`.
void interpolate(graphene.vec2.Vec2 v2, double factor, out graphene.vec2.Vec2 res) nothrowLinearly interpolates v1 and v2 using the given factor.
float length() nothrowComputes the length of the given vector. Returns: the length of the vector
void max(graphene.vec2.Vec2 b, out graphene.vec2.Vec2 res) nothrowCompares 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) nothrowCompares 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) nothrowMultiplies each component of the two passed vectors and places each result into the components of res.
bool near(graphene.vec2.Vec2 v2, float epsilon) nothrowCompares the two given #graphene_vec2_t vectors and checks whether their values are within the given epsilon.
void negate(out graphene.vec2.Vec2 res) nothrowNegates the given #graphene_vec2_t.
void normalize(out graphene.vec2.Vec2 res) nothrowComputes the normalized vector for the given vector `v`.
void scale(float factor, out graphene.vec2.Vec2 res) nothrowMultiplies all components of the given vector with the given scalar factor.
void subtract(graphene.vec2.Vec2 b, out graphene.vec2.Vec2 res) nothrowSubtracts 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) nothrowStores the components of `v` into an array.
graphene.vec2.Vec2 one() static nothrowRetrieves a constant vector with (1, 1) components. Returns: the one vector
graphene.vec2.Vec2 xAxis() static nothrowRetrieves a constant vector with (1, 0) components. Returns: the X axis vector
graphene.vec2.Vec2 yAxis() static nothrowRetrieves a constant vector with (0, 1) components. Returns: the Y axis vector
graphene.vec2.Vec2 zero() static nothrowRetrieves a constant vector with (0, 0) components. Returns: the zero vector
Constructors
this()Create a `vec2.Vec2` boxed type.
this(void * ptr, Flag!"Take" take)