1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-16 18:01:40 +00:00

Improve :compose documentation

This commit is contained in:
Lars Mueller 2025-06-02 19:28:22 +02:00
parent b4dbda3eb7
commit c3cb0a6d4e

View file

@ -4180,6 +4180,7 @@ Constructors
* All angles in radians. * All angles in radians.
* Mathematically equivalent to `Rotation.compose(Rotation.z(roll), Rotation.y(yaw), Rotation.x(pitch))`. * Mathematically equivalent to `Rotation.compose(Rotation.z(roll), Rotation.y(yaw), Rotation.x(pitch))`.
* Consistent with the euler angles that can be used for bones or attachments. * Consistent with the euler angles that can be used for bones or attachments.
* `Rotation.compose(...)`: See methods below.
Conversions Conversions
----------- -----------
@ -4203,11 +4204,12 @@ Methods
------- -------
* `Rotation:apply(vec)`: Returns the result of applying the rotation to the given vector. * `Rotation:apply(vec)`: Returns the result of applying the rotation to the given vector.
* `Rotation.compose(...)`: Returns the composition of the given rotations, * `Rotation.compose(...)`: Returns the composition of the given rotations.
in right-to-left order: `second:compose(first):apply(v)` * `Rotation.compose()` is an alias for `Rotation.identity()`.
is equivalent to `second:apply(first:apply(v))`. * `Rotation.compose(rot)` copies the rotation.
`Rotation.compose()` is an alias for `Rotation.identity()`, * `rot:compose(...)` is shorthand for `Rotation.compose(rot, ...)`.
`Rotation:compose()` copies the rotation. * Right-to-left order: `second:compose(first):apply(v)`
is equivalent to `second:apply(first:apply(v))`.
* `Rotation:invert()`: Returns the inverse rotation. * `Rotation:invert()`: Returns the inverse rotation.
* `Rotation.slerp(from, to, time)`: Interpolate from one rotation to another. * `Rotation.slerp(from, to, time)`: Interpolate from one rotation to another.
* `time = 0` is all `from`, `time = 1` is all `to`. * `time = 0` is all `from`, `time = 1` is all `to`.
@ -4251,6 +4253,7 @@ Constructors
component-wise scaling factors to vectors. component-wise scaling factors to vectors.
* `Matrix4.reflection(normal)`: Constructs a matrix that reflects vectors * `Matrix4.reflection(normal)`: Constructs a matrix that reflects vectors
at the plane with the given plane normal vector (which need not be normalized). at the plane with the given plane normal vector (which need not be normalized).
* `Matrix4.compose(...)`: See methods below.
Methods Methods
------- -------
@ -4277,11 +4280,12 @@ Linear algebra:
* `Matrix4:transform_direction(dir)`: * `Matrix4:transform_direction(dir)`:
* Apply the matrix to a vector representing a direction. * Apply the matrix to a vector representing a direction.
* Ignores the fourth row and column; does not apply the translation (w = 0). * Ignores the fourth row and column; does not apply the translation (w = 0).
* `Matrix4.compose(...)`: Returns the composition of the given matrices * `Matrix4.compose(...)`: Returns the composition of the given matrices.
in right-to-left order: `second:compose(first):apply(v)` * `Matrix4.compose()` is equivalent to `Matrix4.identity()`.
is equivalent to `second:apply(first:apply(v))`. * `Matrix4.compose(mat)` is equivalent to `mat:copy()`.
If `...` is empty, this is just the identity. * `mat:compose(...)` is shorthand for `Matrix4.compose(mat, ...)`.
`Matrix4:compose()` copies the matrix. * Right-to-left order: `second:compose(first):apply(v)`
is equivalent to `second:apply(first:apply(v))`.
* `Matrix4:determinant()`: Returns the determinant. * `Matrix4:determinant()`: Returns the determinant.
* `Matrix4:invert()`: Returns a newly created inverse, or `nil` if the matrix is (close to being) singular. * `Matrix4:invert()`: Returns a newly created inverse, or `nil` if the matrix is (close to being) singular.
* `Matrix4:transpose()`: Returns a transposed copy of the matrix. * `Matrix4:transpose()`: Returns a transposed copy of the matrix.