Last active
November 11, 2017 15:16
-
-
Save bonsak/f987259d8e778c8d05723d665591f0e7 to your computer and use it in GitHub Desktop.
Houdini Vex Randomize point numbersFrom https://www.sidefx.com/forum/topic/52579/?page=1#post-236410
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Run in a detail wrangle. Added .h to get syntax highlighting | |
| i[]@index; | |
| int rand; | |
| vector newpos; | |
| int succ; | |
| // create a simple ordered array | |
| for (int i=0; i<@numpt;i++){ | |
| @index[i] = i; | |
| } | |
| // set new point position from a random array index and shrinking the array for each iteration so we only select unused indexes. | |
| for (int i = 0; i < @numpt; i++){ | |
| rand = int(fit01(rand(i + chf('seed')),0 ,len(@index))); | |
| newpos = pointattrib( 0, 'P', pop(@index, rand), succ ); | |
| setpointattrib(0,'P', i, newpos); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment