Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss][Nef_polyhedron]A more complex but still simple question

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss][Nef_polyhedron]A more complex but still simple question


Chronological Thread 
  • From: Peter Hachenberger <>
  • To:
  • Subject: Re: [cgal-discuss][Nef_polyhedron]A more complex but still simple question
  • Date: Mon, 04 Feb 2008 16:53:29 +0100

I never saw number type Gmpzf before. It is not tested with
Nef_polyhedron_3. I know that there are problems of Nef_3 with MP_float.
So, I would not be surprised if there are also problems with Gmpzf.
MP_float and Gmpzf do not allow gcd computation and therefore do not
allow normalization of coordinates. If Gmpz works, but Gmpzf does not,
you might want to try Gmpzf with the indexed items. That might work.
It's not easy for me to test this, because my test suite uses reference
files to check computed polyhedra. But the checking assumes that I have
normalized coordinates. Summing up:

1. Try your code with

typedef CGAL::Homogeneous<CGAL::Gmpz> Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron_3;

If it does not work, we have to go into more depth.

2. Try

typedef CGAL::Homogeneous<CGAL::Gmpzf> Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel, CGAL::SNC_indexed_itemsl>
Nef_polyhedron_3;

Would be interesting to know whether this works.

Peter


On Mon, 2008-02-04 at 22:52 +0800, Max wrote:
> Hi,
>
> I posted this message about 2 weeks ago. But I've got no
> response. :-P
>
> I've tested this case for several times on VS 2003 / 2005.
> But the problem persists.
>
> I've also test the simplest case as follows, with the same kernel:
>
> {
> Point_3 p( 1.0, 0.0, 0.0);
> Point_3 q( 0.0, 1.0, 0.0);
> Point_3 r( 0.0, 0.0, 1.0);
> Point_3 s( 0.0, 0.0, 0.0);
>
> Polyhedron_3 P;
> P.make_tetrahedron( p, q, r, s);
> Nef_polyhedron_3 N(P); // convert to nef
> }
>
> and found this is ok.
>
> Could anybody, especially Peter :-), help me?
>
> Many thanks.
> Max
>
> >Hello,
> >
> >It seems that I probably have not understood CGAL::Nef_3 well,
> >for I just keep coming across problems with it.
> >
> >Here's still a simple question/problem related to Nef_polyhedron:
> >
> >I'm reading a closed polyhedron and then convert it into a Nef_3,
> >the code is as this:
> >
> >template <class Polyhedron_3>
> >bool ReadPolyhedron(std::string path, Polyhedron_3& P)
> >{
> > try
> > {
> > std::ifstream is(path.c_str());
> > is >> P;
> > is.close();
> > }
> > catch(...) { return false; }
> >
> > return true;
> >}
> >
> >typedef CGAL::Homogeneous<CGAL::Gmpzf> Kernel;
> >typedef Kernel::Point_3 Point_3;
> >typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
> >typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron_3;
> >
> >int main(int argc, char*argv[])
> >{
> > std::string path("simple.off");
> > Polyhedron_3 P1;
> > if(!ReadPolyhedron(path, P1)) return 1;
> > std::cout << P1;
> >
> > if(! P1.is_closed())
> > {
> > cout << "not a closed polyhedron" << endl;
> > return 1;
> > }
> > Nef_polyhedron_3 N1(P1); // convert to nef
> > cout << N1;
> >}
> >
> >The program ceased, under debug mode, at assertions.cpp:
> >
> >assertion_fail( const char* expr,
> > const char* file,
> > int line,
> > const char* msg )
> >{
> > (*_error_handler)("assertion", expr, file, line, msg);
> > switch (_error_behaviour) {
> > case ABORT:
> > CGAL_CLIB_STD::abort();
> > case EXIT:
> > CGAL_CLIB_STD::exit(1); // EXIT_FAILURE
> > case EXIT_WITH_SUCCESS:
> > CGAL_CLIB_STD::exit(0); // EXIT_SUCCESS
> > case THROW_EXCEPTION:
> > throw Assertion_exception("CGAL", expr, file, line, msg); //
> > HERE !!!
> > case CONTINUE:
> > ;
> > }
> >}
> >
> >and seems to be called by converting P into a Nef_3.
> >
> >I'm using CGAL 3.3.1+WinXP/SP2+VS2005/SP1.
> >the .off file is attached.
> >
> >Please tell me what's wrong.
> >
> >Thanks
> >
> >B/Rgds
> >Max



Archive powered by MHonArc 2.6.16.

Top of Page