Version: 9.16.0
VTKViewer_ArcBuilder.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef VTKVIEWER_ARCBUILDER_H
21#define VTKVIEWER_ARCBUILDER_H
22
23#include "VTKViewer.h"
24#include <list>
25#include <map>
26#include <vector>
27
28#include <vtkType.h>
29#include <vtkSmartPointer.h>
30
31class vtkCell;
32class vtkDataArray;
33class vtkPoints;
34class vtkPolyData;
35class vtkUnstructuredGrid;
36
37class Pnt;
38
39typedef std::list<Pnt> PntList;
40
41vtkIdType MergevtkPoints(const std::vector< vtkSmartPointer< vtkPoints > >& theCollection,
42 const std::vector< std::vector<double> >& theScalarCollection,
43 vtkPoints* thePoints,
44 std::map<vtkIdType, double>& thePntId2ScalarValue,
45 vtkIdType* &theIds);
46
47vtkIdType Build1DArc(vtkIdType cellId,
48 vtkUnstructuredGrid* input,
49 vtkPolyData *output,
50 vtkIdType *pts,
51 double myMaxArcAngle);
52
53Pnt CreatePnt(vtkCell* cell,
54 vtkDataArray* scalars,
55 vtkIdType index);
56
60class XYZ{
61 public:
62
63 XYZ();
64 XYZ(double , double , double);
65 ~XYZ();
66
67 double X()const {return x;}
68 double Y()const {return y;}
69 double Z()const {return z;}
70
71 void SetX(const double X) { x=X; }
72 void SetY(const double Y) { y=Y; }
73 void SetZ(const double Z) { z=Z; }
74
75 void Coord (double& X, double& Y, double& Z) const { X = x; Y = y; Z = z; }
76
77 double Modulus () const;
78
79 private:
80 double x;
81 double y;
82 double z;
83};
84
88class Pnt{
89 public:
90 Pnt();
91 Pnt(double, double, double, double);
92 ~Pnt();
93
94 void Coord (double& X, double& Y, double& Z) const {coord.Coord(X,Y,Z);}
95 XYZ GetXYZ() const {return coord;}
96 double GetScalarValue() const { return scalarValue; }
97
98 private:
101};
102
106class Vec{
107 public:
108
109 Vec(const double Xv, const double Yv, const double Zv);
110 ~Vec();
111
112 XYZ GetXYZ() const {return coord;}
113
114 double AngleBetween(const Vec & Other);
115 double AngleBetweenInGrad(const Vec & Other);
116
117 Vec VectMultiplication(const Vec & Other) const;
118
119 private:
121};
122
126class Plane{
127
128 public:
129 Plane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
130 ~Plane();
131
132 double A() const {return myA;}
133 double B() const {return myB;}
134 double C() const {return myC;}
135
136 Vec GetNormale() const;
137
138 private:
139 void CalculatePlane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
140
141 private:
142 double myA;
143 double myB;
144 double myC;
145};
146
147
149 public:
151 VTKViewer_ArcBuilder(const Pnt& thePnt1,
152 const Pnt& thePnt2,
153 const Pnt& thePnt3,
154 double theAngle);
155
157
159
161
162 void GetAngle(const double theAngle);
163
164 static double GetPointAngleOnCircle(const double theXCenter, const double theYCenter,
165 const double theXPoint, const double theYPoint);
166
167 vtkPoints* GetPoints();
168 const std::vector<double>& GetScalarValues();
169
170 private:
171
173
174 vtkUnstructuredGrid* BuildGrid(const PntList& theList) const;
175 vtkUnstructuredGrid* TransformGrid(vtkUnstructuredGrid* theGrid, const Vec& theAxis, const double angle) const;
176 vtkUnstructuredGrid* BuildArc(std::vector<double>& theScalarValues);
177 IncOrder GetArcAngle( const double& P1, const double& P2, const double& P3, double* Ang);
178
179
180
181 private:
185
186 double myAngle;
188 vtkSmartPointer<vtkPoints> myPoints;
189 std::vector<double> myScalarValues;
190};
191
192#endif //VTKVIEWER_ARCBUILDER_H
std::list< Pnt > PntList
Definition: VTKViewer_ArcBuilder.h:39
vtkIdType Build1DArc(vtkIdType cellId, vtkUnstructuredGrid *input, vtkPolyData *output, vtkIdType *pts, double myMaxArcAngle)
Definition: VTKViewer_ArcBuilder.cxx:595
Pnt CreatePnt(vtkCell *cell, vtkDataArray *scalars, vtkIdType index)
Definition: VTKViewer_ArcBuilder.cxx:584
vtkIdType MergevtkPoints(const std::vector< vtkSmartPointer< vtkPoints > > &theCollection, const std::vector< std::vector< double > > &theScalarCollection, vtkPoints *thePoints, std::map< vtkIdType, double > &thePntId2ScalarValue, vtkIdType *&theIds)
Definition: VTKViewer_ArcBuilder.cxx:640
Definition: VTKViewer_ArcBuilder.h:126
double C() const
Definition: VTKViewer_ArcBuilder.h:134
void CalculatePlane(const Pnt &thePnt1, const Pnt &thePnt2, const Pnt &thePnt3)
Definition: VTKViewer_ArcBuilder.cxx:195
Vec GetNormale() const
Definition: VTKViewer_ArcBuilder.cxx:188
~Plane()
Definition: VTKViewer_ArcBuilder.cxx:182
double myB
Definition: VTKViewer_ArcBuilder.h:143
double A() const
Definition: VTKViewer_ArcBuilder.h:132
Plane(const Pnt &thePnt1, const Pnt &thePnt2, const Pnt &thePnt3)
Definition: VTKViewer_ArcBuilder.cxx:174
double B() const
Definition: VTKViewer_ArcBuilder.h:133
double myA
Definition: VTKViewer_ArcBuilder.h:142
double myC
Definition: VTKViewer_ArcBuilder.h:144
Definition: VTKViewer_ArcBuilder.h:88
double scalarValue
Definition: VTKViewer_ArcBuilder.h:100
double GetScalarValue() const
Definition: VTKViewer_ArcBuilder.h:96
Pnt()
Definition: VTKViewer_ArcBuilder.cxx:97
XYZ GetXYZ() const
Definition: VTKViewer_ArcBuilder.h:95
void Coord(double &X, double &Y, double &Z) const
Definition: VTKViewer_ArcBuilder.h:94
XYZ coord
Definition: VTKViewer_ArcBuilder.h:99
~Pnt()
Definition: VTKViewer_ArcBuilder.cxx:104
Definition: VTKViewer_ArcBuilder.h:148
Pnt myPnt1
Definition: VTKViewer_ArcBuilder.h:182
const std::vector< double > & GetScalarValues()
Definition: VTKViewer_ArcBuilder.cxx:557
vtkPoints * GetPoints()
Definition: VTKViewer_ArcBuilder.cxx:553
ArcStatus
Definition: VTKViewer_ArcBuilder.h:150
@ Arc_Error
Definition: VTKViewer_ArcBuilder.h:150
@ Arc_Done
Definition: VTKViewer_ArcBuilder.h:150
vtkUnstructuredGrid * BuildArc(std::vector< double > &theScalarValues)
Definition: VTKViewer_ArcBuilder.cxx:424
static double GetPointAngleOnCircle(const double theXCenter, const double theYCenter, const double theXPoint, const double theYPoint)
Definition: VTKViewer_ArcBuilder.cxx:544
ArcStatus myStatus
Definition: VTKViewer_ArcBuilder.h:187
std::vector< double > myScalarValues
Definition: VTKViewer_ArcBuilder.h:189
IncOrder GetArcAngle(const double &P1, const double &P2, const double &P3, double *Ang)
Definition: VTKViewer_ArcBuilder.cxx:562
VTKViewer_ArcBuilder(const Pnt &thePnt1, const Pnt &thePnt2, const Pnt &thePnt3, double theAngle)
Definition: VTKViewer_ArcBuilder.cxx:226
IncOrder
Definition: VTKViewer_ArcBuilder.h:172
@ MINUS
Definition: VTKViewer_ArcBuilder.h:172
@ PLUS
Definition: VTKViewer_ArcBuilder.h:172
vtkSmartPointer< vtkPoints > myPoints
Definition: VTKViewer_ArcBuilder.h:188
~VTKViewer_ArcBuilder()
Definition: VTKViewer_ArcBuilder.cxx:351
Pnt myPnt2
Definition: VTKViewer_ArcBuilder.h:183
double myAngle
Definition: VTKViewer_ArcBuilder.h:186
void GetAngle(const double theAngle)
Definition: VTKViewer_ArcBuilder.cxx:409
Pnt myPnt3
Definition: VTKViewer_ArcBuilder.h:184
vtkUnstructuredGrid * BuildGrid(const PntList &theList) const
Definition: VTKViewer_ArcBuilder.cxx:358
ArcStatus GetStatus()
Definition: VTKViewer_ArcBuilder.h:160
vtkUnstructuredGrid * TransformGrid(vtkUnstructuredGrid *theGrid, const Vec &theAxis, const double angle) const
Definition: VTKViewer_ArcBuilder.cxx:392
Definition: VTKViewer_ArcBuilder.h:106
XYZ coord
Definition: VTKViewer_ArcBuilder.h:120
Vec(const double Xv, const double Yv, const double Zv)
Definition: VTKViewer_ArcBuilder.cxx:113
XYZ GetXYZ() const
Definition: VTKViewer_ArcBuilder.h:112
~Vec()
Definition: VTKViewer_ArcBuilder.cxx:133
Vec VectMultiplication(const Vec &Other) const
Definition: VTKViewer_ArcBuilder.cxx:163
double AngleBetween(const Vec &Other)
Definition: VTKViewer_ArcBuilder.cxx:139
double AngleBetweenInGrad(const Vec &Other)
Definition: VTKViewer_ArcBuilder.cxx:156
Definition: VTKViewer_ArcBuilder.h:60
double X() const
Definition: VTKViewer_ArcBuilder.h:67
double x
Definition: VTKViewer_ArcBuilder.h:80
double Modulus() const
Definition: VTKViewer_ArcBuilder.cxx:79
double z
Definition: VTKViewer_ArcBuilder.h:82
~XYZ()
Definition: VTKViewer_ArcBuilder.cxx:73
double Y() const
Definition: VTKViewer_ArcBuilder.h:68
void SetZ(const double Z)
Definition: VTKViewer_ArcBuilder.h:73
void SetY(const double Y)
Definition: VTKViewer_ArcBuilder.h:72
double y
Definition: VTKViewer_ArcBuilder.h:81
double Z() const
Definition: VTKViewer_ArcBuilder.h:69
void Coord(double &X, double &Y, double &Z) const
Definition: VTKViewer_ArcBuilder.h:75
void SetX(const double X)
Definition: VTKViewer_ArcBuilder.h:71
XYZ()
Definition: VTKViewer_ArcBuilder.cxx:68