MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
SPointSeq.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGSPointSeq_HH_
6 #define _MGSPointSeq_HH_
7 
11 #include "mg/MGCL.h"
12 
13 // MGSPointSeq.h
14 //
15 
17 class MGBox;
18 class MGNDDArray;
19 class MGVector;
20 class MGPosition;
21 class MGMatrix;
22 class MGTransf;
23 class MGBPointSeq;
24 class MGPlane;
25 class MGStraight;
26 class MGIfstream;
27 class MGOfstream;
28 
30 
36 class MG_DLL_DECLR MGSPointSeq {
37 
38 public:
39 
42 MG_DLL_DECLR friend MGSPointSeq operator* (double scale, const MGSPointSeq&);
43 
45 MG_DLL_DECLR friend std::ostream& operator<< (std::ostream& out, const MGSPointSeq& sp);
46 
48 
52 explicit MGSPointSeq(
53  int sizeu=0,
54  int sizev=0,
55  int dim=0
56 );
57 
61  int dim,
62  const MGSPointSeq& old_brep,
63  int start1=0,
64  int start2=0
65 );
66 
68 MGSPointSeq(const MGSPointSeq& rhs);
69 
71 ~MGSPointSeq(){if(m_spoint) delete[] m_spoint;};
72 
74 
76 MGSPointSeq& operator=(const MGSPointSeq&);
77 
79 double& operator()(int i, int j, int k);
80 double operator()(int i, int j, int k) const{return ref(i,j,k);};
81 
83 MGVector operator()(int i, int j) const;
84 
87 MGSPointSeq operator+ (const MGVector& ) const;
88 
91 MGSPointSeq& operator+= (const MGVector& );
92 
95 MGSPointSeq operator- (const MGVector& ) const;
96 
99 MGSPointSeq& operator-= (const MGVector& );
100 
103 MGSPointSeq operator* (double) const;
104 
107 MGSPointSeq& operator*= (double);
108 
111 MGSPointSeq operator* (const MGMatrix& ) const;
112 
116 
119 MGSPointSeq operator* (const MGTransf& ) const;
120 
124 
126 MGSPointSeq operator+ (const MGSPointSeq& sp2) const;
127 MGSPointSeq& operator+= (const MGSPointSeq& sp2);
128 MGSPointSeq operator- (const MGSPointSeq& sp2) const;
129 MGSPointSeq& operator-= (const MGSPointSeq& sp2);
130 
133 bool operator== (const MGSPointSeq& ) const;
134 
136 bool operator!= (const MGSPointSeq& brep) const{return !(operator== (brep));}
137 
139 
144 int average_plane(
145  MGPosition& center
146  , MGPlane& plane
147  , MGStraight& line
148  , double& deviation
149 )const;
150 
152 MGBox box()const;
153 
155 const double* data(int i=0, int j=0, int k=0) const;
156 
158 double* data(int i=0, int j=0, int k=0);
159 
162 MGSPointSeq& homogeneous_transform(double);
164 MGSPointSeq& homogeneous_transform(const MGVector&);
166 MGSPointSeq& homogeneous_transform(const MGMatrix&);
168 MGSPointSeq& homogeneous_transform(const MGTransf&);
169 
171 bool is_null()const{return sdim()==0;};
172 
174 void length(int& lengthu, int& lengthv) const
175 {lengthu=m_lengthu;lengthv=m_lengthv;}
176 
178 int length_u() const{return m_lengthu;}
179 
181 int length_v() const{return m_lengthv;}
182 
188 void make_data_point(MGNDDArray& utau, MGNDDArray& vtau) const;
189 
194 MGSPointSeq non_homogeneous() const;
195 
198 double ref(int i, int j, int k=0) const;
199 
201 void reshape(
202  int sizeu
203  , int suzev
204  , int startu=0
205  , int startv=0
206 );
207 
211 void resize(int lenu, int lenv, int dim);
212 
214 void reverse(
215  int is_u
216 );
217 
219 int sdim() const {return m_sdim;}
220 
222 void set_null();
223 
225 void set_length(int lengthu,
226  int lengthv );
227 
229 void capacity(int& capau, int& capav) const{capau=m_capacityu; capav=m_capacityv;}
230 
232 int capacity_u() const {return m_capacityu;}
233 
235 int capacity_v() const {return m_capacityv;}
236 
240 void store_at(
241  int i,
242  int j,
243  const MGVector& vctr,
244  int to=0,
245  int from=0
246 );
247 
251 void store_at(
252  int i,
253  int j,
254  const MGVector& vctr,
255  int to,
256  int from,
257  int len
258 );
259 
263 void store_at(
264  int i,
265  int j,
266  const double* data,
267  int to=0
268 );
269 
274 void store_BP_along_u_at(
275  int j,
276  const MGBPointSeq& bp,
277  int to=0,
278  int from=0
279 );
280 
285 void store_BP_along_v_at(
286  int i,
287  const MGBPointSeq& bp,
288  int to=0,
289  int from=0
290 );
291 
293 int dump_size() const;
294 
296 int dump(MGOfstream& ) const;
297 
299 int restore(MGIfstream& );
300 
301 private:
302 
304  int m_capacityu;
305  int m_capacityv;
306  int m_sdim;
307  int m_lengthu;
308  int m_lengthv;
309  double* m_spoint;
310 
312 MGBox* compute_box()const;
313 
314 friend class MGSBRep;
315 friend class MGRSBRep;
316 
317 };
318  // end of BASE group
320 #endif
int sdim() const
Returns the space dimension.
Definition: SPointSeq.h:219
~MGSPointSeq()
Definition: SPointSeq.h:71
MGPlane is infinite plane in 3D space.
Definition: Plane.h:38
MGTransf represents a transformation of a space dimension.
Definition: Transf.h:35
double operator()(int i, int j, int k) const
Definition: SPointSeq.h:80
int length_v() const
Returns the actual size of Spoint seq.
Definition: SPointSeq.h:181
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
int capacity_u() const
Returns the size of u-direction.
Definition: SPointSeq.h:232
std::ostream & operator<<(std::ostream &ostrm, const MGisect &is)
Debug Function.
Definition: isect.h:95
MG_DLL_DECLR MGVector & operator*=(MGVector &v, const MGMatrix &m)
bool is_null() const
Test if this is a null SPointSeq.
Definition: SPointSeq.h:171
Vector of a general n space dimension.
Definition: Vector.h:26
Defines a Box of any space dimendion.
Definition: Box.h:34
MGStraight is a curve of any space dimension, represent a straight line.
Definition: Straight.h:49
MG_DLL_DECLR MGVector operator*(const MGVector &v, const MGMatrix &m)
Represent a positional data.
Definition: Position.h:28
int length_u() const
Returns the actual size of Spoint seq.
Definition: SPointSeq.h:178
Defines BPoint seq of a space dimension and of a capacity.
Definition: BPointSeq.h:38
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
Defines Surface B-Representation of rational form.
Definition: RSBRep.h:38
Defines non-decreasing double data array.
Definition: NDDArray.h:27
Defines Surface B-Representation, that is , B-Spline surface.
Definition: SBRep.h:48
void capacity(int &capau, int &capav) const
Returns the sizes along u and v direction.
Definition: SPointSeq.h:229
Defines Spoint seq of a space dimension and of a size.
Definition: SPointSeq.h:36
void length(int &lengthu, int &lengthv) const
Returns the actual size of Spoint seq.
Definition: SPointSeq.h:174
int capacity_v() const
Returns the size of v-direction.
Definition: SPointSeq.h:235
MGMatrix is a matix of m by m, where m is the space dimension.
Definition: Matrix.h:30