OpenLexocad  28.0
GTrsf2d.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/Trsf2d.h>
25 
26 namespace Geom
27 {
28 class Ax2d;
29 class Mat2d;
30 class XY;
31 
48 class LX_GEOM_EXPORT GTrsf2d
49 {
50 public:
55  GTrsf2d(const Trsf2d& T);
59  GTrsf2d(const Mat2d& M, const XY& V);
60 
61 
68 
69 
70  void invert();
71 
72 
73 
77  GTrsf2d inverted() const;
78 
79 
80 
83  bool isNegative() const;
84 
93  bool isSingular() const;
94 
95 
109  GTrsf2d multiplied(const GTrsf2d& T) const;
110 
111 
112  void multiply(const GTrsf2d& T);
113 
114  void operator*=(const GTrsf2d& T) { multiply(T); }
115 
116  //
117  GTrsf2d operator*(const GTrsf2d& T) const { return multiplied(T); }
118 
119 
120  double operator()(const int Row, const int Col) const { return value(Row, Col); }
121 
122 
123  void power(const int N);
124 
125 
126  GTrsf2d powered(const int N) const;
127 
128 
129 
133  void preMultiply(const GTrsf2d& T);
134 
141  void setAffinity(const Ax2d& A, const double Ratio);
142 
145  void setTranslationPart(const XY& Coord);
146 
148  void setTrsf2d(const Trsf2d& T);
149 
150 
154  void setValue(const int Row, const int Col, const double Value);
156  void setVectorialPart(const Mat2d& Matrix);
157 
158 
160  const XY& translationPart() const;
161 
162 
163 
164  XY transformed(const XY& Coord) const;
165 
166 
167 
168  void transforms(XY& Coord) const;
169 
170 
171 
179  void transforms(double& X, double& Y) const;
180 
181 
182 
187  Trsf2d trsf2d() const;
188 
191  double value(const int Row, const int Col) const;
194  const Mat2d& vectorialPart() const;
195 
196  const Mat2d& _CSFDB_GetGTrsf2dmatrix() const { return matrix; }
197  const XY& _CSFDB_GetGTrsf2dloc() const { return loc; }
198  Trsf2d::FormEnum _CSFDB_GetGTrsf2dshape() const { return shape; }
199  void _CSFDB_SetGTrsf2dshape(const Trsf2d::FormEnum p) { shape = p; }
200  double _CSFDB_GetGTrsf2dscale() const { return scale; }
201  void _CSFDB_SetGTrsf2dscale(const double p) { scale = p; }
202 
203 
204 
205 protected:
206 private:
207  Mat2d matrix;
208  XY loc;
209  Trsf2d::FormEnum shape;
210  double scale;
211 };
212 
213 } // namespace Geom
Geom::GTrsf2d::trsf2d
Trsf2d trsf2d() const
Geom::GTrsf2d::invert
void invert()
Geom::GTrsf2d::transforms
void transforms(XY &Coord) const
Geom::GTrsf2d::transforms
void transforms(double &X, double &Y) const
Geom::GTrsf2d::transformed
XY transformed(const XY &Coord) const
Geom::GTrsf2d::setValue
void setValue(const int Row, const int Col, const double Value)
Geom::GTrsf2d::_CSFDB_GetGTrsf2dloc
const XY & _CSFDB_GetGTrsf2dloc() const
Definition: GTrsf2d.h:197
Geom::GTrsf2d::translationPart
const XY & translationPart() const
Returns the translation part of the GTrsf2d.
Geom::GTrsf2d::inverted
GTrsf2d inverted() const
Geom::GTrsf2d::setVectorialPart
void setVectorialPart(const Mat2d &Matrix)
Replaces the vectorial part of this transformation by Matrix.
Geom::GTrsf2d::vectorialPart
const Mat2d & vectorialPart() const
Geom::GTrsf2d::form
Trsf2d::FormEnum form() const
Geom::GTrsf2d::_CSFDB_SetGTrsf2dshape
void _CSFDB_SetGTrsf2dshape(const Trsf2d::FormEnum p)
Definition: GTrsf2d.h:199
X
X
Definition: Globals.h:29
Trsf2d.h
Geom::Trsf2d::FormEnum
FormEnum
Definition: Trsf2d.h:50
Geom::GTrsf2d::GTrsf2d
GTrsf2d()
returns identity transformation.
Geom::GTrsf2d::powered
GTrsf2d powered(const int N) const
Geom::GTrsf2d::setAffinity
void setAffinity(const Ax2d &A, const double Ratio)
Geom::GTrsf2d::power
void power(const int N)
Geom::XY
Definition: XY.h:34
Geom::GTrsf2d::operator()
double operator()(const int Row, const int Col) const
Definition: GTrsf2d.h:120
Geom::GTrsf2d::setTrsf2d
void setTrsf2d(const Trsf2d &T)
Assigns the vectorial and translation parts of T to this transformation.
Geom::GTrsf2d::setTranslationPart
void setTranslationPart(const XY &Coord)
Geom::GTrsf2d::GTrsf2d
GTrsf2d(const Mat2d &M, const XY &V)
Geom::GTrsf2d::_CSFDB_SetGTrsf2dscale
void _CSFDB_SetGTrsf2dscale(const double p)
Definition: GTrsf2d.h:201
Geom::GTrsf2d::isNegative
bool isNegative() const
Geom::GTrsf2d::operator*=
void operator*=(const GTrsf2d &T)
Definition: GTrsf2d.h:114
Geom::Mat2d
Definition: Mat2d.h:34
Geom::GTrsf2d::value
double value(const int Row, const int Col) const
Geom::GTrsf2d::_CSFDB_GetGTrsf2dscale
double _CSFDB_GetGTrsf2dscale() const
Definition: GTrsf2d.h:200
Geom::GTrsf2d::multiply
void multiply(const GTrsf2d &T)
Geom::GTrsf2d::_CSFDB_GetGTrsf2dmatrix
const Mat2d & _CSFDB_GetGTrsf2dmatrix() const
Definition: GTrsf2d.h:196
Geom::GTrsf2d::operator*
GTrsf2d operator*(const GTrsf2d &T) const
Definition: GTrsf2d.h:117
Geom::Ax2d
Definition: Ax2d.h:51
Geom::GTrsf2d
Definition: GTrsf2d.h:49
Y
Y
Definition: Globals.h:30
Geom::GTrsf2d::isSingular
bool isSingular() const
Geom::GTrsf2d::preMultiply
void preMultiply(const GTrsf2d &T)
Geom::Trsf2d
Definition: Trsf2d.h:47
Geom::GTrsf2d::_CSFDB_GetGTrsf2dshape
Trsf2d::FormEnum _CSFDB_GetGTrsf2dshape() const
Definition: GTrsf2d.h:198
Geom::GTrsf2d::multiplied
GTrsf2d multiplied(const GTrsf2d &T) const
Geom::GTrsf2d::GTrsf2d
GTrsf2d(const Trsf2d &T)
Geom
Definition: PropertyContainer.h:33