OpenLexocad  28.0
Trsf2d.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/Mat2d.h>
25 #include <Geom/XY.h>
26 
27 namespace Geom
28 {
29 class Ax2d;
30 class Pnt2d;
31 class Vec2d;
32 
45 
46 class LX_GEOM_EXPORT Trsf2d
47 {
48 public:
49  enum FormEnum
50  {
59  Other
60  };
61 
63  Trsf2d();
66  Trsf2d(const Trsf2d& T);
67 
77  const Mat2d& hVectorialPart() const;
78 
79  void invert();
80 
85  Trsf2d inverted() const;
86 
89  bool isNegative() const;
90 
91  Trsf2d multiplied(const Trsf2d& T) const;
103  void multiply(const Trsf2d& T);
104  Trsf2d operator*(const Trsf2d& T) const { return multiplied(T); }
105 
106  void operator*=(const Trsf2d& T) { multiply(T); }
107 
108  void power(const int N);
109 
114  Trsf2d powered(const int N);
115 
118  void preMultiply(const Trsf2d& T);
119 
122  double rotationPart() const;
123 
125  double scaleFactor() const;
126 
129  void setMirror(const Pnt2d& P);
130 
133  void setMirror(const Ax2d& A);
134 
138  void setRotation(const Pnt2d& P, const double Ang);
139 
142  void setScale(const Pnt2d& P, const double S);
143 
145  void setScaleFactor(const double S);
148  void setTransformation(const Ax2d& FromSystem1, const Ax2d& ToSystem2);
149 
154  void setTransformation(const Ax2d& ToSystem);
155 
158  void setTranslation(const Vec2d& V);
159 
162  void setTranslation(const Pnt2d& P1, const Pnt2d& P2);
164  void setTranslationPart(const Vec2d& V);
165  void transforms(double& X, double& Y) const;
167  void transforms(XY& Coord) const;
168 
170  const XY& translationPart() const;
171 
175  double value(const int Row, const int Col) const;
176 
180 
181  friend class GTrsf2d;
182 
183 protected:
184 private:
185  Geom::XY _loc;
186  Mat2d _matrix;
187  double _scale;
188  Trsf2d::FormEnum _shape;
189 };
190 } // namespace Geom
Geom::Trsf2d::invert
void invert()
Geom::Trsf2d::setMirror
void setMirror(const Ax2d &A)
Geom::Trsf2d::value
double value(const int Row, const int Col) const
Geom::Trsf2d::setTranslation
void setTranslation(const Pnt2d &P1, const Pnt2d &P2)
Geom::Trsf2d::operator*
Trsf2d operator*(const Trsf2d &T) const
Definition: Trsf2d.h:104
Geom::Trsf2d::Identity
@ Identity
Definition: Trsf2d.h:51
Geom::Trsf2d::hVectorialPart
const Mat2d & hVectorialPart() const
Geom::Trsf2d::setRotation
void setRotation(const Pnt2d &P, const double Ang)
Geom::Trsf2d::isNegative
bool isNegative() const
Geom::Trsf2d::form
Trsf2d::FormEnum form() const
Geom::Trsf2d::preMultiply
void preMultiply(const Trsf2d &T)
XY.h
Geom::Trsf2d::PntMirror
@ PntMirror
Definition: Trsf2d.h:54
X
X
Definition: Globals.h:29
Geom::Trsf2d::translationPart
const XY & translationPart() const
Returns the translation part of the transformation's matrix
Geom::Trsf2d::FormEnum
FormEnum
Definition: Trsf2d.h:50
Geom::Trsf2d::CompoundTrsf
@ CompoundTrsf
Definition: Trsf2d.h:58
Geom::Trsf2d::multiplied
Trsf2d multiplied(const Trsf2d &T) const
Geom::Trsf2d::operator*=
void operator*=(const Trsf2d &T)
Definition: Trsf2d.h:106
Geom::Trsf2d::vectorialPart
Mat2d vectorialPart() const
Geom::XY
Definition: XY.h:34
Geom::Trsf2d::scaleFactor
double scaleFactor() const
Returns the scale factor.
Geom::Trsf2d::powered
Trsf2d powered(const int N)
Geom::Mat2d
Definition: Mat2d.h:34
Geom::Trsf2d::setTranslation
void setTranslation(const Vec2d &V)
Geom::Trsf2d::rotationPart
double rotationPart() const
Geom::Trsf2d::Ax2Mirror
@ Ax2Mirror
Definition: Trsf2d.h:56
Geom::Trsf2d::Translation
@ Translation
Definition: Trsf2d.h:53
Mat2d.h
Geom::Trsf2d::setScale
void setScale(const Pnt2d &P, const double S)
Geom::Trsf2d::power
void power(const int N)
Geom::Trsf2d::Rotation
@ Rotation
Definition: Trsf2d.h:52
Geom::Trsf2d::setTransformation
void setTransformation(const Ax2d &ToSystem)
Geom::Vec2d
Defines a non-persistent vector in 2D space.
Definition: Vec2d.h:33
Geom::Trsf2d::Trsf2d
Trsf2d()
Returns identity transformation.
Geom::Trsf2d::Ax1Mirror
@ Ax1Mirror
Definition: Trsf2d.h:55
Geom::Trsf2d::transforms
void transforms(XY &Coord) const
Transforms a doublet XY with a Trsf2d
Geom::Ax2d
Definition: Ax2d.h:51
Geom::GTrsf2d
Definition: GTrsf2d.h:49
Y
Y
Definition: Globals.h:30
Geom::Trsf2d::Trsf2d
Trsf2d(const Trsf2d &T)
Geom::Trsf2d::inverted
Trsf2d inverted() const
Geom::Trsf2d::setMirror
void setMirror(const Pnt2d &P)
Geom::Trsf2d::Scale
@ Scale
Definition: Trsf2d.h:57
Geom::Pnt2d
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:34
Geom::Trsf2d
Definition: Trsf2d.h:47
Geom::Trsf2d::setTranslationPart
void setTranslationPart(const Vec2d &V)
Replaces the translation vector with V.
Geom::Trsf2d::transforms
void transforms(double &X, double &Y) const
Geom
Definition: PropertyContainer.h:33
Geom::Trsf2d::multiply
void multiply(const Trsf2d &T)
Geom::Trsf2d::setScaleFactor
void setScaleFactor(const double S)
Modifies the scale factor.
Geom::Trsf2d::setTransformation
void setTransformation(const Ax2d &FromSystem1, const Ax2d &ToSystem2)