Alternate triangulation bug

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

Alternate triangulation bug

Ronaldo
As Parkinbot remarked recently in another thread, the alternate triangulation
OpenSCAD builds for non-triangular faces has some bugs. I could isolate a
small example where this comes clear. The code is a simple polyhedron (fully
inside an intercepting cube) with many triangular faces and 2 quadrangular
faces. The list faces0 contains just the triangular faces; faces1 includes
the 2 quadrangular faces and faces2 is the same as faces1 with the
quadrangular faces explicitly subdivided in triangles. The polyhedron
defined with faces2 renders fine. With faces0, it renders with a warning
(non-manifold) because of the 2 missing faces. With faces1, we get an access
violation from CGAL. I checked it with version 2017.08.31 (git c6f3f0d) in a
Windows 7 environment.

verts = [[107.118, 20.796, 3.69206], [101.912, 18.7279, -9.29348], [89.8439,
13.9336, -3.69206], [95.0496, 16.0017, 9.29348], [91.3134, 60.0577,
3.69206], [86.6335, 56.9797, -9.29348], [75.7842, 49.844, -3.69206],
[80.4641, 52.9221, 9.29348], [61.5224, 90.1203, 3.69206], [57.5616, 86.1595,
-9.29348], [48.3794, 76.9773, -3.69206], [52.3402, 80.9381, 9.29348]];
;

faces0 = [[0, 5, 1], [0, 4, 5], [1, 6, 2], [1, 5, 6], [2, 7, 3], [2, 6, 7],
[3, 4, 0], [3, 7, 4], [4, 9, 5], [4, 8, 9], [5, 10, 6], [5, 9, 10], [6, 11,
7], [6, 10, 11], [7, 8, 4], [7, 11, 8]];

faces1 = concat(faces0, [ [0, 1, 2, 3], [11, 10, 9, 8]] );

faces2 =  concat( faces0, [ [0, 1, 2], [0, 2, 3], [8, 11, 10], [8, 10, 9]]
);

intersection(){
  translate([0,0,-100]) cube(200);
  polyhedron( verts, faces1);
//  polyhedron( verts, faces0);
//  polyhedron( verts, faces2);
}

 



--
Sent from: http://forum.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: Alternate triangulation bug

kintel
Administrator

> On Jan 7, 2018, at 11:26 AM, Ronaldo <[hidden email]> wrote:
>
> As Parkinbot remarked recently in another thread, the alternate triangulation
> OpenSCAD builds for non-triangular faces has some bugs.

I believe this is covered by #2246, which I fixed yesterday: https://github.com/openscad/openscad/issues/2246

FYI: The bug was that we didn’t always catch when CGAL failed at accepting a polygon. I think our own triangulation has always worked.

 -Marius


_______________________________________________
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: Alternate triangulation bug

tp3
On 07.01.2018 17:34, Marius Kintel wrote:
>
>> On Jan 7, 2018, at 11:26 AM, Ronaldo <[hidden email]> wrote:
>>
>> As Parkinbot remarked recently in another thread, the alternate triangulation
>> OpenSCAD builds for non-triangular faces has some bugs.
>
> I believe this is covered by #2246, which I fixed yesterday:> https://github.com/openscad/openscad/issues/2246
>
And Windows snapshot builds are updated to include that fix.

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: Alternate triangulation bug

Ronaldo
I was not aware of #2246. I have checked my codes with the new version and it seems to work as expected. Thank you.

2018-01-07 14:38 GMT-02:00 Torsten Paul <[hidden email]>:
On 07.01.2018 17:34, Marius Kintel wrote:
>
>> On Jan 7, 2018, at 11:26 AM, Ronaldo <[hidden email]> wrote:
>>
>> As Parkinbot remarked recently in another thread, the alternate triangulation
>> OpenSCAD builds for non-triangular faces has some bugs.
>
> I believe this is covered by #2246, which I fixed yesterday:> https://github.com/openscad/openscad/issues/2246
>
And Windows snapshot builds are updated to include that fix.

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: Alternate triangulation bug

Gadgetmind
Does this triangulation handle faces that have concave edges? If so, it's
something that's hard to implement within OpenSCAD "user land" and it would
be good to be able to force polyhedron to do this task. Perhaps a
triangulation option that defaults to false?

This would speed up rendering and make skin () from list-comprehensions far
more useful. I've added my own convex-only triangulation to skin () to
prevent cgal errors and speed things up, but as the logic is in the "back
end" why not enable users to choose to enable it?

Thanks.




--
Sent from: http://forum.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: Alternate triangulation bug

Ronaldo
2018-02-25 6:42 GMT-03:00 Gadgetmind <[hidden email]>:
Does this triangulation handle faces that have concave edges?
​...
 Perhaps a
triangulation option that defaults to false?

​Yes, it handles non-convex facets and even non-planar ones:

p = [ [10,20,0],[0,0,-10], [10,-10,0], [20,0,0], [30,0,20], [20,20,0]];

polyhedron(points=p,faces=[[1,2,3,4,5,0]]);

​Note that the triangulation of the facet changes​ with the facet indexing (circular) order. You have no control on it although it may change radically the geometry of non-planar facets.

AFAIK, this triangulation is fired automatically when CGAL complaints some facet is non-planar. I don't think a triangulation option is needed because the process is very fast. Anyway, to help beginners it should defaults to true.


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

Re: Alternate triangulation bug

Gadgetmind
On 25/02/18 14:10, Ronaldo Persiano wrote:

AFAIK, this triangulation is fired automatically when CGAL complaints some facet is non-planar. I don't think a triangulation option is needed because the process is very fast.

I used to see the error and the retry a good 15-20 minutes into a render. Won't cgal restart from scratch?



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