~ubuntu-branches/debian/stretch/cgal/stretch

« back to all changes in this revision

Viewing changes to include/CGAL/RS/algebraic_1_real_embeddable.h

  • Committer: Package Import Robot
  • Author(s): Joachim Reichel
  • Date: 2014-04-05 10:56:43 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20140405105643-jgnrpu2thtx23zfs
Tags: 4.4-1
* New upstream release.
* Remove patches do-not-link-example-with-qt4-support-library.patch and
  fix_jet_fitting_3.patch (applied upstream).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (c) 2006-2008 Inria Lorraine (France). All rights reserved.
2
 
//
3
 
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
4
 
// modify it under the terms of the GNU Lesser General Public License as
5
 
// published by the Free Software Foundation; either version 3 of the License,
6
 
// or (at your option) any later version.
7
 
//
8
 
// Licensees holding a valid commercial license may use this file in
9
 
// accordance with the commercial license agreement provided with the software.
10
 
//
11
 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12
 
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13
 
//
14
 
// $URL$
15
 
// $Id$
16
 
//
17
 
// Author(s)     :  Michael Hemmer <hemmer@mpi-inf.mpg.de> 
18
 
//
19
 
// ============================================================================
20
 
 
21
 
 
22
 
namespace CGAL {
23
 
 
24
 
template<>
25
 
class Real_embeddable_traits< Algebraic_1  >
26
 
  : public INTERN_RET::Real_embeddable_traits_base<  Algebraic_1  , CGAL::Tag_true > {
27
 
 
28
 
public:
29
 
  typedef INTERN_RET::Real_embeddable_traits_base<  Algebraic_1  , CGAL::Tag_true > Base;
30
 
 
31
 
  typedef CGAL::Tag_true                 Is_real_embeddable;
32
 
  typedef bool                           Boolean;
33
 
  typedef CGAL::Sign                     Sign;
34
 
  typedef CGAL::Comparison_result        Comparison_result;
35
 
 
36
 
 
37
 
  typedef Algebraic_1  Type;
38
 
  typedef Base::Compare Compare; // todo: get a more efficient impl
39
 
   
40
 
  class Sgn
41
 
    : public std::unary_function< Type, CGAL::Sign > {
42
 
  public:
43
 
    CGAL::Sign operator()( const Type& a ) const {
44
 
      return Compare()(a, Type(0));
45
 
    }
46
 
  };
47
 
 
48
 
  class To_double
49
 
    : public std::unary_function< Type, double > {
50
 
  public:
51
 
    double operator()(const Type& a) const {
52
 
      return a.to_double();
53
 
    }
54
 
  };
55
 
 
56
 
  class To_interval
57
 
    : public std::unary_function< Type, std::pair<double, double> > {
58
 
  public:
59
 
    std::pair<double, double> operator()(const Type& a) const {        
60
 
      return a.to_interval();
61
 
    }
62
 
  };       
63
 
 
64
 
  class Is_zero
65
 
    : public std::unary_function< Type, Boolean> {
66
 
  public:
67
 
    bool operator()(const Type& a) const {        
68
 
      return  Sgn()(a) == CGAL::ZERO;
69
 
    }
70
 
  };
71
 
 
72
 
  class Is_finite
73
 
    :public std::unary_function< Type, Boolean> {
74
 
  public:
75
 
    bool operator()(const Type& ) const {
76
 
      return  true;
77
 
    }
78
 
  };
79
 
 
80
 
  class Abs
81
 
    :public  std::unary_function< Type, Type> {
82
 
  public:
83
 
    Type operator()(const Type& a) const {
84
 
      return Sgn()(a)==CGAL::NEGATIVE?-a:a;
85
 
    }
86
 
  };
87
 
};
88
 
} // namespace CGAL