00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 # ifndef algebraic_curve_hpp
00013 # define algebraic_curve_hpp
00014
00015
00016 # include <shape/curve.hpp>
00017 # include <shape/bounding_box.hpp>
00018 # include <shape/algebraic_set.hpp>
00019
00020 # define TMPL template<class C, class V>
00021 # define TMPL1 template<class V>
00022 # define SELF algebraic_curve<C,V>
00023 # define Viewer viewer<axel,V>
00024
00025 namespace mmx {
00026 namespace shape {
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 template<class C, class V=default_env>
00041 class algebraic_curve
00042 :public curve<REF_OF(V)>
00043 ,public algebraic_set<C,REF_OF(V)>
00044 {
00045 public:
00046
00047 typedef REF_OF(V) Ref;
00048 typedef typename use<algebraic_set_def,C,V>::Polynomial Polynomial;
00049 typedef curve<Ref> Curve;
00050
00051 algebraic_curve(void): Curve() {};
00052 algebraic_curve(char* s) ;
00053 algebraic_curve(const char* s1, const char* s2);
00054 algebraic_curve(const Polynomial& eq) ;
00055 algebraic_curve(const Polynomial& eq1, const Polynomial& eq2);
00056
00057 ~algebraic_curve(void) {};
00058
00059 };
00060
00061 TMPL
00062 SELF::algebraic_curve(char * s): Curve()
00063 {
00064
00065
00066 Polynomial e(s, variables("x y") );
00067 this->insert(e);
00068 }
00069
00070 TMPL
00071 SELF::algebraic_curve(const char * s1, const char* s2) : Curve()
00072 {
00073 variables var("x y z");
00074
00075
00076 Polynomial e1(s1,var);
00077 this->insert(e1);
00078
00079
00080
00081 Polynomial e2(s2,var);
00082 this->insert(e2);
00083 }
00084
00085 TMPL
00086 SELF::algebraic_curve(const Polynomial& s) : Curve()
00087 {
00088 this->insert(s);
00089 }
00090
00091 TMPL
00092 SELF::algebraic_curve(const Polynomial& p1, const Polynomial& p2) : Curve()
00093 {
00094 this->insert(p1);
00095 this->insert(p2);
00096 }
00097
00098
00099 } ;
00100
00101
00102 template<class OSTREAM, class C, class V>
00103 OSTREAM& operator<<(OSTREAM& os, const shape::SELF& cv) {
00104 os<<"AlgebraicCurve(";
00105 for(int i=0; i<cv.nbequation();i++){
00106 if(i>0) os<<",";
00107 print(os,cv.equation(i),variables("x y z"));
00108 }
00109 os<<")";
00110 return os;
00111 }
00112
00113
00114 } ;
00115
00116 # undef TMPL
00117 # undef TMPL1
00118 # undef SELF
00119 # undef Viewer
00120 # endif // shape_algebraic_curve_hpp