Graphene.Vec3

Fields

Name

Type

Access

Description

value

Graphene.Simd4F

r

Methods

class

alloc ()

class

one ()

class

x_axis ()

class

y_axis ()

class

z_axis ()

class

zero ()

add (b)

cross (b)

divide (b)

dot (b)

equal (v2)

free ()

get_x ()

get_xy ()

get_xy0 ()

get_xyz0 ()

get_xyz1 ()

get_xyzw (w)

get_y ()

get_z ()

init (x, y, z)

init_from_float (src)

init_from_vec3 (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.Vec3

A structure capable of holding a vector with three dimensions: x, y, and z.

The contents of the Graphene.Vec3 structure are private and should never be accessed directly.

classmethod alloc()
Returns:

the newly allocated Graphene.Vec3 structure. Use Graphene.Vec3.free() to free the resources allocated by this function.

Return type:

Graphene.Vec3

Allocates a new Graphene.Vec3 structure.

The contents of the returned structure are undefined.

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

Added in version 1.0.

classmethod one()
Returns:

a constant vector

Return type:

Graphene.Vec3

Provides a constant pointer to a vector with three components, all sets to 1.

Added in version 1.0.

classmethod x_axis()
Returns:

a constant vector

Return type:

Graphene.Vec3

Provides a constant pointer to a vector with three components with values set to (1, 0, 0).

Added in version 1.0.

classmethod y_axis()
Returns:

a constant vector

Return type:

Graphene.Vec3

Provides a constant pointer to a vector with three components with values set to (0, 1, 0).

Added in version 1.0.

classmethod z_axis()
Returns:

a constant vector

Return type:

Graphene.Vec3

Provides a constant pointer to a vector with three components with values set to (0, 0, 1).

Added in version 1.0.

classmethod zero()
Returns:

a constant vector

Return type:

Graphene.Vec3

Provides a constant pointer to a vector with three components, all sets to 0.

Added in version 1.0.

add(b)
Parameters:

b (Graphene.Vec3) – a Graphene.Vec3

Returns:

return location for the resulting vector

Return type:

res: Graphene.Vec3

Adds each component of the two given vectors.

Added in version 1.0.

cross(b)
Parameters:

b (Graphene.Vec3) – a Graphene.Vec3

Returns:

return location for the resulting vector

Return type:

res: Graphene.Vec3

Computes the cross product of the two given vectors.

Added in version 1.0.

divide(b)
Parameters:

b (Graphene.Vec3) – a Graphene.Vec3

Returns:

return location for the resulting vector

Return type:

res: Graphene.Vec3

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.Vec3) – a Graphene.Vec3

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.Vec3) – a Graphene.Vec3

Returns:

true if the two vectors are equal, and false otherwise

Return type:

bool

Checks whether the two given Graphene.Vec3 are equal.

Added in version 1.2.

free()

Frees the resources allocated by self

Added in version 1.0.

get_x()
Returns:

the value of the first component of the vector

Return type:

float

Retrieves the first component of the given vector self.

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 and second components of the given Graphene.Vec3.

Added in version 1.0.

get_xy0()
Returns:

return location for a Graphene.Vec3

Return type:

res: Graphene.Vec3

Creates a Graphene.Vec3 that contains the first two components of the given Graphene.Vec3, and the third component set to 0.

Added in version 1.0.

get_xyz0()
Returns:

return location for the vector

Return type:

res: Graphene.Vec4

Converts a Graphene.Vec3 in a Graphene.Vec4 using 0.0 as the value for the fourth component of the resulting vector.

Added in version 1.0.

get_xyz1()
Returns:

return location for the vector

Return type:

res: Graphene.Vec4

Converts a Graphene.Vec3 in a Graphene.Vec4 using 1.0 as the value for the fourth component of the resulting vector.

Added in version 1.0.

get_xyzw(w)
Parameters:

w (float) – the value of the W component

Returns:

return location for the vector

Return type:

res: Graphene.Vec4

Converts a Graphene.Vec3 in a Graphene.Vec4 using w as the value of the fourth component of the resulting vector.

Added in version 1.0.

get_y()
Returns:

the value of the second component of the vector

Return type:

float

Retrieves the second component of the given vector self.

Added in version 1.0.

get_z()
Returns:

the value of the third component of the vector

Return type:

float

Retrieves the third component of the given vector self.

Added in version 1.0.

init(x, y, z)
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

Returns:

a pointer to the initialized vector

Return type:

Graphene.Vec3

Initializes a Graphene.Vec3 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 3 floating point values

Returns:

the initialized vector

Return type:

Graphene.Vec3

Initializes a Graphene.Vec3 with the values from an array.

Added in version 1.0.

init_from_vec3(src)
Parameters:

src (Graphene.Vec3) – a Graphene.Vec3

Returns:

the initialized vector

Return type:

Graphene.Vec3

Initializes a Graphene.Vec3 with the values of another Graphene.Vec3.

Added in version 1.0.

interpolate(v2, factor)
Parameters:
Returns:

the interpolated vector

Return type:

res: Graphene.Vec3

Linearly interpolates self and v2 using the given factor.

Added in version 1.10.

length()
Returns:

the value of the length of the vector

Return type:

float

Retrieves the length of the given vector self.

Added in version 1.0.

max(b)
Parameters:

b (Graphene.Vec3) – a Graphene.Vec3

Returns:

return location for the result vector

Return type:

res: Graphene.Vec3

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.Vec3) – a Graphene.Vec3

Returns:

return location for the result vector

Return type:

res: Graphene.Vec3

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.Vec3) – a Graphene.Vec3

Returns:

return location for the resulting vector

Return type:

res: Graphene.Vec3

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

Negates the given Graphene.Vec3.

Added in version 1.2.

normalize()
Returns:

return location for the normalized vector

Return type:

res: Graphene.Vec3

Normalizes the given Graphene.Vec3.

Added in version 1.0.

scale(factor)
Parameters:

factor (float) – the scalar factor

Returns:

return location for the result vector

Return type:

res: Graphene.Vec3

Multiplies all components of the given vector with the given scalar factor.

Added in version 1.2.

subtract(b)
Parameters:

b (Graphene.Vec3) – a Graphene.Vec3

Returns:

return location for the resulting vector

Return type:

res: Graphene.Vec3

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]

Copies the components of a Graphene.Vec3 into the given array.

Added in version 1.0.