Subject: CGAL users discussion list
List archive
- From: Martin Baeker <>
- To: CGAL Mailinglist <>
- Subject: [cgal-discuss] Is a point inside a Nef_polyhedron?
- Date: Tue, 9 Mar 2010 15:28:36 +0100 (CET)
- Organization: Institut fuer Werkstoffe TU Braunschweig
Dear all,
I have trouble finding out whether a point is inside a
Nef_polyhedron. I create a cube by intersecting 6 planes. However,
even when a point is clearly outside, it is still located as being
inside a volume - probably because a Polyhedron created in this way
actually consists of two volumes. (example program below)
Is there a way to use the Volume_const_handle to find out whether I'm
actually inside or outside of my polyhedron (for example, by checking
whether it is bounded)?
Thanks for any help,
Martin.
Here is the example program:
#include <CGAL/Gmpz.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
typedef CGAL::Extended_homogeneous<CGAL::Gmpz> Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
typedef Kernel::Plane_3 Plane_3;
typedef Kernel::Point_3 Point_3;
typedef Nef_polyhedron::Vertex_const_handle Vertex_const_handle;
typedef Nef_polyhedron::Halfedge_const_handle Halfedge_const_handle;
typedef Nef_polyhedron::Halffacet_const_handle Halffacet_const_handle;
typedef Nef_polyhedron::Volume_const_handle Volume_const_handle;
typedef Nef_polyhedron::Object_handle Object_handle;
int main() {
Nef_polyhedron N1(Plane_3( 1, 0, 0,-1));
Nef_polyhedron N2(Plane_3(-1, 0, 0,-1));
Nef_polyhedron N3(Plane_3( 0, 1, 0,-1));
Nef_polyhedron N4(Plane_3( 0,-1, 0,-1));
Nef_polyhedron N5(Plane_3( 0, 0, 1,-1));
Nef_polyhedron N6(Plane_3( 0, 0,-1,-1));
Nef_polyhedron Cube2 = N1 * N2 * N3 * N4 * N5 * N6;
Vertex_const_handle v;
Halfedge_const_handle e;
Halffacet_const_handle f;
Volume_const_handle c;
// This point is definitely outside!
Object_handle o = Cube2.locate(Point_3(1000,1000,1000));
if(CGAL::assign(v,o))
std::cout << "Locating vertex" << std::endl;
else if(CGAL::assign(e,o))
std::cout << "Locating edge" << std::endl;
else if(CGAL::assign(f,o))
std::cout << "Locating facet" << std::endl;
else if(CGAL::assign(c,o))
std::cout << "Locating volume" << std::endl;
//other cases can not occur
return 0;
}
Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
<>
- [cgal-discuss] Is a point inside a Nef_polyhedron?, Martin Baeker, 03/09/2010
Archive powered by MHonArc 2.6.16.