Vec4#
- class Vec4(*args, **kwargs)#
A structure capable of holding a vector with four dimensions: x, y, z, and w.
The contents of the Vec4 structure are private and should
never be accessed directly.
Constructors#
Methods#
- class Vec4
- add(b: Vec4) Vec4#
Adds each component of the two given vectors.
Added in version 1.0.
- Parameters:
b – a
Vec4
- divide(b: Vec4) Vec4#
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
Vec4
- dot(b: Vec4) float#
Computes the dot product of the two given vectors.
Added in version 1.0.
- Parameters:
b – a
Vec4
- equal(v2: Vec4) bool#
Checks whether the two given
Vec4are equal.Added in version 1.2.
- Parameters:
v2 – a
Vec4
- get_xy() Vec2#
Creates a
Vec2that contains the first two components of the givenVec4.Added in version 1.0.
- get_xyz() Vec3#
Creates a
Vec3that contains the first three components of the givenVec4.Added in version 1.0.
- init(x: float, y: float, z: float, w: float) Vec4#
Initializes a
Vec4using 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
w – the W field of the vector
- init_from_float(src: list[float]) Vec4#
Initializes a
Vec4with the values inside the given array.Added in version 1.0.
- Parameters:
src – an array of four floating point values
- init_from_vec2(src: Vec2, z: float, w: float) Vec4#
Initializes a
Vec4using the components of aVec2and the values ofzandw.Added in version 1.0.
- Parameters:
src – a
Vec2z – the value for the third component of
vw – the value for the fourth component of
v
- init_from_vec3(src: Vec3, w: float) Vec4#
Initializes a
Vec4using the components of aVec3and the value ofw.Added in version 1.0.
- Parameters:
src – a
Vec3w – the value for the fourth component of
v
- init_from_vec4(src: Vec4) Vec4#
Initializes a
Vec4using the components of anotherVec4.Added in version 1.0.
- Parameters:
src – a
Vec4
- interpolate(v2: Vec4, factor: float) Vec4#
Linearly interpolates
v1andv2using the givenfactor.Added in version 1.10.
- Parameters:
v2 – a
Vec4factor – the interpolation factor
- max(b: Vec4) Vec4#
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
Vec4
- min(b: Vec4) Vec4#
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
Vec4
- multiply(b: Vec4) Vec4#
Multiplies each component of the two given vectors.
Added in version 1.0.
- Parameters:
b – a
Vec4
- near(v2: Vec4, epsilon: float) bool#
Compares the two given
Vec4vectors and checks whether their values are within the givenepsilon.Added in version 1.2.
- Parameters:
v2 – a
Vec4epsilon – the threshold between the two vectors
- classmethod one() Vec4#
Retrieves a pointer to a
Vec4with all its components set to 1.Added in version 1.0.
- scale(factor: float) Vec4#
Multiplies all components of the given vector with the given scalar
factor.Added in version 1.2.
- Parameters:
factor – the scalar factor
- subtract(b: Vec4) Vec4#
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
Vec4
- to_float() list[float]#
Stores the components of the given
Vec4into an array of floating point values.Added in version 1.0.
- classmethod w_axis() Vec4#
Retrieves a pointer to a
Vec4with its components set to (0, 0, 0, 1).Added in version 1.0.
- classmethod x_axis() Vec4#
Retrieves a pointer to a
Vec4with its components set to (1, 0, 0, 0).Added in version 1.0.
- classmethod y_axis() Vec4#
Retrieves a pointer to a
Vec4with its components set to (0, 1, 0, 0).Added in version 1.0.
Fields#
- class Vec4
- value#