Justin K Posted November 10, 2017 Share Posted November 10, 2017 (edited) Hey All, Simple question here. If you have a line, can you randomize the ptnum using only the existing ptnum values (0-24) and associated P positions? So ptnum 1 (0,4,0) is now ptnum 7 (0,12,0), ptnum 3 is now (0,12,0), replacing ptnum 12, etc. I know you can do this with a Sort Sop (random) but I'd like to do it in a Vex Sop Specifically, and then in a wrangle afterwards--its a tech challenge thing. I feel like this is simple and Im missing something pretty basic. Also, bonus question, what is the difference between ptnum and id in vop globals? They are behaving as if they were the same thing when I am running orders (say random) across points. Thanks! Edited November 10, 2017 by JKeil Quote Link to comment Share on other sites More sharing options...
djiki Posted November 18, 2017 Share Posted November 18, 2017 Hm, sorting using random gives you actually similar thing as if you do: @myindex = rand(@ptnum); (this is in pointwranglenode) and now you can use sort node but instead random choose sort by attribute and enter myindex as name for it. If you are familiar with math you can also try something like: @myindex = cos(2 * 3.1415926 * @ptnum / float(@numpt)); or any other, your, function to calculate values of myindex which when sorted gives you order you want. ptnum is the basically index of point in some node and it is NOT "stick" to point. So for example if you have line with 10 points (ptnum goes from 0 to 9) and if you delete some point in the middle of the line you will see (in spreadsheet) that number of points is decreased (and become 0 to 8). It is simple counter of points after some operation. In general, any node which result affects the point count will make ptnum "floats" over points. Think on it as simple array from zero to numpt-1 without "holes" in it. All numbers are there. @id is attribute, same as your custom attribute let say @myindex and it is stick to point. So for example if your line of 10 points initially have @index attribute equal to @ptnum, when you delete let say point with @ptnum=4 (or @index=4 same thing) remaining 9 points will have ptnum from 0 to 8 (because it is simple counter of remaining points) while @index attribute on those 9 points will be: 0,1,2,3,5,6,7,8,9 Quote Link to comment Share on other sites More sharing options...
Justin K Posted November 20, 2017 Author Share Posted November 20, 2017 On 11/18/2017 at 1:58 AM, djiki said: Hm, sorting using random gives you actually similar thing as if you do: @myindex = rand(@ptnum); (this is in pointwranglenode) and now you can use sort node but instead random choose sort by attribute and enter myindex as name for it. If you are familiar with math you can also try something like: @myindex = cos(2 * 3.1415926 * @ptnum / float(@numpt)); or any other, your, function to calculate values of myindex which when sorted gives you order you want. ptnum is the basically index of point in some node and it is NOT "stick" to point. So for example if you have line with 10 points (ptnum goes from 0 to 9) and if you delete some point in the middle of the line you will see (in spreadsheet) that number of points is decreased (and become 0 to 8). It is simple counter of points after some operation. In general, any node which result affects the point count will make ptnum "floats" over points. Think on it as simple array from zero to numpt-1 without "holes" in it. All numbers are there. @id is attribute, same as your custom attribute let say @myindex and it is stick to point. So for example if your line of 10 points initially have @index attribute equal to @ptnum, when you delete let say point with @ptnum=4 (or @index=4 same thing) remaining 9 points will have ptnum from 0 to 8 (because it is simple counter of remaining points) while @index attribute on those 9 points will be: 0,1,2,3,5,6,7,8,9 Thanks for the post, makes perfect sense Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.