shape_doc 0.1
/Users/mourrain/Devel/mmx/shape/include/shape/surface_algebraic_glue.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 * MODULE     : implicit_surface_glue.hpp
00003 * DESCRIPTION: Glue for implicit surface
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_IMPLICIT_SURFACE_GLUE_HPP
00012 #define __MMX_SHAPE_IMPLICIT_SURFACE_GLUE_HPP
00013 #include <basix/glue.hpp>
00014 #include <basix/tuple.hpp>
00015 #include <shape/MGXK.hpp>
00016 
00017 #include <realroot/polynomial_sparse_glue.hpp>
00018 #include <shape/axel_glue.hpp>
00019 #include <shape/algebraic_curve_glue.hpp>
00020 #include <shape/surface_algebraic.hpp>
00021 
00022 #define shape_surface_algebraic shape::surface_algebraic<rational,shape::MGXK>
00023 #define SURFACE    shape::surface_algebraic<rational,shape::MGXK>
00024 #define CURVE      shape::algebraic_curve<rational,shape::MGXK>
00025 #define Polynomial shape::algebraic_set<shape::MGXK>::Polynomial
00026 
00027 
00028 namespace mmx {
00029 
00030   namespace shape {
00031     inline bool operator ==(const SURFACE& v1, const SURFACE& v2) {return v1.equation()==v2.equation();}
00032     inline bool operator !=(const SURFACE& v1, const SURFACE& v2) {return !(v1==v2);}
00033     inline bool exact_eq(const SURFACE& v1, const SURFACE& v2) {return v1==v2;}
00034     inline bool exact_neq(const SURFACE& v1, const SURFACE& v2) {return v1!=v2;}
00035     
00036     inline unsigned hash (const SURFACE& v) 
00037     {
00038       register unsigned i, h= 214365, n=1;
00039       for (i=0; i<n; i++) h= (h<<1) ^ (h<<5) ^ (h>>27) ;//^ hash(v[i]);
00040       return h;
00041     }
00042     inline unsigned exact_hash (const SURFACE& m) {return hash(m);}
00043     inline unsigned soft_hash (const SURFACE& m) {return hash(m);}
00044 
00045     syntactic flatten (const SURFACE& s) 
00046     {
00047       using namespace shape;
00048       
00049       syntactic res = "AlgebraicSurface";
00050       
00051       return apply(res, mmx::flatten(s.equation()));
00052       
00053     }
00054   }
00055   
00056   CURVE shape_surface_algebraic_intersection (const SURFACE& s1, const SURFACE& s2)
00057   {
00058     //    using namespace shape;
00059     //    BOX *bx= s1.boundingBox() * s2.boundingBox();
00060     return CURVE(s1.equation(), s2.equation());
00061   }
00062 
00063 
00064 
00065 //====================================================================
00066 #undef Polynomial
00067 #undef BOX
00068 #undef CURVE
00069 #undef SURFACE
00070 //====================================================================
00071 } // namespace mmx
00072 #endif // __MMX_IMPLICIT_SURFACE_GLUE_HPP