Jump to content

Vex shifting values.


Crisis

Recommended Posts

Hi.

 

Probably this is trivial but i don't know how to deal with this in Vex in very optimal way.

 

I have problem with shifting values in Vex. For example I have a line with points from 0 - 100.

Points have Cd from point 0 - 0 in Cd.r to 100  - 1 in Cd.r.  How to shift this values about custom value? ( If last value is shifted then must go to the begining of my list of points ).

I can do this in loop by checking last value and storing it in temporary parameter , but this is not a very optimal way.

 

I'm searching for function but I don't see any.

 

 

Link to comment
Share on other sites

Modulo indeed a way to go and worth to learn about. Here's some pieces to help with a VEX setup:
vertexprimindex() gives you the index on a primitive and  primvertexcount() gives you max amount. Modulo the first with the second while adding an offset value to the first and you got your carrousel.

Or... you can just shift the points with Sort SOP and read the value from the point with the same newly aquired index. Scene PRB_ShiftAttrib.hiplc
cht7X0D.gif

 

Another example of a setup using Modulo. If confused check the initial explanation.

 

Cheers

 

Edited by probiner
Link to comment
Share on other sites

Thanks. I probably do it wrong but I cant figure out how to do it by modulo operator.

 

I used sawtooth function. Not to hard to fit this function in range.

Still simple code, but maybe some novice as I, will feel this is a usefull.


 

float amplitude = chf("amplitude");

// sawtooth - function with offset about an amplitude. - Begining at 0 and rising up. With animation.


@P.y =((-2 * amplitude)/3.14) * atan(1/tan((@Cd.r + @Time * -0.5 * 3.14)/chf("period"))) + amplitude;

Yes i like to complicate everything. But this make so fun :) even if I don't have to much free time.

Edited by Crisis
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...