discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] PolySet has nonplanar faces. Attempting alternate construction

U
ufomorace
Sat, Aug 22, 2015 5:31 AM

I have the same nonplanar message with the following code.

It's a 6 triangle pyramid polyhedron, any random combination of unions of
this pyramid causes the error warning. The CGAL engine still makes the
geometry fast. am wondering if it would even cause the error with a cube,
and if so why with a poly constructed cube and not a primitive one.

module tetra(size, height) {
polyhedron ( points = [[size, 0, 0],
[0, 0, size],
[-size, 0, 0],
[0, 0, -size],
[0, height, 0]],

faces = [[0, 1, 2, 3],[4, 1, 0],[4, 2, 1],[4, 3, 2],[4, 0, 3]]);

}

width =4;
hgt = 2;

// the identity matrix
identity = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ]
];

// generate 4x4 rotation matrix around Z axis
function mr(a) = [ [ cos(a), -sin(a), 0, 0 ], [ sin(a), cos(a), 0, 0 ], [ 0,
0, 1, 0 ], [ 0, 0, 0, 1 ] ];

// generate 4x4 translation matrix
function mt(x, y) = [ [ 1, 0, 0, x ], [ 0, 1, 0, y ], [ 0, 0, 1, 0 ], [ 0,
0, 0, 1 ] ];

function matrices(i = 10, m = identity, ret = []) = i >= 0
? matrices(i - 1, m
* mt(0, width)
* mr(33.65)
, concat(ret, [ m ]))
: ret;

for (m = matrices(300))
multmatrix(m)
tetra(2,4);

--
View this message in context: http://forum.openscad.org/PolySet-has-nonplanar-faces-Attempting-alternate-construction-tp7544p13588.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I have the same nonplanar message with the following code. It's a 6 triangle pyramid polyhedron, any random combination of unions of this pyramid causes the error warning. The CGAL engine still makes the geometry fast. am wondering if it would even cause the error with a cube, and if so why with a poly constructed cube and not a primitive one. module tetra(size, height) { polyhedron ( points = [[size, 0, 0], [0, 0, size], [-size, 0, 0], [0, 0, -size], [0, height, 0]], faces = [[0, 1, 2, 3],[4, 1, 0],[4, 2, 1],[4, 3, 2],[4, 0, 3]]); } width =4; hgt = 2; // the identity matrix identity = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]; // generate 4x4 rotation matrix around Z axis function mr(a) = [ [ cos(a), -sin(a), 0, 0 ], [ sin(a), cos(a), 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]; // generate 4x4 translation matrix function mt(x, y) = [ [ 1, 0, 0, x ], [ 0, 1, 0, y ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]; function matrices(i = 10, m = identity, ret = []) = i >= 0 ? matrices(i - 1, m * mt(0, width) * mr(33.65) , concat(ret, [ m ])) : ret; for (m = matrices(300)) multmatrix(m) tetra(2,4); -- View this message in context: http://forum.openscad.org/PolySet-has-nonplanar-faces-Attempting-alternate-construction-tp7544p13588.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Sat, Aug 22, 2015 9:07 AM

Your facets all have the wrong winding order. With faces = [[3, 2, 1,
0],[0, 1, 4],[1, 2, 4],[2, 3, 4],[3, 0, 4]]); the warnings go away and F6
is much faster as well.

Note that in general you might get non-planar warnings when you do
rotations if you don't split the base into two triangles. This is because
floating point inaccuracies might make the transformed vertices slightly
non-planar.

Note also all your emails go into Google's spam filter so people might not
see them. Your email address seems to be blacklisted.

On 22 August 2015 at 06:31, ufomorace ant.stewart@yahoo.com wrote:

I have the same nonplanar message with the following code.

It's a 6 triangle pyramid polyhedron, any random combination of unions of
this pyramid causes the error warning. The CGAL engine still makes the
geometry fast. am wondering if it would even cause the error with a cube,
and if so why with a poly constructed cube and not a primitive one.

module tetra(size, height) {
polyhedron ( points = [[size, 0, 0],
[0, 0, size],
[-size, 0, 0],
[0, 0, -size],
[0, height, 0]],

     faces = [[0, 1, 2, 3],[4, 1, 0],[4, 2, 1],[4, 3, 2],[4, 0, 3]]);

}

width =4;
hgt = 2;

// the identity matrix
identity = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ]
];

// generate 4x4 rotation matrix around Z axis
function mr(a) = [ [ cos(a), -sin(a), 0, 0 ], [ sin(a), cos(a), 0, 0 ], [
0,
0, 1, 0 ], [ 0, 0, 0, 1 ] ];

// generate 4x4 translation matrix
function mt(x, y) = [ [ 1, 0, 0, x ], [ 0, 1, 0, y ], [ 0, 0, 1, 0 ], [ 0,
0, 0, 1 ] ];

function matrices(i = 10, m = identity, ret = []) = i >= 0
? matrices(i - 1, m
* mt(0, width)
* mr(33.65)
, concat(ret, [ m ]))
: ret;

for (m = matrices(300))
multmatrix(m)
tetra(2,4);

--
View this message in context:
http://forum.openscad.org/PolySet-has-nonplanar-faces-Attempting-alternate-construction-tp7544p13588.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

Your facets all have the wrong winding order. With faces = [[3, 2, 1, 0],[0, 1, 4],[1, 2, 4],[2, 3, 4],[3, 0, 4]]); the warnings go away and F6 is much faster as well. Note that in general you might get non-planar warnings when you do rotations if you don't split the base into two triangles. This is because floating point inaccuracies might make the transformed vertices slightly non-planar. Note also all your emails go into Google's spam filter so people might not see them. Your email address seems to be blacklisted. On 22 August 2015 at 06:31, ufomorace <ant.stewart@yahoo.com> wrote: > I have the same nonplanar message with the following code. > > It's a 6 triangle pyramid polyhedron, any random combination of unions of > this pyramid causes the error warning. The CGAL engine still makes the > geometry fast. am wondering if it would even cause the error with a cube, > and if so why with a poly constructed cube and not a primitive one. > > module tetra(size, height) { > polyhedron ( points = [[size, 0, 0], > [0, 0, size], > [-size, 0, 0], > [0, 0, -size], > [0, height, 0]], > > faces = [[0, 1, 2, 3],[4, 1, 0],[4, 2, 1],[4, 3, 2],[4, 0, 3]]); > } > > > width =4; > hgt = 2; > > // the identity matrix > identity = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] > ]; > > // generate 4x4 rotation matrix around Z axis > function mr(a) = [ [ cos(a), -sin(a), 0, 0 ], [ sin(a), cos(a), 0, 0 ], [ > 0, > 0, 1, 0 ], [ 0, 0, 0, 1 ] ]; > > // generate 4x4 translation matrix > function mt(x, y) = [ [ 1, 0, 0, x ], [ 0, 1, 0, y ], [ 0, 0, 1, 0 ], [ 0, > 0, 0, 1 ] ]; > > function matrices(i = 10, m = identity, ret = []) = i >= 0 > ? matrices(i - 1, m > * mt(0, width) > * mr(33.65) > , concat(ret, [ m ])) > : ret; > > for (m = matrices(300)) > multmatrix(m) > tetra(2,4); > > > > > -- > View this message in context: > http://forum.openscad.org/PolySet-has-nonplanar-faces-Attempting-alternate-construction-tp7544p13588.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
R
runsun
Sun, Aug 23, 2015 1:38 AM

nophead wrote

Note that in general you might get non-planar warnings when you do
rotations if you don't split the base into two triangles. This is because
floating point inaccuracies might make the transformed vertices slightly
non-planar.

When encountering this "non-planar" warning at rendering, but the shape
looks normal, will it go print correctly? Or this warning has to be
corrected
to make a correct print ?


$  Runsun Pan, PhD

$ -- libs: doctest , faces ( git ), offliner ( git );

tips: hash( 1 , 2 ), sweep , var

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly

--
View this message in context: http://forum.openscad.org/PolySet-has-nonplanar-faces-Attempting-alternate-construction-tp7544p13594.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

nophead wrote > Note that in general you might get non-planar warnings when you do > rotations if you don't split the base into two triangles. This is because > floating point inaccuracies might make the transformed vertices slightly > non-planar. When encountering this "non-planar" warning at rendering, but the shape looks normal, will it go print correctly? Or this warning has to be corrected to make a correct print ? ----- $ Runsun Pan, PhD $ -- libs: doctest , faces ( git ), offliner ( git ); tips: hash( 1 , 2 ), sweep , var $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly -- View this message in context: http://forum.openscad.org/PolySet-has-nonplanar-faces-Attempting-alternate-construction-tp7544p13594.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Sun, Aug 23, 2015 8:25 AM

I think it just resorts to splitting the face into triangles, so it doesn't
cause any problem other than being slower than triangulating it yourself.

On 23 August 2015 at 02:38, runsun runsun@gmail.com wrote:

nophead wrote

Note that in general you might get non-planar warnings when you do
rotations if you don't split the base into two triangles. This is because
floating point inaccuracies might make the transformed vertices slightly
non-planar.

When encountering this "non-planar" warning at rendering, but the shape
looks normal, will it go print correctly? Or this warning has to be
corrected
to make a correct print ?


$  Runsun Pan, PhD

$ -- libs: doctest , faces ( git ), offliner ( git );

tips: hash( 1 , 2 ), sweep , var

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly

--
View this message in context:
http://forum.openscad.org/PolySet-has-nonplanar-faces-Attempting-alternate-construction-tp7544p13594.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

I think it just resorts to splitting the face into triangles, so it doesn't cause any problem other than being slower than triangulating it yourself. On 23 August 2015 at 02:38, runsun <runsun@gmail.com> wrote: > nophead wrote > > Note that in general you might get non-planar warnings when you do > > rotations if you don't split the base into two triangles. This is because > > floating point inaccuracies might make the transformed vertices slightly > > non-planar. > > When encountering this "non-planar" warning at rendering, but the shape > looks normal, will it go print correctly? Or this warning has to be > corrected > to make a correct print ? > > > > > > ----- > > $ Runsun Pan, PhD > > $ -- libs: doctest , faces ( git ), offliner ( git ); > > tips: hash( 1 , 2 ), sweep , var > > $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly > > > > > -- > View this message in context: > http://forum.openscad.org/PolySet-has-nonplanar-faces-Attempting-alternate-construction-tp7544p13594.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
MK
Marius Kintel
Mon, Aug 24, 2015 2:15 PM

On Aug 23, 2015, at 04:25 AM, nop head nop.head@gmail.com wrote:

I think it just resorts to splitting the face into triangles, so it doesn't cause any problem other than being slower than triangulating it yourself.

Btw., the non-planar handling was rewritten just before the 2015.03 release - please report any new issues as there still might be unhandled corner cases in that code.

-Marius

On Aug 23, 2015, at 04:25 AM, nop head <nop.head@gmail.com> wrote: > I think it just resorts to splitting the face into triangles, so it doesn't cause any problem other than being slower than triangulating it yourself. > Btw., the non-planar handling was rewritten just before the 2015.03 release - please report any new issues as there still might be unhandled corner cases in that code. -Marius