Use the intersection traits macro to simplify code (cosmetic change)

This commit is contained in:
Mael Rouxel-Labbé 2019-05-17 12:15:48 +02:00
parent 58c894ed5e
commit ab0ca8a735
1 changed files with 16 additions and 25 deletions

View File

@ -23,47 +23,38 @@
//
// Author(s) : Geert-Jan Giezeman
#ifndef CGAL_INTERSECTIONS_2_CIRCLE_2_CIRCLE_2_H
#define CGAL_INTERSECTIONS_2_CIRCLE_2_CIRCLE_2_H
#include <CGAL/Circle_2.h>
#include <CGAL/squared_distance_2_1.h>
namespace CGAL {
namespace Intersections {
#include <CGAL/Intersection_traits_2.h>
namespace CGAL {
namespace Intersections {
namespace internal {
template <class K>
bool
do_intersect(const typename K::Circle_2 & circ1,
const typename K::Circle_2& circ2,
const K&)
bool do_intersect(const typename K::Circle_2 & circ1,
const typename K::Circle_2& circ2,
const K&)
{
typedef typename K::FT FT;
FT sr1 = circ1.squared_radius();
FT sr2 = circ2.squared_radius();
FT squared_dist = squared_distance(circ1.center(), circ2.center());
FT temp = sr1+sr2-squared_dist;
return !(FT(4)*sr1*sr2 < temp*temp);
typedef typename K::FT FT;
FT sr1 = circ1.squared_radius();
FT sr2 = circ2.squared_radius();
FT squared_dist = squared_distance(circ1.center(), circ2.center());
FT temp = sr1+sr2-squared_dist;
return !(FT(4)*sr1*sr2 < temp*temp);
}
} // namespace internal
} // namespace Intersections
template <class K>
inline
bool
do_intersect(const Circle_2<K> & circ1,
const Circle_2<K> & circ2)
{
typedef typename K::Do_intersect_2 Do_intersect;
return Do_intersect()(circ1, circ2);
}
CGAL_DO_INTERSECT_FUNCTION_SELF(Circle_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif