vpRotate(3)
π« vpRotate β bestie edition π«
okay so real quick, this is from the Library Functions Manual and it's all about vpRotate, a lil function that spins your stuff around. not literally spinning you around (though honestly? mood). let's get into it π
β¨ NAME β¨
vpRotate β multiply the current transformation matrix by a rotation matrix
like. that's the whole job. it rotates. it multiplies. it slays. π
πΈ SYNOPSIS πΈ
#include <volpack.h>
vpResult
vpRotate(vpc, axis, degrees)
vpContext *vpc;
int axis;
double degrees;
π¦ ARGUMENTS π¦
vpcβ your VolPack context, the one you got fromvpCreateContext. it's the main character of your whole rendering situation fr.axisβ the rotation axis code. has to be one ofVP_X_AXIS,VP_Y_AXISorVP_Z_AXIS. pick your vibe, bestie.degreesβ how many degrees you wanna rotate. that's it, that's the number.
π DESCRIPTION π
so vpRotate multiplies the current transformation matrix by a 4-by-4 rotation matrix. iconic behavior honestly.
the rotation axis has to be one of the three principal viewing axes, and you specify it with one of these codes:
VP_X_AXISβ X axisVP_Y_AXISβ Y axisVP_Z_AXISβ Z axis
the rotation angle is given in degrees. and listen, this part matters: a positive angle means a clockwise rotation when you're looking towards the positive direction along the axis. lowkey important, don't sleep on it π
for an X-axis rotation, the rotation matrix is:
1 0 0 0
0 cos(d) sin(d) 0
0 -sin(d) cos(d) 0
0 0 0 1
for a Y-axis rotation, the rotation matrix is:
cos(d) 0 -sin(d) 0
0 1 0 0
sin(d) 0 cos(d) 0
0 0 0 1
for a Z-axis rotation, the rotation matrix is:
cos(d) sin(d) 0 0
-sin(d) cos(d) 0 0
0 0 1 0
0 0 0 1
(where d stands for the degrees argument, in case that wasn't obvious β no shade, just saying π«Ά)
use vpCurrentMatrix to set the current transformation matrix. by default, the rotation matrix is post-multiplied, like:
M = M*R
where M is the current matrix and R is the rotation matrix. but if you're feeling a different flavor, the VP_CONCAT_MODE option to vpSeti can be used to select pre-multiplication. options, we love to see it β¨
π STATE VARIABLES π
the current matrix concatenation parameters can be retrieved with these state variable codes (peep vpGeti(3) for the deets):
VP_CURRENT_MATRIXVP_CONCAT_MODE
π ERRORS π
the normal return value is VP_OK. literally the good ending.
the following error return value is possible:
VPERROR_BAD_OPTIONβ theaxisargument is invalid. like bestie, that's not one of the three axes. read the room π
π₯ SEE ALSO π₯
reminder that a positive angle = clockwise rotation when looking towards the positive direction along the axis. write it on your hand if you have to π
okay that's the whole page, mwah π this was VolPack, vpRotate(3), and that's a wrap β go rotate something gorgeous πβ
π¦ where this page comes from
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- Copyright (c) 1995-2008, Stanford University
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms