nemsi Posted February 1, 2018 Share Posted February 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
fencer Posted February 1, 2018 Share Posted February 1, 2018 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 1 Quote Link to comment Share on other sites More sharing options...
nemsi Posted February 1, 2018 Author Share Posted February 1, 2018 (edited) 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 February 1, 2018 by nemsi add more info 1 Quote Link to comment Share on other sites More sharing options...
fencer Posted February 1, 2018 Share Posted February 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
nemsi Posted February 1, 2018 Author Share Posted February 1, 2018 Thank you Fencer!!! 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.