Recommended Posts

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 by JJ FX

Share on other sites
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...

Share on other sites
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 :-)