discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Coloring bug?

W
wolf
Mon, Mar 14, 2016 12:59 AM

When executing the following code
$fn=200;
translate([0,.1,0])
Disk();
Cut_Ball();

module Ball()
sphere(10);
module Disk()
color("Silver")
intersection()
{ Ball();
translate([-12,-12,3])  cube([24,24,2]);
}
module Cut_Ball()
color("Red")
difference()
{ Ball();
translate([-12,-12,3])  cube([24,24,2]);
}
As the code stands, a red sphere is generated, with a silver disk inside it
and some red/silver area on the circumference of the disk. When removing the
translate instruction in line 2, a uniformly red sphere is produced by
Preview (F5). Also, when changing $fn, the width of the red/silver area
changes.
To me it means that the code is not executed inside-out, as I would expect,
but rather outside-in, or, if you want, the module Ball() is colored first
and only then are the intersection() and difference() instructions carried
out.
Is that intentional?
wolf

PS.: I use version 2015.03-1 on Kubuntu 14.10

--
View this message in context: http://forum.openscad.org/Coloring-bug-tp16471.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

When executing the following code $fn=200; translate([0,.1,0]) Disk(); Cut_Ball(); module Ball() sphere(10); module Disk() color("Silver") intersection() { Ball(); translate([-12,-12,3]) cube([24,24,2]); } module Cut_Ball() color("Red") difference() { Ball(); translate([-12,-12,3]) cube([24,24,2]); } As the code stands, a red sphere is generated, with a silver disk inside it and some red/silver area on the circumference of the disk. When removing the translate instruction in line 2, a uniformly red sphere is produced by Preview (F5). Also, when changing $fn, the width of the red/silver area changes. To me it means that the code is not executed inside-out, as I would expect, but rather outside-in, or, if you want, the module Ball() is colored first and only then are the intersection() and difference() instructions carried out. Is that intentional? wolf PS.: I use version 2015.03-1 on Kubuntu 14.10 -- View this message in context: http://forum.openscad.org/Coloring-bug-tp16471.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Mon, Mar 14, 2016 2:19 AM

I'd call it a bug.


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!

View this message in context: http://forum.openscad.org/Coloring-bug-tp16471p16472.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I'd call it a bug. ----- 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! -- View this message in context: http://forum.openscad.org/Coloring-bug-tp16471p16472.html Sent from the OpenSCAD mailing list archive at Nabble.com.
MK
Marius Kintel
Mon, Mar 14, 2016 5:40 AM

On Mar 13, 2016, at 20:59 PM, wolf wv99999@gmail.com wrote:
To me it means that the code is not executed inside-out, as I would expect,
but rather outside-in, or, if you want, the module Ball() is colored first
and only then are the intersection() and difference() instructions carried
out.
Is that intentional?

I believe this is an instance of https://github.com/openscad/openscad/issues/1000

-Marius

> On Mar 13, 2016, at 20:59 PM, wolf <wv99999@gmail.com> wrote: > To me it means that the code is not executed inside-out, as I would expect, > but rather outside-in, or, if you want, the module Ball() is colored first > and only then are the intersection() and difference() instructions carried > out. > Is that intentional? I believe this is an instance of https://github.com/openscad/openscad/issues/1000 -Marius
NH
nop head
Mon, Mar 14, 2016 8:00 AM

In general OpenCSG doesn't work well with coincident faces but CGAL does.
If you put render() after color("Red") it works without the translate but
is obviously slow first time because of the $fn = 200.

I render all my objects before colouring them and composing them because
otherwise negative volumes from different objects that happen to coincide
cause Z buffer artefacts.

On 14 March 2016 at 05:40, Marius Kintel marius@kintel.net wrote:

On Mar 13, 2016, at 20:59 PM, wolf wv99999@gmail.com wrote:
To me it means that the code is not executed inside-out, as I would

expect,

but rather outside-in, or, if you want, the module Ball() is colored

first

and only then are the intersection() and difference() instructions

carried

out.
Is that intentional?

In general OpenCSG doesn't work well with coincident faces but CGAL does. If you put render() after color("Red") it works without the translate but is obviously slow first time because of the $fn = 200. I render all my objects before colouring them and composing them because otherwise negative volumes from different objects that happen to coincide cause Z buffer artefacts. On 14 March 2016 at 05:40, Marius Kintel <marius@kintel.net> wrote: > > On Mar 13, 2016, at 20:59 PM, wolf <wv99999@gmail.com> wrote: > > To me it means that the code is not executed inside-out, as I would > expect, > > but rather outside-in, or, if you want, the module Ball() is colored > first > > and only then are the intersection() and difference() instructions > carried > > out. > > Is that intentional? > > I believe this is an instance of > https://github.com/openscad/openscad/issues/1000 > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >