Vec4
Object Hierarchy:
Graphene.Vec4
Graphene.Vec4
Graphene.Vec4
Description:
[ CCode ( cname = "graphene_vec4_t" , copy_function = "g_boxed_copy" , free_function = "g_boxed_free" , type_id = "graphene_vec4_get_type ()" ) ]public struct Vec4
A structure capable of holding a vector with four dimensions: x, y, z, and w.
The contents of the Vec4 structure are private and should never be accessed directly.
Content:
Static methods:
public static unowned Vec4 ? one ()
Retrieves a pointer to a Vec4 with all its
components set to 1.
public static unowned Vec4 ? w_axis ()
Retrieves a pointer to a Vec4 with its
components set to (0, 0, 0, 1).
public static unowned Vec4 ? x_axis ()
Retrieves a pointer to a Vec4 with its
components set to (1, 0, 0, 0).
public static unowned Vec4 ? y_axis ()
Retrieves a pointer to a Vec4 with its
components set to (0, 1, 0, 0).
public static unowned Vec4 ? z_axis ()
Retrieves a pointer to a Vec4 with its
components set to (0, 0, 1, 0).
public static unowned Vec4 ? zero ()
Retrieves a pointer to a Vec4 with all its
components set to 0.
Methods:
public Vec4 add (Vec4 b)
Adds each component of the two given vectors.
public Vec4 divide (Vec4 b)
Divides each component of the first operand
this by the corresponding component of the second operand b
, and places the results
into the vector res
.
public float dot (Vec4 b)
Computes the dot product of the two given vectors.
public bool equal (Vec4 v2)
Checks whether the two given Vec4 are
equal.
public float get_w ()
Retrieves the value of the fourth component of the given
Vec4 .
public float get_x ()
Retrieves the value of the first component of the given
Vec4 .
public Vec2 get_xy ()
Creates a Vec2 that
contains the first two components of the given Vec4 .
public Vec3 get_xyz ()
Creates a Vec3 that
contains the first three components of the given Vec4 .
public float get_y ()
Retrieves the value of the second component of the given
Vec4 .
public float get_z ()
Retrieves the value of the third component of the given
Vec4 .
public unowned Vec4 ? init (float x, float y, float z, float w)
Initializes a Vec4 using the given values.
public unowned Vec4 ? init_from_float (float [] src)
Initializes a Vec4 with the values inside
the given array.
public unowned Vec4 ? init_from_vec2 (Vec2 src, float z, float w)
Initializes a Vec4 using the components of
a Vec2 and the values of z
and w
.
public unowned Vec4 ? init_from_vec3 (Vec3 src, float w)
Initializes a Vec4 using the components of
a Vec3 and the value of w
.
public unowned Vec4 ? init_from_vec4 (Vec4 src)
Initializes a Vec4 using the components of
another Vec4 .
public Vec4 interpolate (Vec4 v2, double factor)
Linearly interpolates this and
v2
using the given factor
.
public float length ()
Computes the length of the given Vec4 .
public Vec4 max (Vec4 b)
Compares each component of the two given vectors and creates a vector
that contains the maximum values.
public Vec4 min (Vec4 b)
Compares each component of the two given vectors and creates a vector
that contains the minimum values.
public Vec4 multiply (Vec4 b)
Multiplies each component of the two given vectors.
public bool near (Vec4 v2, float epsilon)
Compares the two given Vec4 vectors and
checks whether their values are within the given epsilon
.
public Vec4 negate ()
Negates the given Vec4 .
public Vec4 normalize ()
Normalizes the given Vec4 .
public Vec4 scale (float factor)
Multiplies all components of the given vector with the given scalar
factor
.
public Vec4 subtract (Vec4 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 of res
.
public void to_float (ref float [] dest)
Stores the components of the given Vec4
into an array of floating point values.