mathlib module¶
Provides access to mathematical objects.
- class mathlib.Matrix3x4¶
Bases:
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
).
- class mathlib.Plane¶
Bases:
instance
- property dist¶
None( (_mathlib.Plane)arg1) -> float
- property normal¶
None( (_mathlib.Plane)arg1) -> _mathlib.Vector
- property signbits¶
None( (_mathlib.Plane)arg1) -> int
- property type¶
None( (_mathlib.Plane)arg1) -> int
- class mathlib.QAngle¶
Bases:
instance
- 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>.
- property length¶
Returns the length of the angle.
- property length_sqr¶
Returns the square of the angle’s length.
- property x¶
None( (_mathlib.QAngle)arg1) -> float
- property y¶
None( (_mathlib.QAngle)arg1) -> float
- property z¶
None( (_mathlib.QAngle)arg1) -> float
- class mathlib.Quaternion¶
Bases:
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.
- property w¶
None( (_mathlib.Quaternion)arg1) -> float
- property x¶
None( (_mathlib.Quaternion)arg1) -> float
- property y¶
None( (_mathlib.Quaternion)arg1) -> float
- property z¶
None( (_mathlib.Quaternion)arg1) -> float
- class mathlib.RadianEuler¶
Bases:
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.
- property x¶
None( (_mathlib.RadianEuler)arg1) -> float
- property y¶
None( (_mathlib.RadianEuler)arg1) -> float
- property z¶
None( (_mathlib.RadianEuler)arg1) -> float
- class mathlib.Vector¶
Bases:
instance
- 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.
- invalidate((Vector)arg1) None : ¶
Invalidates the vector.
- 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.
- property length¶
Returns the vector’s 3D length.
- property length_2D¶
Returns the vector’s 2D length.
- property length_2D_sqr¶
Returns the vector’s 2D length as a square product.
- property length_sqr¶
Returns the vector’s 3D length as a square product.
- property x¶
None( (_mathlib.Vector)arg1) -> float
- property y¶
None( (_mathlib.Vector)arg1) -> float
- property z¶
None( (_mathlib.Vector)arg1) -> float
- 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)¶