very unpleasant effect in current openscad 2018.06.14 (git master)

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

very unpleasant effect in current openscad 2018.06.14 (git master)

Peter
Hello everybody
i need help with this:

with openscad 2018.06.14 from github

this code:

h=9.2-4+.3;

difference()
{
    cube([20,2*h,2*h]);   
    cylinder(d=15,h=h);

        translate([0,0,h])
        {
            cube([17,20,4]);
            cylinder(d=15,h=h);
        }
}
produces this after rendering:

but if you change  the value of h at the first line to

h=5.2+.3; 

(which is still the same number as above h=9.2-4+.3 and still equals to 5.5 )

restart openscad to reset cache, and rerender, you will get a different picture:


anybody knows which version(revision) of openscad is last to be known to not have this effect?

why do i get 2 volumes anyway?

Thanks for advice. Peter



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: very unpleasant effect in current openscad 2018.06.14 (git master)

MichaelAtOz
Administrator
Try this

h=9.2-4+.3;
h2=5.2+.3;  
h3=5.2+.3+0.000005;  
echo(h=h,h2=h2,h3=h3);
echo( (h==h2) ? "EQ" : "NEQ" );
echo( h-h2);

Floating point plays tricks, compounded, AGAIN, by echo rounding results.



-----
Admin - PM me if you need anything, or if I've done something stupid...

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.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - PM me if you need anything,
or if I've done something stupid...

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.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: very unpleasant effect in current openscad 2018.06.14 (git master)

nophead
You get two volumes for a single object because the outside universe counts as a volume. So you always need to subtract one from what OpenSCAD reports.

Also internal cavities count as volumes, so a hollow sphere would report 3 volumes.

On 20 June 2018 at 14:43, MichaelAtOz <[hidden email]> wrote:
Try this

h=9.2-4+.3;
h2=5.2+.3; 
h3=5.2+.3+0.000005; 
echo(h=h,h2=h2,h3=h3);
echo( (h==h2) ? "EQ" : "NEQ" );
echo( h-h2);

Floating point plays tricks, compounded, AGAIN, by echo rounding results.



-----
Admin - PM me if you need anything, or if I've done something stupid...

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.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org