mirror of https://github.com/CGAL/cgal
Bugfix in Simple_polygon_visibility_2.h
Fixed a bug and added an extra testcase.
This commit is contained in:
parent
524c5a21fa
commit
c21a2da2a1
|
|
@ -27,6 +27,7 @@
|
||||||
#include <CGAL/enum.h>
|
#include <CGAL/enum.h>
|
||||||
#include <CGAL/Visibility_2/visibility_utils.h>
|
#include <CGAL/Visibility_2/visibility_utils.h>
|
||||||
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
|
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
|
||||||
|
#include <CGAL/Arrangement_2.h>
|
||||||
#include <CGAL/assertions.h>
|
#include <CGAL/assertions.h>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
@ -271,12 +272,31 @@ private:
|
||||||
|
|
||||||
std::vector<Point_2> points;
|
std::vector<Point_2> points;
|
||||||
while(!s.empty()) {
|
while(!s.empty()) {
|
||||||
points.push_back(s.top());
|
const Point_2& top = s.top();
|
||||||
|
if (top != q) {
|
||||||
|
points.push_back(top);
|
||||||
|
}
|
||||||
|
else if (query_pt_is_vertex) {
|
||||||
|
points.push_back(top);
|
||||||
|
}
|
||||||
s.pop();
|
s.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
Visibility_2::report_while_handling_needles<Simple_polygon_visibility_2>(
|
|
||||||
traits, q, points, out_arr);
|
// Quick fix for now. Can be done faster.
|
||||||
|
std::vector<Segment_2> segments;
|
||||||
|
|
||||||
|
for(typename std::vector<Point_2>::size_type i = 0;
|
||||||
|
i < points.size() - 1; ++i)
|
||||||
|
{
|
||||||
|
segments.push_back(Segment_2(points[i], points[i+1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
CGAL::insert(out_arr, segments.begin(), segments.end());
|
||||||
|
|
||||||
|
|
||||||
|
// Visibility_2::report_while_handling_needles<Simple_polygon_visibility_2>(
|
||||||
|
// traits, q, points, out_arr);
|
||||||
|
|
||||||
CGAL_postcondition(out_arr.number_of_isolated_vertices() == 0);
|
CGAL_postcondition(out_arr.number_of_isolated_vertices() == 0);
|
||||||
CGAL_postcondition(s.empty());
|
CGAL_postcondition(s.empty());
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
0.5 2
|
||||||
|
0.5 2
|
||||||
|
|
||||||
|
0
|
||||||
|
6
|
||||||
|
0 4 0 0
|
||||||
|
0 0 3 2
|
||||||
|
3 2 4 0
|
||||||
|
4 0 4 4
|
||||||
|
4 4 1 2
|
||||||
|
1 2 0 4
|
||||||
|
|
||||||
|
0
|
||||||
|
5
|
||||||
|
0 4 0 0
|
||||||
|
0 0 3 2
|
||||||
|
3 2 4 2
|
||||||
|
3 2 1 2
|
||||||
|
1 2 0 4
|
||||||
|
|
@ -44,14 +44,14 @@ int main() {
|
||||||
RSV;
|
RSV;
|
||||||
CGAL::test_model_methods<RSV,Arrangement_2>();
|
CGAL::test_model_methods<RSV,Arrangement_2>();
|
||||||
std::cout << "Running test suite with " << GREEN << "Cartesian" << RESET << " Kernel..." << std::endl;
|
std::cout << "Running test suite with " << GREEN << "Cartesian" << RESET << " Kernel..." << std::endl;
|
||||||
CGAL::run_tests<RSV,Arrangement_2>(21, 2);
|
CGAL::run_tests<RSV,Arrangement_2>(22, 2);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef CGAL::Rotational_sweep_visibility_2<Arrangement_2, CGAL::Tag_true>
|
typedef CGAL::Rotational_sweep_visibility_2<Arrangement_2, CGAL::Tag_true>
|
||||||
RSV;
|
RSV;
|
||||||
CGAL::test_model_methods<RSV,Arrangement_2>();
|
CGAL::test_model_methods<RSV,Arrangement_2>();
|
||||||
std::cout << "Running test suite with " << GREEN << "Cartesian" << RESET << " Kernel..." << std::endl;
|
std::cout << "Running test suite with " << GREEN << "Cartesian" << RESET << " Kernel..." << std::endl;
|
||||||
CGAL::run_tests<RSV,Arrangement_2>(21, 2);
|
CGAL::run_tests<RSV,Arrangement_2>(22, 2);
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||||
|
|
@ -62,14 +62,14 @@ int main() {
|
||||||
RSV;
|
RSV;
|
||||||
CGAL::test_model_methods<RSV,Arrangement_2>();
|
CGAL::test_model_methods<RSV,Arrangement_2>();
|
||||||
std::cout << "Running test suite with " << GREEN << "EPECK" << RESET << " Kernel..." << std::endl;
|
std::cout << "Running test suite with " << GREEN << "EPECK" << RESET << " Kernel..." << std::endl;
|
||||||
CGAL::run_tests<RSV,Arrangement_2>(21, 2);
|
CGAL::run_tests<RSV,Arrangement_2>(22, 2);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef CGAL::Rotational_sweep_visibility_2<Arrangement_2, CGAL::Tag_true>
|
typedef CGAL::Rotational_sweep_visibility_2<Arrangement_2, CGAL::Tag_true>
|
||||||
RSV;
|
RSV;
|
||||||
CGAL::test_model_methods<RSV,Arrangement_2>();
|
CGAL::test_model_methods<RSV,Arrangement_2>();
|
||||||
std::cout << "Running test suite with " << GREEN << "EPECK" << RESET << " Kernel..." << std::endl;
|
std::cout << "Running test suite with " << GREEN << "EPECK" << RESET << " Kernel..." << std::endl;
|
||||||
CGAL::run_tests<RSV,Arrangement_2>(21, 2);
|
CGAL::run_tests<RSV,Arrangement_2>(22, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -82,11 +82,11 @@ int main() {
|
||||||
{
|
{
|
||||||
typedef CGAL::Rotational_sweep_visibility_2<ARR,CGAL::Tag_true> Visibility_2;
|
typedef CGAL::Rotational_sweep_visibility_2<ARR,CGAL::Tag_true> Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,EARR>();
|
CGAL::test_model_methods<Visibility_2,EARR>();
|
||||||
CGAL::run_tests<Visibility_2,EARR>(21, 2);
|
CGAL::run_tests<Visibility_2,EARR>(22, 2);
|
||||||
}{
|
}{
|
||||||
typedef CGAL::Rotational_sweep_visibility_2<ARR,CGAL::Tag_false> Visibility_2;
|
typedef CGAL::Rotational_sweep_visibility_2<ARR,CGAL::Tag_false> Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,EARR>();
|
CGAL::test_model_methods<Visibility_2,EARR>();
|
||||||
CGAL::run_tests<Visibility_2,EARR>(21, 2);
|
CGAL::run_tests<Visibility_2,EARR>(22, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ int main() {
|
||||||
std::cout << GREEN << "Done!" << RESET << std::endl;
|
std::cout << GREEN << "Done!" << RESET << std::endl;
|
||||||
std::cout << "Running test suite with " << GREEN
|
std::cout << "Running test suite with " << GREEN
|
||||||
<< "Cartesian" << RESET << " Kernel..." << std::endl;
|
<< "Cartesian" << RESET << " Kernel..." << std::endl;
|
||||||
CGAL::run_tests<Simple_polygon_visibility_2,Arrangement_2>(21, 0);
|
CGAL::run_tests<Simple_polygon_visibility_2,Arrangement_2>(22, 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||||
|
|
@ -60,7 +60,7 @@ int main() {
|
||||||
std::cout << GREEN << "Done!" << RESET << std::endl;
|
std::cout << GREEN << "Done!" << RESET << std::endl;
|
||||||
std::cout << "Running test suite with " << GREEN
|
std::cout << "Running test suite with " << GREEN
|
||||||
<< "EPECK" << RESET << " Kernel..." << std::endl;
|
<< "EPECK" << RESET << " Kernel..." << std::endl;
|
||||||
CGAL::run_tests<Simple_polygon_visibility_2,Arrangement_2>(21, 0);
|
CGAL::run_tests<Simple_polygon_visibility_2,Arrangement_2>(22, 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// test Visibility_arrangement_type with extended DCEL
|
// test Visibility_arrangement_type with extended DCEL
|
||||||
|
|
@ -72,11 +72,11 @@ int main() {
|
||||||
{
|
{
|
||||||
typedef CGAL::Simple_polygon_visibility_2<ARR,CGAL::Tag_true> Visibility_2;
|
typedef CGAL::Simple_polygon_visibility_2<ARR,CGAL::Tag_true> Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,EARR>();
|
CGAL::test_model_methods<Visibility_2,EARR>();
|
||||||
CGAL::run_tests<Visibility_2,EARR>(21, 2);
|
CGAL::run_tests<Visibility_2,EARR>(22, 2);
|
||||||
}{
|
}{
|
||||||
typedef CGAL::Simple_polygon_visibility_2<ARR,CGAL::Tag_false> Visibility_2;
|
typedef CGAL::Simple_polygon_visibility_2<ARR,CGAL::Tag_false> Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,EARR>();
|
CGAL::test_model_methods<Visibility_2,EARR>();
|
||||||
CGAL::run_tests<Visibility_2,EARR>(21, 2);
|
CGAL::run_tests<Visibility_2,EARR>(22, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,13 @@ int main() {
|
||||||
typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2 , CGAL::Tag_true>
|
typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2 , CGAL::Tag_true>
|
||||||
Visibility_2;
|
Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,Arrangement_2>();
|
CGAL::test_model_methods<Visibility_2,Arrangement_2>();
|
||||||
CGAL::run_tests<Visibility_2,Arrangement_2>(21, 2);
|
CGAL::run_tests<Visibility_2,Arrangement_2>(22, 2);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2 , CGAL::Tag_false>
|
typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2 , CGAL::Tag_false>
|
||||||
Visibility_2;
|
Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,Arrangement_2>();
|
CGAL::test_model_methods<Visibility_2,Arrangement_2>();
|
||||||
CGAL::run_tests<Visibility_2,Arrangement_2>(21, 2);
|
CGAL::run_tests<Visibility_2,Arrangement_2>(22, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -60,12 +60,12 @@ int main() {
|
||||||
typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2 , CGAL::Tag_true>
|
typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2 , CGAL::Tag_true>
|
||||||
Visibility_2;
|
Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,Arrangement_2>();
|
CGAL::test_model_methods<Visibility_2,Arrangement_2>();
|
||||||
CGAL::run_tests<Visibility_2,Arrangement_2>(21, 2);
|
CGAL::run_tests<Visibility_2,Arrangement_2>(22, 2);
|
||||||
}{
|
}{
|
||||||
typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2 , CGAL::Tag_false>
|
typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2 , CGAL::Tag_false>
|
||||||
Visibility_2;
|
Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,Arrangement_2>();
|
CGAL::test_model_methods<Visibility_2,Arrangement_2>();
|
||||||
CGAL::run_tests<Visibility_2,Arrangement_2>(21, 2);
|
CGAL::run_tests<Visibility_2,Arrangement_2>(22, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,11 +79,11 @@ int main() {
|
||||||
{
|
{
|
||||||
typedef CGAL::Triangular_expansion_visibility_2<ARR,CGAL::Tag_true> Visibility_2;
|
typedef CGAL::Triangular_expansion_visibility_2<ARR,CGAL::Tag_true> Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,EARR>();
|
CGAL::test_model_methods<Visibility_2,EARR>();
|
||||||
CGAL::run_tests<Visibility_2,EARR>(21, 2);
|
CGAL::run_tests<Visibility_2,EARR>(22, 2);
|
||||||
}{
|
}{
|
||||||
typedef CGAL::Triangular_expansion_visibility_2<ARR,CGAL::Tag_false> Visibility_2;
|
typedef CGAL::Triangular_expansion_visibility_2<ARR,CGAL::Tag_false> Visibility_2;
|
||||||
CGAL::test_model_methods<Visibility_2,EARR>();
|
CGAL::test_model_methods<Visibility_2,EARR>();
|
||||||
CGAL::run_tests<Visibility_2,EARR>(21, 2);
|
CGAL::run_tests<Visibility_2,EARR>(22, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue