cPy.cTypes module#
- class cStr(Src: str)[source]#
Bases:
objectA custom string class optimized for performance and ease of use. *This class provides a wide range of string manipulation functions, includingdynamic resizing, formatting, path handling, and type conversions.It is designed to work with standard C-style strings and providessafe memory management.- ToCharPtr() str[source]#
- Returns a pointer to the internal character buffer.
- Returns:
A const char pointer to the string data. Returns a pointer to an empty string if null.
- Return type:
str
- SetLength(Length: int, Fill: any)[source]#
- Ensures needed capacity and sets a specified length.
- Parameters:
Length (int) – The new length of the string.
Fill – The character to fill new space with if expanding.
- CalcLength()[source]#
- Recalculates the length based on the actual null terminator position.Useful after direct buffer manipulation via ToCharPtr().
- StartsWith(Str: str, NoCase: bool = False) bool[source]#
- Determines whether the beginning of this instance matches the specified string.
- Parameters:
Str (str) – The string to compare.
NoCase (bool) – If true, ignores case.
- Returns:
True if it starts with Str or if Str is empty.
- Return type:
bool
- EndsWith(Str: str, NoCase: bool = False) bool[source]#
- Determines whether the end of this instance matches the specified string.
- Parameters:
Str (str) – The string to compare.
NoCase (bool) – If true, ignores case.
- Returns:
True if it ends with Str or if Str is empty.
- Return type:
bool
- AppendPath(Path: str)[source]#
- rief Appends a path segment, automatically adding a slash or backslash.
- Remove(StartIndex: int, Count: int)[source]#
- Deletes a specific number of characters.
- Parameters:
StartIndex (int) – Position to start removing.
Count (int) – Number of characters to remove.
- ReplaceCommaWithDot()[source]#
- rief Utility to replace commas with dots (e.g. for localization fixing).
- Replace(String: str, WithString: str, StartIndex: int, Count: int, NoCase: bool = False) int[source]#
- ReplaceFirst(String: str, WithString: str, StartIndex: int, Count: int, NoCase: bool = False) int[source]#
- Substring(StartIndex: int, Count: int) cStr[source]#
- rief Retrieves a substring of specified length.
- PadLeft(TotalWidth: int, PaddingChar: any)[source]#
- rief Right-aligns characters, padding on the left.
- PadRight(TotalWidth: int, PaddingChar: any)[source]#
- rief Left-aligns characters, padding on the right.
- Contains(Str: str, NoCase: bool = False) bool[source]#
- rief Checks if the string contains a substring.
- static CharIsExponent(c: int) bool[source]#
- rief Helper: Is character part of exponent notation (e, E, d, D)?
- class cVec2(v: cVec2)[source]#
Bases:
objectA 2D vector class providing linear algebra operations and geometry functions. *This class represents a 2-component vector (x, y) and includes methods forarithmetic, geometric transformations (dot, cross, normalize), matrix multiplication,and various utility functions (lerp, clamp, reflect). *Refer to it as coat::vec2 in the Core API.- x: float#
- The X component of the vector.
- y: float#
- The Y component of the vector.
- Transform(_0: any)[source]#
- Transforms the vector by a 3x3 matrix.Treats the vector as a direction (x, y, 0).
- TransformCoordinate(_0: any)[source]#
- Transforms the vector by a 4x4 matrix treating it as a point.Implicitly extends to (x, y, 0, 1) and projects the result backby dividing by w (Perspective divide).
- TransformNormal(_0: any)[source]#
- Transforms the vector by a 4x4 matrix treating it as a normal/direction.Implicitly extends to (x, y, 0, 0), ignoring translation.
- static Equals(_0: cVec2, _1: cVec2, Eps: float) bool[source]#
- Checks if two vectors are equal within a given epsilon tolerance.
- NormalizeSafe(Fallback: cVec2) float[source]#
- Normalizes the vector safely.
- Parameters:
Fallback (cVec2) – The value to assign if the vector length is zero.
- Returns:
The previous length, or 0.0f if the vector was zero.
- Return type:
float
- IsNormalized(Eps: float) bool[source]#
- Checks if the vector is normalized (length == 1) within tolerance.
- static Round(_0: cVec2) cVec2[source]#
- Returns a new vector with components rounded to the nearest integer.
- static Abs(_0: cVec2) cVec2[source]#
- Returns a vector containing the absolute values of the components.
- static AreaSigned(t0: cVec2, t1: cVec2, t2: cVec2) float[source]#
- Returns the signed area of the triangle formed by t0, t1, t2.
- static Ccw(_0: cVec2, _1: cVec2) float[source]#
- “Counter-Clockwise” or 2D Cross Product.
- Returns:
The magnitude of the Z component of the cross product (u.x*v.y - u.y*v.x).
- Return type:
float
- static Clamp(Value: cVec2, Lo: cVec2, Hi: cVec2) cVec2[source]#
- Clamps a vector between a Low and High range (component-wise).
- static DistanceSq(_0: cVec2, _1: cVec2) float[source]#
- Calculates the squared distance between two vectors.
- static Lerp(_0: cVec2, _1: cVec2, _2: float) cVec2[source]#
- Linearly interpolates between two vectors.
- static Lerp05(_0: cVec2, _1: cVec2) cVec2[source]#
- Linearly interpolates between two vectors with factor 0.5.
- static PerpCw(_0: cVec2) cVec2[source]#
- Returns a vector perpendicular to u (Clockwise rotation 90 deg).
- static PerpCcw(_0: cVec2) cVec2[source]#
- Returns a vector perpendicular to u (Counter-Clockwise rotation 90 deg).
- static Reflect(RayDir: cVec2, Normal: cVec2) cVec2[source]#
- Reflects a ray direction off a surface normal.
- static Refract(RayDir: cVec2, Normal: cVec2, Eta: float) cVec2[source]#
- Refracts a ray direction through a surface normal with index of refraction Eta.
- static Truncate(u: cVec2, MaxLength: float) cVec2[source]#
- Truncates the vector length to MaxLength. Returns a new vector.
- DistanceToLineSegSq(A: cVec2, B: cVec2, pScale: float = None) float[source]#
- Squared distance from this point to a line segment AB.
- static SegIntersection(L0: cVec2, L1: cVec2, R0: cVec2, R1: cVec2, l: float = None, r: float = None) bool[source]#
- Calculates the intersection of two line segments.
- static FromBaryCentric(t0: cVec2, t1: cVec2, t2: cVec2, u: float, v: float) cVec2[source]#
- Calculates a position from Barycentric coordinates (u, v) on a triangle.
- static FromPolar(Radius: float, Angle: float) cVec2[source]#
- Creates a vector from Polar coordinates (Radius, Angle in degrees).
- Infinity: cVec2 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
- ToPolar(Radius: float, Angle: float)[source]#
- Converts Cartesian coordinates to Polar (Radius, Angle).
- ToBaryCentric(t0: cVec2, t1: cVec2, t2: cVec2, u: float, v: float) float[source]#
- Calculates Barycentric coordinates of this point within triangle t0,t1,t2.
- class cVec3(v: cVec3)[source]#
Bases:
objectThe 3D-vector, refer it as coat::vec3 in the Core API.This class represents a 3-dimensional vector with float precision components (x, y, z).
It includes standard vector arithmetic, geometric operations, and transformation utilities.- x: float#
- X component of the vector
- y: float#
- Y component of the vector
- z: float#
- Z component of the vector
- TransformCoordinate(_0: any)[source]#
- Transforms the vector as a coordinate (position) using a 4x4 matrix.
- TransformNormalTransposed(_0: any)[source]#
- Transforms the vector as a normal using the transpose of a 4x4 matrix.
- static Equals(_0: cVec3, _1: cVec3, Eps: float) bool[source]#
- Checks if two vectors are equal within a given epsilon tolerance.
- NormalizeSafe(Fallback: cVec3 = cVec3.AxisZ) float[source]#
- Safely normalizes the vector. If length is zero, uses the Fallback vector.
- FixDegenerateNormal() bool[source]#
- Fixes degenerate normal vectors (NaN or zero length). Returns true if fixed.
- IsNormalized(Eps: float) bool[source]#
- Checks if the vector is normalized (length is approximately 1).
- static Angle(p1: cVec3, p2: cVec3, p3: cVec3, normal: cVec3) float[source]#
- Returns the signed angle between (p1-p2) and (p3-p2) around a normal.
- static AreaSigned(t0: cVec3, t1: cVec3, t2: cVec3) float[source]#
- Returns the area of the triangle formed by t0, t1, t2.
- static BaryCentric(t0: cVec3, t1: cVec3, t2: cVec3, f: float, g: float) cVec3[source]#
- Computes a point using barycentric coordinates (f, g).
- static Clamp(_0: cVec3, _1: cVec3, _2: cVec3) cVec3[source]#
- Clamps a vector between a min and max vector (component-wise).
- static Cross(_0: cVec3, _1: cVec3) cVec3[source]#
- Computes the cross product of two vectors (static).
- SetCross(_0: cVec3, _1: cVec3)[source]#
- Computes the cross product of two vectors and sets the result to this.
- static Distance2(_0: cVec3, _1: cVec3) float[source]#
- Computes the distance between two vectors using fast sqrt.
- static DistanceSq(_0: cVec3, _1: cVec3) float[source]#
- Computes the squared distance between two vectors.
- static Lerp(_0: cVec3, _1: cVec3, _2: float) cVec3[source]#
- Linearly interpolates between two vectors.
- static Lerp05(_0: cVec3, _1: cVec3) cVec3[source]#
- Linearly interpolates between two vectors with factor 0.5.
- static Reflect(RayDir: cVec3, Normal: cVec3) cVec3[source]#
- Reflects a ray direction off a surface with the given normal.
- static Refract(RayDir: cVec3, Normal: cVec3, Eta: float) cVec3[source]#
- Refracts a ray direction.
- Parameters:
Eta (float) – Ratio of indices of refraction at the surface interface.
- static Slerp(n0: cVec3, n1: cVec3, s: float) cVec3[source]#
- Spherical linear interpolation between two vectors.
- static Truncate(u: cVec3, MaxLen: float) cVec3[source]#
- Truncates the vector u so its length does not exceed MaxLen.
- static Rand(Lo: cVec3, Hi: cVec3) cVec3[source]#
- Returns a vector with random components in the range [Lo, Hi].
- static Perpendicular(v1: cVec3) cVec3[source]#
- Returns a vector perpendicular to v1 (arbitrary axis).
- TriProjectionSolidAngle(a: cVec3, b: cVec3, c: cVec3) float[source]#
- Calculates the solid angle of the triangle (a, b, c) as seen from this point.
- Infinity: cVec3 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
- < (1, 1, 1)
- GetOrthonormalPair() list[source]#
- Returns a pair of vectors orthonormal to this one and each other (forming a basis).
- static FromPolarXZ(Radius: float, Angle: float) cVec3[source]#
- Creates a vector from Polar coordinates in the XZ plane.
- ToBaryCentric(t0: cVec3, t1: cVec3, t2: cVec3, f: float, g: float) float[source]#
- Computes barycentric coordinates (f, g) of this point relative to triangle (t0, t1, t2).
- class cVec4(v: cVec4)[source]#
Bases:
objectA 4-component vector class (x, y, z, w).This class represents a 4D vector, often used for homogeneous coordinates in 3D graphics,
colors (RGBA), or generic 4-value mathematical operations.Refer to it as coat::vec4 in the Core API.- x: float#
- X component of the vector.
- y: float#
- Y component of the vector.
- z: float#
- Z component of the vector.
- w: float#
- W component of the vector.
- Set(XYZ: cVec3, W: float)[source]#
- Sets components from a 3D vector and a scalar.
- Parameters:
XYZ (cVec3) – The vector containing x, y, and z.
W (float) – The w component.
- Copy(pSrc: float)[source]#
- Copies components from a raw float array.
- Parameters:
pSrc (float) – Pointer to an array of at least 4 floats.
- Transform(mat: any)[source]#
- Transforms this vector by a 4x4 matrix.
- Parameters:
mat – The matrix to transform by.
- static Equals(u: cVec4, v: cVec4, Eps: float) bool[source]#
- Checks if two vectors are equal within a tolerance.
- Normalize() float[source]#
- Normalizes the vector to unit length.
- Returns:
The original length of the vector.
- Return type:
float
- NormalizeSafe(Fallback: cVec4 = cVec4.AxisW) float[source]#
- Safely normalizes the vector. If length is close to zero, sets to Fallback.
- Parameters:
Fallback (cVec4) – The vector to use if this vector is zero-length.
- Returns:
The original length.
- Return type:
float
- static Abs(_0: cVec4) cVec4[source]#
- Returns a vector containing the absolute values of the input components.
- static Max(_0: cVec4, _1: cVec4) cVec4[source]#
- Returns a vector containing the maximum components of two vectors.
- static Min(_0: cVec4, _1: cVec4) cVec4[source]#
- Returns a vector containing the minimum components of two vectors.
- Infinity: cVec4 = 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000 340282346638528859811704183484516925440.0000#
- < (1, 1, 1, 1)
- class cMat3(v: cMat3)[source]#
Bases:
objectRepresents a 3x3 Matrix.Used for 3D linear algebra transformations, primarily rotation and scaling.
Stored in row-major order (array of 3 rows).
- CopyTransposed(Float9: float)[source]#
- Copies 9 floats into the matrix treating input as Column-Major (Transposes).
- SetRow(Index: int, X: float, Y: float, Z: float)[source]#
- Sets the values of a specific row using floats.
- GetCol(Index: int) cVec3[source]#
- Constructs and returns a vector representing the specified column.
- SetCol(Index: int, X: float, Y: float, Z: float)[source]#
- Sets the values of a specific column using floats.
- static Equals(_0: cMat3, _1: cMat3, Eps: float) bool[source]#
- Checks equality with a tolerance (Epsilon).
- IsOrthonormal(Eps: float) bool[source]#
- Checks if rows are orthogonal and unit length (Pure rotation matrix).
- Identity: cMat3 = 1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 1.0000#
- Identity matrix constant.
- static Transpose(_0: cMat3) cMat3[source]#
- Returns the transpose of matrix M (swaps rows and columns).
- static OrthoNormalize(Src: cMat3) cMat3[source]#
- Inverts this matrix in place. Returns false if singular.
- static Rotation(Axis: cVec3, Angle: float) cMat3[source]#
- Creates a rotation matrix around an arbitrary axis.
- static EulerZYX(eulerX: float, eulerY: float, eulerZ: float) cMat3[source]#
- Creates a rotation matrix using ZYX order.
- ToVectors(Forward: cVec3, Right: cVec3 = None, Up: cVec3 = None)[source]#
- Extracts basis vectors (Forward, Right, Up) from the matrix.Typically assumes rows contain the basis vectors.
- static FromVectors(Forward: cVec3, Right: cVec3, Up: cVec3) cMat3[source]#
- Constructs a matrix from basis vectors.
- class cMat4(v: cMat4)[source]#
Bases:
objectA 4x4 Matrix class designed for 3D graphics and linear algebra. *This class uses row-major storage (cVec4 m_Rows[4]).It supports row-vector multiplication conventions (v’ = v * M).Translation data is typically stored in the 4th row (Index 3). *ote Refer to it as coat::mat4 in the Core API.- static Equals(_0: cMat4, _1: cMat4, Eps: float) bool[source]#
- Checks equality with another matrix within a tolerance epsilon.
- ToNormalMatrix() cMat3[source]#
- Extracts the normal matrix (usually inverse transpose of upper 3x3).
- static Invert(Fm: cMat4, To: cMat4) bool[source]#
- Calculates the inverse of Fm and stores it in To. Returns false if singular.
- Zero: cMat4 = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000#
- Inverts this matrix in-place. Returns false if singular.
- Identity: cMat4 = 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000#
- static Perspective(YFov: float, AspectWtoH: float, Znear: float, Zfar: float) cMat4[source]#
- Creates a perspective projection matrix.
- static PerspectiveInf(YFov: float, AspectWtoH: float, Znear: float) cMat4[source]#
- Creates an infinite perspective projection matrix (Zfar at infinity).
- class cRect(v: cRect)[source]#
Bases:
objectRepresents an axis-aligned 2D rectangle defined by Min and Max points.Coordinate system note: This class typically assumes a standard mathematical
coordinate system where Y increases upwards (Top > Bottom), based on the implementationof AlignTop/Bottom.- static Equals(_0: cRect, _1: cRect, Eps: float) bool[source]#
- Checks if two rectangles are equal within a tolerance epsilon.
- Parameters:
Eps (float) – Tolerance for floating point comparison.
- AlignInside(Parent: cRect)[source]#
- Successively aligns right, bottom, left, and top edges to keep this rectangle inside the parent.
- SetHeight(HoldPoint: int, Height: float)[source]#
- Sets the height, resizing relative to a specific hold point (cAlign).
- class cBounds(v: any)[source]#
Bases:
objectRepresents an Axis-Aligned Bounding Box (AABB) in 3D space.Defined by a minimum point (min x, min y, min z) and a maximum point (max x, max y, max z).
Used for collision detection, visibility testing, and spatial partitioning.- GetLargestAxis() int[source]#
- Returns the index of the longest axis.
- Returns:
0 for X, 1 for Y, 2 for Z.
- Return type:
int
- GetShortestAxis() int[source]#
- Returns the index of the shortest axis.
- Returns:
0 for X, 1 for Y, 2 for Z.
- Return type:
int
- AddPoint(_0: cVec3) bool[source]#
- Expands the bounds to include the given point.
- Returns:
True if the bounds were expanded.
- Return type:
bool
- AddBounds(_0: any) bool[source]#
- Expands the bounds to include another bounding box.
- Returns:
True if the bounds were expanded.
- Return type:
bool
- DistanceToPointSq(p: cVec3) float[source]#
- Squared distance from a 3D point to the bounds (0 if inside).
- ContainsCircle(Center: cVec2, Radius: float) bool[source]#
- Checks if a 2D circle is contained within or overlaps the projected bounds.
- ContainsBounds(_0: any) bool[source]#
- Checks if another bounding box is fully contained within this one.
- class cRotation(Orig: cVec3, Axis: cVec3, Angle: float)[source]#
Bases:
objectRepresents a rotation defined by an origin (pivot), an axis, and an angle. *This class handles rotation logic including conversion to matrices, quaternions,to optimize repeated access.- Set(Orig: cVec3, Axis: cVec3, Angle: float) cRotation[source]#
- Sets new parameters for the rotation.
Invalidates the cached matrix.
- GetOrig() cVec3[source]#
- Gets the origin of the rotation.
- Returns:
Const reference to the origin vector.
- Return type:
- GetAxis() cVec3[source]#
- Gets the axis of the rotation.
- Returns:
Const reference to the axis vector.
- Return type:
- GetAngle() float[source]#
- Gets the angle of the rotation.
- Returns:
The angle value.
- Return type:
float
- SetOrig(Orig: cVec3)[source]#
- Sets the origin of the rotation.
- Parameters:
Orig (cVec3) – The new origin vector.
- SetAxis(Axis: cVec3)[source]#
- Sets the axis of the rotation.
Invalidates the cached matrix.
- Parameters:
Axis (cVec3) – The new axis vector.
- SetAngle(Angle: float)[source]#
- Sets the angle of the rotation.
Invalidates the cached matrix.
- Parameters:
Angle (float) – The new angle value.
- Normalize180() cRotation[source]#
- Normalizes the angle to be within [-180, 180] degrees (or radians equivalent).
- Returns:
Reference to this object.
- Return type:
- Normalize360() cRotation[source]#
- Normalizes the angle to be within [0, 360] degrees (or radians equivalent).
- Returns:
Reference to this object.
- Return type:
- ToMat3() cMat3[source]#
- Converts the rotation to a 3x3 Matrix.
Updates the internal cache if necessary.
- class cAngles(Pitch: float, Yaw: float, Roll: float)[source]#
Bases:
objectRepresents Euler angles for 3D rotations.This class manages rotations using Pitch, Yaw, and Roll components.
Commonly used for object orientation, camera control, and physics calculations.- Pitch: float#
- Rotation around the X-axis (Up/Down) in degrees.
- Yaw: float#
- Rotation around the Y-axis (Left/Right) in degrees.
- Roll: float#
- Rotation around the Z-axis (Banking/Fall over) in degrees.
- Set(Pitch: float, Yaw: float, Roll: float)[source]#
- Sets the angles to new values.
- Parameters:
Pitch (float) – Rotation around X-axis.
Yaw (float) – Rotation around Y-axis.
Roll (float) – Rotation around Z-axis.
- Copy(Src: float)[source]#
- Copies values from a float array.
- Parameters:
Src (float) – Pointer to an array of at least 3 floats [Pitch, Yaw, Roll].
- static Equals(_0: cAngles, _1: cAngles, Eps: float) bool[source]#
- Checks if two angles are equal within a given epsilon tolerance.
- Parameters:
Eps (float) – Tolerance value (default is cMath::Epsilon).
- Returns:
True if components are within Eps of each other.
- Return type:
bool
- Length() float[source]#
- Calculates the length (magnitude) of the angle vector.
- Returns:
Square root of sum of squares.
- Return type:
float
- LengthSq() float[source]#
- Calculates the squared length of the angle vector.
- Returns:
Sum of squares (Pitch^2 + Yaw^2 + Roll^2).
- Return type:
float
- static Clamp(u: cAngles, Min: cAngles, Max: cAngles) cAngles[source]#
- Clamps angle values between a minimum and maximum range.
- static Angle(l: cAngles, r: cAngles) float[source]#
- Calculates the angular difference between two orientations.
- static Distance(l: cAngles, r: cAngles) float[source]#
- Calculates the “distance” between two angles (alias for Angle).
- ToVectors(Forward: cVec3, Right: cVec3 = None, Up: cVec3 = None)[source]#
- Converts Euler angles to direction vectors (Forward, Right, Up).
- ToString(Prec: int = 2) cStr[source]#
- Converts the angles to a string representation.
- Parameters:
Prec (int) – Decimal precision.
- Returns:
String formatted as “Pitch Yaw Roll”.
- Return type:
- class cQuat(v: cQuat)[source]#
Bases:
objectHeader file for the Quaternion class.Implementation of quaternions for 3D rotations and orientation,
including arithmetic operations, interpolation (SLERP, SQUAD),and conversions to/from matrices and Euler angles.- x: float#
- y: float#
- < X component of the vector part.
- z: float#
- < Y component of the vector part.
- w: float#
- < Z component of the vector part.
- IsZero(Eps: float) bool[source]#
- Checks if the quaternion is zero (within epsilon).
- Parameters:
Eps (float) – Tolerance for comparison.
- Returns:
true if all components are close to zero.
- Return type:
bool
- static Mul(_0: cQuat, _1: cQuat) cQuat[source]#
- Multiplies two quaternions.
Represents combining two rotations (q0 applied then q1, depending on convention).
- static Div(_0: cQuat, _1: cQuat) cQuat[source]#
- Divides two quaternions.
Equivalent to q0 * Inverse(q1).
- static Equals(_0: cQuat, _1: cQuat, Eps: float) bool[source]#
- Checks if two quaternions are equal component-wise.
- static EqualRotations(_0: cQuat, _1: cQuat, Eps: float) bool[source]#
- Checks if two quaternions represent the same rotation.
Considers that q and -q represent the same orientation in 3D space.
- static SameHemisphere(_0: cQuat, _1: cQuat) bool[source]#
- Checks if two quaternions are in the same hemisphere.
Based on the dot product sign.
- Compress()[source]#
- Compresses the quaternion for storage (e.g., usually for network).
Ensures W is positive and then sets it to 0 (assuming reconstruction later).
- CalcW()[source]#
- Reconstructs W component assuming a unit quaternion.
w = sqrt(1 - x^2 - y^2 - z^2).
- Normalize() cQuat[source]#
- Normalizes the quaternion to unit length.
- Returns:
Reference to this quaternion.
- Return type:
- IsNormalized(Eps: float) bool[source]#
- Checks if the quaternion is normalized (length is close to 1).
- static Lerp(q0: cQuat, q1: cQuat, s: float, ShortestPath: bool = True) cQuat[source]#
- Linear Interpolation between two quaternions.
- Parameters:
ShortestPath (bool) – If true, flips signs to ensure shortest rotational path.
- static Slerp(q0: cQuat, q1: cQuat, s: float, ShortestPath: bool = True) cQuat[source]#
- Spherical Linear Interpolation (SLERP).
Provides constant speed interpolation along the arc.
- static Squad(q1: cQuat, A: cQuat, B: cQuat, C: cQuat, s: float) cQuat[source]#
- Spherical Quadrangle Interpolation (SQUAD).
Used for smooth spline interpolation between quaternions.
- class cPlane(Normal: cVec3, Offset: float)[source]#
Bases:
objectClass representing a generic plane in 3D space.The plane is defined by the equation: ax + by + cz + d = 0.
The vector (a, b, c) represents the plane’s normal, and d representsthe distance factor relative to the origin.- a: float#
- brief X component of the plane normal (A in the plane equation).
- b: float#
- brief Y component of the plane normal (B in the plane equation).
- c: float#
- brief Z component of the plane normal (C in the plane equation).
- d: float#
- brief Distance coefficient (D in the plane equation).
- SetNormalize(A: float, B: float, C: float, D: float)[source]#
- Sets the plane coefficients and normalizes them.
- Parameters:
A (float) – X component.
B (float) – Y component.
C (float) – Z component.
D (float) – Distance coefficient.
- GetNormal() cVec3[source]#
- Gets the normal vector of the plane.
- Returns:
Const reference to the normal vector (interpreted from a, b, c).
- Return type:
- SetOffset(Offset: float)[source]#
- Sets the offset (distance to origin).
Note: Internal ‘d’ is stored as -Offset.
- Parameters:
Offset (float) – The distance from the origin.
- SetFromPointAndNormal(Pt: cVec3, Normal: cVec3)[source]#
- Defines the plane from a point and a normal.
- MoveToPoint(p: cVec3)[source]#
- Moves the plane so that it passes through the specified point.
The normal vector remains unchanged.
- Parameters:
p (cVec3) – The point to move the plane to.
- Distance(p: cVec3) float[source]#
- Calculates the signed distance from a point to the plane.
- Parameters:
p (cVec3) – The point to check.
- Returns:
Positive value if in front, negative if behind, zero if on the plane.
- Return type:
float
- ProjectVector(u: cVec3) cVec3[source]#
- Projects a vector onto the plane (removes the component parallel to the normal).
- FlipNormal()[source]#
- Inverts the normal of the plane and the distance coefficient.
Effectively flips the front and back sides of the plane.
- BelowPlane(B: any, T: cMat4) bool[source]#
- Checks if a bounding box is completely on the negative side of the plane.
- Parameters:
B – The bounding box.
T (cMat4) – Transformation matrix applied to the bounds.
- Returns:
True if all vertices are on the back side.
- Return type:
bool
- ClassifyPoint(p: cVec3, Eps: float) any[source]#
- Classifies a point’s position relative to the plane.
- Parameters:
p (cVec3) – The point to classify.
Eps (float) – Epsilon tolerance for “on the plane” check.
- Returns:
S_FRONT, S_BACK, or S_ON.
- Return type:
any
- ClassifySphere(S: any, Eps: float) any[source]#
- Classifies a sphere’s position relative to the plane.
- Parameters:
S – The sphere to classify.
Eps (float) – Epsilon tolerance.
- Returns:
S_FRONT, S_BACK, or S_CROSS.
- Return type:
any
- IsFrontFacingTo(Dir: cVec3) bool[source]#
- Checks if the plane is facing towards a specific direction.
- Parameters:
Dir (cVec3) – The direction vector.
- Returns:
True if the plane normal opposes the direction vector (dot product <= 0).
- Return type:
bool
- RayIntersection(RayOrig: cVec3, RayDir: cVec3, pScale: float = None, pCross: cVec3 = None) bool[source]#
- Intersects a ray with the plane.
- Parameters:
- Returns:
True if an intersection occurs (ray is not parallel).
- Return type:
bool
- SegIntersection(S0: cVec3, S1: cVec3, pCross: cVec3 = None) bool[source]#
- Intersects a line segment with the plane.
- PlaneIntersection(P: cPlane, pCross: cVec3 = None, pDir: cVec3 = None) bool[source]#
- Intersects this plane with another plane.
- class cMath[source]#
Bases:
objectStatic helper class providing a wide range of mathematical functions. *This class includes constants, trigonometry, interpolation (Linear, Cosine, Hermite, TCB),geometric calculations, random number generation, and utility functions forfloating-point and integer comparisons.- Pi: float = 3.1415927410125732#
- TwoPi: float = 6.2831854820251465#
- < brief Value of Pi (3.14159…)
- HalfPi: float = 1.5707963705062866#
- < brief Value of 2 * Pi
- QuarterPi: float = 0.7853981852531433#
- < brief Value of Pi / 2
- RadsPerDeg: float = 0.01745329238474369#
- < brief Value of Pi / 4
- DegsPerRad: float = 57.2957763671875#
- < brief Multiplier to convert Degrees to Radians
- Epsilon: float = 0.0010000000474974513#
- < brief Multiplier to convert Radians to Degrees
- EpsilonSq: float = 1.0000001111620804e-06#
- < brief Standard small epsilon for float comparisons
- SpaceEpsilon: float = 0.10000000149011612#
- < brief Epsilon squared
- MatrixEpsilon: float = 9.999999974752427e-07#
- < brief Epsilon used for spatial calculations
- MatrixInvertEpsilon: float = 9.9999998245167e-15#
- < brief Epsilon for matrix operations
- dMatrixInvertEpsilon: float = 1.0000000195414814e-24#
- < brief Epsilon for matrix inversion checks (float)
- dEpsilon: float = 1e-06#
- < brief Epsilon for matrix inversion checks (double)
- Sqrt1Over2: float = 0.7071067690849304#
- < brief Standard small epsilon for double comparisons
- Sqrt1Over3: float = 0.5773502588272095#
- < brief Square root of 1/2
- SecsPerMs: float = 0.0010000000474974513#
- < brief Square root of 1/3
- MsPerSec: float = 1000.0#
- < brief Seconds per Millisecond (0.001)
- DoubleMinValue: float = 2.2250738585072014e-308#
- < brief Milliseconds per Second (1000.0)
- DoubleMaxValue: float = 1.7976931348623157e+308#
- < brief Minimum representable positive double (0x0010000000000000)
- FloatMinValue: float = 1.1754943508222875e-38#
- < brief Maximum representable double (0x7fefffffffffffff)
- FloatMaxValue: float = 3.4028234663852886e+38#
- < brief Minimum representable positive float (0x00800000)
- static IsPositiveInfinity(Value: float) bool[source]#
- < rief Checks if value is either positive or negative infinity
- IntMinValue: int = -2147483648#
- < brief Checks if value is negative infinity
- IntMaxValue: int = 2147483647#
- < brief Minimum integer value (0x80000000)
- static MulDiv(Number: int, Numerator: int, Denominator: int) int[source]#
- Multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value.Equivalent to Win32 API “MulDiv”.
- Parameters:
Number (int) – Multiplicand
Numerator (int) – Multiplier
Denominator (int) – Divisor
- Returns:
(Number * Numerator) / Denominator
- Return type:
int
- static IsInRangeExact(f: float, Lo: float, Hi: float) bool[source]#
- < rief Checks if Lo <= i <= Hi (integer)
- static IsInRangeEps(f: float, Lo: float, Hi: float, Eps: float) bool[source]#
- < rief Checks if Lo <= f <= Hi (float)
- static IsValid(f: float) bool[source]#
- < rief Checks if float is a valid number (not infinite, inside bounds)
- static Equals(x: float, y: float, Eps: float) bool[source]#
- < rief Checks if double is close to zero
- static Cerp(a: float, b: float, s: float) float[source]#
- < rief Linear Interpolation: a + s * (b - a)
- static LerperClamp01(Lo: float, Hi: float, x: float) float[source]#
- < rief Inverse Lerp: Returns factor given value x
- static MidPointLerp(Start: float, Mid: float, End: float, s: float) float[source]#
- < rief Inverse Lerp clamped to [0, 1]
- static SinCos(Angle: float, S: float, C: float)[source]#
- < rief Simultaneous Sine and Cosine (float)
- static Periodic(f: float, Lo: float, Hi: float, nPeriods: int = None) float[source]#
- < rief Fractional part (double)
- static IndexForInsert(f: float, Array: float, nCount: int, Stride: int = 0) int[source]#
- < rief Normalizes value to a periodic range
- static AngleEnsureShortestPath180(Alpha: float, Beta: float)[source]#
- < rief Normalizes angle to (-180, 180]
- static AngleDeltaRad(Alpha: float, Beta: float) float[source]#
- < rief Adjusts Beta so transition from Alpha is shortest
- static AngleLerpRad(Alpha: float, Beta: float, s: float) float[source]#
- < rief Smallest difference between two angles in radians
- static AngleDeltaDeg(Alpha: float, Beta: float) float[source]#
- < rief Interpolates between angles in radians correctly
- static AngleLerpDeg(Alpha: float, Beta: float, s: float) float[source]#
- < rief Smallest difference between two angles in degrees
- static EndianSwap4(Src: any, Count: int = 1) any[source]#
- < rief Swap bytes for 16-bit values (Word)