discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Union of polyhedra not rendering.

AC
Andrea Croci
Mon, Jan 11, 2016 8:13 AM

Hello Everybody,

I was playing around with OpenSCAD trying out some platonic solids and
extensions thereof. I'm only at my first day with it, so I'm very much a
newbie.

I wanted to build tetrahedra on a tetrahedron and wrote this code:

lato=100;
h_triangolo=sqrt(3)/2*lato;
h_tetraedro=sqrt(2/3)*lato;

union() {
scale(1.1,1.1,1.1) //added later to try the overlapping of faces
polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro]],
faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,0,(3/4)h_tetraedro],[0,-(5/(2sqrt(7)))lato,(5/(2sqrt(42)))*lato]],
faces=[ [0,1,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[-(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)lato,(5/(2sqrt(42)))*lato]],
faces=[ [0,1,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)lato,(5/(2sqrt(42)))*lato]],
faces=[ [1,0,2],[1,0,3],[2,1,3],[0,2,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,-(5/4)*h_tetraedro]],
faces=[ [1,0,2],[1,0,3],[2,1,3],[0,2,3]] );
}

It does preview the way I expect, but only renders the first polyhedron
in the list. I was thinking it may have to do with the small
uncertainties in the floating point calculated numbers that make the
faces not perfectly in contact, therefore I scaled up the first
tetrahedron and now it sticks out. It still doesn't render in my case:

version 2015.03-1on Ubuntu 14.04.3 LTS

What else could it be? Maybe a library that I left out? I installed
pretty much all suggested packages.

Thank you,

Andrea.

Hello Everybody, I was playing around with OpenSCAD trying out some platonic solids and extensions thereof. I'm only at my first day with it, so I'm very much a newbie. I wanted to build tetrahedra on a tetrahedron and wrote this code: lato=100; h_triangolo=sqrt(3)/2*lato; h_tetraedro=sqrt(2/3)*lato; union() { scale(1.1,1.1,1.1) //added later to try the overlapping of faces polyhedron( points=[ [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro]], faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] ); polyhedron( points=[ [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[0,-(5/(2*sqrt(7)))*lato,(5/(2*sqrt(42)))*lato]], faces=[ [0,1,2],[0,1,3],[1,2,3],[2,0,3]] ); polyhedron( points=[ [-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[-(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)*lato,(5/(2*sqrt(42)))*lato]], faces=[ [0,1,2],[0,1,3],[1,2,3],[2,0,3]] ); polyhedron( points=[ [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)*lato,(5/(2*sqrt(42)))*lato]], faces=[ [1,0,2],[1,0,3],[2,1,3],[0,2,3]] ); polyhedron( points=[ [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,-(5/4)*h_tetraedro]], faces=[ [1,0,2],[1,0,3],[2,1,3],[0,2,3]] ); } It does preview the way I expect, but only renders the first polyhedron in the list. I was thinking it may have to do with the small uncertainties in the floating point calculated numbers that make the faces not perfectly in contact, therefore I scaled up the first tetrahedron and now it sticks out. It still doesn't render in my case: version 2015.03-1on Ubuntu 14.04.3 LTS What else could it be? Maybe a library that I left out? I installed pretty much all suggested packages. Thank you, Andrea.
NH
nop head
Mon, Jan 11, 2016 8:49 AM

You had some of your faces facing inwards. They show up purple in the
thrown together view. This version works.

lato=100;
h_triangolo=sqrt(3)/2*lato;
h_tetraedro=sqrt(2/3)*lato;

union() {
//scale(1.1,1.1,1.1) //added later to try the overlapping of faces
polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro]],
faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,0,(3/4)h_tetraedro],[0,-(5/(2sqrt(7)))lato,(5/(2sqrt(42)))*lato]],
faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[-(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)lato,(5/(2sqrt(42)))*lato]],
faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)lato,(5/(2sqrt(42)))*lato]],
faces=[ [0,1,2],[1,0,3],[2,1,3],[0,2,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,-(5/4)*h_tetraedro]],
faces=[ [0,1,2],[1,0,3],[2,1,3],[0,2,3]] );
}

On 11 January 2016 at 08:13, Andrea Croci andrea.croci@gmx.de wrote:

Hello Everybody,

I was playing around with OpenSCAD trying out some platonic solids and
extensions thereof. I'm only at my first day with it, so I'm very much a
newbie.

I wanted to build tetrahedra on a tetrahedron and wrote this code:

lato=100;
h_triangolo=sqrt(3)/2*lato;
h_tetraedro=sqrt(2/3)*lato;

union() {
scale(1.1,1.1,1.1) //added later to try the overlapping of faces
polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro]],
faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,0,(3/4)h_tetraedro],[0,-(5/(2sqrt(7)))lato,(5/(2sqrt(42)))*lato]],
faces=[ [0,1,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[-(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)lato,(5/(2sqrt(42)))*lato]],
faces=[ [0,1,2],[0,1,3],[1,2,3],[2,0,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)lato,(5/(2sqrt(42)))*lato]],
faces=[ [1,0,2],[1,0,3],[2,1,3],[0,2,3]] );

polyhedron(
points=[
[lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,-(5/4)*h_tetraedro]],
faces=[ [1,0,2],[1,0,3],[2,1,3],[0,2,3]] );
}

It does preview the way I expect, but only renders the first polyhedron in
the list. I was thinking it may have to do with the small uncertainties in
the floating point calculated numbers that make the faces not perfectly in
contact, therefore I scaled up the first tetrahedron and now it sticks out.
It still doesn't render in my case:

version 2015.03-1 on Ubuntu 14.04.3 LTS

What else could it be? Maybe a library that I left out? I installed pretty
much all suggested packages.

Thank you,

Andrea.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

You had some of your faces facing inwards. They show up purple in the thrown together view. This version works. lato=100; h_triangolo=sqrt(3)/2*lato; h_tetraedro=sqrt(2/3)*lato; union() { //scale(1.1,1.1,1.1) //added later to try the overlapping of faces polyhedron( points=[ [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro]], faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] ); polyhedron( points=[ [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[0,-(5/(2*sqrt(7)))*lato,(5/(2*sqrt(42)))*lato]], faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] ); polyhedron( points=[ [-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[-(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)*lato,(5/(2*sqrt(42)))*lato]], faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] ); polyhedron( points=[ [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)*lato,(5/(2*sqrt(42)))*lato]], faces=[ [0,1,2],[1,0,3],[2,1,3],[0,2,3]] ); polyhedron( points=[ [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,-(5/4)*h_tetraedro]], faces=[ [0,1,2],[1,0,3],[2,1,3],[0,2,3]] ); } On 11 January 2016 at 08:13, Andrea Croci <andrea.croci@gmx.de> wrote: > Hello Everybody, > > I was playing around with OpenSCAD trying out some platonic solids and > extensions thereof. I'm only at my first day with it, so I'm very much a > newbie. > > I wanted to build tetrahedra on a tetrahedron and wrote this code: > > lato=100; > h_triangolo=sqrt(3)/2*lato; > h_tetraedro=sqrt(2/3)*lato; > > union() { > scale(1.1,1.1,1.1) //added later to try the overlapping of faces > polyhedron( > points=[ > [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro]], > faces=[ [1,0,2],[0,1,3],[1,2,3],[2,0,3]] ); > > polyhedron( > points=[ > [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[0,-(5/(2*sqrt(7)))*lato,(5/(2*sqrt(42)))*lato]], > faces=[ [0,1,2],[0,1,3],[1,2,3],[2,0,3]] ); > > polyhedron( > points=[ > [-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[-(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)*lato,(5/(2*sqrt(42)))*lato]], > faces=[ [0,1,2],[0,1,3],[1,2,3],[2,0,3]] ); > > polyhedron( > points=[ > [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,(3/4)*h_tetraedro],[(5/4)*sqrt(3/7)*lato,(5/4)*sqrt(1/7)*lato,(5/(2*sqrt(42)))*lato]], > faces=[ [1,0,2],[1,0,3],[2,1,3],[0,2,3]] ); > > polyhedron( > points=[ > [lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[-lato/2,-h_triangolo/3,-(1/4)*h_tetraedro],[0,(2/3)*h_triangolo,-(1/4)*h_tetraedro],[0,0,-(5/4)*h_tetraedro]], > faces=[ [1,0,2],[1,0,3],[2,1,3],[0,2,3]] ); > } > > It does preview the way I expect, but only renders the first polyhedron in > the list. I was thinking it may have to do with the small uncertainties in > the floating point calculated numbers that make the faces not perfectly in > contact, therefore I scaled up the first tetrahedron and now it sticks out. > It still doesn't render in my case: > > version 2015.03-1 on Ubuntu 14.04.3 LTS > > What else could it be? Maybe a library that I left out? I installed pretty > much all suggested packages. > > Thank you, > > Andrea. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
AC
Andrea Croci
Mon, Jan 11, 2016 8:59 AM

Boy, Nop Head, you are the man!

I doubled and triple checked them all also with the Thrown together view
(well, not really all of them: I was missing just the four that create
the problem), but I couldn't see any. The thing I didn't understand is
that the same face could belong to two different polyhedra and has to
face inside the right one: namely once in one direction and the other
time in the other direction. I was doing them both times in the same
direction. Thank you for teaching me something.

Andrea.

On 11.01.2016 09:49, nop head wrote:

You had some of your faces facing inwards. They show up purple in the
thrown together view. This version works.

Boy, Nop Head, you are the man! I doubled and triple checked them all also with the Thrown together view (well, not really all of them: I was missing just the four that create the problem), but I couldn't see any. The thing I didn't understand is that the same face could belong to two different polyhedra and has to face inside the right one: namely once in one direction and the other time in the other direction. I was doing them both times in the same direction. Thank you for teaching me something. Andrea. On 11.01.2016 09:49, nop head wrote: > You had some of your faces facing inwards. They show up purple in the > thrown together view. This version works.