BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Polynomials_2_3.h
Go to the documentation of this file.
00001 // Copyright (c) 2005-2006  INRIA Sophia-Antipolis (France).
00002 // All rights reserved.
00003 //
00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under
00005 // the terms of the Q Public License version 1.0.
00006 // See the file LICENSE.QPL distributed with CGAL.
00007 //
00008 // Licensees holding a valid commercial license may use this file in
00009 // accordance with the commercial license agreement provided with the software.
00010 //
00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 //
00014 // Partially supported by the IST Programme of the EU as a Shared-cost
00015 // RTD (FET Open) Project under Contract No  IST-2000-26473 
00016 // (ECG - Effective Computational Geometry for Curves and Surfaces) 
00017 // and a STREP (FET Open) Project under Contract No  IST-006413 
00018 // (ACS -- Algorithms for Complex Shapes)
00019 //
00020 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Algebraic_kernel_for_spheres/include/CGAL/Polynomials_2_3.h $
00021 // $Id: Polynomials_2_3.h 46224 2008-10-13 11:22:46Z pmachado $
00022 //
00023 // Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
00024 //             Sylvain Pion
00025 //             Pedro Machado
00026 //             Julien Hazebrouck
00027 //             Damien Leroy
00028 
00029 #ifndef CGAL_ALGEBRAIC_KERNEL_POLYNOMIALS_2_3_H
00030 #define CGAL_ALGEBRAIC_KERNEL_POLYNOMIALS_2_3_H
00031 
00032 #include <CGAL/enum.h>
00033 
00034 CGAL_BEGIN_NAMESPACE
00035 
00036 // polynomials of the form (X-a)^2 + (Y-b)^2 + (Z-c)^2 - R^2
00037 template < typename FT_ >
00038 class Polynomial_for_spheres_2_3
00039 {
00040   FT_ rep[4]; // stores a, b, c, R^2
00041   
00042 public:
00043   
00044   typedef FT_ FT;
00045   
00046   Polynomial_for_spheres_2_3(){}
00047   
00048   Polynomial_for_spheres_2_3(const FT & a, const FT & b, const FT & c, const FT & rsq)
00049   { 
00050     rep[0]=a;
00051     rep[1]=b;
00052     rep[2]=c;
00053     rep[3]=rsq;
00054   }
00055 
00056   const FT & a() const
00057   { return rep[0]; }
00058 
00059   const FT & b() const
00060   { return rep[1]; }
00061   
00062   const FT & c() const
00063   { return rep[2]; }
00064   
00065   const FT & r_sq() const
00066   { return rep[3]; }
00067 
00068   bool empty_space() const {
00069     return is_negative(r_sq());
00070   }
00071 
00072   bool isolated_point() const {
00073     return is_zero(r_sq());
00074   }
00075 
00076 };
00077 
00078 template < typename FT >
00079 inline
00080 bool 
00081 operator == ( const Polynomial_for_spheres_2_3<FT> & p1,
00082               const Polynomial_for_spheres_2_3<FT> & p2 )
00083 {
00084   return( (p1.a() == p2.a()) && 
00085           (p1.b() == p2.b()) &&
00086           (p1.c() == p2.c()) &&
00087           (p1.r_sq() == p2.r_sq()) );
00088 }
00089 
00090 CGAL_END_NAMESPACE
00091 
00092 #endif //CGAL_ALGEBRAIC_KERNEL_POLYNOMIALS_2_3_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines