Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef VTKVIEWER_ARCBUILDER_H
00021 #define VTKVIEWER_ARCBUILDER_H
00022
00023 #include "VTKViewer.h"
00024 #include <list>
00025 #include <map>
00026 #include <vector>
00027
00028 class vtkCell;
00029 class vtkDataArray;
00030 class vtkPoints;
00031 class vtkPolyData;
00032 class vtkUnstructuredGrid;
00033
00034 class Pnt;
00035
00036 typedef std::list<Pnt> PntList;
00037
00038 vtkIdType MergevtkPoints(const std::vector<vtkPoints*>& theCollection,
00039 const std::vector< std::vector<double> >& theScalarCollection,
00040 vtkPoints* thePoints,
00041 std::map<int, double>& thePntId2ScalarValue,
00042 vtkIdType* &theIds);
00043
00044 vtkIdType Build1DArc(vtkIdType cellId,
00045 vtkUnstructuredGrid* input,
00046 vtkPolyData *output,
00047 vtkIdType *pts,
00048 vtkFloatingPointType myMaxArcAngle);
00049
00050 Pnt CreatePnt(vtkCell* cell,
00051 vtkDataArray* scalars,
00052 vtkIdType index);
00053
00057 class XYZ{
00058 public:
00059
00060 XYZ();
00061 XYZ(double , double , double);
00062 ~XYZ();
00063
00064 double X()const {return x;}
00065 double Y()const {return y;}
00066 double Z()const {return z;}
00067
00068 void SetX(const double X) { x=X; }
00069 void SetY(const double Y) { y=Y; }
00070 void SetZ(const double Z) { z=Z; }
00071
00072 void Coord (double& X, double& Y, double& Z) const { X = x; Y = y; Z = z; }
00073
00074 double Modulus () const;
00075
00076 private:
00077 double x;
00078 double y;
00079 double z;
00080 };
00081
00085 class Pnt{
00086 public:
00087 Pnt();
00088 Pnt(double, double, double, double);
00089 ~Pnt();
00090
00091 void Coord (double& X, double& Y, double& Z) const {coord.Coord(X,Y,Z);}
00092 XYZ GetXYZ() const {return coord;}
00093 double GetScalarValue() const { return scalarValue; }
00094
00095 private:
00096 XYZ coord;
00097 double scalarValue;
00098 };
00099
00103 class Vec{
00104 public:
00105
00106 Vec(const double Xv, const double Yv, const double Zv);
00107 ~Vec();
00108
00109 XYZ GetXYZ() const {return coord;}
00110
00111 double AngleBetween(const Vec & Other);
00112 double AngleBetweenInGrad(const Vec & Other);
00113
00114 Vec VectMultiplication(const Vec & Other) const;
00115
00116 private:
00117 XYZ coord;
00118 };
00119
00123 class Plane{
00124
00125 public:
00126 Plane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
00127 ~Plane();
00128
00129 double A() const {return myA;}
00130 double B() const {return myB;}
00131 double C() const {return myC;}
00132
00133 Vec GetNormale() const;
00134
00135 private:
00136 void CalculatePlane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
00137
00138 private:
00139 double myA;
00140 double myB;
00141 double myC;
00142 };
00143
00144
00145 class VTKViewer_ArcBuilder{
00146 public:
00147 enum ArcStatus {Arc_Done=0, Arc_Error};
00148 VTKViewer_ArcBuilder(const Pnt& thePnt1,
00149 const Pnt& thePnt2,
00150 const Pnt& thePnt3,
00151 double theAngle);
00152
00153 ~VTKViewer_ArcBuilder();
00154
00155 Vec GetNormale();
00156
00157 ArcStatus GetStatus(){return myStatus;}
00158
00159 void GetAngle(const double theAngle);
00160
00161 static double GetPointAngleOnCircle(const double theXCenter, const double theYCenter,
00162 const double theXPoint, const double theYPoint);
00163
00164 vtkPoints* GetPoints();
00165 const std::vector<double>& GetScalarValues();
00166
00167 private:
00168
00169 enum IncOrder{MINUS=0,PLUS};
00170
00171 vtkUnstructuredGrid* BuildGrid(const PntList& theList) const;
00172 vtkUnstructuredGrid* TransformGrid(vtkUnstructuredGrid* theGrid, const Vec& theAxis, const double angle) const;
00173 vtkUnstructuredGrid* BuildArc(std::vector<double>& theScalarValues);
00174 IncOrder GetArcAngle( const double& P1, const double& P2, const double& P3, double* Ang);
00175
00176
00177
00178 private:
00179 Pnt myPnt1;
00180 Pnt myPnt2;
00181 Pnt myPnt3;
00182
00183 double myAngle;
00184 ArcStatus myStatus;
00185 vtkPoints* myPoints;
00186 std::vector<double> myScalarValues;
00187 };
00188
00189 #endif //VTKVIEWER_ARCBUILDER_H