Enumerating solid polyhedra

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

Enumerating solid polyhedra

kintel
Administrator
Hi all,

It's a bit annoying to specify basic solid polyhedra (and polygons) in OpenSCAD due to the very limited pre-defined basic shapes.
I was thinking about how to improve this.  One idea is to do smth. like what Mathematica does; it can generate meshes for difference classes of polyhedra (platonic, archimedean etc.), see http://reference.wolfram.com/mathematica/ref/PolyhedronData.html

For 2D primitives, a regular polygon generator would be a good start.

Some of this could (best?) be solved through built-in libraries, and some better with built-in native modules/functions - I'm uncertain which are best for what purpose.

Any ideas of how these interfaces should look like, or related ideas?

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Enumerating solid polyhedra

Bryan Bishop
On Sun, May 19, 2013 at 10:48 AM, Marius Kintel <[hidden email]> wrote:
Some of this could (best?) be solved through built-in libraries, and some better with built-in native modules/functions - I'm uncertain which are best for what purpose.

I think libraries would be very useful. elmom's library has been all alone for a long time, and it would be excellent if random projects like splotbot, chemobot, parametric-mendel, and others, could be forced to use the openscad library format and be used as reusable packages.

- Bryan
http://heybryan.org/
1 512 203 0507
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Enumerating solid polyhedra

devlaam
In reply to this post by kintel
On 19-05-13 17:48, Marius Kintel wrote:

> For 2D primitives, a regular polygon generator would be a good start.

I have just wrote an extension for 2D with a 'loop' primitive.

It enables the generation of polygons and other closed loops
composed of (elliptic) arcs, beziers  and sines.
This was mainly because i needed objects with specially rounded
curves, for a project of mine.

Basic syntax examples:

standard rectangle:
   loop([[-5,5],[5,5],[5,0],[-5,0]]);

hexagon (defined with inner radius):
   loop(poly=[6,"rin",[5]]);

square with two circular rounded edges:
   loop(poly=[4,"flat",[6]], vertices=[1,2,["arc",1]]);

saw blade (see attached image)
   loop(poly=[10,[5]] , edges=[["bzr",[-0.5,0.5],[0.5,-0.5]]], $fn=20);

and lots more.

If you guys are interested i can post a patch.
Modification to the primives.cc file only.

Ruud


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

sawblade.png (21K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Enumerating solid polyhedra

Alan Cox
In reply to this post by kintel
On Sun, 19 May 2013 11:48:30 -0400
Marius Kintel <[hidden email]> wrote:

> Hi all,
>
> It's a bit annoying to specify basic solid polyhedra (and polygons) in OpenSCAD due to the very limited pre-defined basic shapes.
> I was thinking about how to improve this.  One idea is to do smth. like what Mathematica does; it can generate meshes for difference classes of polyhedra (platonic, archimedean etc.), see http://reference.wolfram.com/mathematica/ref/PolyhedronData.html
>
> For 2D primitives, a regular polygon generator would be a good start.
>
> Some of this could (best?) be solved through built-in libraries, and some better with built-in native modules/functions - I'm uncertain which are best for what purpose.
>
> Any ideas of how these interfaces should look like, or related ideas?

I'd favour

        polygon(sides)
        polyhedron(sides)

and it can grow extra arguments later for other types.

I don't see why it needs to be native however. Stuff like bends and path
extrusion really do, but polyhedra surely not ?

Alan
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Enumerating solid polyhedra

clothbot
In reply to this post by kintel
If it helps, this "map2PointsOnSphere.scad" file I crafted a while back exercises various approaches to mapping child objects to equidistant points around the surface of spheres and toroids:


The functions/math should be adaptable to creating n-sided polyhedra natively.

Andrew.

On 2013-05-19, at 11:48 AM, Marius Kintel wrote:

Hi all,

It's a bit annoying to specify basic solid polyhedra (and polygons) in OpenSCAD due to the very limited pre-defined basic shapes.
I was thinking about how to improve this.  One idea is to do smth. like what Mathematica does; it can generate meshes for difference classes of polyhedra (platonic, archimedean etc.), see http://reference.wolfram.com/mathematica/ref/PolyhedronData.html

For 2D primitives, a regular polygon generator would be a good start.

Some of this could (best?) be solved through built-in libraries, and some better with built-in native modules/functions - I'm uncertain which are best for what purpose.

Any ideas of how these interfaces should look like, or related ideas?

-Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Enumerating solid polyhedra

kintel
Administrator
In reply to this post by devlaam
On 2013-05-19, at 12:12 , Ruud Vlaming wrote:

> I have just wrote an extension for 2D with a 'loop' primitive.
>
Your idea is interesting! I'm a bit sceptical towards your proposed syntax, but please publish your patch - then we at least have a proof of concept.

I'm planning to release a new version very soon now - after that would be the time to mess around with longer-term features like this one.

 -Marius
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Enumerating solid polyhedra

devlaam
On 23-05-13 16:34, Marius Kintel wrote:
> On 2013-05-19, at 12:12 , Ruud Vlaming wrote:
>
>> I have just wrote an extension for 2D with a 'loop' primitive.
>>
> Your idea is interesting! I'm a bit sceptical towards your
> proposed syntax, but please publish your patch -
> then we at least have a proof of concept.
Understandable. Of course, i had to stay within your framework,
i.e. no keywords inside the parameters only strings, doubles
or vectors. So my keywords are necessarily strings. And i have
quite a few, so i did not want to make them to verbose. If they
are to cryptic to your taste, we can supply longer variants.

[Please note that any choice i make is always going to
frown other ones eyebrows. Just as, for example, the
center adjective defaults to true for spheres and
to false for cubes, is very awkward to me.]

I am still making small adjustments and need to write a
how-to document. Probably i will post this, together with
the patch, somewhere next week.

> I'm planning to release a new version very soon now -
 > after that would be the time to mess around with
 > longer-term features like this one.
Okay, i am in no hurry.

Ruud.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Enumerating solid polyhedra

kintel
Administrator
Hi again,

I'll wait for your patch.
I expect to feed this into the discussion on predefined polyhedra/polygon functions, alternatively the discussion on loop/list constructs vs. mutable arrays for programmatically building shapes.

I'm very aware of some awkward choices in OpenSCAD. However, backwards compatibility is important. Longer term I want to properly upgrade the language and provide an upgrade path, but by then we might have made a number of architecture changes, which are still not on the drawing board..

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566