Use orientation with ORIGIN

This commit is contained in:
Andreas Fabri 2022-04-06 18:54:40 +01:00
parent ff15795882
commit 68a1fb4aad
1 changed files with 11 additions and 8 deletions

View File

@ -95,17 +95,20 @@ bool strictly_ordered_ccw_at(const Sphere_point<R>& p,
const Sphere_direction<R>& d2,
const Sphere_direction<R>& 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;
}
}