Update documents

This commit is contained in:
Ning Xu 2014-07-16 23:46:17 -04:00
parent b1439c5622
commit 8c1f806a24
4 changed files with 16 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -123,6 +123,9 @@ if only one (or very little) queries are required, using one of the algorithms t
\section simple_polygon_visibility_example Example of Visibility in a Simple Polygon
The following example shows how to obtain the regularized and non-regularized visibility regions.
\cgalFigureBegin{simple_example, simple_example.png}
The visibility region of \f$ q \f$ in a simple polygon: (1) non-regularized visibility; and (2) regularized visibility.
\cgalFigureEnd
\cgalExample{Visibility_2/simple_polygon_visibility_2.cpp}
\section general_polygon_example Example of Visibility in a Polygon with Holes

View File

@ -49,8 +49,8 @@ int main() {
<< " edges." << std::endl;
Arrangement_2::Ccb_halfedge_circulator curr = fh->outer_ccb();
std::cout << "Traverse the face of the visibility region." << std::endl;
std::cout << "[" << curr->curve() << "]"<< std::endl;
std::cout << "[" << curr->source()->point() << " -> " << curr->target()->point() << "]"<< std::endl;
while (++curr != fh->outer_ccb())
std::cout << "[" << curr->curve() << "]" << std::endl;
std::cout << "[" << curr->source()->point() << " -> " << curr->target()->point() << "]"<< std::endl;
return 0;
}

View File

@ -31,35 +31,36 @@ int main() {
Arrangement_2 env;
CGAL::insert_non_intersecting_curves(env, &s[0], &s[6]);
//locate the query point in the arrangement
Point_2 query_point(0.5, 2);
Arrangement_2::Face_const_handle face;
Point_2 q(0.5, 2);
Arrangement_2::Face_const_handle * face;
CGAL::Arr_naive_point_location<Arrangement_2> pl(env);
CGAL::Object obj = pl.locate(query_point);
CGAL::assign(face, obj);
typename CGAL::Arr_point_location_result<Arrangement_2>::Type obj = pl.locate(q);
// The query point locates in the interior of a face
face = boost::get<Arrangement_2::Face_const_handle> (&obj);
//visibility query
Arrangement_2 non_regular_output;
NSPV non_regular_visibility(env);
Face_handle non_regular_fh = non_regular_visibility.compute_visibility(query_point, face, non_regular_output);
Face_handle non_regular_fh = non_regular_visibility.compute_visibility(q, *face, non_regular_output);
std::cout << "Non-regularized visibility region of q has "
<< non_regular_output.number_of_edges()
<< " edges:" << std::endl;
for (Edge_const_iterator eit = non_regular_output.edges_begin(); eit != non_regular_output.edges_end(); ++eit)
std::cout << "[" << eit->curve() << "]" << std::endl;
std::cout << "[" << eit->source()->point() << " -> " << eit->target()->point() << "]" << std::endl;
Arrangement_2 regular_output;
RSPV regular_visibility(env);
Face_handle regular_fh = regular_visibility.compute_visibility(query_point, face, regular_output);
Face_handle regular_fh = regular_visibility.compute_visibility(q, *face, regular_output);
Ccb_halfedge_circulator curr = regular_fh->outer_ccb();
std::cout << "Regularized visibility region of q has "
<< regular_output.number_of_edges()
<< " edges:" << std::endl;
for (Edge_const_iterator eit = regular_output.edges_begin(); eit != regular_output.edges_end(); ++eit)
std::cout << "[" << eit->curve() << "]" << std::endl;
std::cout << "[" << eit->source()->point() << " -> " << eit->target()->point() << "]" << std::endl;
//For a regular face, we can also get its whole boundary by traversing its outer CCB.
std::cout << "Traverse the face of the regularized visibility region:" << std::endl;
std::cout << "[" << curr->curve() << "]"<< std::endl;
std::cout << "[" << curr->source()->point() << " -> " << curr->target()->point() << "]" << std::endl;
while (++curr != regular_fh->outer_ccb())
std::cout << "[" << curr->curve() << "]" << std::endl;
std::cout << "[" << curr->source()->point() << " -> " << curr->target()->point() << "]" << std::endl;
return 0;
}