shape_doc 0.1
/Users/mourrain/Devel/mmx/shape/include/shape/semialgebraic_curve.hpp
Go to the documentation of this file.
00001 /*****************************************************************************
00002  * M a t h e m a g i x
00003  *****************************************************************************
00004  * AlgebraicSurface
00005  * 2008-03-28
00006  * Julien Wintz
00007  *****************************************************************************
00008  *               Copyright (C) 2006 INRIA Sophia-Antipolis
00009  *****************************************************************************
00010  * Comments :
00011  ****************************************************************************/
00012 
00013 # ifndef shape_semialgebraic_domain_hpp
00014 # define shape_semialgebraic_domain_hpp
00015 
00016 # include <realroot/GMP.hpp>
00017 # include <shape/algebraic_curve.hpp>
00018 # include <shape/surface.hpp>
00019 # define TMPL template<class C, class V>
00020 # define REF  REF_OF(V)
00021 # define SELF semialgebraic_curve<C,V>
00022 //====================================================================
00023 namespace mmx {
00024 namespace shape {
00025 //====================================================================
00026 // TMPL struct semialgebraic_curve;
00027 
00028 // TMPL struct with_semialgebraic_curve { 
00029 //   typedef semialgebraic_curve<K> SemiAlgebraicDomain; 
00030 // };
00031 
00032 // TMPL struct semialgebraic_curve_def 
00033 //   :public algebraic_curve_def<K>
00034 //   ,public with_semialgebraic_curve<K> {};
00035 
00036 template<class C, class V=default_env>
00037 class semialgebraic_curve : public algebraic_curve<C,V> {
00038 
00039 public:
00040   typedef typename SHAPE_OF(V)       Shape;
00041   typedef algebraic_curve<C,REF>     AlgebraicCurve;
00042   typedef typename AlgebraicCurve::Polynomial Polynomial;
00043 
00044   semialgebraic_curve(void) {} ;
00045   semialgebraic_curve(char *, int=1) ;
00046   semialgebraic_curve(const Polynomial &, int=1) ;
00047   semialgebraic_curve(AlgebraicCurve*, int=1) ;
00048   ~semialgebraic_curve(void) {};
00049 
00050   Polynomial inequality() const  { return this->equation() ; }
00051 
00052   //int        sign()       const  { return this->m_sign; }
00053   //void set_sign    (int s)                { return this->m_sign=s; }
00054 private:
00055    //Polynomial m_polynomial ;
00056   //int        m_sign; //always assumed +1
00057 } ;
00058 
00059 TMPL
00060 SELF::semialgebraic_curve(char * s, int i)
00061   : AlgebraicCurve(s) { 
00062    if (i<0) this->set_equation( this->equation()*(-1));
00063 }
00064 
00065 TMPL
00066 SELF::semialgebraic_curve(const Polynomial& p, int s) 
00067     : AlgebraicCurve(p) { if (s<0) this->set_equation((-1)*p); }
00068 
00069 TMPL
00070 SELF::semialgebraic_curve(AlgebraicCurve* c, int s) 
00071     : AlgebraicCurve(c) { if (s<0) this->set_equation((-1)*c->equation()); }
00072 //====================================================================
00073 } ; // namespace shape
00074 } ; // namespace mmx
00075 //====================================================================
00076 # undef TMPL 
00077 # undef REF 
00078 # undef SELF
00079 # endif // shape_semialgebraic_curve_hpp