
NO_TITLE
Gnome::Graphene::N-Vec4
Description
A structure capable of holding a vector with four dimensions: x, y, z, and w.
The contents of the graphene_vec4_t structure are private and should never be accessed directly.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
alloc
Allocates a new graphene_vec4_t structure.
The contents of the returned structure are undefined.
Use .init()
to initialize the vector.
method alloc ( --> Gnome::Graphene::Vec4 \)
Methods
add
Adds each component of the two given vectors.
method add ( CArray[N-Vec4] $b, CArray[N-Vec4] $res )
$b; a graphene_vec4_t.
$res; return location for the resulting vector.
divide
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
.
method divide ( CArray[N-Vec4] $b, CArray[N-Vec4] $res )
$b; a graphene_vec4_t.
$res; return location for the resulting vector.
dot
Computes the dot product of the two given vectors.
method dot ( CArray[N-Vec4] $b --> Num )
$b; a graphene_vec4_t.
Return value; the value of the dot product.
equal This function is not yet available
Checks whether the two given graphene_vec4_t are equal.
method equal ( CArray[N-Vec4] $v2 )
$v2; a graphene_vec4_t.
free
Frees the resources allocated by $v
method free ( )
get-w
Retrieves the value of the fourth component of the given graphene_vec4_t.
method get-w (--> Num )
Return value; the value of the fourth component.
get-x
Retrieves the value of the first component of the given graphene_vec4_t.
method get-x (--> Num )
Return value; the value of the first component.
get-xy
Creates a graphene_vec2_t that contains the first two components of the given graphene_vec4_t.
method get-xy ( CArray[N-Vec2] $res )
$res; return location for a graphene_vec2_t.
get-xyz
Creates a graphene_vec3_t that contains the first three components of the given graphene_vec4_t.
method get-xyz ( CArray[N-Vec3] $res )
$res; return location for a graphene_vec3_t.
get-y
Retrieves the value of the second component of the given graphene_vec4_t.
method get-y (--> Num )
Return value; the value of the second component.
get-z
Retrieves the value of the third component of the given graphene_vec4_t.
method get-z (--> Num )
Return value; the value of the third component.
init
Initializes a graphene_vec4_t using the given values.
This function can be called multiple times.
method init ( Num() $x, Num() $y, Num() $z, Num() $w --> CArray[N-Vec4] )
$x; the X field of the vector.
$y; the Y field of the vector.
$z; the Z field of the vector.
$w; the W field of the vector.
Return value; a pointer to the initialized vector.
init-from-float
Initializes a graphene_vec4_t with the values inside the given array.
method init-from-float ( Num() $src --> CArray[N-Vec4] )
$src; an array of four floating point values.
Return value; the initialized vector.
init-from-vec2
Initializes a graphene_vec4_t using the components of a graphene_vec2_t and the values of $z
and $w
.
method init-from-vec2 ( CArray[N-Vec2] $src, Num() $z, Num() $w --> CArray[N-Vec4] )
$src; a graphene_vec2_t.
$z; the value for the third component of
$v
.$w; the value for the fourth component of
$v
.
Return value; the initialized vector.
init-from-vec3
Initializes a graphene_vec4_t using the components of a graphene_vec3_t and the value of $w
.
method init-from-vec3 ( CArray[N-Vec3] $src, Num() $w --> CArray[N-Vec4] )
$src; a graphene_vec3_t.
$w; the value for the fourth component of
$v
.
Return value; the initialized vector.
init-from-vec4
Initializes a graphene_vec4_t using the components of another graphene_vec4_t.
method init-from-vec4 ( CArray[N-Vec4] $src --> CArray[N-Vec4] )
$src; a graphene_vec4_t.
Return value; the initialized vector.
interpolate
Linearly interpolates $v1
and $v2
using the given $factor
.
method interpolate ( CArray[N-Vec4] $v2, Num() $factor, CArray[N-Vec4] $res )
$v2; a graphene_vec4_t.
$factor; the interpolation factor.
$res; the interpolated vector.
length
Computes the length of the given graphene_vec4_t.
method length (--> Num )
Return value; the length of the vector.
max
Compares each component of the two given vectors and creates a vector that contains the maximum values.
method max ( CArray[N-Vec4] $b, CArray[N-Vec4] $res )
$b; a graphene_vec4_t.
$res; return location for the result vector.
min
Compares each component of the two given vectors and creates a vector that contains the minimum values.
method min ( CArray[N-Vec4] $b, CArray[N-Vec4] $res )
$b; a graphene_vec4_t.
$res; return location for the result vector.
multiply
Multiplies each component of the two given vectors.
method multiply ( CArray[N-Vec4] $b, CArray[N-Vec4] $res )
$b; a graphene_vec4_t.
$res; return location for the resulting vector.
near This function is not yet available
Compares the two given graphene_vec4_t vectors and checks whether their values are within the given $epsilon
.
method near ( CArray[N-Vec4] $v2, Num() $epsilon )
$v2; a graphene_vec4_t.
$epsilon; the threshold between the two vectors.
negate
Negates the given graphene_vec4_t.
method negate ( CArray[N-Vec4] $res )
$res; return location for the result vector.
normalize
Normalizes the given graphene_vec4_t.
method normalize ( CArray[N-Vec4] $res )
$res; return location for the normalized vector.
scale
Multiplies all components of the given vector with the given scalar $factor
.
method scale ( Num() $factor, CArray[N-Vec4] $res )
$factor; the scalar factor.
$res; return location for the result vector.
subtract
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
.
method subtract ( CArray[N-Vec4] $b, CArray[N-Vec4] $res )
$b; a graphene_vec4_t.
$res; return location for the resulting vector.
to-float
Stores the components of the given graphene_vec4_t into an array of floating point values.
method to-float ( Num() $dest )
$dest; return location for an array of floating point values.
Functions
one
Retrieves a pointer to a graphene_vec4_t with all its components set to 1.
method one (--> CArray[N-Vec4] )
Return value; a constant vector.
w-axis
Retrieves a pointer to a graphene_vec4_t with its components set to (0, 0, 0, 1).
method w-axis (--> CArray[N-Vec4] )
Return value; a constant vector.
x-axis
Retrieves a pointer to a graphene_vec4_t with its components set to (1, 0, 0, 0).
method x-axis (--> CArray[N-Vec4] )
Return value; a constant vector.
y-axis
Retrieves a pointer to a graphene_vec4_t with its components set to (0, 1, 0, 0).
method y-axis (--> CArray[N-Vec4] )
Return value; a constant vector.
z-axis
Retrieves a pointer to a graphene_vec4_t with its components set to (0, 0, 1, 0).
method z-axis (--> CArray[N-Vec4] )
Return value; a constant vector.
zero
Retrieves a pointer to a graphene_vec4_t with all its components set to 0.
method zero (--> CArray[N-Vec4] )
Return value; a constant vector.