mirror of https://github.com/CGAL/cgal
no insertion of same edge twice
This commit is contained in:
parent
2b863b7fda
commit
cde5ec15be
|
|
@ -256,6 +256,7 @@ public:
|
|||
Intersection_type i_type = needle(active_edges, curr_vision_ray, collinear_vertices);
|
||||
switch (i_type) {
|
||||
case UNBOUNDED :
|
||||
//todo:this part is not finished.
|
||||
//remove right and collinear;
|
||||
remove_edges(active_edges, curr_vision_ray);
|
||||
update_visibility(right_p, polygon, out_arr);
|
||||
|
|
@ -271,10 +272,10 @@ public:
|
|||
remove_edges(active_edges, curr_vision_ray);
|
||||
left_p = intersection_point(curr_vision_ray, active_edges[0]);
|
||||
update_visibility(right_p, polygon, out_arr);
|
||||
|
||||
update_visibility(collinear_vertices, polygon, out_arr);
|
||||
insert_needle(collinear_vertices, polygon, out_arr);
|
||||
// update_visibility(mid_p, polygon, out_arr);
|
||||
update_visibility(left_p, polygon, out_arr);
|
||||
// update_visibility(left_p, polygon, out_arr);
|
||||
polygon.push_back(left_p);
|
||||
break;
|
||||
case INNER :
|
||||
//remove right and collinear;
|
||||
|
|
@ -285,8 +286,9 @@ public:
|
|||
else {
|
||||
left_p = intersection_point(curr_vision_ray, active_edges[0]);
|
||||
update_visibility(right_p, polygon, out_arr);
|
||||
update_visibility(collinear_vertices, polygon, out_arr);
|
||||
update_visibility(left_p, polygon, out_arr);
|
||||
insert_needle(collinear_vertices, polygon, out_arr);
|
||||
// update_visibility(left_p, polygon, out_arr);
|
||||
polygon.push_back(left_p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -294,7 +296,7 @@ public:
|
|||
vit = end_it;
|
||||
}
|
||||
if (!is_init_empty) {
|
||||
CGAL::insert(out_arr, Segment_2(polygon.front(),polygon.back()));
|
||||
CGAL::insert(out_arr, Segment_2(polygon.back(),polygon.front()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -496,9 +498,11 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void update_visibility(const std::vector<Point_2>& points, std::vector<Point_2>& polygon, Arrangement_2 &arr){
|
||||
for (int i = 0; i != points.size(); i++) {
|
||||
update_visibility(points[i], polygon, arr);
|
||||
void insert_needle(const std::vector<Point_2>& points, std::vector<Point_2>& polygon, Arrangement_2 &arr){
|
||||
if (points.size() > 1) {
|
||||
for (int i = 0; i != points.size()-1; i++) {
|
||||
CGAL::insert(arr, Segment_2(points[i], points[i+1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ std::string number2string(T n) {
|
|||
}
|
||||
|
||||
int main() {
|
||||
int case_number = 5;
|
||||
int case_number = 1;
|
||||
//test kernel Cartesian<Gmpq>
|
||||
{
|
||||
typedef CGAL::Gmpq Number_type;
|
||||
|
|
@ -59,8 +59,8 @@ int main() {
|
|||
if (!fit->is_unbounded()) break;
|
||||
} while (++fit != arr_in.faces_end());
|
||||
vb.visibility_region(Point_2(0, 0), fit, arr_vb);
|
||||
// CGAL::Visibility_2::print_arrangement(arr_vb);
|
||||
// CGAL::Visibility_2::print_arrangement(arr_ans);
|
||||
CGAL::Visibility_2::print_arrangement(arr_vb);
|
||||
CGAL::Visibility_2::print_arrangement(arr_ans);
|
||||
std::cout<<(true == (CGAL::test_are_equal<Arrangement_2>(arr_ans, arr_vb)))<<std::endl;
|
||||
std::cout<<CGAL::compare_arr_by_edges(arr_ans, arr_vb)<<std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue