Sat May 25 08:43:21 EDT 2019

```cacb wrote
> On 2019-05-24 23:41, adrianv wrote:
>> I suppose it's a somewhat advanced effort, but I don't think it would
>> be
>> particularly hard to write a "bent_sweep" module that would take a
>> polygon
>> expressed as a series of point coordinates and a second "destination"
>> polygon also as a series of points.  You could project the first
>> polygon
>> onto the second one and then build it up to the desired thickness (in
>> the
>> normal direction), constructing the vertices and faces of the necessary
>> polyhedron.
>
> A polygon in OpenSCAD is a 2d object with only (x,y) coordinates, so the
> "destination" cannot exist anywhere but in the (x,y) plane. I think you
> would "be on your own" having to write such from scratch using lists of
> 3d coordinates. Possible perhaps, but somewhat inconvenient.

I was suggesting a strategy for producing the desired gear model, not a
fully general approach to melting.  In my conception, the gear is defined by
a 2d polygon.  The gear in the image is deformed by being wrapped around an
extrusion, so the 3d surface it is wrapped around also has a 2d description.
So you can construct the top and bottom of the "melted" gear through a
projection operation that is relatively simple.

> The melting/morphing case is quite different, it begins with an existing
> valid 3d model created using any method. Usually keeping the topology of
> the model fixed, the *shape* of the 3d model is modified. If the model
> is represented as a polyhedron mesh, either explicitly modeled as such
> or the result of mesh based boolean operations, changing the shape
> translates to transforming the polyhedron vertex coordinates, using
> different transformations for different vertices (i.e. "non-affine
> transformation" of the model).

It seems that starting with polyhedron described by a 3d vertex set (and
face list) one could also achieve the desired result.  It basically boils
down to the question of representing the desired transformation.  The
problem, of course, is that OpenSCAD doesn't expose that information, so you
can't just do it to geometry.  You could use one of the existing sweep
modules to generate the necessary input from the 2d gear cross-section.

--

```