mathlib module

Provides access to mathematical objects.

class mathlib.Matrix3x4

Bases: Boost.Python.instance

__init__((object)arg1) → None
__init__( (object)arg1, (float)arg2, (float)arg3, (float)arg4, (float)arg5, (float)arg6, (float)arg7, (float)arg8, (float)arg9, (float)arg10, (float)arg11, (float)arg12, (float)arg13) -> None :

Create a new 3x4 matrix.

Note

The matrix is not initialized with 0.0.

__init__( (object)arg1, (Matrix3x4)arg2) -> None :
Copy an existing matrix.

__init__( (object)arg1, (Vector)arg2, (Vector)arg3, (Vector)arg4, (Vector)arg5) -> None

invalidate((Matrix3x4)arg1) → None :

Invalidate the the matrix (set all values to nan).

angles

Extract the angles from the matrix.

Return type:QAngle
position

Extract the position from the matrix.

Return type:Vector
class mathlib.Plane

Bases: Boost.Python.instance

__init__((object)arg1) → None
dist
normal
signbits
type
class mathlib.QAngle

Bases: Boost.Python.instance

__init__((object)arg1[, (float)x=0[, (float)y=0[, (float)z=0]]]) → None
get_angle_vectors((QAngle)arg1[, (Vector)forward=None[, (Vector)right=None[, (Vector)up=None]]]) → None :

Euler QAngle -> Basis Vectors. Each vector is optional

invalidate((QAngle)arg1) → None :

Invalidates the angle.

is_valid((QAngle)arg1) → bool :

Returns True if the angle is valid.

random((QAngle)arg1, (float)min_val, (float)max_val) → None :

Generates some random values between <min_val> and <max_val>.

length

Returns the length of the angle.

length_sqr

Returns the square of the angle’s length.

x
y
z
class mathlib.Quaternion

Bases: Boost.Python.instance

__init__((object)arg1[, (float)x=0[, (float)y=0[, (float)z=0[, (float)w=0]]]]) → None

__init__( (object)arg1, (RadianEuler)arg2) -> None

invalidate((Quaternion)arg1) → None :

Invalidates all values.

is_valid((Quaternion)arg1) → bool :

Returns True if all values are valid.

w
x
y
z
class mathlib.RadianEuler

Bases: Boost.Python.instance

__init__((object)arg1[, (float)x=0[, (float)y=0[, (float)z=0]]]) → None

__init__( (object)arg1, (Quaternion)arg2) -> None

__init__( (object)arg1, (QAngle)arg2) -> None

invalidate((RadianEuler)arg1) → None :

Invalidates all values.

is_valid((RadianEuler)arg1) → bool :

Returns True if all values are valid.

to_qangle((RadianEuler)arg1) → QAngle :

Converts the instance to a QAngle instance.

x
y
z
class mathlib.Vector

Bases: Boost.Python.instance

__init__((object)arg1[, (float)x=0[, (float)y=0[, (float)z=0]]]) → None
as_vector_2D((Vector)arg1) → object
copy((Vector)arg1) → Vector :

Return a copy of the vector.

cross((Vector)arg1, (Vector)other) → Vector :

Returns the cross product between two vectors.

dot((Vector)arg1, (Vector)other) → float :

Returns the dot product.

get_distance((Vector)arg1, (Vector)other) → float :

Returns the distance to the other vector.

get_distance_sqr((Vector)arg1, (Vector)other) → float :

Returns the distance to the other vector as a square product.

get_vector_angles((Vector)arg1, (QAngle)angles) → None :

Forward direction vector -> Euler angles.

get_vector_angles( (Vector)arg1, (Vector)pseudoup, (QAngle)angles) -> None :
Forward direction vector with a reference up vector -> Euler angles.
get_vector_vectors((Vector)arg1, (Vector)right, (Vector)up) → None
init((Vector)arg1, (float)x, (float)y, (float)z) → None
invalidate((Vector)arg1) → None :

Invalidates the vector.

is_length_greater_than((Vector)arg1, (float)value) → bool
is_length_less_than((Vector)arg1, (float)value) → bool
is_valid((Vector)arg1) → bool :

Returns True if the vector is valid.

is_within_box((Vector)arg1, (Vector)corner1, (Vector)corner2) → bool :

Returns True if the vector is within the given box coordinates.

is_zero((Vector)arg1[, (float)tolerance=0.009999999776482582]) → bool :

Returns True if x, y and z are zero or within the tolerance.

max((Vector)arg1, (Vector)other) → Vector :

Returns a new vector containing the biggest values of both vectors.

min((Vector)arg1, (Vector)other) → Vector :

Returns a new vector containing the lowest values of both vectors.

mul_add((Vector)arg1, (Vector)a, (Vector)b, (float)scalar) → None :

Multiply and add. this = a + b * scalar.

negate((Vector)arg1) → None :

Negates the vector.

normalize((Vector)arg1) → float :

Normalize the vector inplace and return its length before normalization.

normalized((Vector)arg1) → Vector :

Return a normalized copy of the vector.

random((Vector)arg1, (float)min, (float)max) → None :

Fills the vector with random values within the given range.

zero((Vector)arg1) → None :

Zeros out the vector.

length

Returns the vector’s 3D length.

length_2D

Returns the vector’s 2D length.

length_2D_sqr

Returns the vector’s 2D length as a square product.

length_sqr

Returns the vector’s 3D length as a square product.

x
y
z
mathlib.NULL_MATRIX = [(0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)]
mathlib.NULL_QANGLE = QAngle(0.0, 0.0, 0.0)
mathlib.NULL_QUATERNION = Quaternion(0.0, 0.0, 0.0, 0.0)
mathlib.NULL_RADIANEULER = RadianEuler(0.0, 0.0, 0.0)
mathlib.NULL_VECTOR = Vector(0.0, 0.0, 0.0)