OpenLexocad  27.1
Trsf.h
Go to the documentation of this file.
1 //
3 // Copyright(C) 2013-2016 OpenCascade [www.opencascade.org]
4 //
5 // This library is free software; you can redistribute it and / or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street,
18 // Fifth Floor, Boston, MA 02110 - 1301 USA
19 //
21 
22 #pragma once
23 
24 #include <Base/Matrix.h>
25 #include <Geom/Mat.h>
26 #include <Geom/XYZ.h>
27 
28 namespace Geom
29 {
30 class Ax1;
31 class Ax2;
32 class Ax3;
33 class Pnt;
34 class Vec;
35 class GTrsf;
36 class Trsf2d;
37 } // namespace Geom
38 
39 
40 namespace Geom
41 {
56 
57 class LX_GEOM_EXPORT Trsf
58 {
59 public:
61  // //
62  // --------------------- BEGIN API --------------------- //
63  // //
64  // ATTENTION: DO NOT CHANGE ANY SIGNATURES IN THE API ! //
65  // //
67 
68  // Methods PUBLIC
69  //
71  Trsf();
88  explicit Trsf(const Geom::Trsf2d& T);
89 
90  Trsf(const Geom::Mat& mat, const Geom::XYZ& location, double scale);
91  Trsf(const Base::Matrix4D& mtrx);
92 
94  Trsf(const Trsf& rhs);
95 
96  enum FormEnum
97  {
106  Other
107  };
108 
111  void setMirror(const Geom::Pnt& P);
112 
113 
116  void setMirror(const Geom::Ax1& A1);
117 
118 
123  void setMirror(const Geom::Ax2& A2);
124 
125 
129  void setRotation(const Geom::Ax1& A1, const double Ang);
130 
131 
135  void setScale(const Geom::Pnt& P, const double S);
136 
137 
158  void setDisplacement(const Geom::Ax3& FromSystem1, const Geom::Ax3& ToSystem2);
159 
178  void setTransformation(const Geom::Ax3& FromSystem1, const Geom::Ax3& ToSystem2);
179 
190  void setTransformation(const Geom::Ax3& ToSystem);
191 
194  void setTranslation(const Geom::Vec& V);
195 
198  void setTranslation(const Geom::Pnt& P1, const Geom::Pnt& P2);
199 
201  void setTranslationPart(const Geom::Vec& V);
202 
204  void translate(const Geom::Vec& V);
205 
208  void setScaleFactor(const double S);
209 
225  void setValues(double a11,
226  double a12,
227  double a13,
228  double a14,
229  double a21,
230  double a22,
231  double a23,
232  double a24,
233  double a31,
234  double a32,
235  double a33,
236  double a34,
237  double Tolang,
238  double TolDist);
241  bool isNegative() const;
242 
245  bool isIdentity() const;
247  void setIdentity();
248 
253  // TODO
254  Trsf::FormEnum form() const;
256  double scaleFactor() const;
257 
259  const Geom::XYZ& translationPart() const;
260 
261 
264  Geom::Mat vectorialPart() const;
265 
272  const Geom::Mat& hVectorialPart() const;
273 
278  double value(const int Row, const int Col) const;
279 
280 
281  void invert();
282 
296  Trsf inverted() const;
297 
298  Trsf multiplied(const Trsf& T) const;
299  Trsf operator*(const Trsf& T) const { return multiplied(T); }
300 
301 
302 
314  void multiply(const Trsf& T);
315  void operator*=(const Trsf& T) { multiply(T); }
316 
317 
318 
321  void preMultiply(const Trsf& T);
322 
323 
324  void power(const int N);
325 
330  Trsf powered(const int N);
331 
332  void transforms(double& X, double& Y, double& Z) const;
334  void transforms(Geom::XYZ& Coord) const;
335 
336  void toMatrix4D(Base::Matrix4D& mtrx);
337 
338  friend class gp_GTrsf;
339  friend class Geom::GTrsf;
340 
342  // //
343  // ---------------------- END API ---------------------- //
344  // //
346 
347 private:
348  double _scale;
349  Trsf::FormEnum _shape;
350  Geom::Mat _matrix;
351  Geom::XYZ _loc;
352 };
353 
354 } // namespace Geom
Definition: Variant.h:60
X
Definition: Globals.h:29
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:43
Vector3f & operator *=(Vector3f &rclVect, const Matrix4D &rclMtrx)
Definition: Matrix.h:351
Definition: Mat.h:38
Definition: Trsf.h:102
Definition: Trsf.h:98
Definition: Trsf.h:105
Definition: Ax2.h:67
Definition: Trsf.h:104
Definition: XYZ.h:43
Definition: Trsf.h:57
Y
Definition: Globals.h:29
Definition: Trsf.h:99
FormEnum
Definition: Trsf.h:96
Definition: Ax3.h:69
Definition: Trsf2d.h:46
Definition: Ax1.h:50
Z
Definition: Globals.h:29
Defines a non-persistent vector in 3D space.
Definition: Vec.h:44
Definition: GTrsf.h:47
Definition: Trsf.h:100
Definition: Matrix.h:38
Definition: Trsf.h:103
DualNumber operator *(DualNumber a, DualNumber b)
Definition: DualNumber.h:71
Definition: Trsf.h:101