Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] strange results when cutting a triangle and tetrahedron (both convert to Nef_polyhedron_3)
Chronological Thread
- From: Andre Massing <>
- To:
- Subject: Re: [cgal-discuss] strange results when cutting a triangle and tetrahedron (both convert to Nef_polyhedron_3)
- Date: Thu, 6 May 2010 10:07:31 +0200
- Organization: Simula Research Laboratory
Hi!
Maybe I should have asked a short question before I digged into the details:
It is in principle possible to use Nef_polyhedrons to compute the
intersection
of a triangle and tetrahedron? I assumed it from the documentation of the
package since it seems quite powerful... Or am I doing the conversion from
Polyhdron to Nef_Polyhedron wrong?
Onsdag 5. mai 2010 10.48.05 skrev Andre Massing :
> Hi!
>
> I found (many) example(s) of a strange intersection results for a triangle
> and a and tetrahedron when converted to Nef_polyhedron_3. Background is
> that I implemented a barycenter quadrature for arbitrary polyhedrons as
> part of a the FEM library DOLFIN (http://www.fenics.org/wiki/DOLFIN).
>
> In the code I first create a tetrahedron and a triangle as Polyhedron_3 via
> the make_triangle and make_tetrahedron. Afterwards I assign them to
> Nef_polyhedron objects and intersect them via operator*.
> Here a 2 examples, the second (which is the first in the attached code)
> gives reasonable results (at least if I compute volume and barycenter),
> but I don't understand the result of the first (2nd in attached code) at
> all:
>
> Point_3 a3(0.35, 0.35 ,0.35);
> Point_3 a4(0.45, 0.35 ,0.35);
> Point_3 a5(0.45, 0.45 ,0.35);
>
> Polyhedron_3 tri_1;
> tri_1.make_triangle(a3,a4,a5);
> Nef_polyhedron_3 Ntri_1(tri_1);
>
> Point_3 b0(0.333333, 0.333333, 0.333333);
> Point_3 b1(0.333333, 0.666667, 0.333333);
> Point_3 b2(0.666667, 0.666667, 0.333333);
> Point_3 b3(0.666667, 0.666667, 0.666667);
>
> Polyhedron_3 tet_1;
> tet_1.make_tetrahedron(b0,b1,b2,b3);
> Nef_polyhedron_3 Ntet_1(tet_1);
>
> At least my understanding of how the Nef_polyhedron intersections works
> tells me that there should be nontrivial polygonal intersection if I do
> Ntet_1*Ntri_1. The triangle is a triangle located in a x-y plane shifted to
> z = 0.35 and the (solid) tetrahedron clearly intersects this triangle in
> a polygonal region.
>
> But the output says:
> cut_polygon is non_empty (): 0
> Number of number_of_vertices (): 0
> ^^^? Why 0 vertices?
> Number of number_of_egdes (): 1
> ^^^? One edge but no
> vertices??
> Number of number_of_halfegdes (): 2
> Number of number_of_halffacets (): 0
> Number of number_of_facets (): 0
> ^^There should be a facet
> (representing the polygonal intersection
> as part of the triangle, shouldn't there?
> Number of number_of_volumes (): 1
>
> Opposed to the other example:
>
> Point_3 a0(0.0, 0.0, 0.5);
> Point_3 a1(2.0, -0.1, 0.5);
> Point_3 a2(-0.1, 2.0, 0.5);
>
> Polyhedron_3 tri;
> tri.make_triangle(a0,a1,a2);
> Nef_polyhedron_3 Ntri(tri);
>
> and
>
> Point_3 e0(0.0, 0.0, 0.0);
> Point_3 e1(1.0, 0.0, 0.0);
> Point_3 e2(0.0, 1.0, 0.0);
> Point_3 e3(0.0, 0.0, 1.0);
>
> Polyhedron_3 tet;
> tet.make_tetrahedron(e0,e1,e2,e3);
> Nef_polyhedron_3 Ntet(tet);
>
> Ntri*Ntet gives
>
> Cut_polygon is non_empty (): 0
> Number of number_of_vertices (): 2
> ^^^ Also strange...
> Number of number_of_egdes (): 3
> Number of number_of_halfegdes (): 6
> Number of number_of_halffacets (): 2
> Number of number_of_facets (): 1
> Number of number_of_volumes (): 1
>
> Can anybody come up with a explanation for that behaviour? Or do I use the
> classes the wrong way? Any help/enlightment are really appreciated!
> Example code is attached, you can compile it with (one line)
> g++ -o strange_poyhedron_cuts strange_poyhedron_cuts.cpp -frounding-math \
> -lCGAL -L/<YOUR CGAL LIBPATH>
>
>
> Kind regards,
> Andre
>
- [cgal-discuss] strange results when cutting a triangle and tetrahedron (both convert to Nef_polyhedron_3), Andre Massing, 05/05/2010
- Re: [cgal-discuss] strange results when cutting a triangle and tetrahedron (both convert to Nef_polyhedron_3), Andre Massing, 05/06/2010
Archive powered by MHonArc 2.6.16.