Vec3#
- class Vec3(*args, **kwargs)#
A structure capable of holding a vector with three dimensions: x, y, and z.
The contents of the Vec3 structure are private and should
never be accessed directly.
Constructors#
Methods#
- class Vec3
- add(b: Vec3) Vec3#
Adds each component of the two given vectors.
Added in version 1.0.
- Parameters:
b – a
Vec3
- cross(b: Vec3) Vec3#
Computes the cross product of the two given vectors.
Added in version 1.0.
- Parameters:
b – a
Vec3
- divide(b: Vec3) Vec3#
Divides each component of the first operand
aby the corresponding component of the second operandb, and places the results into the vectorres.Added in version 1.0.
- Parameters:
b – a
Vec3
- dot(b: Vec3) float#
Computes the dot product of the two given vectors.
Added in version 1.0.
- Parameters:
b – a
Vec3
- equal(v2: Vec3) bool#
Checks whether the two given
Vec3are equal.Added in version 1.2.
- Parameters:
v2 – a
Vec3
- get_xy() Vec2#
Creates a
Vec2that contains the first and second components of the givenVec3.Added in version 1.0.
- get_xy0() Vec3#
Creates a
Vec3that contains the first two components of the givenVec3, and the third component set to 0.Added in version 1.0.
- get_xyz0() Vec4#
Converts a
Vec3in aVec4using 0.0 as the value for the fourth component of the resulting vector.Added in version 1.0.
- get_xyz1() Vec4#
Converts a
Vec3in aVec4using 1.0 as the value for the fourth component of the resulting vector.Added in version 1.0.
- get_xyzw(w: float) Vec4#
Converts a
Vec3in aVec4usingwas the value of the fourth component of the resulting vector.Added in version 1.0.
- Parameters:
w – the value of the W component
- init(x: float, y: float, z: float) Vec3#
Initializes a
Vec3using the given values.This function can be called multiple times.
Added in version 1.0.
- Parameters:
x – the X field of the vector
y – the Y field of the vector
z – the Z field of the vector
- init_from_float(src: list[float]) Vec3#
Initializes a
Vec3with the values from an array.Added in version 1.0.
- Parameters:
src – an array of 3 floating point values
- init_from_vec3(src: Vec3) Vec3#
Initializes a
Vec3with the values of anotherVec3.Added in version 1.0.
- Parameters:
src – a
Vec3
- interpolate(v2: Vec3, factor: float) Vec3#
Linearly interpolates
v1andv2using the givenfactor.Added in version 1.10.
- Parameters:
v2 – a
Vec3factor – the interpolation factor
- max(b: Vec3) Vec3#
Compares each component of the two given vectors and creates a vector that contains the maximum values.
Added in version 1.0.
- Parameters:
b – a
Vec3
- min(b: Vec3) Vec3#
Compares each component of the two given vectors and creates a vector that contains the minimum values.
Added in version 1.0.
- Parameters:
b – a
Vec3
- multiply(b: Vec3) Vec3#
Multiplies each component of the two given vectors.
Added in version 1.0.
- Parameters:
b – a
Vec3
- near(v2: Vec3, epsilon: float) bool#
Compares the two given
Vec3vectors and checks whether their values are within the givenepsilon.Added in version 1.2.
- Parameters:
v2 – a
Vec3epsilon – the threshold between the two vectors
- classmethod one() Vec3#
Provides a constant pointer to a vector with three components, all sets to 1.
Added in version 1.0.
- scale(factor: float) Vec3#
Multiplies all components of the given vector with the given scalar
factor.Added in version 1.2.
- Parameters:
factor – the scalar factor
- subtract(b: Vec3) Vec3#
Subtracts from each component of the first operand
athe corresponding component of the second operandband places each result into the components ofres.Added in version 1.0.
- Parameters:
b – a
Vec3
- classmethod x_axis() 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() Vec3#
Provides a constant pointer to a vector with three components with values set to (0, 1, 0).
Added in version 1.0.
Fields#
- class Vec3
- value#