Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Search for

# Polygon.h

Go to the documentation of this file.

    00001
    00002 #ifndef POLYGON_IS_INCLUDED
    00003 #define POLYGON_IS_INCLUDED
    00004
    00005 #include <tools.h>
    00006
    00007
    00008 class Polygon;
    00009 class Triangle;
    00010 class Mesh;
    00011 class Point;
    00012 class Edge;
    00013 class Face;
    00014
    00015 enum  Repr_format {
    00016   SUBS_PERFORMED = 1,
    00017   SUBS_NOT_PERFORMED = 2
    00018 };
    00019
    00020 /* Comment:
    00021    Every Polygon can have a name, e.g., for the lines in
    00022    a triangle we can name them   "l1", "l2", "l3".
    00023    In repr we could then represent the lines as
    00024    line "l1": [x = A^{l1}*t -x0^{l1},
    00025                y = B^{l1}*t -y0^{l1},
    00026                z = C^{l1}*t -z0^{l1},
    00027                A^{l1} = .., B^{l1} = ..,  C^{l1} = ..
    00028                t, 0, 1 ]
    00029
    00030    can also consider to store this stuff as a map !
    00031    E.g.,
    00032        equations = lst ( x = ..., y = ..., z = ...)
    00033        subst     = lst ( A^{li} = ..., B^{li} = ...,  C^{li} = ...)
    00034        variables = lst ( t )
    00035        range     = lst ( 0, 1)
    00036 */
    00037
    00038 class Polygon {
    00039   public:
    00040   string subscript;
    00041   GiNaC::exvector p;
    00042
    00043   Polygon() {}
    00044   virtual ~Polygon() {}
    00045
    00046   virtual int no_vertices();
    00047   virtual GiNaC::ex vertex(int i);
    00048   virtual GiNaC::ex integrate(GiNaC::ex f, Repr_format format = SUBS_PERFORMED) {
    00049           //FIXME
    00050           cout <<"Polygon integrate not implemented "<<endl;
    00051           return GiNaC::ex(0);
    00052   }
    00053   virtual string str();
    00054 };
    00055
    00056 class Line : public Polygon  {
    00057   GiNaC::ex a_;
    00058   GiNaC::ex b_;
    00059   public:
    00060   Line() {}
    00061   Line(GiNaC::ex x0, GiNaC::ex x1, string subscript = ""); // x0_ and x1_ are points
    00062   virtual ~Line(){}
    00063
    00064   virtual int no_vertices();
    00065   virtual GiNaC::ex vertex(int i);
    00066   virtual GiNaC::ex repr(GiNaC::ex t, Repr_format format = SUBS_PERFORMED);
    00067   virtual string str();
    00068   virtual GiNaC::ex integrate(GiNaC::ex f, Repr_format format = SUBS_PERFORMED);
    00069 };
    00070
    00071
    00072 class ReferenceLine : public Line {
    00073   public:
    00074   ReferenceLine(string subscript = "");
    00075   virtual ~ReferenceLine(){}
    00076
    00077   virtual int no_vertices();
    00078   virtual GiNaC::ex vertex(int i);
    00079   virtual GiNaC::ex repr(GiNaC::ex t, Repr_format format = SUBS_PERFORMED);
    00080   GiNaC::ex a();
    00081   GiNaC::ex b();
    00082   virtual string str();
    00083   virtual GiNaC::ex integrate(GiNaC::ex f, Repr_format format = SUBS_PERFORMED);
    00084 };
    00085
    00086 class Triangle : public Polygon {
    00087   public:
    00088   Triangle(GiNaC::ex x0, GiNaC::ex x1, GiNaC::ex x1, string subscript = "");
    00089   Triangle() {}
    00090   virtual ~Triangle(){}
    00091
    00092   virtual int no_vertices();
    00093   virtual GiNaC::ex vertex(int i);
    00094   virtual Line line(int i);
    00095   virtual GiNaC::ex repr(Repr_format = SUBS_PERFORMED);
    00096   virtual string str();
    00097   virtual GiNaC::ex integrate(GiNaC::ex f, Repr_format format = SUBS_PERFORMED);
    00098 };
    00099
    00100 class ReferenceTriangle : public Triangle {
    00101   public:
    00102   ReferenceTriangle(string subscript = "");
    00103   virtual ~ReferenceTriangle(){}
    00104
    00105   virtual int no_vertices();
    00106   virtual GiNaC::ex vertex(int i);
    00107   virtual Line line(int i);
    00108   virtual GiNaC::ex repr(Repr_format format = SUBS_PERFORMED);
    00109   virtual string str();
    00110   virtual GiNaC::ex integrate(GiNaC::ex f);
    00111 };
    00112
    00113 class Rectangle : public Polygon {
    00114   public:
    00115   Rectangle(GiNaC::ex p0, GiNaC::ex p1, string subscript = "");
    00116   Rectangle() {}
    00117   virtual ~Rectangle(){}
    00118
    00119   virtual int no_vertices();
    00120   virtual GiNaC::ex vertex(int i);
    00121   virtual Line line(int i);
    00122   virtual GiNaC::ex repr(Repr_format format = SUBS_PERFORMED);
    00123   virtual string str();
    00124   virtual GiNaC::ex integrate(GiNaC::ex f);
    00125 };
    00126
    00127
    00128
    00129 class ReferenceRectangle : public Rectangle {
    00130   public:
    00131   ReferenceRectangle(string subscript = "");
    00132   virtual ~ReferenceRectangle(){}
    00133
    00134   virtual int no_vertices();
    00135   virtual GiNaC::ex vertex(int i);
    00136   virtual Line line(int i);
    00137   virtual GiNaC::ex repr(Repr_format format = SUBS_PERFORMED);
    00138   virtual string str();
    00139   virtual GiNaC::ex integrate(GiNaC::ex f);
    00140 };
    00141
    00142 class Tetrahedron : public Polygon {
    00143   public:
    00144   Tetrahedron(string subscript) {}
    00145   Tetrahedron(GiNaC::ex x0, GiNaC::ex x1, GiNaC::ex x1, GiNaC::ex x2, string subscript = "");
    00146   virtual ~Tetrahedron(){}
    00147
    00148   virtual int no_vertices();
    00149   virtual GiNaC::ex vertex(int i);
    00150   virtual Line line(int i);
    00151   virtual Triangle triangle(int i);
    00152   virtual GiNaC::ex repr(Repr_format format = SUBS_PERFORMED);
    00153   virtual string str();
    00154   virtual GiNaC::ex integrate(GiNaC::ex f, Repr_format format = SUBS_PERFORMED);
    00155 };
    00156
    00157 class ReferenceTetrahedron : public Tetrahedron {
    00158   public:
    00159   ReferenceTetrahedron(string subscript = "");
    00160   virtual ~ReferenceTetrahedron(){}
    00161
    00162   virtual int no_vertices();
    00163   virtual GiNaC::ex vertex(int i);
    00164   virtual Line line(int i);
    00165   virtual Triangle triangle(int i);
    00166   virtual GiNaC::ex repr(Repr_format format = SUBS_PERFORMED) { return GiNaC::ex(0); }
    00167   virtual string str();
    00168   virtual GiNaC::ex integrate(GiNaC::ex f, Repr_format = SUBS_PERFORMED);
    00169 };
    00170
    00171 class Box: public Polygon {
    00172   public:
    00173   Box(GiNaC::ex p0, GiNaC::ex p1, string subscript = "");
    00174   Box(){}
    00175   virtual ~Box(){}
    00176
    00177   virtual int no_vertices();
    00178   virtual GiNaC::ex vertex(int i);
    00179   virtual Line line(int i);
    00180   virtual GiNaC::ex repr(Repr_format format = SUBS_PERFORMED);
    00181   virtual string str();
    00182   virtual GiNaC::ex integrate(GiNaC::ex f);
    00183 };
    00184
    00185
    00186
    00187 class ReferenceBox: public Box{
    00188   public:
    00189   ReferenceBox(string subscript = "");
    00190   virtual ~ReferenceBox(){}
    00191
    00192   virtual int no_vertices();
    00193   virtual GiNaC::ex vertex(int i);
    00194   virtual Line line(int i);
    00195   virtual GiNaC::ex repr(Repr_format format = SUBS_PERFORMED);
    00196   virtual string str();
    00197   virtual GiNaC::ex integrate(GiNaC::ex f);
    00198 };
    00199
    00200 // Some tools for Polygons
    00201
    00202 // FIXME: change to barycenter(Triangle&)
    00203 // FIXME:       and barycenter(Tetrahedron&)
    00204 GiNaC::ex barycenter_line(GiNaC::ex p0, GiNaC::ex p1);
    00205 GiNaC::ex barycenter_triangle(GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2);
    00206 GiNaC::ex barycenter_tetrahedron(GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2, GiNaC::ex p3);
    00207 GiNaC::lst bezier_ordinates(Triangle& triangle, int d);
    00208 GiNaC::lst bezier_ordinates(Tetrahedron& tetrahedra, int d);
    00209
    00210 // polynom of arbitrary order on a line, a triangle,
    00211 // or a tetrahedron using the Bernstein basis
    00212 GiNaC::ex bernstein(int order, Polygon& p, const string a);
    00213
    00214 // vector polynom of arbitrary order on a line, a triangle,
    00215 // or a tetrahedron using the Bernstein basis
    00216 GiNaC::lst bernsteinv(int no_fields, int order, Polygon& p, const string a);
    00217
    00218 GiNaC::lst normal(Triangle&, int i);
    00219 GiNaC::lst normal(Tetrahedron&, int i);
    00220
    00221 GiNaC::lst tangent(Triangle&, int i);
    00222
    00223
    00224
    00225
    00226
    00227 #endif
    00228