From 1cb71db25ddaa82cfa1cc7f99bdec9f5c8b74fd9 Mon Sep 17 00:00:00 2001 From: Panagiotis Cheilaris Date: Fri, 22 Feb 2013 17:03:59 +0100 Subject: [PATCH] faster drawing with horizontal segment parabola Signed-off-by: Panagiotis Cheilaris --- .../Constructions_C2.h | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Constructions_C2.h b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Constructions_C2.h index 82b31a2c359..83e61e30bd0 100644 --- a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Constructions_C2.h +++ b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Constructions_C2.h @@ -945,22 +945,16 @@ public: FT half = FT(0.5); FT seglenhalf ( half * CGAL::abs(pnt.y()-pver.y()) ); - //positive side is left-turn - if (lseg.has_on_positive_side(pnt)) { - points[1]= (compare_x_2(seg.source(),seg.target())==SMALLER) - ? Point_2(m.x() + seglenhalf, m.y()) - : Point_2(m.x() - seglenhalf, m.y()); - points[2]= (compare_x_2(seg.source(),seg.target())==SMALLER) - ? Point_2(m.x() - seglenhalf, m.y()) - : Point_2(m.x() + seglenhalf, m.y()); - } else {//pnt is on the negative side of lseg i.e right turn - points[1]= (compare_x_2(seg.source(),seg.target())==SMALLER) - ? Point_2(m.x() - seglenhalf, m.y()) - : Point_2(m.x() + seglenhalf, m.y()); - points[2]= (compare_x_2(seg.source(),seg.target())==SMALLER) - ? Point_2(m.x() + seglenhalf, m.y()) - : Point_2(m.x() - seglenhalf, m.y()); + Comparison_result cmp = compare_y_2(pnt, pver); + if (cmp == LARGER) { + points[1] = Point_2(m.x() + seglenhalf, m.y()); + points[2] = Point_2(m.x() - seglenhalf, m.y()); + } else { + CGAL_assertion(cmp == SMALLER); + points[1] = Point_2(m.x() - seglenhalf, m.y()); + points[2] = Point_2(m.x() + seglenhalf, m.y()); } + if (p.is_segment()) { std::swap(points[1], points[2]); } @@ -1012,7 +1006,6 @@ public: FT seglenhalf ( half * CGAL::abs(pnt.x()-phor.x()) ); npts = 4; - Compare_y_2 compare_y_2; if (lseg.has_on_positive_side(pnt)) { points[1]= (compare_y_2(seg.source(),seg.target())==SMALLER)