otto Posted April 13, 2018 Share Posted April 13, 2018 Hi! How can I test and avoid that two neighbour points gets same exact attribute value when using random in attribcreate? Here illustrated with a simple setup with ordered grid points as input. My attribute my_number is rand($PT)*5 loop.hip Quote Link to comment Share on other sites More sharing options...
3dome Posted April 13, 2018 Share Posted April 13, 2018 try to widen the range of values. now they only go from 0-5 make it big like 0-9999 or try not to use $PT instead use ($PT*4542248.26) [some big random number in there] Quote Link to comment Share on other sites More sharing options...
otto Posted April 13, 2018 Author Share Posted April 13, 2018 Thanks for the quick reply 3dome. Unfortunately, I have a limited range of values to choose from in my setup (the screenshots were from an example file), so I can't use that approach. Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted April 13, 2018 Share Posted April 13, 2018 Hi, here is an approach using a foreach and checking each neighbour for each point. loopX.hipnc 1 Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted April 14, 2018 Share Posted April 14, 2018 Hi again, if you want avoid the while loop, which potentially can fail, here is another (similar) way. loopY.hipnc 1 Quote Link to comment Share on other sites More sharing options...
otto Posted April 14, 2018 Author Share Posted April 14, 2018 Thank you so much Aizatulin, this works great! I will put it to good use. 1 Quote Link to comment Share on other sites More sharing options...
otto Posted April 14, 2018 Author Share Posted April 14, 2018 Just another question, @Aizatulin. Is it possible to make this setup work on points that are not on a grid, but for instance a set of points that are created from a singe point copied 10x horizontally and 10x vertically (see example file)? I tried using nearpoints instead of neighbours, but I am not sure how to get the point position in this code. Sorry, I am an absolute beginner when it comes to VEX . loopZ.hipnc Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted July 31, 2019 Share Posted July 31, 2019 (edited) Hi, damn I missed this answer completely (sorry) If still interested, here is a modified version working of loopZ. The neighbour() function can be replaced by the pcfind() function, which is searching all neighbours, which are in a specific radius but not necessarily connected. It can be an idea to use a limit for the maximal neighbour count, which can be 8 for example. loopZ.hipnc Edited July 31, 2019 by Aizatulin 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.