Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Determining if a point is inside a polyhedron
- Date: Mon, 02 Apr 2012 09:04:37 +0200
Since you are using Nef, what about computing the union of the two
spheres and then extract the boundary?
N1+=N2;
Polyhedron result;
N1.convert_to_polyhedron(result);
see:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Nef_3_ref/Class_Nef_polyhedron_3.html
Sebastien.
On 04/01/2012 04:13 PM, Oleg wrote:
Hi all!
Newbie question. I have two triangulated intersecting spheres (3D
polyhedrons) and want to exclude the triangles from each sphere surface that
are inside the other sphere. What would be the easiest way to do that? Here
is what I'm trying and so far it doesn't work (skipping the unnecessary
code):
#include<CGAL/Exact_predicates_exact_constructions_kernel.h>
#include<CGAL/Polyhedron_3.h>
#include<CGAL/Nef_polyhedron_3.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Triangle_3 Triangle;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef Polyhedron::Facet_const_iterator Facet_const_iterator;
typedef Nef_polyhedron::Volume_const_handle Volume_const_handle;
std::vector<Triangle> triangles;
//The spheres are represented by two 3D polyhedrons:
Polyhedron P1;
Polyhedron P2;
Volume_const_handle v;
//I convert each polyhedron to a nef_polyhedron:
Nef_polyhedron N1(P1);
Nef_polyhedron N2(P2);
//and check if a vertex from P1 belongs to N2:
for ( Facet_const_iterator i = P1.facets_begin(); i != P1.facets_end();
++i){
if (!assign(v, N2.locate(i->halfedge()->vertex()->point()))&&
!assign(v, N2.locate(i->halfedge()->next()->vertex()->point()))&&
!assign(v,
N2.locate(i->halfedge()->next()->next()->vertex()->point()))) {
Triangle t(i->halfedge()->vertex()->point(),
i->halfedge()->next()->vertex()->point(),
i->halfedge()->next()->next()->vertex()->point());
triangles.push_back(t);
}
}
//Same for P2
The goal is to have vector 'triangles' with those triangles from each
surface that are not inside the other sphere. So far it compiles, but I get
empy vector in the output. What do I miss here? Or is there an easier way to
achieve the same goal? Thanks for any help.
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Determining-if-a-point-is-inside-a-polyhedron-tp4523460p4523460.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Determining if a point is inside a polyhedron, Oleg, 04/01/2012
- Re: [cgal-discuss] Determining if a point is inside a polyhedron, Sebastien Loriot (GeometryFactory), 04/02/2012
- [cgal-discuss] Re[2]: Determining if a point is inside a polyhedron, Oleg, 04/03/2012
- [cgal-discuss] Re: Re[2]: Determining if a point is inside a polyhedron, Zohar, 04/03/2012
- Re: [cgal-discuss] Re[2]: Determining if a point is inside a polyhedron, Sebastien Loriot (GeometryFactory), 04/04/2012
- [cgal-discuss] Re[4]: Determining if a point is inside a polyhedron, Oleg, 04/10/2012
- Re: [cgal-discuss] Re[4]: Determining if a point is inside a polyhedron, Sebastien Loriot (GeometryFactory), 04/11/2012
- [cgal-discuss] Re[6]: Determining if a point is inside a polyhedron, Oleg, 04/11/2012
- Re: [cgal-discuss] Re[4]: Determining if a point is inside a polyhedron, Sebastien Loriot (GeometryFactory), 04/11/2012
- [cgal-discuss] Re[4]: Determining if a point is inside a polyhedron, Oleg, 04/10/2012
- [cgal-discuss] Re[2]: Determining if a point is inside a polyhedron, Oleg, 04/03/2012
- [cgal-discuss] Re: Determining if a point is inside a polyhedron, daisy, 04/11/2012
- [cgal-discuss] Re[2]: Determining if a point is inside a polyhedron, Oleg, 04/12/2012
- Re: [cgal-discuss] Determining if a point is inside a polyhedron, Sebastien Loriot (GeometryFactory), 04/02/2012
Archive powered by MHonArc 2.6.16.