Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: "Max" <>
  • To: "" <>
  • Subject: Re: Re: [cgal-discuss][Nef_polyhedron]A more complex but still simplequestion
  • Date: Tue, 5 Feb 2008 10:20:19 +0800
  • Disposition-notification-to: "Max" <>
  • Organization: LoadCom

Hello Peter,

Thank you for youe quick reply.

>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;

Ignoring the fact that the kernel will convert the double type
input into integers, This one works nearly well, except:

I encountered a rediculous problem that I once did before.

with code

Polyhedron_3 P;
std::cin >> P;

and command line
[nef.exe] < [sample.off]

it works well. but with code

ReadPolyhedron(path, P);

which is difined as follows:

template <class Polyhedron_3>
bool ReadPolyhedron(std::string path, Polyhedron_3& P)
{
std::ifstream is;
try { is.open(path.c_str()); } catch(...) { return false; }
try { is >> P; } catch(...) { is.close(); return false; }

is.close();
return true;
}

P is not properly read. it's really strange.

>
>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;

I know nothing about indexed item before. But it works quite well.

One more question, the program output 'Constructor not available for this
Kernel'
What does it mean? Could this message be ignored?

Thanks again.
Max

>
>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
>--
>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