Extrusion along an arbitrary path

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Extrusion along an arbitrary path

Olivier Iffrig
Hello everybody,

Unlike the thread concerning Minkowski sum, I tried to find out a way to
extrude a polygon along an arbitrary path by adding facets between
duplicates of the original polygon.

The main issue with this is the orientation of the polygon: for instance
if you want to make a torus (which would be the extrusion of a circle
along another circle), you expect each copy of the circle you extrude to
rotate instead of staying parallel to the original. On top of that, one
may also want to (and in some cases, will have to) control twisting,
which can be a bit puzzling when the path along which you extrude is not
contained in a plane (if it is, a solution is to use the normal to this
plane as a reference and force its projection on the polygon plane to
stay the same for each copy).

To take this into account, I use a second path, which is only there to
give the polygon's orientation (and, as a side effect, to scale it).
One way to imagine that would be to imagine the polygon you want to
extrude is on two rails (the two paths), so that its movement is totally
constrained. In that case, we even assume that if the spacing of the
"rails" is not constant, the polygon will be scaled to fit on them.

I wrote a program which implements this and generates STL files (I did
not want to have any dependencies, so it only uses the standard C and
C++ libraries). You can find it on GitHub :
http://github.com/Iota1/path-extrude

The algorithm is working, but there is still much work to be done if we
want to use it for OpenSCAD (which was my first idea), including some
"philosophical" thinking about how this should be implemented.

I hope my explanations are understandable. If not, do not hesitate to
ask questions.

Regards,

--
Olivier Iffrig


Reply | Threaded
Open this post in threaded view
|

Re: Extrusion along an arbitrary path

Triffid Hunter
On Sun, Jun 5, 2011 at 4:27 AM, Olivier Iffrig <[hidden email]> wrote:
> To take this into account, I use a second path, which is only there to
> give the polygon's orientation (and, as a side effect, to scale it).
> One way to imagine that would be to imagine the polygon you want to
> extrude is on two rails (the two paths), so that its movement is totally
> constrained. In that case, we even assume that if the spacing of the
> "rails" is not constant, the polygon will be scaled to fit on them.

makes perfect sense to me.. sounds significantly simpler than
minkowski sum too, for the case where we want to run a 2d shape along
a path.

If you want to alter the orientation vs the vector of the path (like
calligraphy) you would need either paired vertices along the path
(like a twisty ladder) or full triangles to define a plane at each
copy point.