Merge pull request #5978 from janetournois/Mesh_2-add_predicate_for_lloyd-jtournois
Mesh 2 and Kernel - add predicate oriented_side_2(segment, triangle)
This commit is contained in:
@@ -4683,6 +4683,7 @@ namespace HomogeneousKernelFunctors {
|
||||
typedef typename K::Circle_2 Circle_2;
|
||||
typedef typename K::Line_2 Line_2;
|
||||
typedef typename K::Triangle_2 Triangle_2;
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
public:
|
||||
typedef typename K::Oriented_side result_type;
|
||||
|
||||
@@ -4722,6 +4723,41 @@ namespace HomogeneousKernelFunctors {
|
||||
? ON_ORIENTED_BOUNDARY
|
||||
: -ot;
|
||||
}
|
||||
|
||||
result_type
|
||||
operator()(const Segment_2& s, const Triangle_2& t) const
|
||||
{
|
||||
typename K::Construct_source_2 source;
|
||||
typename K::Construct_target_2 target;
|
||||
typename K::Construct_vertex_2 vertex;
|
||||
typename K::Construct_circumcenter_2 circumcenter;
|
||||
typename K::Orientation_2 orientation;
|
||||
|
||||
const Point_2& a = source(s);
|
||||
const Point_2& b = target(s);
|
||||
CGAL_assertion(a != b);
|
||||
|
||||
const Point_2& p0 = vertex(t, 0);
|
||||
const Point_2& p1 = vertex(t, 1);
|
||||
const Point_2& p2 = vertex(t, 2);
|
||||
CGAL_assertion(p0 != p1 && p1 != p2 && p2 != p0);
|
||||
|
||||
const Point_2 cc = circumcenter(t);
|
||||
|
||||
CGAL::Orientation o_abc = orientation(a, b, cc);
|
||||
if (o_abc == CGAL::COLLINEAR)
|
||||
return CGAL::ON_ORIENTED_BOUNDARY;
|
||||
|
||||
CGAL::Orientation o_abt = orientation(a, b, p0);
|
||||
if (o_abt == CGAL::COLLINEAR)
|
||||
o_abt = orientation(a, b, p1);
|
||||
if (o_abt == CGAL::COLLINEAR)
|
||||
o_abt = orientation(a, b, p2);
|
||||
CGAL_assertion(o_abt != CGAL::COLLINEAR);
|
||||
|
||||
if (o_abc == o_abt) return CGAL::ON_POSITIVE_SIDE;
|
||||
else return CGAL::ON_NEGATIVE_SIDE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user