VEX - Accessing/printing coordinates from point ID

   71   1   1
User Avatar
Member
1 posts
Joined: 3月 2025
オフライン
Hi all

In an Attribute Wrangle:

int p0 = addpoint(0, set(0,0,0));
int p1 = addpoint(0, set(1,0,0));
int p2 = addpoint(0, set(1,1,0));

vector pos = point(geoself(), "P", p2);
printf("Position of p2 is: %g\n", pos); // This prints Position of p2 is: {0,0,0} which is wrong

I would like to access the coordinates of p2 and print them out. I'm using:

vector pos = point(geoself(), "P", p2);
printf("Position of p2 is: %g\n", pos);

but instead of printing {1,1,0} it prints {0,0,0} which is wrong.
How could I print or access the coordinates correctly?

Thanks in advance
User Avatar
Member
9479 posts
Joined: 7月 2007
オフライン
you can't

addpoint(), setpointattrib() and many other functions that allow creating/writing data to new or non-current element are queued to be executed later as a single threaded operation

furthermore point() or other functions that query data currently query the input geometry even if geoself() is used, as currently geoself() just returns 0 which is the cached first input geo

so currently writing/reading the newly written values within a single wrangle is limited to current element only using @ binding

EDIT: or if you are running within Detail wrangle you can probably store the values in an array to keep track of them yourself
Edited by tamte - 昨日 16:14:32
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links