konstantin magnus Posted November 26, 2016 Share Posted November 26, 2016 (edited) I am trying to create a subway network with VEX. In order to define individual end stations I assigned all points to sectors according to their radial position. Now I am looking for a way to find the bluest/greenest point for each sector. i@result shows me the best match for all the points, but how can I loop through groups (i.e. "sector_0", "sector_1" and so on) and put all matching points into one array? vector seek_clr = {0,1,1}; //Finds points with a similar color int pcloud = pcopen(0, "P", @P, 0.4, 6); int closecolor[] = pcfind(0, "sector_0", "Cd", seek_clr, 2, 5); i@result_0 = closecolor[1]; vex_subway_sectors.hipnc Edited November 27, 2016 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
Shinjipierre Posted November 26, 2016 Share Posted November 26, 2016 Try to use findshortestpath instead. Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted November 26, 2016 Author Share Posted November 26, 2016 (edited) 1 hour ago, Shinjipierre said: Try to use findshortestpath instead. I am not looking for a pathfinding solution. I basically want to split up a pointcloud function in areas. Edited November 26, 2016 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
deniz Posted November 26, 2016 Share Posted November 26, 2016 (edited) you could sort your points by their polar angle and range them for exemple 300-330 is blue "converting between polar and cartesian coordinates" https://en.wikipedia.org/wiki/Polar_coordinate_system Edited November 26, 2016 by deniz Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted November 26, 2016 Author Share Posted November 26, 2016 (edited) please look at the file first. the whole thing is already done with polar coords. and maybe read my post: 3 hours ago, konstantin magnus said: I am looking for a way to find the bluest/greenest point for each sector Edited November 26, 2016 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
deniz Posted November 27, 2016 Share Posted November 27, 2016 (edited) i am sorry i answered in affect when i saw the picture, but "seek" is not defined, int extreme[] = pcfind(0, "Cd", seek, 2, 1); is maybe what you are looking for Edited November 27, 2016 by deniz Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted November 27, 2016 Author Share Posted November 27, 2016 (edited) 2 hours ago, deniz said: maybe what you are looking for No, thats not it. I think I just need to know how to use point clouds inside for loops or maybe rather for loops inside point clouds. Edited November 27, 2016 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
deniz Posted November 27, 2016 Share Posted November 27, 2016 22 minutes ago, konstantin magnus said: No, thats not it. I think I just need to know how to use point clouds inside for loops. i dont get it why you are using closestpoint, you want to find the bluest/greenest color value for each sector and store the bluest/greenest from each sector to a list right ? Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted November 27, 2016 Author Share Posted November 27, 2016 (edited) colors and positions are interchangeable I hope. thats why pcfind should also be able to look for colors in points. Maybe I have to iterate through point groups use separate arrays for each sector to finally assign the first entries of each array to one big array Or is there an easier solution? Edited November 27, 2016 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
deniz Posted November 27, 2016 Share Posted November 27, 2016 tutorialminmax.hip Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted November 27, 2016 Author Share Posted November 27, 2016 (edited) I found a solution: vector seek_clr = {0,1,1}; int sectors = detail(0, "sectors", 0); i[]@result[sectors]; int pcloud = pcopen(0, "P", @P, 0.4, 6); for(int i = 0; i < sectors; i++) { string group = s[]@groups[i]; int closecolor[] = pcfind(0, group, "Cd", seek_clr, 2, 5); if(closecolor[1] == @ptnum) setpointgroup(0, "in", @ptnum, 1, "set"); @result[i] = closecolor[1]; } Edited November 27, 2016 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
petz Posted November 27, 2016 Share Posted November 27, 2016 (edited) for something like this it´s most probably faster to just interate over the points instead of using pcfind. when you rely on pointcloud functions houdini needs to build a kdtree and in your case it has to rebuild the tree for every "sector". since accessing the tree is fast but building it is relatively slow you loose the advantage of using pointclouds. this becomes even more apparant when you have a high number of "sectors". anyway, both versions are attached ... hth. petz vex_subway_sectors1.hipnc Edited November 27, 2016 by petz 2 Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted November 27, 2016 Author Share Posted November 27, 2016 thank you! i will try to get this.. 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.