discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] walkthrough / flythrough

JB
Jordan Brown
Tue, Dec 22, 2020 3:54 PM

I eventually want the "route" to be specified turtle-style:  move
forward N, turn left N, et cetera.  However, that adds significant
trickiness.  First, there's the obvious thing that the positions are all
relative and to get the position and look direction at time N you have
to add up all of the moves before that point.

Trickier, though, is that the position isn't simply added (even rotated
by the look angle) because a forward move combined with a turn yields an
arc.

It would also be tempting to add turtle-style view navigation to the
OpenSCAD UI, so that you could move forward or back, and turn the camera
left/right/up/down.  Any interest?

I eventually want the "route" to be specified turtle-style:  move forward N, turn left N, et cetera.  However, that adds significant trickiness.  First, there's the obvious thing that the positions are all relative and to get the position and look direction at time N you have to add up all of the moves before that point. Trickier, though, is that the position isn't simply added (even rotated by the look angle) because a forward move combined with a turn yields an arc. It would also be tempting to add turtle-style view navigation to the OpenSCAD UI, so that you could move forward or back, and turn the camera left/right/up/down.  Any interest?
A
adrianv
Tue, Dec 22, 2020 4:40 PM

I thought about mentioning this when I first saw your example:  I've
implemented turtle both in 2d and 3d versions, including turns with arcs.
The 3d version produces a transformation list as output, so it would give
you look angle as well as position.  (Accumulating to time N isn't hard in a
turtle implementation.  You compute the next "move" and multiply its matrix
by the current transform (in the appropriate way).  The hardest thing about
a 3d turtle is deciding what rotations actually mean and how to calculate
them.

https://github.com/revarbat/BOSL2/wiki/turtle3d.scad

JordanBrown wrote

I eventually want the "route" to be specified turtle-style:  move
forward N, turn left N, et cetera.  However, that adds significant
trickiness.  First, there's the obvious thing that the positions are all
relative and to get the position and look direction at time N you have
to add up all of the moves before that point.

Trickier, though, is that the position isn't simply added (even rotated
by the look angle) because a forward move combined with a turn yields an
arc.

It would also be tempting to add turtle-style view navigation to the
OpenSCAD UI, so that you could move forward or back, and turn the camera
left/right/up/down.  Any interest?


OpenSCAD mailing list

Discuss@.openscad

I thought about mentioning this when I first saw your example: I've implemented turtle both in 2d and 3d versions, including turns with arcs. The 3d version produces a transformation list as output, so it would give you look angle as well as position. (Accumulating to time N isn't hard in a turtle implementation. You compute the next "move" and multiply its matrix by the current transform (in the appropriate way). The hardest thing about a 3d turtle is deciding what rotations actually mean and how to calculate them. https://github.com/revarbat/BOSL2/wiki/turtle3d.scad JordanBrown wrote > I eventually want the "route" to be specified turtle-style:  move > forward N, turn left N, et cetera.  However, that adds significant > trickiness.  First, there's the obvious thing that the positions are all > relative and to get the position and look direction at time N you have > to add up all of the moves before that point. > > Trickier, though, is that the position isn't simply added (even rotated > by the look angle) because a forward move combined with a turn yields an > arc. > > It would also be tempting to add turtle-style view navigation to the > OpenSCAD UI, so that you could move forward or back, and turn the camera > left/right/up/down.  Any interest? > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/