Vec2
Object Hierarchy:
Description:
[ CCode ( cname = "graphene_vec2_t" , copy_function = "g_boxed_copy" , free_function = "g_boxed_free" , type_id = "graphene_vec2_get_type ()" ) ]
public struct Vec2
public struct Vec2
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.
Namespace: Graphene
Package: graphene-gobject-1.0
Content:
Static methods:
- public static unowned Vec2? one ()
Retrieves a constant vector with (1, 1) components.
- public static unowned Vec2? x_axis ()
Retrieves a constant vector with (1, 0) components.
- public static unowned Vec2? y_axis ()
Retrieves a constant vector with (0, 1) components.
- public static unowned Vec2? zero ()
Retrieves a constant vector with (0, 0) components.
Methods:
- public Vec2 add (Vec2 b)
Adds each component of the two passed vectors and places each result into the components of
res
. - public Vec2 divide (Vec2 b)
Divides each component of the first operand this by the corresponding component of the second operand
b
, and places the results into the vectorres
. - public float dot (Vec2 b)
Computes the dot product of the two given vectors.
- public bool equal (Vec2 v2)
Checks whether the two given Vec2 are equal.
- public float get_x ()
Retrieves the X component of the Vec2.
- public float get_y ()
Retrieves the Y component of the Vec2.
- public unowned Vec2? init (float x, float y)
Initializes a Vec2 using the given values.
- public unowned Vec2? init_from_float (float[] src)
Initializes this with the contents of the given array.
- public unowned Vec2? init_from_vec2 (Vec2 src)
Copies the contents of
src
into this . - public Vec2 interpolate (Vec2 v2, double factor)
Linearly interpolates this and
v2
using the givenfactor
. - public float length ()
Computes the length of the given vector.
- public Vec2 max (Vec2 b)
Compares the two given vectors and places the maximum values of each component into
res
. - public Vec2 min (Vec2 b)
Compares the two given vectors and places the minimum values of each component into
res
. - public Vec2 multiply (Vec2 b)
Multiplies each component of the two passed vectors and places each result into the components of
res
. - public bool near (Vec2 v2, float epsilon)
Compares the two given Vec2 vectors and checks whether their values are within the given
epsilon
. - public Vec2 negate ()
Negates the given Vec2.
- public Vec2 normalize ()
Computes the normalized vector for the given vector this.
- public Vec2 scale (float factor)
Multiplies all components of the given vector with the given scalar
factor
. - public Vec2 subtract (Vec2 b)
Subtracts from each component of the first operand this the corresponding component of the second operand
b
and places each result into the components ofres
. - public void to_float (ref float[] dest)
Stores the components of this into an array.