Graphene.Vec4

Fields

Name

Type

Access

Description

value

Graphene.Simd4F

r

Methods

class

alloc ()

class

one ()

class

w_axis ()

class

x_axis ()

class

y_axis ()

class

z_axis ()

class

zero ()

add (b)

divide (b)

dot (b)

equal (v2)

free ()

get_w ()

get_x ()

get_xy ()

get_xyz ()

get_y ()

get_z ()

init (x, y, z, w)

init_from_float (src)

init_from_vec2 (src, z, w)

init_from_vec3 (src, w)

init_from_vec4 (src)

interpolate (v2, factor)

length ()

max (b)

min (b)

multiply (b)

near (v2, epsilon)

negate ()

normalize ()

scale (factor)

subtract (b)

to_float ()

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. Use Graphene.Vec4.free() to free the resources allocated by this function.

Return type:

Graphene.Vec4

Allocates a new Graphene.Vec4 structure.

The contents of the returned structure are undefined.

Use Graphene.Vec4.init() to initialize the vector.

Added in version 1.0.

classmethod one()
Returns:

a constant vector

Return type:

Graphene.Vec4

Retrieves a pointer to a Graphene.Vec4 with all its components set to 1.

Added in version 1.0.

classmethod w_axis()
Returns:

a constant vector

Return type:

Graphene.Vec4

Retrieves a pointer to a Graphene.Vec4 with its components set to (0, 0, 0, 1).

Added in version 1.0.

classmethod x_axis()
Returns:

a constant vector

Return type:

Graphene.Vec4

Retrieves a pointer to a Graphene.Vec4 with its components set to (1, 0, 0, 0).

Added in version 1.0.

classmethod y_axis()
Returns:

a constant vector

Return type:

Graphene.Vec4

Retrieves a pointer to a Graphene.Vec4 with its components set to (0, 1, 0, 0).

Added in version 1.0.

classmethod z_axis()
Returns:

a constant vector

Return type:

Graphene.Vec4

Retrieves a pointer to a Graphene.Vec4 with its components set to (0, 0, 1, 0).

Added in version 1.0.

classmethod zero()
Returns:

a constant vector

Return type:

Graphene.Vec4

Retrieves a pointer to a Graphene.Vec4 with all its components set to 0.

Added in version 1.0.

add(b)
Parameters:

b (Graphene.Vec4) – a Graphene.Vec4

Returns:

return location for the resulting vector

Return type:

res: Graphene.Vec4

Adds each component of the two given vectors.

Added in version 1.0.

divide(b)
Parameters:

b (Graphene.Vec4) – a Graphene.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.

Added in version 1.0.

dot(b)
Parameters:

b (Graphene.Vec4) – a Graphene.Vec4

Returns:

the value of the dot product

Return type:

float

Computes the dot product of the two given vectors.

Added in version 1.0.

equal(v2)
Parameters:

v2 (Graphene.Vec4) – a Graphene.Vec4

Returns:

true if the two vectors are equal, and false otherwise

Return type:

bool

Checks whether the two given Graphene.Vec4 are equal.

Added in version 1.2.

free()

Frees the resources allocated by self

Added in version 1.0.

get_w()
Returns:

the value of the fourth component

Return type:

float

Retrieves the value of the fourth component of the given Graphene.Vec4.

Added in version 1.0.

get_x()
Returns:

the value of the first component

Return type:

float

Retrieves the value of the first component of the given Graphene.Vec4.

Added 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 given Graphene.Vec4.

Added 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 given Graphene.Vec4.

Added in version 1.0.

get_y()
Returns:

the value of the second component

Return type:

float

Retrieves the value of the second component of the given Graphene.Vec4.

Added in version 1.0.

get_z()
Returns:

the value of the third component

Return type:

float

Retrieves the value of the third component of the given Graphene.Vec4.

Added in version 1.0.

init(x, y, z, w)
Parameters:
  • x (float) – the X field of the vector

  • y (float) – the Y field of the vector

  • z (float) – the Z field of the vector

  • w (float) – the W field of the vector

Returns:

a pointer to the initialized vector

Return type:

Graphene.Vec4

Initializes a Graphene.Vec4 using the given values.

This function can be called multiple times.

Added in version 1.0.

init_from_float(src)
Parameters:

src ([float]) – an array of four floating point values

Returns:

the initialized vector

Return type:

Graphene.Vec4

Initializes a Graphene.Vec4 with the values inside the given array.

Added in version 1.0.

init_from_vec2(src, z, w)
Parameters:
Returns:

the initialized vector

Return type:

Graphene.Vec4

Initializes a Graphene.Vec4 using the components of a Graphene.Vec2 and the values of z and w.

Added in version 1.0.

init_from_vec3(src, w)
Parameters:
Returns:

the initialized vector

Return type:

Graphene.Vec4

Initializes a Graphene.Vec4 using the components of a Graphene.Vec3 and the value of w.

Added in version 1.0.

init_from_vec4(src)
Parameters:

src (Graphene.Vec4) – a Graphene.Vec4

Returns:

the initialized vector

Return type:

Graphene.Vec4

Initializes a Graphene.Vec4 using the components of another Graphene.Vec4.

Added in version 1.0.

interpolate(v2, factor)
Parameters:
Returns:

the interpolated vector

Return type:

res: Graphene.Vec4

Linearly interpolates self and v2 using the given factor.

Added in version 1.10.

length()
Returns:

the length of the vector

Return type:

float

Computes the length of the given Graphene.Vec4.

Added in version 1.0.

max(b)
Parameters:

b (Graphene.Vec4) – a Graphene.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.

Added in version 1.0.

min(b)
Parameters:

b (Graphene.Vec4) – a Graphene.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.

Added in version 1.0.

multiply(b)
Parameters:

b (Graphene.Vec4) – a Graphene.Vec4

Returns:

return location for the resulting vector

Return type:

res: Graphene.Vec4

Multiplies each component of the two given vectors.

Added in version 1.0.

near(v2, epsilon)
Parameters:
Returns:

true if the two vectors are near each other

Return type:

bool

Compares the two given Graphene.Vec4 vectors and checks whether their values are within the given epsilon.

Added in version 1.2.

negate()
Returns:

return location for the result vector

Return type:

res: Graphene.Vec4

Negates the given Graphene.Vec4.

Added in version 1.2.

normalize()
Returns:

return location for the normalized vector

Return type:

res: Graphene.Vec4

Normalizes the given Graphene.Vec4.

Added 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.

Added in version 1.2.

subtract(b)
Parameters:

b (Graphene.Vec4) – a Graphene.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.

Added 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.

Added in version 1.0.