Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] [CGAL] - Intersection de polyèdres

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] [CGAL] - Intersection de polyèdres


Chronological Thread 
  • From: Peter Hachenberger <>
  • To:
  • Subject: Re: [cgal-discuss] [CGAL] - Intersection de polyèdres
  • Date: Tue, 12 Dec 2006 18:00:23 +0100

Hi Cedric,

my French is very bad, but I am in charge of the Nef polyehdra, so I try
to help you. Usually you should write in English to this mailing list.

First, you can do complex polyhedron intersections with
Nef_polyhedron_3. You can get a Nef_polyhedron from a Polyhedron
by using the constructor Nef_polyhedron_3(Polyhedron_3). It sounds like
you had some problems with that, but my French is not good enough to
understand them. If you can state your problems in English, I will
help you.

An advice. We already wrote a demo program for the visual hull. You can
find it in demo/Nef_3. Try to compile visual_hull.cpp and run it with
the given example mpi.vsh.

Best, Peter

On Tue, 2006-12-12 at 17:40 +0100, Cédric LE MAITRE wrote:
> Bonjour,
>
> Je suis novice avec la librairie CGAL et j'utilise pour la 1ere fois
> cette mailing-list (je ne connais donc pas les uses et coutumes).
> En tout cas, j'utiliserais pour cela le Français pour communiquer. Et
> mon message s'adresse à des développeur CGAL.
>
> Je cherche à calculer un polyèdre correspondant l'intersection de 2
> polyèdres 3D. Mes polyèdres sont des cones de vues constitués d'un
> sommet et d'une base constituée de n points (correspondant à n points
> d'un contour sur un plan. L'objectif final étant de reconstruire un
> visual hull à partir de contour 2D de la silhouette d'une forme).
>
> Voici mon code :
>
> #include <CGAL/Simple_cartesian.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/IO/Polyhedron_iostream.h>
> #include <CGAL/IO/Polyhedron_VRML_2_ostream.h>
> #include <iostream>
>
>
> #include <CGAL/Gmpz.h>
> #include <CGAL/Homogeneous.h>
> #include <CGAL/Nef_polyhedron_3.h>
> #include <CGAL/IO/Nef_polyhedron_iostream_3.h>
>
> typedef CGAL::Homogeneous<CGAL::Gmpz> Kernel;
> typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
> typedef Polyhedron::Point_3 Point;
> typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
>
>
> int main() {
> Point p_top(10.0f, 10.0f, 0.0f);
> Point p_center(10.0f, 10.0f, -40.0f);
> Point p1(20.0f, 5.0f, -40.0f);
> Point p2(5.0f, 5.0f, -40.0f);
> Point p3(5.0f, 30.0f, -40.0f);
> Point p4(15.0f, 30.0f, -40.0f);
> Point p5(25.0f, 10.0f, -40.0f);
> Polyhedron P;
> P.make_tetrahedron(p_top, p_center, p1, p2);
> P.make_tetrahedron(p_top, p_center, p2, p3);
> P.make_tetrahedron(p_top, p_center, p3, p4);
> P.make_tetrahedron(p_top, p_center, p4, p5);
> P.make_tetrahedron(p_top, p_center, p5, p1);
>
>
> Point p2_top(20.0f, 10.0f, -10.0f);
> Point p2_center(-20.0f, 10.0f, -30.0f);
> Point p21(-20.0f, 5.0f, 0.0f);
> Point p22(-20.0f, 5.0f, -25.0f);
> Point p23(-20.0f, 30.0f, -25.0f);
> Point p24(-20.0f, 30.0f, -5.0f);
> Point p25(-20.0f, 10.0f, 5.0f);
> Polyhedron P2;
> P2.make_tetrahedron(p2_top, p2_center, p21, p22);
> P2.make_tetrahedron(p2_top, p2_center, p22, p23);
> P2.make_tetrahedron(p2_top, p2_center, p23, p24);
> P2.make_tetrahedron(p2_top, p2_center, p24, p25);
> P2.make_tetrahedron(p2_top, p2_center, p25, p21);
>
> CGAL::VRML_2_ostream out( std::cout);
>
>
>
> out << (Polyhedron)P;
> out << (Polyhedron)P2;
>
>
> return (1);
> }
>
> J'y crée 2 polyèdre P et P2 (qui possède une zone d'intersection).
>
> Mon problème est comment calculer le polyèdre d'intersection ?
>
> J'ai essayé de le faire en utilisant la classe Nef_Polyedron et ces
> opération booléenne. Or:
>
> * il est impossible de créer un Nef_Polyhedron directement à
> partir d'un Polyhedron tel que P et P2
>
> * ex: Nef_polyhedron N1(P); -> plante CGAL
>
> * idem lorsque j'assaie de créer un Nef_Polyhedron en faisant
> l'union de tetrahedron (sans passer ?
>
> * Ex: Nef_polyhedron N1(P_tetra); // Nb de vertices de
> N1 résultat = 4
>
>
> Nef_polyhedronN2(P_tetra2);
>
> N1 += N2; // Nb de vertices de N1 résultat = 0 !!
>
>
> Est-il possible de calculer l'intersection de polyèdre complexe avec
> CGAL ?
>
> Merci d'avance à toute les personnes qui prendront le temps de
> répondre à mes questions.
>
> Cédric.
>





Archive powered by MHonArc 2.6.16.

Top of Page