Merge remote-tracking branch 'cgal/releases/CGAL-5.0-branch'

This commit is contained in:
Sébastien Loriot 2020-10-02 15:08:56 +02:00
commit 090b82e762
8 changed files with 23 additions and 27 deletions

View File

@ -36,10 +36,10 @@ namespace internal {
template <class K>
class Line_2_Line_2_pair {
public:
enum Intersection_results {NO_INTERSECTION, POINT, LINE};
enum Intersection_results {NOT_COMPUTED_YET, NO_INTERSECTION, POINT, LINE};
Line_2_Line_2_pair(typename K::Line_2 const *line1,
typename K::Line_2 const *line2)
: _line1(line1), _line2(line2), _known(false) {}
: _line1(line1), _line2(line2), _result(NOT_COMPUTED_YET) {}
Intersection_results intersection_type() const;
@ -48,7 +48,6 @@ public:
protected:
typename K::Line_2 const* _line1;
typename K::Line_2 const * _line2;
mutable bool _known;
mutable Intersection_results _result;
mutable typename K::Point_2 _intersection_point;
};
@ -141,11 +140,10 @@ typename Line_2_Line_2_pair<K>::Intersection_results
Line_2_Line_2_pair<K>::intersection_type() const
{
typedef typename K::RT RT;
if (_known)
if (_result != NOT_COMPUTED_YET)
return _result;
RT nom1, nom2, denom;
// The non const this pointer is used to cast away const.
_known = true;
denom = _line1->a()*_line2->b() - _line2->a()*_line1->b();
if (denom == RT(0)) {
if (RT(0) == (_line1->a()*_line2->c() - _line2->a()*_line1->c()) &&
@ -180,7 +178,7 @@ template <class K>
typename K::Point_2
Line_2_Line_2_pair<K>::intersection_point() const
{
if (!_known)
if (_result == NOT_COMPUTED_YET)
intersection_type();
CGAL_kernel_assertion(_result == POINT);
return _intersection_point;
@ -190,7 +188,7 @@ template <class K>
typename K::Line_2
Line_2_Line_2_pair<K>::intersection_line() const
{
if (!_known)
if (_result == NOT_COMPUTED_YET)
intersection_type();
CGAL_kernel_assertion(_result == LINE);
return *_line1;

View File

@ -35,10 +35,13 @@ namespace internal {
template <class K>
class Ray_2_Line_2_pair {
public:
enum Intersection_results {NO_INTERSECTION, POINT, RAY};
enum Intersection_results {NOT_COMPUTED_YET, NO_INTERSECTION, POINT, RAY};
typedef typename K::FT FT;
Ray_2_Line_2_pair(typename K::Ray_2 const *ray,
typename K::Line_2 const *line)
: _ray(ray), _line(line), _known(false) {}
: _ray(ray), _line(line), _result(NOT_COMPUTED_YET),
_intersection_point(K().construct_point_2_object()(ORIGIN))
{}
Intersection_results intersection_type() const;
@ -47,7 +50,6 @@ public:
protected:
typename K::Ray_2 const * _ray;
typename K::Line_2 const * _line;
mutable bool _known;
mutable Intersection_results _result;
mutable typename K::Point_2 _intersection_point;
};
@ -94,7 +96,7 @@ intersection(const typename K::Line_2 &line,
const typename K::Ray_2 &ray,
const K& k)
{
return internal::intersection(ray, line, k);
return internal::intersection(ray, line, k);
}
@ -115,14 +117,14 @@ template <class K>
typename Ray_2_Line_2_pair<K>::Intersection_results
Ray_2_Line_2_pair<K>::intersection_type() const
{
if (_known)
if (_result != NOT_COMPUTED_YET)
return _result;
// The non const this pointer is used to cast away const.
_known = true;
const typename K::Line_2 &l1 = _ray->supporting_line();
Line_2_Line_2_pair<K> linepair(&l1, _line);
switch ( linepair.intersection_type()) {
case Line_2_Line_2_pair<K>::NO_INTERSECTION:
default:
_result = NO_INTERSECTION;
break;
case Line_2_Line_2_pair<K>::POINT:
@ -142,7 +144,7 @@ template <class K>
typename K::Point_2
Ray_2_Line_2_pair<K>::intersection_point() const
{
if (!_known)
if (_result == NOT_COMPUTED_YET)
intersection_type();
CGAL_kernel_assertion(_result == POINT);
return _intersection_point;
@ -152,7 +154,7 @@ template <class K>
typename K::Ray_2
Ray_2_Line_2_pair<K>::intersection_ray() const
{
if (!_known)
if (_result == NOT_COMPUTED_YET)
intersection_type();
CGAL_kernel_assertion(_result == RAY);
return *_ray;

View File

@ -308,6 +308,7 @@ Segment_2_Segment_2_pair<K>::intersection_type() const
Line_2_Line_2_pair<K> linepair(&l1, &l2);
switch ( linepair.intersection_type()) {
case Line_2_Line_2_pair<K>::NO_INTERSECTION:
default:
_result = NO_INTERSECTION;
break;
case Line_2_Line_2_pair<K>::POINT:

View File

@ -275,6 +275,7 @@ cut_right_off(typename K::Line_2 const & cutter)
Line_2_Line_2_pair<K> pair(&support_, &cutter);
switch (pair.intersection_type()) {
case Line_2_Line_2_pair<K>::NO_INTERSECTION:
default:
if (cutter.has_on_negative_side(support_.point()))
bound_state_ = LINE_EMPTY;
break;

View File

@ -21,7 +21,6 @@ public:
*(vec+1) = 0;
}
MyPointC2(const double x, const double y, int c = 0)
: col(c)
{

View File

@ -59,8 +59,7 @@
#ifndef NDEBUG
#define CGAL_NEF_TRACEN(t) if((debugthread%CGAL_NEF_DEBUG)==0) \
std::cerr<< " "<<t<<std::endl; \
std::cerr.flush()
std::cerr<< " "<<t<<std::endl;
#else
#define CGAL_NEF_TRACEN(t)
#endif

View File

@ -75,8 +75,8 @@ extern "C" {
// Pure and safe SSE2 mode (g++ -mfpmath=sse && (-msse2 || -march=pentium4))
// can be detected by :
// TODO : see what Intel and VC++ have to say about this.
#if defined __FLT_EVAL_METHOD__ && defined __SSE2_MATH__ && \
(__FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 1)
#if defined _M_X64 || ( defined __FLT_EVAL_METHOD__ && defined __SSE2_MATH__ && \
(__FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 1) )
# define CGAL_SAFE_SSE2
# include <xmmintrin.h>
#endif
@ -90,7 +90,7 @@ extern "C" {
#if !defined CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT && \
(((defined __i386__ || defined __x86_64__) && !defined CGAL_SAFE_SSE2) \
|| defined __ia64__ \
|| defined _M_IX86 || defined _M_X64 || defined _M_IA64 \
|| defined _M_IX86 || defined _M_IA64 \
|| (defined FLT_EVAL_METHOD && FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1))
# define CGAL_FPU_HAS_EXCESS_PRECISION
#endif

View File

@ -2976,9 +2976,9 @@ exact_locate(const Point& p,
Face_handle start) const
#endif // no CGAL_NO_STRUCTURAL_FILTERING
{
li = 4; //general init to avoid warnings.
lt = OUTSIDE_AFFINE_HULL; //same
if (dimension() < 0) {
lt = OUTSIDE_AFFINE_HULL;
li = 4; // li should not be used in this case
return Face_handle();
}
if( dimension() == 0) {
@ -2987,10 +2987,6 @@ exact_locate(const Point& p,
if (xy_equal(p,finite_vertex()->face()->vertex(0)->point())){
lt = VERTEX ;
}
else{
lt = OUTSIDE_AFFINE_HULL;
}
li = 4; // li should not be used in this case
return Face_handle();
}
if(dimension() == 1){