MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
BPointSeq.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGBPointSeq_HH_
6 #define _MGBPointSeq_HH_
7 
12 #include <vector>
13 #include "mg/MGCL.h"
14 
15 // MGBPointSeq.h
16 //
17 
18 //Forward Declaration
19 class MGIfstream;
20 class MGOfstream;
21 class MGBox;
22 class MGVector;
23 class MGPosition;
24 class MGSPointSeq;
25 class MGMatrix;
26 class MGTransf;
27 class MGPlane;
28 class MGStraight;
29 
31 
38 class MG_DLL_DECLR MGBPointSeq {
39 
40 public:
41 
43 MG_DLL_DECLR friend MGBPointSeq operator+(const MGVector& v, const MGBPointSeq& b);
44 
47 MG_DLL_DECLR friend MGBPointSeq operator* (double scale, const MGBPointSeq&);
48 
50 MG_DLL_DECLR friend std::ostream& operator<< (std::ostream&, const MGBPointSeq&);
51 
53 
56 explicit MGBPointSeq(int capacity=0, int dim=0);
57 
61 MGBPointSeq(int dim,
62  const MGBPointSeq& old_brep,
63  int start1=0,
64  int start2=0
65 );
66 
69  bool along_u,
70  int m,
73  const MGSPointSeq& sp
74 );
75 
79  int start_id,
80  int num,
81  const MGBPointSeq& bp_old
82 );
83 
85 MGBPointSeq(const std::vector<MGPosition>& poses);
86 
88 MGBPointSeq(const MGBPointSeq&);
89 
91 ~MGBPointSeq(){if(m_bpoint) delete[] m_bpoint;};
92 
94 
96 MGBPointSeq& operator= (const MGBPointSeq&);
97 
99 double& operator()(int i, int j){
100  assert(i<capacity()&&j<m_sdim);
101  return m_bpoint[i+m_capacity*j];
102 }
103 
105 double operator()(int i, int j) const{return ref(i,j);};
106 
108 MGVector operator() (int i) const;
109 
112 MGBPointSeq operator+(const MGVector& v) const;
113 
116 MGBPointSeq& operator+= (const MGVector&);
117 
120 MGBPointSeq operator- (const MGVector&) const;
121 
124 MGBPointSeq& operator-= (const MGVector&);
125 
127 MGBPointSeq operator+ (const MGBPointSeq& bp2) const;
128 
130 MGBPointSeq& operator+= (const MGBPointSeq& bp2);
131 
133 MGBPointSeq operator- (const MGBPointSeq& bp2) const;
134 
136 MGBPointSeq& operator-= (const MGBPointSeq& bp2);
137 
140 MGBPointSeq operator* (double scale) const;
141 
144 MGBPointSeq& operator*= (double scale);
145 
148 MGBPointSeq operator/ (double scale) const;
149 
152 MGBPointSeq& operator/= (double scale);
153 
156 MGBPointSeq operator* (const MGMatrix&) const;
157 
161 
164 MGBPointSeq operator* (const MGTransf&) const;
165 
169 
172 bool operator== (const MGBPointSeq& ) const;
173 
176 bool operator!= (const MGBPointSeq& brep) const
177 {return !(operator== (brep));}
178 
180 
185 int average_plane(
186  MGPosition& center
187  , MGPlane& plane
188  , MGStraight& line
189  , double& deviation
190 )const;
191 
193 MGBox box()const;
194 
197 void coordinate_exchange(int j1, int j2);
198 
200 double* data(int i=0, int j=0);
201 
203 const double* data(int i=0, int j=0)const;
204 
206 void insert_at(
207  int i,
208  const MGVector& vctr
209 );
210 
212 void insert_at(int i,
213  const double* data
214 );
215 
217 bool is_null()const{return m_sdim==0;};
218 
220 int length()const{return m_length;};
221 
224 void negate();
225 
229 MGBPointSeq non_homogeneous()const;
230 
236 int planar(
237  MGPlane& plane
238  , MGStraight& line
241  , MGPosition& center
242 )const;
243 
246 void point(int i, int j, int sd, MGPosition& P)const;
247 
249 double ref(int i, int j) const;
250 
254 void reshape(
255  int capacity
256  , int start=0
257 );
258 
262 //dim=0 means space dimension be set same as the old one.
263 void resize(int sz, int dim=0);
264 
266 int sdim() const {return m_sdim;}
267 
269 void set_length(int length);
270 
272 void set_null();
273 
275 int capacity() const {return m_capacity;}
276 
280 void store_at(int i,
281  const MGVector& vctr,
282  int to=0,
283  int from=0
284 );
285 
289 void store_at(int i,
290  const MGVector& vctr,
291  int to,
292  int from,
293  int len
294 );
295 
299 void store_at(int i,
300  const double* data,
301  int to=0
302 );
303 
306 MGBPointSeq& homogeneous_transform(double);
307 
309 MGBPointSeq& homogeneous_transform(const MGVector&);
310 
312 MGBPointSeq& homogeneous_transform(const MGMatrix&);
313 
315 MGBPointSeq& homogeneous_transform(const MGTransf&);
316 
318 int dump_size() const;
319 
321 int dump(MGOfstream& ) const;
322 
324 int restore(MGIfstream& );
325 
327 private:
328  int m_capacity;
329  int m_sdim;
330  int m_length;
331  double* m_bpoint;
333 
336 MGBox* compute_box()const;
337 
338 friend class MGLBRep;
339 friend class MGRLBRep;
340 };
341  // end of BASE group
343 #endif
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) const
Access to (i,j)th element(RHS version).
Definition: BPointSeq.h:105
bool is_null() const
Test if this is null.
Definition: BPointSeq.h:217
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
MGLBRep is a class for B-SPline representation.
Definition: LBRep.h:41
MG_DLL_DECLR MGVector & operator*=(MGVector &v, const MGMatrix &m)
Vector of a general n space dimension.
Definition: Vector.h:26
Defines a Box of any space dimendion.
Definition: Box.h:34
int capacity() const
Returns the capacity.
Definition: BPointSeq.h:275
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
double & operator()(int i, int j)
Access to (i,j)th element(LHS version).
Definition: BPointSeq.h:99
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 Rational Line B-Representation.
Definition: RLBRep.h:32
int sdim() const
Returns the space dimension.
Definition: BPointSeq.h:266
int length() const
Returns the actual size of Bpoint seq.
Definition: BPointSeq.h:220
Defines Spoint seq of a space dimension and of a size.
Definition: SPointSeq.h:36
~MGBPointSeq()
Definition: BPointSeq.h:91
MGMatrix is a matix of m by m, where m is the space dimension.
Definition: Matrix.h:30