polyhedron() inverse

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

polyhedron() inverse

kitwallace
I suspect that its not possible to provide an inverse for polyhedron()  but it would be great to have.  For example I might create an object through CSG operations but to do further work on the object I need it defined as points and faces.
Reply | Threaded
Open this post in threaded view
|

Re: polyhedron() inverse

kintel
Administrator
On Sep 28, 2014, at 01:50 AM, kitwallace <[hidden email]> wrote:

> I suspect that its not possible to provide an inverse for polyhedron()  but
> it would be great to have.  For example I might create an object through CSG
> operations but to do further work on the object I need it defined as points
> and faces.
>

What you want is basically to be able to assigning geometry to variables, and to query these variable for vertices and faces and eventually create polyhedrons from these.

This is challenging for a few reasons:

1) In OpenSCAD, all expressions are evaluated before the CSG tree is evaluated. This change would require us to do geometry evaluation in-line with expression evaluation. While this in itself isn’t hard to do, it breaks our clean source->AST->CSG->(Preview|Render) pipeline. Requires some thinking.

2) CSG trees are not evaluated to geometry in Preview (F5) mode, only in Render (F6) mode. In-line geometry evaluation would force us to fully evaluate all geometry which is requested for variable storage. Since geometry evaluation using CGAL is so slow, opening for in-line evaluation will likely annoy more people than it pleases, until we get around to dealing with that performance challenge.

I do think what you suggest is a powerful feature which would open for some interesting feedback opportunities, but I’ve been putting this off until we get CGAL performance under control.

If you have some particular thing you’d want to model, please start a discussion. I regularly gets surprised with what’s possible with clever modeling techniques.

 -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: polyhedron() inverse

Oskar
kintel wrote
On Sep 28, 2014, at 01:50 AM, kitwallace <[hidden email]> wrote:

> I suspect that its not possible to provide an inverse for polyhedron()  but
> it would be great to have.  For example I might create an object through CSG
> operations but to do further work on the object I need it defined as points
> and faces.
>

What you want is basically to be able to assigning geometry to variables, and to query these variable for vertices and faces and eventually create polyhedrons from these.

This is challenging for a few reasons:

[...]

2) CSG trees are not evaluated to geometry in Preview (F5) mode, only in Render (F6) mode. In-line geometry evaluation would force us to fully evaluate all geometry which is requested for variable storage. Since geometry evaluation using CGAL is so slow, opening for in-line evaluation will likely annoy more people than it pleases, until we get around to dealing with that performance challenge.
For the 2D case, the Clipper library we use is so fast that there is no reason to use OpenCSG anymore. I implemented a forced evaluation of 2D CSG in Preview as an experiment and it turned out to render much faster than before, and also makes it unnecessary to draw 2D geometry with an artificial 3D thickness which if nothing else further speeds up rendering. The remaining issue is how to handle color properties as these aren't preserved by CSG operations.

/Oskar
Reply | Threaded
Open this post in threaded view
|

Re: polyhedron() inverse

kintel
Administrator
On Sep 28, 2014, at 05:31 AM, Oskar <[hidden email]> wrote:
>
> For the 2D case, the Clipper library we use is so fast that there is no
> reason to use OpenCSG anymore. […]

Good point - that’s a start.

> The remaining issue is how to handle color properties as these aren't preserved
> by CSG operations.
>
Hm..
CSG colors is a good debugging tool, but has limited value apart from that.

As an experiment, we could make forced 2D evaluation optional with a Preference setting.

 -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: polyhedron() inverse

MichaelAtOz
Administrator
> CSG colors is a good debugging tool, but has limited value apart from that.

Would that be a start to multi-material handling?
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: polyhedron() inverse

kintel
Administrator
On Sep 29, 2014, at 00:46 AM, MichaelAtOz <[hidden email]> wrote:

>> CSG colors is a good debugging tool, but has limited value apart from that.
>
> Would that be a start to multi-material handling?
>
multi-material is a slightly different topic: https://github.com/openscad/openscad/wiki/Multi-material-support

 -Marius

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