NO_TITLE
Table of Contents
Gnome::Graphene::N-Vec2§
Description§
A structure capable of holding a vector with two dimensions, x and y.
The contents of the #graphene_vec2_t structure are private and should never be accessed directly.
Record N-Vec2§
class N-Vec2:auth<github:MARTIMM>:api<2> is export is repr('CStruct') {
has N-Simd4F _UA_ $.value;
}
- value;
Class initialization§
new§
:native-object§
Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object() :$native-object! )
alloc§
Allocates a new #graphene_vec2_t structure.
The contents of the returned structure are undefined.
Use .init() to initialize the vector.
method alloc ( --> Gnome::Graphene::Vec2 \)
Methods§
add§
Adds each component of the two passed vectors and places each result into the components of $res.
method add ( CArray[N-Vec2] $b, CArray[N-Vec2] $res )
- $b; a #graphene_vec2_t.
- $res; return location for the result.
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-Vec2] $b, CArray[N-Vec2] $res )
- $b; a #graphene_vec2_t.
- $res; return location for the result.
dot§
Computes the dot product of the two given vectors.
method dot ( CArray[N-Vec2] $b --> Num )
- $b; a #graphene_vec2_t.
Return value; the dot product of the vectors.
equal This function is not yet available§
Checks whether the two given #graphene_vec2_t are equal.
method equal ( CArray[N-Vec2] $v2 )
- $v2; a #graphene_vec2_t.
free§
Frees the resources allocated by $v
method free ( )
get-x§
Retrieves the X component of the #graphene_vec2_t.
method get-x (--> Num )
Return value; the value of the X component.
get-y§
Retrieves the Y component of the #graphene_vec2_t.
method get-y (--> Num )
Return value; the value of the Y component.
init§
Initializes a #graphene_vec2_t using the given values.
This function can be called multiple times.
method init ( Num() $x, Num() $y --> CArray[N-Vec2] )
- $x; the X field of the vector.
- $y; the Y field of the vector.
Return value; the initialized vector.
init-from-float§
Initializes $v with the contents of the given array.
method init-from-float ( Num() $src --> CArray[N-Vec2] )
- $src; an array of floating point values with at least two elements.
Return value; the initialized vector.
init-from-vec2§
Copies the contents of $src into $v.
method init-from-vec2 ( CArray[N-Vec2] $src --> CArray[N-Vec2] )
- $src; a #graphene_vec2_t.
Return value; the initialized vector.
interpolate§
Linearly interpolates $v1 and $v2 using the given $factor.
method interpolate ( CArray[N-Vec2] $v2, Num() $factor, CArray[N-Vec2] $res )
- $v2; a #graphene_vec2_t.
- $factor; the interpolation factor.
- $res; the interpolated vector.
length§
Computes the length of the given vector.
method length (--> Num )
Return value; the length of the vector.
max§
Compares the two given vectors and places the maximum values of each component into $res.
method max ( CArray[N-Vec2] $b, CArray[N-Vec2] $res )
- $b; a #graphene_vec2_t.
- $res; the resulting vector.
min§
Compares the two given vectors and places the minimum values of each component into $res.
method min ( CArray[N-Vec2] $b, CArray[N-Vec2] $res )
- $b; a #graphene_vec2_t.
- $res; the resulting vector.
multiply§
Multiplies each component of the two passed vectors and places each result into the components of $res.
method multiply ( CArray[N-Vec2] $b, CArray[N-Vec2] $res )
- $b; a #graphene_vec2_t.
- $res; return location for the result.
near This function is not yet available§
Compares the two given #graphene_vec2_t vectors and checks whether their values are within the given $epsilon.
method near ( CArray[N-Vec2] $v2, Num() $epsilon )
- $v2; a #graphene_vec2_t.
- $epsilon; the threshold between the two vectors.
negate§
Negates the given #graphene_vec2_t.
method negate ( CArray[N-Vec2] $res )
- $res; return location for the result vector.
normalize§
Computes the normalized vector for the given vector $v.
method normalize ( CArray[N-Vec2] $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-Vec2] $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-Vec2] $b, CArray[N-Vec2] $res )
- $b; a #graphene_vec2_t.
- $res; return location for the result.
to-float§
Stores the components of $v into an array.
method to-float ( Num() $dest )
- $dest; return location for an array of floating point values with at least 2 elements.
Functions§
one§
Retrieves a constant vector with (1, 1) components.
method one (--> CArray[N-Vec2] )
Return value; the one vector.
x-axis§
Retrieves a constant vector with (1, 0) components.
method x-axis (--> CArray[N-Vec2] )
Return value; the X axis vector.
y-axis§
Retrieves a constant vector with (0, 1) components.
method y-axis (--> CArray[N-Vec2] )
Return value; the Y axis vector.
zero§
Retrieves a constant vector with (0, 0) components.
method zero (--> CArray[N-Vec2] )
Return value; the zero vector.
About my projects, examples and tutorials