## Recommended Posts

I am in the same boat with you, just start learning VEX and Houdini, I even did not complete the entagma parallel transport!. If I learn something new out of this thread I will post it here (like I did with the circle) ##### Share on other sites

cool ! tomorrow I will post the normal rotation with matrix and the version with sin

##### Share on other sites

If you remember the last picture I posted after the poly frame create a wrangle :
v@up = cross(v@tangentv, v@tangentu);
v@at = v@tangentv;

after that a new wrangle:

float pt01 = float(i@ptnum)/float(i@numpt);

pt01 = chramp("shape", pt01);

matrix m = ident();
vector axis = v@tangentu;
vector Newm;

rotate(m, angle, axis);

v@at *= m;

##### Share on other sites

Is it a correct way to do a three-axis rotation with the matrix?

```// DEFINE VARIABLES
// Rotation matrix
matrix3 matrx = ident();
// Angle control with UI
float angle_X = radians( chf('angle_X') );
float angle_Y = radians( chf('angle_Y') );
float angle_Z = radians( chf('angle_Z') );
// Define rotation axis
vector axis_X = {1, 0, 0};
vector axis_Y = {0, 1, 0};
vector axis_Z = {0, 0, 1};

// BUILD FUNCTIONALITY
// Rotate matrix by axis
rotate ( matrx, angle_X, axis_X);
rotate ( matrx, angle_Y, axis_Y);
rotate ( matrx, angle_Z, axis_Z);

// Apply rotation: multiply position by matrix
@P *= matrx; ```

Edited by kiryha

##### Share on other sites

I'm not very good on matrix but you can use matrix with so many way.

using quaterion matrix3 ect..

there is an ther way to achieve this exercice without matrix.
replace the second wrangle by that:

float pt01, twistx, twisty;
vector x, y, z;

x = v@tangentv;
y = v@up;
z = v@tangentu;

pt01 = float(i@ptnum)/float(i@numpt);

twistx = sin(pt01 * ch("amount")) * ch("strength");
twisty = cos(pt01 * ch("amount")) * ch("strength");

x *= twistx;
y *= twisty;

v@at = x + y;

v@N = v@tangentu;
v@up = v@at;

##### Share on other sites

I did not find a more elegant way of three-axis rotations with matrix but with quaternions it is:

```float angle_X = radians(chf('angle_X'));

vector rotations = set(angle_X,angle_Y,angle_Z);
@P = qrotate(quaternion(rotations), @P);```

## Create an account

Register a new account