[OpenSCAD] Evaluating imported STL's

Lucas Vinicius Hartmann lucas.hartmann at gmail.com
Wed Jun 15 11:39:47 EDT 2016


Attached is a NON-WORKING code that would be a solid-if if openscad behaved
as I had anticipated... I doesn't...

This is a simpler test case to demonstrate what I expected OpenSCAD to
do... Not sure if this is intentional or  should be considered a bug...

// Test inputs
module nothing() {
    difference() {
        sphere(r=1);
        sphere(r=2);
    }
}
module something() {
    sphere(r=1);
}

// Should return nothing, but returns something.
intersection() {
    nothing();
    something();
}

// Should return nothing, but returns something.
minkowski() {
    nothing();
    something();
}

The intersection case is pretty straight forward, intersection with an
empty set should always return empty.

Minkowski is not as easy but, to my understanding of it something() should
actually be the result of minkowski operating on something() and a single
point at (0,0,0). As I understand it, minkowski decomposes each solid (S1
and S2) as an infinite set of (x,y,z) points, combines all points from S1
to all points from S2 by adding their coordinates, and takes the resulting
set as the output solid...

>From what I saw (never looked at the code) I believe OpenSCAD is simply
discarding empty solids and, by doing so, it actually promotes nothing() to
everything() on intersections, and nothing() to a single point (0,0,0) on
minkowski operations.

--
Lucas Vinicius Hartmann

Dizem que se você rodar o CD do Windows ao contrário ele mostra uma
mensagem demoníaca... Mas isso nem é o pior, se você rodar ele normal ele
instala o Windows!

2016-06-15 11:10 GMT-03:00 <arnholm at arnholm.org>:

> On 2016-06-15 13:34, Lucas Vinicius Hartmann wrote:
>
>> If all you need to know is IF 2 objects are colliding, then you may
>> use intersection(), export via commandline, and check for a non-empty
>> resulting STL (filesize maybe?).
>>
>
> Based on 2 STL files (or better: 2 AMF files), it would be trivially easy
> and fast to determine many cases of non-intersection, based on bounding
> boxes. However, there will be cases where bounding boxes intersect but
> where the bodies still do not intersect. For these cases a more detailed
> intersection algorithm is needed.
>
> However, I am not aware of any way something like this can be done in
> OpenSCAD.
>
> Carsten Arnholm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20160615/9db1641a/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifsolid.scad
Type: application/x-openscad
Size: 912 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20160615/9db1641a/attachment.scad>


More information about the Discuss mailing list