00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __MMX_SHAPE_RATIONAL_CURVE_GLUE_HPP
00012 #define __MMX_SHAPE_RATIONAL_CURVE_GLUE_HPP
00013 #include <basix/glue.hpp>
00014 #include <basix/tuple.hpp>
00015 #include <realroot/ring_sparse_glue.hpp>
00016 #include <shape/MGXK.hpp>
00017 #include <shape/axel_glue.hpp>
00018 #include <shape/bounding_box.hpp>
00019 namespace mmx {
00020 namespace shape {
00021 struct rational_curve_def;
00022
00023 template<class C> struct use<rational_curve_def,C,MGXK> {
00024 typedef polynomial< C, with<Sparse,DegRevLex> > Polynomial;
00025 };
00026 }
00027 }
00028 #include <shape/rational_curve.hpp>
00029
00030 #define shape_rational_curve shape::rational_curve<rational,shape::MGXK>
00031 #define Polynomial polynomial< rational, with<Sparse,DegRevLex> >
00032 #define CURVE shape_rational_curve
00033
00034 namespace mmx {
00035 namespace shape {
00036
00037 inline bool operator ==(const CURVE& v1, const CURVE& v2) {return true;}
00038 inline bool operator !=(const CURVE& v1, const CURVE& v2) {return !(v1==v2);}
00039 inline bool exact_eq(const CURVE& v1, const CURVE& v2) {return v1==v2;}
00040 inline bool exact_neq(const CURVE& v1, const CURVE& v2) {return v1!=v2;}
00041
00042 inline unsigned hash (const CURVE& v)
00043 {
00044 register unsigned i, h= 214365, n=1;
00045 for (i=0; i<n; i++) h= (h<<1) ^ (h<<5) ^ (h>>27) ;
00046 return h;
00047 }
00048 inline unsigned exact_hash (const CURVE& m) {return hash(m);}
00049 inline unsigned soft_hash (const CURVE& m) {return hash(m);}
00050
00051 inline syntactic flatten (const CURVE& s)
00052 {
00053 using namespace shape;
00054
00055 syntactic res = "RationalCurve";
00056 return res;
00057
00058 if(s.dimension()>1)
00059 return apply(res, mmx::flatten(s.numerator(0)), mmx::flatten(s.numerator(1)), mmx::flatten(s.denominator()));
00060 else
00061 return apply(res, mmx::flatten(s.numerator(0)), mmx::flatten(s.denominator()));
00062 }
00063
00064 }
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 inline CURVE create_rational_curve(const Polynomial& e1,const Polynomial& e2, const Polynomial& e3)
00077 {
00078 return CURVE(e1,e2,e3);
00079 }
00080
00081 inline CURVE create_rational_curve(const interval<double>& I, const Polynomial& e1,const Polynomial& e2, const Polynomial& e3)
00082 {
00083 return CURVE(lower(I), upper(I), e1,e2,e3);
00084 }
00085
00086 inline CURVE create_rational_curve(const Polynomial& e1,const Polynomial& e2, const Polynomial& e3,const Polynomial& e4)
00087 {
00088 return CURVE(e1,e2,e3,e4);
00089 }
00090
00091 inline CURVE create_rational_curve(const interval<double>& I, const Polynomial& e1,const Polynomial& e2, const Polynomial& e3, const Polynomial& e4)
00092 {
00093 return CURVE(lower(I), upper(I), e1,e2,e3,e4);
00094 }
00095
00096
00097 #undef CURVE
00098 #undef Polynomial
00099
00100 }
00101 #endif // __MMX_ALGEBRAIC_CURVE_GLUE_HPP