shape_doc 0.1
/Users/mourrain/Devel/mmx/shape/include/shape/algebraic_curve_glue.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 * MODULE     : implicit_curve_glue.hpp
00003 * DESCRIPTION: Glue for implicit curve
00004 * COPYRIGHT  : (C) 2007 Bernard Mourrain
00005 *******************************************************************************
00006 * This software falls under the GNU general public license and comes WITHOUT
00007 * ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
00008 * If you don't have this file, write to the Free Software Foundation, Inc.,
00009 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00010 ******************************************************************************/
00011 #ifndef __MMX_SHAPE_ALGEBRAIC_CURVE_GLUE_HPP
00012 #define __MMX_SHAPE_ALGEBRAIC_CURVE_GLUE_HPP
00013 #include <basix/glue.hpp>
00014 #include <basix/tuple.hpp>
00015 #include <realroot/polynomial_sparse_glue.hpp>
00016 #include <shape/MGXK.hpp>
00017 #include <shape/axel_glue.hpp>
00018 #include <shape/bounding_box.hpp>
00019 #include <shape/algebraic_curve.hpp>
00020 
00021 #define shape_algebraic_curve shape::algebraic_curve<rational,shape::MGXK> 
00022 #define Polynomial  polynomial< rational, with<Sparse,DegRevLex> >
00023 #define CURVE shape_algebraic_curve
00024 
00025 
00026 namespace mmx {
00027   namespace shape {
00028 
00029     inline bool operator ==(const CURVE& v1, const CURVE& v2) {return true;}
00030     inline bool operator !=(const CURVE& v1, const CURVE& v2) {return !(v1==v2);}
00031     inline bool exact_eq(const CURVE& v1, const CURVE& v2) {return v1==v2;}
00032     inline bool exact_neq(const CURVE& v1, const CURVE& v2) {return v1!=v2;}
00033     
00034     inline unsigned hash (const CURVE& v) 
00035     {
00036       register unsigned i, h= 214365, n=1;
00037       for (i=0; i<n; i++) h= (h<<1) ^ (h<<5) ^ (h>>27) ;//^ hash(v[i]);
00038       return h;
00039     }
00040     inline unsigned exact_hash (const CURVE& m) {return hash(m);}
00041     inline unsigned soft_hash (const CURVE& m) {return hash(m);}
00042 
00043     inline syntactic flatten (const CURVE& s) 
00044     {
00045       using namespace shape;
00046       
00047       syntactic res = "AlgebraicCurve";
00048       if(s.nbequation()>1)
00049         return apply(res, mmx::flatten(s.equation(0)), mmx::flatten(s.equation(1)));
00050       else
00051         return apply(res, mmx::flatten(s.equation(0)));
00052     }
00053   }
00054   
00055 //   inline CURVE shape_algebraic_curve_string (const string& e1)
00056 //   {
00057 //     return CURVE (as_charp(e1));
00058 //   }
00059 
00060 //   inline CURVE shape_algebraic_curve_string (const string& e1,const string& e2)
00061 //   {
00062 //     return CURVE (as_charp(e1), as_charp(e2));
00063 //   }
00064 
00065 //   inline CURVE algebraic_curve(const Polynomial& e1,const Polynomial& e2)
00066 //   {
00067 //     return CURVE(e1, e2);
00068 //   }
00069   
00070 
00071  
00072 //====================================================================
00073 #undef CURVE
00074 #undef Polynomial
00075 //====================================================================
00076 } // namespace mmx
00077 #endif // __MMX_ALGEBRAIC_CURVE_GLUE_HPP