Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Nef_3 and Polyedrhon

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Nef_3 and Polyedrhon


Chronological Thread 
  • From: "Rubén Martínez" <>
  • To:
  • Subject: Re: [cgal-discuss] Nef_3 and Polyedrhon
  • Date: Sat, 4 Aug 2007 23:56:05 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=kPY9uSM6D0ZXpezfb/UEYTsSFlYaBxHOwlCf9gdGtfT6jL9fSDaHe5dCEJnGi9rvhiM7+GRMmK6P7TfNsTge2tROmsCJBFLI38gFSw2t+BIwajT0v4wUIBwAm9Uk7nm9m2UBbFzkDKrHk+WIeWnChm8MNbGp2baoargWY9qPpPU=

The complete code is this:

#include <CGAL/Gmpz.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <iostream>
#include <fstream>

typedef CGAL::Homogeneous<CGAL::Gmpz> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
typedef Kernel::Vector_3 Vector_3;
typedef Kernel::Aff_transformation_3 Aff_transformation_3;

using namespace std;

Polyhedron readOFF(char *p)
{
Polyhedron P;
ifstream file;
file.open(p);

file >> P;

return P;
}

int main() {

Polyhedron P;
char *path;
path = "polyhedron.off";

P = readOFF (path);

if(P.is_closed()) {
Nef_polyhedron N1(P);

if(N1.is_simple()) {
N1.convert_to_Polyhedron(P);
std::cout << P;
std::cout << "Número de Vértices: ";
std::cout << P.size_of_vertices ();
}
else
std::cerr << "N1 is not a 2-manifold." << std::endl;
}
}

Is a copy of a one example of basic CGAL, with some changes, but I dot
know because I have this problem...

On 8/3/07, Peter Hachenberger
<>
wrote:
> Hi Ruben,
>
> I've never seen that happen before. CAn you please send me the whole
> code, i.e., with type definitions. As far as I can see, this part of the
> code is fine.
>
> Peter
>
> On Fri, 2007-08-03 at 12:49 +0200, Rubén Martínez wrote:
> > My problem reside in de transformation from Nef 3 to Polyedron, this code:
> >
> > N1.convert_to_Polyhedron(P);
> >
> >
> > My complete code is this:
> >
> > main(){
> >
> > Polyhedron P;
> > char *path;
> > path = "polyhedron.off";
> >
> > P = readOFF (path);
> >
> > if(P.is_closed()) {
> > Nef_polyhedron N1(P);
> >
> > if(N1.is_simple()) {
> > N1.convert_to_Polyhedron(P);
> > std::cout << P;
> > std::cout << "Número de Vértices: ";
> > std::cout << P.size_of_vertices ();
> > }
> > else
> > std::cerr << "N1 is not a 2-manifold." << std::endl;
> > }
> > }
> >
> > And when I convert N1 (Nef 3) to P (Polyedron) i observe that the
> > vertex are duplicated, for example:
> >
> > In this tetrahedron, i f I load this in the Nef 3, i have this:
> >
> > OFF
> > 8 6 0
> > # vertices
> > -1 -1 1
> > -1 1 1
> > 1 1 1
> > 1 -1 1
> > -1 -1 -1
> > -1 1 -1
> > 1 1 -1
> > 1 -1 -1
> > # facets
> > 4 3 2 1 0
> > 4 0 1 5 4
> > 4 6 5 1 2
> > 4 3 7 6 2
> > 4 4 7 3 0
> > 4 4 5 6 7
> >
> >
> > but if I execute the code N1.convert_to_Polyhedron(P); i obtain this
> result
> > OFF
> > 16 12 0
> >
> > -1 -1 1
> > -1 1 1
> > 1 1 1
> > 1 -1 1
> > -1 -1 -1
> > -1 1 -1
> > 1 1 -1
> > 1 -1 -1
> > -1 -1 1
> > -1 1 1
> > 1 1 1
> > 1 -1 1
> > -1 -1 -1
> > -1 1 -1
> > 1 1 -1
> > 1 -1 -1
> >
> > 4 3 2 1 0
> > 4 0 1 5 4
> > 4 6 5 1 2
> > 4 3 7 6 2
> > 4 4 7 3 0
> > 4 4 5 6 7
> > 4 12 15 11 8
> > 4 12 8 9 13
> > 4 8 11 10 9
> > 4 12 13 14 15
> > 4 15 14 10 11
> > 4 13 9 10 14
> >
> > Anyone know any solution for this problem?????
> >
> > Thanks
> >
> > RMG
> >
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>




Archive powered by MHonArc 2.6.16.

Top of Page