move the implementation of segment_hides_circumcenter() to the kernel
to use filtered predicates
This commit is contained in:
@@ -4268,6 +4268,8 @@ namespace CartesianKernelFunctors {
|
||||
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;
|
||||
typedef typename K::FT FT;
|
||||
public:
|
||||
typedef typename K::Oriented_side result_type;
|
||||
|
||||
@@ -4304,6 +4306,36 @@ namespace CartesianKernelFunctors {
|
||||
? result_type(ON_ORIENTED_BOUNDARY)
|
||||
: opposite(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;
|
||||
const Point_2 a = source(s);
|
||||
const Point_2 b = target(s);
|
||||
const FT dX = b.x() - a.x();
|
||||
const FT dY = b.y() - a.y();
|
||||
|
||||
const Point_2& p0 = t[0];
|
||||
const Point_2& p1 = t[1];
|
||||
const Point_2& p2 = t[2];
|
||||
const FT R0 = p0.x() * p0.x() + p0.y() * p0.y();
|
||||
const FT R1 = p1.x() * p1.x() + p1.y() * p1.y();
|
||||
const FT R2 = p2.x() * p2.x() + p2.y() * p2.y();
|
||||
const FT denominator = (p1.x() - p0.x()) * (p2.y() - p0.y()) +
|
||||
(p0.x() - p2.x()) * (p1.y() - p0.y());
|
||||
const FT det = 2 * denominator * (a.x() * dY - a.y() * dX)
|
||||
- (R2 - R1) * (p0.x() * dX + p0.y() * dY)
|
||||
- (R0 - R2) * (p1.x() * dX + p1.y() * dY)
|
||||
- (R1 - R0) * (p2.x() * dX + p2.y() * dY);
|
||||
if (det < 0)
|
||||
return CGAL::ON_NEGATIVE_SIDE;
|
||||
else if (det == 0.)
|
||||
return CGAL::ON_ORIENTED_BOUNDARY;
|
||||
else
|
||||
return CGAL::ON_POSITIVE_SIDE;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
|
||||
Reference in New Issue
Block a user