vanishing polyhedra on difference?

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

vanishing polyhedra on difference?

bboett
Hello,

so my previous question was stupid enough :D so i went into looking to achieve the desired result directly by using the polyhedrons, and here's the next dumb question:

if you activate the difference on line 36, everything vanishes :(
why?? (same for union BTW....)

l = 3;
dlu = 1.4;
dlo = 2.9;
w= 30;
h= 11.5;
uo = 9;
uxo = 25;
uxu = 27;

module einschubForm(untereBr,obereBr,absend,absanf,abshoehe,hoehe,breite)
{
  obVerjBreite = (obereBr-untereBr)*abshoehe/hoehe+untereBr;
  polyhedron(
      points=[[-untereBr,0,0], [untereBr,0,0], [untereBr,breite,0], [-untereBr,breite,0], //unteres Rechteck
      [-obereBr,0,hoehe],[obereBr,0,hoehe], [obVerjBreite,breite,abshoehe],[-obVerjBreite,breite,abshoehe]    //oberes Rechteck
      ,[-obVerjBreite,absanf,hoehe], [-obVerjBreite,absend, abshoehe], [obVerjBreite,absend, abshoehe], [obVerjBreite,absanf,hoehe] //Absenkung
      ,[-untereBr,absanf,0], [-untereBr,absend, 0], [untereBr,absend, 0], [untereBr,absanf,0]
      ],  

      faces=[
      [0,3,2,1], //unten
      [5,4,0,1], //stirn links
      [1,2,6,10,11,5], //hinten
      [2,3,7,6], //stirn rechts
      [0,4,8,9,7,3], //vorne
      [4,5,11,8], [8,11,10,9], [9,10,6,7]  //oben
      ]
      );
}

posx = 11.1;
posy = 0;
posz = 1.71;
translate([posx,posy,posz])
{
  //difference()
  //{
    einschubForm(dlu,dlo,uxu,uxo,uo,h,w);
    color("blue") translate([1,1.5,1])scale(v = [1, .9, .8]) einschubForm(dlu,dlo,uxu,uxo,uo,h,w);
  //}
}

--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr

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

Re: vanishing polyhedra on difference?

tp3
On 20.07.19 17:32, Bruno Boettcher wrote:
> if you activate the difference on line 36, everything vanishes :(
> why?? (same for union BTW....)

The polyhedron is inside out, all faces have the points listed
in reverse order.

See: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6?

ciao,
  Torsten.


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

Re: vanishing polyhedra on difference?

acwest
I did some experimenting with that, as long as it is consistent, openscad does the right thing. Not sure if the two polyhedra need to be consistent with each other though 

On Sat, 20 Jul 2019, 11:48 Torsten Paul, <[hidden email]> wrote:
On 20.07.19 17:32, Bruno Boettcher wrote:
> if you activate the difference on line 36, everything vanishes :(
> why?? (same for union BTW....)

The polyhedron is inside out, all faces have the points listed
in reverse order.

See: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6?

ciao,
  Torsten.


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: vanishing polyhedra on difference?

bboett
In reply to this post by tp3
ok! thanks!
heh, understood the doc inversely....
ciao
Bruno

Am Sa., 20. Juli 2019 um 17:48 Uhr schrieb Torsten Paul <[hidden email]>:
On 20.07.19 17:32, Bruno Boettcher wrote:
> if you activate the difference on line 36, everything vanishes :(
> why?? (same for union BTW....)

The polyhedron is inside out, all faces have the points listed
in reverse order.

See: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6?

ciao,
  Torsten.


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


--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr

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

Re: vanishing polyhedra on difference?

tp3
In reply to this post by acwest
On 20.07.19 17:50, A. Craig West wrote:
> I did some experimenting with that, as long as it is consistent,
> openscad does the right thing. Not sure if the two polyhedra
> need to be consistent with each other though 

The underlying library doing the CSG operations (libCGAL) might
randomly do the right thing. Relying on that may end in trouble
at any time with any changes of the environment (e.g. changing
to a different machine, using a different OpenSCAD build, or
maybe just because the OS is running for more than 6 days without
reboot).

The expected winding order of polyhedron faces is defined,
anything else may work but the result is in general completely
undefined. So my advice is to always use the winding documented
order.

ciao,
  Torsten.

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

Re: vanishing polyhedra on difference?

cacb
In reply to this post by acwest
On 2019-07-20 17:50, A. Craig West wrote:
> I did some experimenting with that, as long as it is consistent,
> openscad does the right thing.

The face normal defines the direction of void ("out of material"). In
case of an inverted polyhedron with normal pointing inside the volume,
the material is infinite in all directions except inside the polyhedron
volume. One should always make sure a polyhedron is properly defined.

Carsten Arnholm

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