Vec3
Object Hierarchy:
Description:
[ CCode ( cname = "graphene_vec3_t" , copy_function = "g_boxed_copy" , free_function = "g_boxed_free" , type_id = "graphene_vec3_get_type ()" ) ]
public struct Vec3
A structure capable of holding a vector with three dimensions: x, y, and z.
The contents of the Vec3 structure are private and should never be accessed directly.
Content:
Static methods:
- public static unowned Vec3? one ()
Provides a constant pointer to a vector with three components, all
sets to 1.
- public static unowned Vec3? x_axis ()
Provides a constant pointer to a vector with three components with
values set to (1, 0, 0).
- public static unowned Vec3? y_axis ()
Provides a constant pointer to a vector with three components with
values set to (0, 1, 0).
- public static unowned Vec3? z_axis ()
Provides a constant pointer to a vector with three components with
values set to (0, 0, 1).
- public static unowned Vec3? zero ()
Provides a constant pointer to a vector with three components, all
sets to 0.
Methods:
- public Vec3 add (Vec3 b)
Adds each component of the two given vectors.
- public Vec3 cross (Vec3 b)
Computes the cross product of the two given vectors.
- public Vec3 divide (Vec3 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 (Vec3 b)
Computes the dot product of the two given vectors.
- public bool equal (Vec3 v2)
Checks whether the two given Vec3 are
equal.
- public float get_x ()
Retrieves the first component of the given vector
this.
- public Vec2 get_xy ()
Creates a Vec2 that
contains the first and second components of the given Vec3.
- public Vec3 get_xy0 ()
Creates a Vec3 that contains the first two
components of the given Vec3, and the third component set to 0.
- public Vec4 get_xyz0 ()
Converts a Vec3 in a
Vec4 using 0.0 as the value for the fourth component of the resulting vector.
- public Vec4 get_xyz1 ()
Converts a Vec3 in a
Vec4 using 1.0 as the value for the fourth component of the resulting vector.
- public Vec4 get_xyzw (float w)
Converts a Vec3 in a
Vec4 using w as the value of the fourth component of the resulting
vector.
- public float get_y ()
Retrieves the second component of the given vector
this.
- public float get_z ()
Retrieves the third component of the given vector
this.
- public unowned Vec3? init (float x, float y, float z)
Initializes a Vec3 using the given values.
- public unowned Vec3? init_from_float (float[] src)
Initializes a Vec3 with the values from an
array.
- public unowned Vec3? init_from_vec3 (Vec3 src)
Initializes a Vec3 with the values of
another Vec3.
- public Vec3 interpolate (Vec3 v2, double factor)
Linearly interpolates this and
v2 using the given factor.
- public float length ()
Retrieves the length of the given vector
this.
- public Vec3 max (Vec3 b)
Compares each component of the two given vectors and creates a vector
that contains the maximum values.
- public Vec3 min (Vec3 b)
Compares each component of the two given vectors and creates a vector
that contains the minimum values.
- public Vec3 multiply (Vec3 b)
Multiplies each component of the two given vectors.
- public bool near (Vec3 v2, float epsilon)
Compares the two given Vec3 vectors and
checks whether their values are within the given epsilon.
- public Vec3 negate ()
Negates the given Vec3.
- public Vec3 normalize ()
Normalizes the given Vec3.
- public Vec3 scale (float factor)
Multiplies all components of the given vector with the given scalar
factor.
- public Vec3 subtract (Vec3 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)
Copies the components of a Vec3 into the
given array.