Jump to content

randomly rotate in a copy and transform


Recommended Posts

attached hip, I need to rotate randomly each copy in a copy and transform sop. I know I can do that with a copy to points and orient, but I need each copy to be proprotoionally bigger than the previous, this isn't about random pscale, they have to be 10% bigger than the previous one, this is why I need to use the copy and  transform, but then I've never randomised the rotation in a copy and transform sop. Any idea?

randomly rotate in a copy and transform.png

randomly_rotate_copies_in_a_copy_and_transform.hiplc

Link to comment
Share on other sites

Copy to Points can still be used.
You just have to bake in the consideration you mentioned into the attributes you need.

orient can be randomized as you pointed out.
Then, you need pscale to be 10% bigger for each copies.

Make as many points as you need (point generate, add, or whatever way to create points).
Each point has a point number associated with them. If you set the pscale to the point number, then it'll go from 0 to 1, 2, 3, and so on for each points. That would be making each copies 100% bigger each time.
If you multiply this by 0.1, then you get 0, 0.1, 0.2, 0.3, and so on.
You need the scale to start at 100%, which is pscale 1, so add 1 to the result.
You get 1.0, 1.1, 1.2, 1.3, and so on.

And there you have it, each copies are 10% bigger than the previous one !

You can edit anything you want on the template points, such as the position (set the position to the point number multiplied by 5 in the y axis, for example).

float scale_factor = 0.1;
@pscale = @ptnum * scale_factor + 1;
@P.y = @ptnum * 5;
Edited by Alain2131
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...