support for drawing bisector ray between segments

Signed-off-by: Panagiotis Cheilaris <philaris@cs.ntua.gr>
This commit is contained in:
Panagiotis Cheilaris 2013-02-06 11:57:30 +01:00
parent b583d26409
commit 000facc886
1 changed files with 42 additions and 24 deletions

View File

@ -10,6 +10,8 @@
#include <CGAL/Polychain_2.h> #include <CGAL/Polychain_2.h>
#include <CGAL/intersections.h> #include <CGAL/intersections.h>
#include <CGAL/Segment_Delaunay_graph_Linf_2/Bisector_Linf.h>
namespace CGAL { namespace CGAL {
@ -415,11 +417,14 @@ public:
typedef typename Gt::Point_2 Point_2; typedef typename Gt::Point_2 Point_2;
typedef typename Gt::Direction_2 Direction_2; typedef typename Gt::Direction_2 Direction_2;
typedef typename Gt::Line_2 Line_2; typedef typename Gt::Line_2 Line_2;
typedef typename Gt::Segment_2 Segment_2; typedef typename Gt::Segment_2 Segment_2;
typedef typename Gt::Construct_svd_vertex_2 Construct_svd_vertex_2; typedef typename Gt::Construct_svd_vertex_2 Construct_svd_vertex_2;
typedef CGAL::Polychainline_2<Gt> Polychainline;
typedef CGAL::Polychainray_2<Gt> Polychainray; typedef CGAL::Polychainray_2<Gt> Polychainray;
typedef Polychainray result_type; typedef Polychainray result_type;
typedef Bisector_Linf<Gt> Bisector_Linf_Type;
typedef typename Gt::Compare_x_2 Compare_x_2; typedef typename Gt::Compare_x_2 Compare_x_2;
typedef typename Gt::Compare_y_2 Compare_y_2; typedef typename Gt::Compare_y_2 Compare_y_2;
typedef typename Gt::Equal_2 Equal_2; typedef typename Gt::Equal_2 Equal_2;
@ -434,8 +439,6 @@ public:
CGAL_SDG_DEBUG( std::cout << "debug construct bisector ray " CGAL_SDG_DEBUG( std::cout << "debug construct bisector ray "
<< "p=" << p << " q=" << q << " r=" << r << std::endl; ); << "p=" << p << " q=" << q << " r=" << r << std::endl; );
CGAL_assertion( !(p.is_segment() && q.is_segment()) );
// compute pqr vertex // compute pqr vertex
Point_2 v = Construct_svd_vertex_2()(p, q, r); Point_2 v = Construct_svd_vertex_2()(p, q, r);
@ -443,7 +446,8 @@ public:
<< "p=" << p << " q=" << q << " r=" << r << "p=" << p << " q=" << q << " r=" << r
<< " has v(pqr)=" << v << std::endl; ); << " has v(pqr)=" << v << std::endl; );
//CGAL_SDG_DEBUG( std::cout << "debug in ray computing bisector" << std::endl; ); //CGAL_SDG_DEBUG( std::cout
// << "debug in ray computing bisector" << std::endl; );
// compute oriented bisector between p and q // compute oriented bisector between p and q
@ -530,7 +534,8 @@ public:
Polychainray pcr(points, points+npts, d); Polychainray pcr(points, points+npts, d);
CGAL_SDG_DEBUG( std::cout << "debug construct bisector ray is " << pcr << std::endl; ); CGAL_SDG_DEBUG( std::cout
<< "debug construct bisector ray is " << pcr << std::endl; );
return pcr; return pcr;
} }
@ -712,20 +717,33 @@ public:
} }
Polychainray pcr(points, points+npts, d); Polychainray pcr(points, points+npts, d);
CGAL_SDG_DEBUG( std::cout << "debug construct bisector ray is " << pcr << std::endl; ); CGAL_SDG_DEBUG( std::cout << "debug construct bisector ray is "
<< pcr << std::endl; );
return pcr; return pcr;
} }
} }
// this part should never be reached if (p.is_segment() and q.is_segment()) {
CGAL_SDG_DEBUG(std::cout
CGAL_SDG_DEBUG( std::cout << "debug construct bisector ray error " << std::endl; ); << "debug construct bisector ray: p, q are segments"
<< std::endl ; ) ;
Bisector_Linf_Type bisector_linf;
Polychainline full_bisec = bisector_linf(p,q);
Point_2 points[1];
points[0] = v;
Polychainray pcr(points, points+1, full_bisec.get_outgoing());
CGAL_SDG_DEBUG( std::cout << "debug construct bisector ray is "
<< pcr << std::endl; );
return pcr;
}
// the following code should never be executed
CGAL_SDG_DEBUG( std::cout
<< "debug construct bisector ray error " << std::endl; );
CGAL_assertion(false);
return Polychainray(); return Polychainray();
} }
}; };