Jump to content

using array to store point position


Recommended Posts

Hi guys,

I'm a little confused about how to store many points position in an array..

// initialise some mouvement
float va = ch('val');
@P = @P*(cos(@Time*f@va*@ptnum/@numpt));

// stick point to position to help understand
@P.x =1;

int nbTotal= @numpt;
vector mypoint = @ptnum;
vector pos[] ;

for (int i = 0; i<nbTotal-1; i++) {
// attribute position to an array
pos[i] = @P;
//float dist = distance(pos[i+1], pos[i]);


Thank you for helping.


Link to comment
Share on other sites

You alredy doing this. Check "pos" in spreadsheet with assign attribute like "v[]@temp = pos;" after loop
You also can fill array with "push(pos, @P);"
Also check loop limit, i<nbTotal-1 should be i<nbTotal

  • Thanks 1
Link to comment
Share on other sites

Hi Fencer,

thank you for your time!! i corrected for the nbTotal, but something is confusing me about this way.. My "printf" give me this 4 times... I mean every loop give me all points, I thaught each different point is given once at each loop, no?.. "fin" is helping me to know where is then end of each loop


What I would like is :

pos[1] = first point

pos[2] = second point

pos[3] =third point...

and not :

pos[1] = (first point, second point,third point,..)

pos[2] = (first point, second point,third point,..)

pos[3] = (first point, second point,third point,..)


Thank you.


Edited by nemsi
add more info
  • Thanks 1
Link to comment
Share on other sites

This is currect. Wrangle is working in "run over" - "points mode" mode. You have feedback with every point.
If you wish run wrangle once use Detail (only once) mode. But in this case you don't have direct access to point like @P (use point(0, "P", num) instead).
Search more about how wrangle is working.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...