Jump to content

[SOLVED]Modulus Range Expression? (as one line)


Recommended Posts

Ok, I have 160,000 points being skinned down a curve using a circle. I want to divide the curve into 10 sections. Each of the circles in that section gets it's own random value applied to the radius of the circle through a stamp function.

 

So I have $NPT, $PT and the number 10 to determine my section count.

 

What expression would I type into the Value1 field of the Stamp TAB of the Copy node to produce the above desired effect?

 

if I had multiple lines I could calculate the value I need  to supply to the rand() seed to produce the desired effect but I am stumped on how to create this in one line of Hscript code.

 

Here is the pseudo code I would like converted into one line.

$NPT = 160000
sections = 10
delta = $NPT/sections
result = 0
if $PT > delta: result =1
if $PT > delta*2: result = 2
if $PT > delta*3: result =3
if $PT > delta*4: result = 4
if $PT > delta*5: result =5
if $PT > delta*6: result = 6
if $PT > delta*7: result =7
if $PT > delta*8: result = 8
if $PT > delta*9: result =9

In the end the result would be routed to the random seed so that only 10 different circle sizes appeared along the skinned tube via stamping.

Edited by Atom
Link to comment
Share on other sites

Thanks for the Wrangle solution but I need to type the final expression into an hScript expression field inside a Copy node. But that is close. I just need to find the hscript equivalent of floor. and int.

 

More pseudo code.

int(floor($PT/$NPT*10))
Edited by Atom
Link to comment
Share on other sites

Thank you for the insight. That does indeed work. I placed the AttributeWrangle before the RIGHT input of the Copy. Then I can reference the attribute name in the stamp as you mention along the LEFT input stream.

 

Now my curve has a different radius but only in the ten sections I want.

post-12295-0-73382300-1436712840_thumb.j

Edited by Atom
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...