Jump to content
girtab

Learning challenge Vex

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 this post


Link to post
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();
float angle = radians(ch("angle")*pt01*100);
vector axis = v@tangentu;
vector Newm;

rotate(m, angle, axis);

v@at *= m;

and your @at is twist

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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'));
float angle_Y = radians(chf('angle_Y'));
float angle_Z = radians(chf('angle_Z'));

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

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×