# 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.y=0;
@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.

Naim.

##### 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

##### 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

```{1,0,-0.555548}{1,0,0.143698}{1,0,-0.576412}{1,0,0.0447447}fin
{1,0,-0.555548}{1,0,0.143698}{1,0,-0.576412}{1,0,0.0447447}fin
{1,0,-0.555548}{1,0,0.143698}{1,0,-0.576412}{1,0,0.0447447}fin
{1,0,-0.555548}{1,0,0.143698}{1,0,-0.576412}{1,0,0.0447447}fin```

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.

Naim

Edited by nemsi
##### 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.

##### Share on other sites

Thank you Fencer!!!

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×