JJ FX Posted June 17, 2018 Share Posted June 17, 2018 (edited) Hi, I have this piece of code float scale[]; for (int i=0; i<@numpt; i++) { float size = point(geoself(), "area", @ptnum); scale[i] = size; } f[]@testing = scale; Which gives me an array of the same value for each point. So: 0: [12,12,12,12....] 1: [4,4,4,4....] 2: [67,67,67,67...] .... What I want is an exact array for each of the points from @area. This way when I sort the array, I can get the biggest value, and therefore keep only the biggest object (because Im using packed geometry) EDIT: I know I can just sort with sort SOP by attrib. But just trying to uderstand and learn VEX and wrangles better Edited June 17, 2018 by JJ FX Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted June 18, 2018 Share Posted June 18, 2018 (edited) use append append(scale,size); Edited June 18, 2018 by ThomasPara wrong tag Quote Link to comment Share on other sites More sharing options...
fsimerey Posted June 18, 2018 Share Posted June 18, 2018 21 hours ago, JJ FX said: Hi, I have this piece of code float scale[]; for (int i=0; i<@numpt; i++) { float size = point(geoself(), "area", @ptnum); scale[i] = size; } f[]@testing = scale; Which gives me an array of the same value for each point. So: 0: [12,12,12,12....] 1: [4,4,4,4....] 2: [67,67,67,67...] .... What I want is an exact array for each of the points from @area. This way when I sort the array, I can get the biggest value, and therefore keep only the biggest object (because Im using packed geometry) EDIT: I know I can just sort with sort SOP by attrib. But just trying to uderstand and learn VEX and wrangles better Do you run this wrangle in Detail Mode ? I'm pretty sure not if you can access to the @ptnum variable... Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted June 18, 2018 Share Posted June 18, 2018 18 minutes ago, fsimerey said: Do you run this wrangle in Detail Mode ? I'm pretty sure not if you can access to the @ptnum variable... If one wants to run it in Detail mode, one should indeed use the npoints(0) function that returns the number of points of the first stream of geo incoming in the Wrangle node. That being said, I don't see the point of running that code on Points, as it basically process the same thing npoints times :-) 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.