How do I access, within a loop, the next point in a list of points?
I want to compute the angle between every pair of adjacent points.
points = [ [0,0],[25,20],[30,50],[17,50],[7,30],[10,45],[35,35]];
for (i=points)
{
translate(i) square(1);
//do something with the next point ??
}
--
View this message in context: http://forum.openscad.org/access-points-in-for-loop-tp20953.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
points = [ [0,0],[25,20],[30,50],[17,50],[7,30],[10,45],[35,35]];
for (i=[0: len(points) - 1])
{
translate(points[i]) square(1);
//do something with the next point ??
something(points[(i+1) % len(points)]);
}
On 18 March 2017 at 18:54, jazzjohn jazzjohn@gmail.com wrote:
How do I access, within a loop, the next point in a list of points?
I want to compute the angle between every pair of adjacent points.
points = [ [0,0],[25,20],[30,50],[17,50],[7,30],[10,45],[35,35]];
for (i=points)
{
translate(i) square(1);
//do something with the next point ??
}
--
View this message in context: http://forum.openscad.org/
access-points-in-for-loop-tp20953.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Ahh... I knew there had to be syntax that would work... thanks!
--
View this message in context: http://forum.openscad.org/access-points-in-for-loop-tp20953p20955.html
Sent from the OpenSCAD mailing list archive at Nabble.com.