Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Polyhedron_3 I/O problem

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Polyhedron_3 I/O problem


Chronological Thread 
  • From: "Joe C" <>
  • To:
  • Subject: Re: [cgal-discuss] Polyhedron_3 I/O problem
  • Date: Wed, 16 Jul 2008 14:22:29 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=VffcGD3dDARM30hFgHnk2nfF3fNr3dZBrPH4fayPdVzXS3S5E9R6eVcS3qduBrqUsY FXBN7VjPQv2p71LXvu6ChOBz/iCH1ZLXGim0oraBTAMPir6XvgB/4I2VpBL4YQRfxZFU Pa5QvUQDwFJ6KhVDgRClxp/irIPAuk9TBw6Zg=

Hi, Peter,

Your code works fine. I just realized that I was using non - default parameters for is_valid(). I was using is_valid(false, 1). If I use is_valid(true, 1), I got the message as:

level 4: normalized_border_is_valid( verbose = true)
begin CGAL::HalfedgeDS_const_decorator<HDS>::normalized_border_is_valid( verb=tr
ue):
    non-border edges: 18
    first border edge does not start at border_halfedges_begin()
end of CGAL::HalfedgeDS_const_decorator<HDS>::normalized_border_is_valid(): stru
cture is NOT VALID.
end of CGAL::HalfedgeDS_const_decorator<HDS>::is_valid(): structure is NOT VALID
.
counting halfedges failed.
end of CGAL::Polyhedron_3<...>::is_valid(): structure is NOT VALID.

I think that's because my cube is closed, and no border halfedges, which might cause this error message.

As long as I use is_valid() without specifying any parameters, it's working fine.

However, if I use another cube2.off (see attached), I am told that the cube2 polyhedron is closed and valid, but the size_of_facets() and the size_of_vertices() return zero. Any ideas why this happens?

Thank you for your help.

Joe


On Wed, Jul 16, 2008 at 11:22 AM, Peter Hachenberger <> wrote:
Hi Joe,

that's odd. The file is OK and I'm also told that it is valid by
Polyhedron_3. My program looks something like the following:

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

int main()
{
    Polyhedron_3 poly;
    std::ifstream in("cube.off");
    in >> poly;
    std::cout << "valid " << poly.is_valid();
}

That works nicely


Peter

-----"Joe C" wrote: -----

To:
From: "Joe C"
Date: 07/16/2008 07:01PM
Subject: Re: [cgal-discuss] Polyhedron_3 I/O problem


I tried Max's approach, it's not working...

Peter, please see the attached cube.off that I used in my test. It's just a simple cube object. When I read in this file, the polyhedron is not valid though I cannot see anything wrong with the data. The cube looks right in my viewer too, but just not valid.

Joe

On Wed, Jul 16, 2008 at 2:25 AM, Peter Hachenberger < > wrote:
Hi Joe,

that sounds like unwanted behavior. Can you send me some example file and tell me what the difference is between how it looks like and how it should look like?

Peter

-----"Joe C" wrote: -----

To:
From: "Joe C"
Date: 07/16/2008 01:56AM
cc: "Joe C"
Subject: [cgal-discuss] Polyhedron_3 I/O problem


Hi, everyone,

I am testing a simple I/O function of Polyhedron_3. I found that the output has different results from the input. Here is the pseudo code:

// a polyhedron
Polyhedron_3 poly;

// some construction work, not listed....

// test closeness and validity before output
poly.is_closed(); // true
poly.is_valid(); // true

// output
std::ofstream SaveFile("output.off");
SaveFile << poly;
SaveFile.close();

// read in output
poly.clear();
OpenFile.open("output.off");
OpenFile >> poly;
OpenFile.close();

// test closeness and validity after output
poly.is_closed(); // true
poly.is_valid(); // false, different from original one

Notice that the polyhedron "poly" after reading in the output is no longer valid.

Is this CGAL bug or am I missing something here ? My guess is that somehow it messed up because of some numerical problem. I am using Exact_predicates_exact_constructions_kernel.

P.S. if I read in some ".off" model into Polydedron_3, do I lose the original validity of the model as well?

Thanks.
Joe








Attachment: Cube2.off
Description: Binary data




Archive powered by MHonArc 2.6.16.

Top of Page