[OpenSCAD] procedurally generating polyhedra and non-uniform scaling
Whosawhatsis
whosawhatsis at gmail.com
Fri Aug 27 14:56:44 CEST 2010
Another feature that might be useful for building shapes that cannot be made using booleans and primitives would be a morph extrusion. What I'm thinking of is an extrusion function that extrudes the first child using the second as a morph target (and it could continue to morph the second into the third, and so on). For example, you could have a square at the origin and a circle above it, and the function would connect the points on the square to the points on the circle, making a rectangle (two triangles) connecting each side of the square to the nearest facet of the circle, then filling in the empty spaces with triangles from the unused facets to the appropriate corner of the square until a manifold solid is created.
On Aug 26, 2010, at 1:18 PM, Whosawhatsis wrote:
> I'm trying to generate some more organic shapes, and I've thought of two ways that I should be able to do it, neither of which seems to be possible.
>
> The first one I thought of was a non-uniform scaling module. What I'm thinking of is something that could take a child element and stretch it unevenly. This could, for instance, take a cylinder and turn it into a cone or section of a cone, or a cylinder with its ends not parallel to its sides. I know all of these examples are possible with booleans and/or with the use of r1 and r2, but what I'm trying to do requires applying these procedures with shapes more complicated than a simple cylinder. This could take the form of a scale function that accepts multiple vectors, each representing a point about which to perform translation, and these point would form a gradient of transformation that would be applied to the points between and beyond them. The multimatrix module may make some of this possible, but I couldn't figure out how to get it to do anything that couldn't be done by combining the other transformation functions.
>
> I would settle for a method of addressing and applying transformations to a subset of the points that make up a polyhedron, which would make it possible for me to implement this myself. This could take the form of a selection function, defining a cube or a cylinder or other polyhedron and returning the points located within it (or simply allowing them to be transformed independently of the unselected points in the same polyhedron).
>
> The other option I thought of was procedurally generated polyhedra. This would require the ability to define points and facets using iterators, conditionals and subroutines (I found a brief reference to someone else wanting this in the archives from a couple of months ago). This would most likely require changing the method of defining a polyhedron so that points and facets would be child elements, rather than arguments.
>
> It would also be useful to be able to build an object and assign it to a variable, rather than building directly to the rendering space. This could be used, for instance, to create a module that renders multiple copies of its children in a loop.
>
> If any of this is possible now, and I just haven't figured it out, I would appreciate it if anyone could point me in the right direction. I know this is starting to sound like I should be using a mesh editor, but I need the mathematical precision and procedural generation that OpenSCAD makes possible.
More information about the OpenSCAD
mailing list