OpenLexocad  28.0
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 <Geom/Mat.h>
25 #include <Geom/XYZ.h>
26 namespace Base { class Matrix4D; }
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 
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
256  double scaleFactor() const;
257 
259  const Geom::XYZ& translationPart() const;
260 
261 
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 
337 
338  friend class gp_GTrsf;
339  friend class Geom::GTrsf;
340 
342  // //
343  // ---------------------- END API ---------------------- //
344  // //
346 
347  bool isSameAs(const Trsf& T) const;
348 
349 private:
350  double _scale;
351  Trsf::FormEnum _shape;
352  Geom::Mat _matrix;
353  Geom::XYZ _loc;
354 };
355 
356 } // namespace Geom
Geom::Trsf::Ax2Mirror
@ Ax2Mirror
Definition: Trsf.h:103
Geom::Trsf::Identity
@ Identity
Definition: Trsf.h:98
Geom::Trsf::invert
void invert()
Geom::Trsf::isSameAs
bool isSameAs(const Trsf &T) const
Geom::Trsf::setMirror
void setMirror(const Geom::Pnt &P)
Geom::Trsf::powered
Trsf powered(const int N)
Geom::Trsf::transforms
void transforms(double &X, double &Y, double &Z) const
Geom::Ax3
Definition: Ax3.h:68
XYZ.h
Geom::Vec
Defines a non-persistent vector in 3D space.
Definition: Vec.h:41
Geom::Trsf::toMatrix4D
void toMatrix4D(Base::Matrix4D &mtrx)
Geom::Trsf::hVectorialPart
const Geom::Mat & hVectorialPart() const
Geom::Trsf::Trsf
Trsf(const Geom::Mat &mat, const Geom::XYZ &location, double scale)
Geom::Trsf::setMirror
void setMirror(const Geom::Ax2 &A2)
Geom::Trsf::Trsf
Trsf(const Trsf &rhs)
Copy constructor.
X
X
Definition: Globals.h:29
Geom::Trsf::setRotation
void setRotation(const Geom::Ax1 &A1, const double Ang)
Geom::Trsf::setScaleFactor
void setScaleFactor(const double S)
Geom::Ax1
Definition: Ax1.h:50
Geom::XYZ
Definition: XYZ.h:44
Geom::Trsf::setMirror
void setMirror(const Geom::Ax1 &A1)
Geom::Trsf::Trsf
Trsf(const Geom::Trsf2d &T)
Geom::GTrsf
Definition: GTrsf.h:49
Geom::Trsf::preMultiply
void preMultiply(const Trsf &T)
Geom::Trsf::Trsf
Trsf(const Base::Matrix4D &mtrx)
Geom::Trsf::Translation
@ Translation
Definition: Trsf.h:100
Geom::Trsf::setDisplacement
void setDisplacement(const Geom::Ax3 &FromSystem1, const Geom::Ax3 &ToSystem2)
Geom::Trsf::setTranslation
void setTranslation(const Geom::Vec &V)
Geom::Trsf::setIdentity
void setIdentity()
Sets the transformation to identity.
Geom::Trsf::Ax1Mirror
@ Ax1Mirror
Definition: Trsf.h:102
Geom::Pnt
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
Geom::Ax2
Definition: Ax2.h:66
Mat.h
Z
Z
Definition: Globals.h:31
Geom::Trsf::operator*
Trsf operator*(const Trsf &T) const
Definition: Trsf.h:299
Geom::Trsf::scaleFactor
double scaleFactor() const
Returns the scale factor.
Geom::Trsf::Scale
@ Scale
Definition: Trsf.h:104
Geom::Trsf::CompoundTrsf
@ CompoundTrsf
Definition: Trsf.h:105
Geom::Trsf::translationPart
const Geom::XYZ & translationPart() const
Returns the translation part of the transformation's matrix
Y
Y
Definition: Globals.h:30
Geom::Trsf::Rotation
@ Rotation
Definition: Trsf.h:99
Geom::Trsf::PntMirror
@ PntMirror
Definition: Trsf.h:101
Geom::Trsf::value
double value(const int Row, const int Col) const
Geom::Trsf::isNegative
bool isNegative() const
Geom::Trsf::setTranslationPart
void setTranslationPart(const Geom::Vec &V)
Replaces the translation vector with the vector V.
Geom::Trsf::multiplied
Trsf multiplied(const Trsf &T) const
Geom::Trsf::operator*=
void operator*=(const Trsf &T)
Definition: Trsf.h:315
Base::Matrix4D
Definition: Matrix.h:55
Geom::Trsf::transforms
void transforms(Geom::XYZ &Coord) const
Transformation of a triplet XYZ with a Trsf
Geom::Trsf
Definition: Trsf.h:58
Geom::Trsf::Trsf
Trsf()
Returns the identity transformation.
Geom::Trsf2d
Definition: Trsf2d.h:47
Geom::Trsf::setTranslation
void setTranslation(const Geom::Pnt &P1, const Geom::Pnt &P2)
Geom::Trsf::translate
void translate(const Geom::Vec &V)
Add vector V to the translation vector.
Geom::Trsf::FormEnum
FormEnum
Definition: Trsf.h:97
Geom::Trsf::isIdentity
bool isIdentity() const
Geom::Trsf::inverted
Trsf inverted() const
Geom::Trsf::setTransformation
void setTransformation(const Geom::Ax3 &FromSystem1, const Geom::Ax3 &ToSystem2)
Geom::Trsf::setScale
void setScale(const Geom::Pnt &P, const double S)
Geom::Trsf::setValues
void setValues(double a11, double a12, double a13, double a14, double a21, double a22, double a23, double a24, double a31, double a32, double a33, double a34, double Tolang, double TolDist)
Geom::Trsf::multiply
void multiply(const Trsf &T)
Geom::Mat
Definition: Mat.h:37
Geom::Trsf::setTransformation
void setTransformation(const Geom::Ax3 &ToSystem)
Geom::Trsf::power
void power(const int N)
Geom::Trsf::vectorialPart
Geom::Mat vectorialPart() const
Base
Definition: AbstractXMLReader.h:5
Geom
Definition: PropertyContainer.h:33
Geom::Trsf::form
Trsf::FormEnum form() const