From 68a1fb4aad6741a56cc25d045abd3dd620dacdc8 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 6 Apr 2022 18:54:40 +0100 Subject: [PATCH] Use orientation with ORIGIN --- Nef_S2/include/CGAL/Nef_S2/Sphere_direction.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_direction.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_direction.h index 164d20f2ce6..d6bb4d88b4d 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_direction.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_direction.h @@ -95,17 +95,20 @@ bool strictly_ordered_ccw_at(const Sphere_point& p, const Sphere_direction& d2, const Sphere_direction& d3) { CGAL_assertion(d1.has_on(p) && d2.has_on(p) && d3.has_on(p)); - typename R::Point_3 p1(CGAL::ORIGIN + d1.orthogonal_vector()); - typename R::Point_3 p2(CGAL::ORIGIN + d2.orthogonal_vector()); - typename R::Point_3 p3(CGAL::ORIGIN + d3.orthogonal_vector()); + typedef typename R::Vector_3 Vector_3; + Vector_3 v0 = p - CGAL::ORIGIN; + Vector_3 v1 = d1.orthogonal_vector(); + Vector_3 v2 = d2.orthogonal_vector(); + Vector_3 v3 = d3.orthogonal_vector(); if ( d1 == d3 ) return false; - if ( CGAL::orientation(CGAL::ORIGIN,p,p1,p3) == CGAL::POSITIVE ) { - return CGAL::orientation(CGAL::ORIGIN,p,p1,p2) == CGAL::POSITIVE && - CGAL::orientation(CGAL::ORIGIN,p,p3,p2) == CGAL::NEGATIVE; + typename R::Orientation_3 orientation = R().orientation_3_object(); + if ( orientation(v0,v1,v3) == CGAL::POSITIVE ) { + return orientation(v0,v1,v2) == CGAL::POSITIVE && + orientation(v0,v3,v2) == CGAL::NEGATIVE; } else { - return CGAL::orientation(CGAL::ORIGIN,p,p1,p2) == CGAL::POSITIVE || - CGAL::orientation(CGAL::ORIGIN,p,p3,p2) == CGAL::NEGATIVE; + return orientation(v0,v1,v2) == CGAL::POSITIVE || + orientation(v0,v3,v2) == CGAL::NEGATIVE; } }