BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Polynomial/basic.h
Go to the documentation of this file.
00001 // Copyright (c) 2005  Stanford University (USA).
00002 // All rights reserved.
00003 //
00004 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public License as
00006 // published by the Free Software Foundation; version 2.1 of the License.
00007 // See the file LICENSE.LGPL distributed with CGAL.
00008 //
00009 // Licensees holding a valid commercial license may use this file in
00010 // accordance with the commercial license agreement provided with the software.
00011 //
00012 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014 //
00015 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Kinetic_data_structures/include/CGAL/Polynomial/basic.h $
00016 // $Id: basic.h 35766 2007-01-20 21:39:01Z drussel $
00017 // 
00018 //
00019 // Author(s)     : Daniel Russel <drussel@alumni.princeton.edu>
00020 
00021 #ifndef CGAL_POLYNOMIAL_BASIC_H
00022 #define CGAL_POLYNOMIAL_BASIC_H
00023 
00024 #include <CGAL/Polynomial/internal/config.h>
00025 #include <CGAL/Polynomial/internal/Statistics.h>
00026 #include <boost/static_assert.hpp>
00035 #ifdef CGAL_USE_GMP
00036 #ifndef CGAL_POLYNOMIAL_USE_CGAL
00037 #define CGAL_POLYNOMIAL_USE_CGAL
00038 #endif
00039 #endif
00040 
00041 #include <CGAL/Polynomial/internal/macros.h>
00042 
00043 #ifdef CGAL_POLYNOMIAL_USE_CGAL
00044 /*
00045   When CGAL is present
00046 */
00047 #include <CGAL/basic.h>
00048 
00049 #ifdef CGAL_USE_GMP
00050 #include <CGAL/Gmpq.h>
00051 CGAL_POLYNOMIAL_BEGIN_NAMESPACE
00052 typedef CGAL::Gmpq Default_field_nt;
00053 CGAL_POLYNOMIAL_END_NAMESPACE
00054 #else
00055 #include <CGAL/MP_Float.h>
00056 CGAL_POLYNOMIAL_BEGIN_NAMESPACE
00057 typedef CGAL::MP_Float Default_field_nt;
00058 CGAL_POLYNOMIAL_END_NAMESPACE
00059 #endif
00060 
00061 CGAL_POLYNOMIAL_BEGIN_NAMESPACE
00062 
00063 /*typedef CGAL::Sign Sign;
00064 static const Sign ZERO= CGAL::ZERO;
00065 static const Sign POSITIVE= CGAL::POSITIVE;
00066 static const Sign NEGATIVE= CGAL::NEGATIVE;*/
00067 /*typedef int Comparison_result;
00068 static const int EQUAL= CGAL::EQUAL;
00069 static const int SMALLER= CGAL::SMALLER;
00070 static const int LARGER = CGAL::LARGER;*/
00071 static const int UNKNOWN = -3;
00072 typedef int Order;
00073 static const int STRICTLY_BELOW = -3;
00074 static const int BELOW=-2;
00075 static const int CONTAINED=-1;
00076 static const int CONTAINS=1;
00077 static const int ABOVE=2;
00078 static const int STRICTLY_ABOVE=3;
00079 //typedef enum Sign {ZERO=CGAL::ZERO, POSITIVE=CGAL::POSITIVE, NEGATIVE=CGAL::NEGATIVE} Sign;
00080 
00081 //typedef CGAL::Comparison_result Comparison_result;
00082 
00083 /*template <class NT>
00084 Sign sign(const NT &nt)
00085 {
00086     return CGAL::sign(nt);
00087     }*/
00088 
00089 
00090 /*typedef ::CGAL::Integral_domain_without_division_tag             Integral_domain_without_division_tag;
00091 typedef ::CGAL::Euclidean_ring_tag   Euclidean_ring_tag;
00092 typedef ::CGAL::Field_tag            Field_tag;
00093 typedef ::CGAL::Field_with_sqrt_tag       Field_with_sqrt_tag;*/
00094 
00095 CGAL_POLYNOMIAL_END_NAMESPACE
00096 
00097 #define CGAL_POLYNOMIAL_TO_DOUBLE(d) CGAL::to_double(d)
00098 
00099 #define CGAL_POLYNOMIAL_TO_INTERVAL(d) CGAL::to_interval(d)
00100 
00101 #else
00102 /*
00103   When no CGAL is present
00104 */
00105 
00106 CGAL_POLYNOMIAL_BEGIN_NAMESPACE
00107 
00108 typedef int Sign;
00109 static const int ZERO =0;
00110 static const int POSITIVE=1;
00111 static const int NEGATIVE=-1;
00112 typedef int Comparison_result;
00113 static const int EQUAL= 0;
00114 static const int SMALLER= -1;
00115 static const int LARGER = 1;
00116 
00117 template <class NT>
00118 Sign sign(const NT &nt)
00119 {
00120     if (nt >0) return POSITIVE;
00121     else if (nt <0) return NEGATIVE;
00122     else return ZERO;
00123 }
00124 
00125 
00126 struct Integral_domain_without_division_tag {};
00127 struct Euclidean_ring_tag {};
00128 struct Field_tag {};
00129 struct Field_with_sqrt_tag {};
00130 
00131 CGAL_POLYNOMIAL_END_NAMESPACE
00132 #endif
00133 
00134 #include <limits>
00135 
00136 /*
00137   Shared
00138 */
00139 
00140 CGAL_POLYNOMIAL_BEGIN_NAMESPACE
00141 
00143 typedef enum Extended_sign
00144 {
00145     EXTENDED_NEGATIVE=NEGATIVE, EXTENDED_ZERO=ZERO,
00146     EXTENDED_POSITIVE=POSITIVE, EXTENDED_UNKNOWN=2
00147 } Extended_sign;
00148 
00150 
00155 template <class NT>
00156 inline Extended_sign extended_sign(const NT &nt)
00157 {
00158   // for VC
00159   switch(CGAL::sign(nt)) {
00160         case ZERO: return EXTENDED_ZERO;
00161         case POSITIVE: return EXTENDED_POSITIVE;
00162         default: return EXTENDED_NEGATIVE;
00163     };
00164 }
00165 
00166 
00167 template <class Rt>
00168 inline Rt infinity()
00169 {
00170   //BOOST_STATIC_ASSERT(std::numeric_limits<Rt>::is_specialized);
00171     if (std::numeric_limits<Rt>::has_infinity) return std::numeric_limits<Rt>::infinity();
00172     else return (std::numeric_limits<Rt>::max)();
00173 }
00174 
00175 
00176 CGAL_POLYNOMIAL_END_NAMESPACE
00177 
00194 /*
00195 CGAL_POLYNOMIAL_BEGIN_NAMESPACE
00196 
00198 struct Descartes_tag {};
00199 struct Sturm_tag {};
00200 struct Bezier_tag {};
00201 
00202 CGAL_POLYNOMIAL_END_NAMESPACE
00203 */
00204 
00205 #ifdef CGAL_POLYNOMIAL_NO_LIMITS
00206 #include <CGAL/Polynomial/internal/limits.h>
00207 #else
00208 #include <limits>
00209 #endif
00210 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines