
NO_TITLE
Gnome::Graphene::N-Vec3
Description
A structure capable of holding a vector with three dimensions: x, y, and z.
The contents of the graphene_vec3_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_vec3_t structure.
The contents of the returned structure are undefined.
Use .init()
to initialize the vector.
method alloc ( --> Gnome::Graphene::Vec3 \)
Methods
add
Adds each component of the two given vectors.
method add ( CArray[N-Vec3] $b, CArray[N-Vec3] $res )
$b; a graphene_vec3_t.
$res; return location for the resulting vector.
cross
Computes the cross product of the two given vectors.
method cross ( CArray[N-Vec3] $b, CArray[N-Vec3] $res )
$b; a graphene_vec3_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-Vec3] $b, CArray[N-Vec3] $res )
$b; a graphene_vec3_t.
$res; return location for the resulting vector.
dot
Computes the dot product of the two given vectors.
method dot ( CArray[N-Vec3] $b --> Num )
$b; a graphene_vec3_t.
Return value; the value of the dot product.
equal This function is not yet available
Checks whether the two given graphene_vec3_t are equal.
method equal ( CArray[N-Vec3] $v2 )
$v2; a graphene_vec3_t.
free
Frees the resources allocated by $v
method free ( )
get-x
Retrieves the first component of the given vector $v
.
method get-x (--> Num )
Return value; the value of the first component of the vector.
get-xy
Creates a graphene_vec2_t that contains the first and second components of the given graphene_vec3_t.
method get-xy ( CArray[N-Vec2] $res )
$res; return location for a graphene_vec2_t.
get-xy0
Creates a graphene_vec3_t that contains the first two components of the given graphene_vec3_t, and the third component set to 0.
method get-xy0 ( CArray[N-Vec3] $res )
$res; return location for a graphene_vec3_t.
get-xyz0
Converts a graphene_vec3_t in a graphene_vec4_t using 0.0 as the value for the fourth component of the resulting vector.
method get-xyz0 ( CArray[N-Vec4] $res )
$res; return location for the vector.
get-xyz1
Converts a graphene_vec3_t in a graphene_vec4_t using 1.0 as the value for the fourth component of the resulting vector.
method get-xyz1 ( CArray[N-Vec4] $res )
$res; return location for the vector.
get-xyzw
Converts a graphene_vec3_t in a graphene_vec4_t using $w
as the value of the fourth component of the resulting vector.
method get-xyzw ( Num() $w, CArray[N-Vec4] $res )
$w; the value of the W component.
$res; return location for the vector.
get-y
Retrieves the second component of the given vector $v
.
method get-y (--> Num )
Return value; the value of the second component of the vector.
get-z
Retrieves the third component of the given vector $v
.
method get-z (--> Num )
Return value; the value of the third component of the vector.
init
Initializes a graphene_vec3_t using the given values.
This function can be called multiple times.
method init ( Num() $x, Num() $y, Num() $z --> CArray[N-Vec3] )
$x; the X field of the vector.
$y; the Y field of the vector.
$z; the Z field of the vector.
Return value; a pointer to the initialized vector.
init-from-float
Initializes a graphene_vec3_t with the values from an array.
method init-from-float ( Num() $src --> CArray[N-Vec3] )
$src; an array of 3 floating point values.
Return value; the initialized vector.
init-from-vec3
Initializes a graphene_vec3_t with the values of another graphene_vec3_t.
method init-from-vec3 ( CArray[N-Vec3] $src --> CArray[N-Vec3] )
$src; a graphene_vec3_t.
Return value; the initialized vector.
interpolate
Linearly interpolates $v1
and $v2
using the given $factor
.
method interpolate ( CArray[N-Vec3] $v2, Num() $factor, CArray[N-Vec3] $res )
$v2; a graphene_vec3_t.
$factor; the interpolation factor.
$res; the interpolated vector.
length
Retrieves the length of the given vector $v
.
method length (--> Num )
Return value; the value of 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-Vec3] $b, CArray[N-Vec3] $res )
$b; a graphene_vec3_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-Vec3] $b, CArray[N-Vec3] $res )
$b; a graphene_vec3_t.
$res; return location for the result vector.
multiply
Multiplies each component of the two given vectors.
method multiply ( CArray[N-Vec3] $b, CArray[N-Vec3] $res )
$b; a graphene_vec3_t.
$res; return location for the resulting vector.
near This function is not yet available
Compares the two given graphene_vec3_t vectors and checks whether their values are within the given $epsilon
.
method near ( CArray[N-Vec3] $v2, Num() $epsilon )
$v2; a graphene_vec3_t.
$epsilon; the threshold between the two vectors.
negate
Negates the given graphene_vec3_t.
method negate ( CArray[N-Vec3] $res )
$res; return location for the result vector.
normalize
Normalizes the given graphene_vec3_t.
method normalize ( CArray[N-Vec3] $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-Vec3] $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-Vec3] $b, CArray[N-Vec3] $res )
$b; a graphene_vec3_t.
$res; return location for the resulting vector.
to-float
Copies the components of a graphene_vec3_t into the given array.
method to-float ( Num() $dest )
$dest; return location for an array of floating point values.
Functions
one
Provides a constant pointer to a vector with three components, all sets to 1.
method one (--> CArray[N-Vec3] )
Return value; a constant vector.
x-axis
Provides a constant pointer to a vector with three components with values set to (1, 0, 0).
method x-axis (--> CArray[N-Vec3] )
Return value; a constant vector.
y-axis
Provides a constant pointer to a vector with three components with values set to (0, 1, 0).
method y-axis (--> CArray[N-Vec3] )
Return value; a constant vector.
z-axis
Provides a constant pointer to a vector with three components with values set to (0, 0, 1).
method z-axis (--> CArray[N-Vec3] )
Return value; a constant vector.
zero
Provides a constant pointer to a vector with three components, all sets to 0.
method zero (--> CArray[N-Vec3] )
Return value; a constant vector.