Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Nef polygon traversal

Subject: CGAL users discussion list

List archive

[cgal-discuss] Nef polygon traversal


Chronological Thread 
  • From: 许春旭 <>
  • To:
  • Subject: [cgal-discuss] Nef polygon traversal
  • Date: Wed, 25 May 2016 16:45:47 +0800
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:NDpbtxUzqayhG6n+IUVmweXvbZ3V8LGtZVwlr6E/grcLSJyIuqrYZhaAt8tkgFKBZ4jH8fUM07OQ6PCxHzBbqs7a+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq8yVP14D3GH1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GLdXBTBjP2Eu79DwrjHCSxGO7z0SSDY4iB1NVvA9FFmuTor6onOqnuV40Siee8bxSOZnCnyZ8653RUqw2288PDkj/TSPhw==

Hi all, 

I'm using the "2D Boolean Operations on Nef Polygon"package. I;m wondering how the structure of the Nef Polygon is organized: I read the part of the manual about the Explorer but still not very clear, so I run a test program. Following is the piece of code creating a rectangle area (0.0, 4.5) x (0.0, 1.0)

Nef_polyhedron N1(Line(1, 0, 0), Nef_polyhedron::EXCLUDED);
Nef_polyhedron N2(Line(0, 1, 0), Nef_polyhedron::EXCLUDED);
Nef_polyhedron N3(Line(-1, 0, 4.5), Nef_polyhedron::EXCLUDED);
Nef_polyhedron N4(Line(0, -1, 1), Nef_polyhedron::EXCLUDED);

and following is the code that traverses the area:

Explorer tE = N5.explorer();
auto faceIter = tE.faces_begin();  ++faceIter;
for (; faceIter != tE.faces_end(); ++faceIter)
{
cout << "New Face: " << endl;
Explorer::Halfedge_around_vertex_const_circulator heIter(tE.halfedge(faceIter));
auto heStartIter = heIter;
CGAL_For_all(heIter, heStartIter)
{
if (tE.is_standard(tE.target(heIter)) || tE.is_standard(tE.source(heIter)))
{
auto p = tE.source(heIter)->point();
cout << CGAL::to_double(p.x()) << " " << CGAL::to_double(p.y()) << " --> ";
p = tE.target(heIter)->point();
cout << CGAL::to_double(p.x()) << " " << CGAL::to_double(p.y()) << endl;
}
}
}

I though at least one face should show all four edges of the rectangle, like this:

New Face: 
0 1 --> 0 0
0 0 --> 4.5 0
4.5 0 --> 4.5 1
4.5 1 --> 0 1

, but the output is like this:

New Face:
New Face:
0 1 --> 0 0
0 1 --> 4.5 1

Where am I understanding it wrong? Thanks very much.


Best regards.

Chunxu Xu
Department of Computer Science and Technology
Tsinghua University
Beijing
People's Republic of China



Archive powered by MHonArc 2.6.18.

Top of Page