Graphene.Vec4¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
value |
r |
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Graphene.Vec4¶
A structure capable of holding a vector with four dimensions: x, y, z, and w.
The contents of the
Graphene.Vec4
structure are private and should never be accessed directly.- classmethod alloc()¶
- Returns:
the newly allocated
Graphene.Vec4
structure. UseGraphene.Vec4.free
() to free the resources allocated by this function.- Return type:
Allocates a new
Graphene.Vec4
structure.The contents of the returned structure are undefined.
Use
Graphene.Vec4.init
() to initialize the vector.New in version 1.0.
- classmethod one()¶
- Returns:
a constant vector
- Return type:
Retrieves a pointer to a
Graphene.Vec4
with all its components set to 1.New in version 1.0.
- classmethod w_axis()¶
- Returns:
a constant vector
- Return type:
Retrieves a pointer to a
Graphene.Vec4
with its components set to (0, 0, 0, 1).New in version 1.0.
- classmethod x_axis()¶
- Returns:
a constant vector
- Return type:
Retrieves a pointer to a
Graphene.Vec4
with its components set to (1, 0, 0, 0).New in version 1.0.
- classmethod y_axis()¶
- Returns:
a constant vector
- Return type:
Retrieves a pointer to a
Graphene.Vec4
with its components set to (0, 1, 0, 0).New in version 1.0.
- classmethod z_axis()¶
- Returns:
a constant vector
- Return type:
Retrieves a pointer to a
Graphene.Vec4
with its components set to (0, 0, 1, 0).New in version 1.0.
- classmethod zero()¶
- Returns:
a constant vector
- Return type:
Retrieves a pointer to a
Graphene.Vec4
with all its components set to 0.New in version 1.0.
- add(b)¶
- Parameters:
b (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
return location for the resulting vector
- Return type:
res:
Graphene.Vec4
Adds each component of the two given vectors.
New in version 1.0.
- divide(b)¶
- Parameters:
b (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
return location for the resulting vector
- Return type:
res:
Graphene.Vec4
Divides each component of the first operand self by the corresponding component of the second operand b, and places the results into the vector res.
New in version 1.0.
- dot(b)¶
- Parameters:
b (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
the value of the dot product
- Return type:
Computes the dot product of the two given vectors.
New in version 1.0.
- equal(v2)¶
- Parameters:
v2 (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
true
if the two vectors are equal, and false otherwise- Return type:
Checks whether the two given
Graphene.Vec4
are equal.New in version 1.2.
- free()¶
Frees the resources allocated by self
New in version 1.0.
- get_w()¶
- Returns:
the value of the fourth component
- Return type:
Retrieves the value of the fourth component of the given
Graphene.Vec4
.New in version 1.0.
- get_x()¶
- Returns:
the value of the first component
- Return type:
Retrieves the value of the first component of the given
Graphene.Vec4
.New in version 1.0.
- get_xy()¶
- Returns:
return location for a
Graphene.Vec2
- Return type:
res:
Graphene.Vec2
Creates a
Graphene.Vec2
that contains the first two components of the givenGraphene.Vec4
.New in version 1.0.
- get_xyz()¶
- Returns:
return location for a
Graphene.Vec3
- Return type:
res:
Graphene.Vec3
Creates a
Graphene.Vec3
that contains the first three components of the givenGraphene.Vec4
.New in version 1.0.
- get_y()¶
- Returns:
the value of the second component
- Return type:
Retrieves the value of the second component of the given
Graphene.Vec4
.New in version 1.0.
- get_z()¶
- Returns:
the value of the third component
- Return type:
Retrieves the value of the third component of the given
Graphene.Vec4
.New in version 1.0.
- init(x, y, z, w)¶
- Parameters:
- Returns:
a pointer to the initialized vector
- Return type:
Initializes a
Graphene.Vec4
using the given values.This function can be called multiple times.
New in version 1.0.
- init_from_float(src)¶
- Parameters:
src ([
float
]) – an array of four floating point values- Returns:
the initialized vector
- Return type:
Initializes a
Graphene.Vec4
with the values inside the given array.New in version 1.0.
- init_from_vec2(src, z, w)¶
- Parameters:
src (
Graphene.Vec2
) – aGraphene.Vec2
z (
float
) – the value for the third component of selfw (
float
) – the value for the fourth component of self
- Returns:
the initialized vector
- Return type:
Initializes a
Graphene.Vec4
using the components of aGraphene.Vec2
and the values of z and w.New in version 1.0.
- init_from_vec3(src, w)¶
- Parameters:
src (
Graphene.Vec3
) – aGraphene.Vec3
w (
float
) – the value for the fourth component of self
- Returns:
the initialized vector
- Return type:
Initializes a
Graphene.Vec4
using the components of aGraphene.Vec3
and the value of w.New in version 1.0.
- init_from_vec4(src)¶
- Parameters:
src (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
the initialized vector
- Return type:
Initializes a
Graphene.Vec4
using the components of anotherGraphene.Vec4
.New in version 1.0.
- interpolate(v2, factor)¶
- Parameters:
v2 (
Graphene.Vec4
) – aGraphene.Vec4
factor (
float
) – the interpolation factor
- Returns:
the interpolated vector
- Return type:
res:
Graphene.Vec4
Linearly interpolates self and v2 using the given factor.
New in version 1.10.
- length()¶
- Returns:
the length of the vector
- Return type:
Computes the length of the given
Graphene.Vec4
.New in version 1.0.
- max(b)¶
- Parameters:
b (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
return location for the result vector
- Return type:
res:
Graphene.Vec4
Compares each component of the two given vectors and creates a vector that contains the maximum values.
New in version 1.0.
- min(b)¶
- Parameters:
b (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
return location for the result vector
- Return type:
res:
Graphene.Vec4
Compares each component of the two given vectors and creates a vector that contains the minimum values.
New in version 1.0.
- multiply(b)¶
- Parameters:
b (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
return location for the resulting vector
- Return type:
res:
Graphene.Vec4
Multiplies each component of the two given vectors.
New in version 1.0.
- near(v2, epsilon)¶
- Parameters:
v2 (
Graphene.Vec4
) – aGraphene.Vec4
epsilon (
float
) – the threshold between the two vectors
- Returns:
true
if the two vectors are near each other- Return type:
Compares the two given
Graphene.Vec4
vectors and checks whether their values are within the given epsilon.New in version 1.2.
- negate()¶
- Returns:
return location for the result vector
- Return type:
res:
Graphene.Vec4
Negates the given
Graphene.Vec4
.New in version 1.2.
- normalize()¶
- Returns:
return location for the normalized vector
- Return type:
res:
Graphene.Vec4
Normalizes the given
Graphene.Vec4
.New in version 1.0.
- scale(factor)¶
- Parameters:
factor (
float
) – the scalar factor- Returns:
return location for the result vector
- Return type:
res:
Graphene.Vec4
Multiplies all components of the given vector with the given scalar factor.
New in version 1.2.
- subtract(b)¶
- Parameters:
b (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
return location for the resulting vector
- Return type:
res:
Graphene.Vec4
Subtracts from each component of the first operand self the corresponding component of the second operand b and places each result into the components of res.
New in version 1.0.
- to_float()¶
- Returns:
return location for an array of floating point values
- Return type:
dest: [
float
]
Stores the components of the given
Graphene.Vec4
into an array of floating point values.New in version 1.0.