mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 09:08:53 +00:00
docs: clarify some rotation rules
This commit is contained in:
@@ -110,7 +110,24 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_rotate(mat4 m, float angle, vec3 axis)
|
.. c:function:: void glm_rotate(mat4 m, float angle, vec3 axis)
|
||||||
|
|
||||||
rotate existing transform matrix around Z axis by angle and axis
|
rotate existing transform matrix around given axis by angle at ORIGIN (0,0,0)
|
||||||
|
|
||||||
|
**❗️IMPORTANT ❗️**
|
||||||
|
|
||||||
|
If you need to rotate object around itself e.g. center of object or at
|
||||||
|
some point [of object] then `glm_rotate_at()` would be better choice to do so.
|
||||||
|
|
||||||
|
Even if object's model transform is identiy, rotation may not be around
|
||||||
|
center of object if object does not lay out at ORIGIN perfectly.
|
||||||
|
|
||||||
|
Using `glm_rotate_at()` with center of bounding shape ( AABB, Sphere ... )
|
||||||
|
would be an easy option to rotate around object if object is not at origin.
|
||||||
|
|
||||||
|
One another option to rotate around itself at any point is `glm_spin()`
|
||||||
|
which is perfect if only rotating around model position is desired e.g. not
|
||||||
|
specific point on model for instance center of geometry or center of mass,
|
||||||
|
again if geometry is not perfectly centered at origin at identity transform,
|
||||||
|
rotation may not be around geometry.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transform
|
| *[in, out]* **m** affine transform
|
||||||
|
@@ -219,7 +219,7 @@ glm_rotate_z(mat4 m, float angle, mat4 dest) {
|
|||||||
* center of object if object does not lay out at ORIGIN perfectly.
|
* center of object if object does not lay out at ORIGIN perfectly.
|
||||||
*
|
*
|
||||||
* Using `glm_rotate_at()` with center of bounding shape ( AABB, Sphere ... )
|
* Using `glm_rotate_at()` with center of bounding shape ( AABB, Sphere ... )
|
||||||
* would be an easy option to rotate around object if this is not work for you.
|
* would be an easy option to rotate around object if object is not at origin.
|
||||||
*
|
*
|
||||||
* One another option to rotate around itself at any point is `glm_spin()`
|
* One another option to rotate around itself at any point is `glm_spin()`
|
||||||
* which is perfect if only rotating around model position is desired e.g. not
|
* which is perfect if only rotating around model position is desired e.g. not
|
||||||
|
Reference in New Issue
Block a user