PlatinumFishy Posted February 16, 2017 Share Posted February 16, 2017 (edited) SO, I am currently trying to make mini planets with procedurally generated biomes (Probably too ambitious since I'm still new at Houdini, especially with vex but oh well). I fist scattered a few points around a sphere then assigned those to a group. After merging the new group of points (radial) with the original sphere I wanted to make it so that points within a certain radius of the scattered dots would be colored red. I got everything in a VEX statement but I cant seem to figure out how to color the points nearby, only the point the wrangle is working on. For those who do not want to open a file. int check = inpointgroup(0, "radial" , @ptnum); if (check==1) { int near[] = nearpoints(0, @P, 5); foreach( int i; near) @Cd = {1,0,0}; } Biome.hipnc Edited February 16, 2017 by PlatinumFishy Quote Link to comment Share on other sites More sharing options...
mine Posted February 16, 2017 Share Posted February 16, 2017 (edited) You find the near points, and that's ok, but then you just color red the @ptnum and not the points the nearpoints function has returned. I guess it should be something like this: int check = inpointgroup(0, "radial" , @ptnum); vector red = set(1,0,0); if (check==1) { int near[] = nearpoints(0, @P, 0.1,5); foreach( int i; near) setpointattrib(0, "Cd", i,red); } Note that I added an additonal parameter to the nearpoints function to indicate the maximum distance (0.1) (edit: now I realise this parameter it's not necessary, but anyway I think it's better to hace more control. Whatever floats your boat): int [] nearpoints(string geometry, vector pt, float maxdist, int maxpts) Edited February 16, 2017 by mine Quote Link to comment Share on other sites More sharing options...
PlatinumFishy Posted February 16, 2017 Author Share Posted February 16, 2017 8 minutes ago, mine said: foreach( int i; near) setpointattrib(0, "Cd", i,red); Thank you! that did the trick. While I was waiting I was trying to input all the points in the "near" array into a group and /then/ color it. I do have one question though, isn't "i" just a place holder for the " near" array? Meaning not the actual point number? Quote Link to comment Share on other sites More sharing options...
mine Posted February 16, 2017 Share Posted February 16, 2017 Glad to help. in every iteration "i" stores the value of the array, so as the function nearpoints returns an aarray containing the point number of every point found, in every iteration "i" stores the pointnumber of a "near point". The you can use that point number to set his color attribute Quote Link to comment Share on other sites More sharing options...
acey195 Posted February 16, 2017 Share Posted February 16, 2017 for reference: @Cd = {1,0,0}; only affects the point itself (that it is currently processing) So it would apply the "sun" color to the "sun", one time for every point found, but since it is the same color, that would be hard to see of course. 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.