MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Transf.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGTransf_HH_
6 #define _MGTransf_HH_
7 
12 #include <glm/glm.hpp>
13 #include "mg/Default.h"
14 #include "mg/Vector.h"
15 #include "mg/Matrix.h"
16 
17 // Defines class MGTransf
18 
19 // Forward Declarations
20 class MGUnit_vector;
21 class MGPosition;
22 class MGIfstream;
23 class MGOfstream;
24 class MGIgesOfstream;
25 class MGObject;
26 
28 
35 class MG_DLL_DECLR MGTransf {
36 
37 public:
38 
41 MG_DLL_DECLR friend MGTransf operator* (double scale, const MGTransf&);
42 
45 MG_DLL_DECLR friend MGTransf operator* (const MGVector& v, const MGTransf& tr);
46 
48 MG_DLL_DECLR friend std::ostream& operator<< (std::ostream&, const MGTransf&);
49 
51 
54 explicit MGTransf(int dim=0);
55 
59 MGTransf(const MGMatrix&, const MGVector&);
60 
63 MGTransf(double scale, const MGVector&);
64 
67 MGTransf (int sdim, const MGTransf& transf,
68  int start1=0, int start2=0);
69 
71 
75 MGTransf(double scalex, double scaley);
76 
79 MGTransf(const MGUnit_vector& unit,
80  const MGPosition& origin
81 );
82 
84 
88 MGTransf(double scalex, double scaley, double scalez);
89 
99 MGTransf(const MGUnit_vector& uvecx,
100  const MGUnit_vector& uvecy,
101  const MGPosition& P
102  );
103 
107 MGTransf(
108  const MGPosition& P0, const MGPosition& P1,
109  const MGPosition& Q0, const MGPosition& Q1);
110 
112 
114 double operator() (int i, int j) const{return ref(i,j);};
115 
117 double& operator() (int i, int j) ;
118 
121 MGObject& operator()(MGObject& object);
122 MGObject* operator()(MGObject* object);
123 
126 MGTransf operator+ (const MGVector&) const;
127 
130 MGTransf& operator+= (const MGVector&);
131 
134 MGTransf operator- (const MGVector&) const;
135 
138 MGTransf& operator-= (const MGVector&);
139 
142 MGTransf operator* (double scale) const;
143 
146 MGTransf operator* (const MGMatrix&) const;
147 
150 MGTransf operator* (const MGTransf& ) const;
151 
154 MGTransf& operator*= (double scale);
155 
158 MGTransf& operator*= (const MGMatrix&);
159 
162 MGTransf& operator*= (const MGTransf&);
163 
167 bool operator== (const MGTransf&) const;
168 bool operator!= (const MGTransf&) const;
169 
171 
174 const MGMatrix& affine() const{return m_affine;};
175 
177 void convert_to_glMatrix(
178  glm::mat4& glMatI//double glMat[16] ///OpenGL Matrix will be output.
179 )const;
180 
182 bool is_null()const{return m_affine.is_null();};
183 
186 int out_to_IGES(
187  MGIgesOfstream& igesfile,
188  int SubordinateEntitySwitch=0
189 )const;
190 
192 double ref(int i, int j) const;
193 
195 void resize(int sdim);
196 
198 double scale()const{return m_affine.scale();};
199 
201 int sdim() const{return m_affine.sdim();};
202 
205 MGTransf& set_matrix(const MGMatrix& mat, const MGPosition& point);
206 
208 void set_null();
209 
215 MGTransf& set_reflect_2D( const MGVector& vec,
216  const MGPosition& P= mgORIGIN_2D);
217 
222 MGTransf& set_rotate_2D( double angle,
223  const MGPosition& P= mgORIGIN_2D);
224 
230 MGTransf& set_reflect_3D(
231  const MGVector&,
232  const MGPosition& P= mgORIGIN);
233 
239 MGTransf& set_rotate_3D(
240  const MGVector& vec,
241  double angle,
242  const MGPosition& P= mgORIGIN);
243 
249 MGTransf& set_scale(double scale);
250 
256 MGTransf& set_diff_scale(double* scale);
257 
259 MGTransf& set_glMatrix(const double glMat[16]);
260 
263 const MGVector& translation() const{return m_translation;};
264 
266 int dump_size() const;
267 
269 int dump(MGOfstream& ) const;
270 
272 int restore(MGIfstream& );
273 
274 private:
275 
277  MGMatrix m_affine;
278  MGVector m_translation;
279 
280 };
281  // end of BASE group
283 #endif
MGTransf represents a transformation of a space dimension.
Definition: Transf.h:35
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
std::ostream & operator<<(std::ostream &ostrm, const MGisect &is)
Debug Function.
Definition: isect.h:95
Is an abstract class which represents a whole geometry and a topology.
Definition: Object.h:42
MG_DLL_DECLR MGVector & operator*=(MGVector &v, const MGMatrix &m)
Vector of a general n space dimension.
Definition: Vector.h:26
const MGVector & translation() const
Definition: Transf.h:263
int sdim() const
Return space dimension.
Definition: Transf.h:201
MG_DLL_DECLR MGVector operator*(const MGVector &v, const MGMatrix &m)
Represent a positional data.
Definition: Position.h:28
double scale() const
Obtain the scaling factor of this transf.
Definition: Transf.h:198
bool is_null() const
Test if this is null.
Definition: Transf.h:182
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
MGOgesIfstream write out to *.iges file, transforming MGCL objects to IGES objects.
Definition: IgesOfstream.h:26
const MGMatrix & affine() const
Definition: Transf.h:174
Define a unit vector, is a MGVector.
Definition: Unit_vector.h:17
MGMatrix is a matix of m by m, where m is the space dimension.
Definition: Matrix.h:30