MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
KnotVector.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGKnotVector_HH_
6 #define _MGKnotVector_HH_
7 
11 #include "mg/NDDArray.h"
12 
13 // MGKnotVector.h
14 //
15 // Forward declaration
16 class MGNDDArray;
17 class MGKnotArray;
18 class MGIfstream;
19 class MGOfstream;
20 
22 
28 class MG_DLL_DECLR MGKnotVector :public MGNDDArray{
29 
30 public:
31 
32 MG_DLL_DECLR friend MGKnotVector operator*(double scale, const MGKnotVector& t);
33 
35 MG_DLL_DECLR friend std::ostream& operator<<(std::ostream& strm, const MGKnotVector& t);
36 
38 
40 explicit MGKnotVector(
41  int order=0,
42  int bdim=0,
43  const double* data=0
44 );
45 
49  int order,
50  int bdim,
51  double init_value,
52  double increment=1.0
53 );
54 
57  const MGNDDArray& dtp,
58  int order
59 );
60 
64  const MGKnotVector& vec2,
65  const MGKnotArray& knots
66 );
67 
70  int start_id,
71  int num,
72  const MGKnotVector& vec2
73 );
74 
77  const MGKnotVector& knotv,
78  int order
79 );
80 
85 MGKnotVector(const MGKnotVector& knotv, double t1, double t2);
86 
88 MGKnotVector(const MGKnotVector& vec2);
89 
90 //Destructor
91 //
92 // ~MGKnotVector(); //We use default destructor.
93 
95 
97 MGKnotVector& operator=(const MGKnotVector& vec2);
98 
101 MGKnotVector operator+ (double) const;
102 MGKnotVector& operator+= (double);
103 MGKnotVector operator- (double) const;
104 MGKnotVector& operator-= (double);
105 
109 MGKnotVector operator- () const;
110 
112 MGKnotVector operator* (double) const;
113 MGKnotVector& operator*= (double);
114 
116 bool operator== (const MGKnotVector& ) const;
117 bool operator!= (const MGKnotVector& knotv) const
118 {return !(operator== (knotv));}
119 
121 
122 int bdim() const{return length()-m_order;};
123 
129 MGKnotVector& change_knot_number(int nnew);
130 
135 MGKnotVector& change_order(int order);
136 
138 void change_range(double ts, double te);
139 
142 void divide_span(int num);
143 
154 int eval_coef(
155  double x,
156  double* coef,
157  int nderiv=0,
159  int left=0
160 )const;
162 
164 bool in_range(double t) const;
165 
172 int locate(double tau, int left) const;
173 int locate(double tau) const;
174 
183 int locate_multi(int start, int multi, int& index) const;
184 
190 MGKnotVector& mix_knot_vector(const MGKnotVector& knot);
191 
193 int order() const{return m_order;};
194 
196 double param_e() const{return MGNDDArray::operator() (bdim());};
197 
199 double param_s() const{return MGNDDArray::operator() (m_order-1);};
200 
202 double param_error()const;
203 
205 double param_span() const;
206 
209 double param_normalize(double t) const;
210 
214 double range(double t) const;
215 
218 void reverse();
219 
221 double reverse_param(double t) const;
222 
225 MGKnotVector& set_bdim(int brdim);
226 
228 void set_null(){MGNDDArray::set_null();m_order=m_current=0;};
229 
231 int dump_size() const;
232 
234 int dump(MGOfstream& ) const;
235 
238 void size_change(int order, int bdim);
239 
241 int restore(MGIfstream& );
242 
244 
245 private:
246  int m_order;
247 
248 void new_knot_coef(const MGKnotVector&,
249  int j_of_t,
250  double* coef
251 );
252 
253 };
254  // end of BASE group
256 #endif
int order() const
Return order.
Definition: KnotVector.h:193
MGNDDArray & operator+=(double)
int length() const
Return the length of MGNDDArray.
Definition: NDDArray.h:179
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
MGNDDArray & operator*=(double scale)
bool operator==(const MGNDDArray &t2) const
Copmarison operator.
MGNDDArray & operator-=(double)
MGNDDArray operator-() const
virtual int restore(MGIfstream &)
Restore Function.
void set_null()
Set this as a null.
Definition: KnotVector.h:228
virtual int dump_size() const
virtual int locate(double tau) const
Defines Knot vector of B-Representation.
Definition: KnotVector.h:28
virtual void set_null()
Set this as a null NDDArray.
MG_DLL_DECLR friend std::ostream & operator<<(std::ostream &, const MGNDDArray &)
String stream Function.
MG_DLL_DECLR friend MGNDDArray operator*(double scale, const MGNDDArray &nd)
Friend Function.
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
virtual void change_range(double ts, double te)
bool operator!=(const MGNDDArray &t2) const
Definition: NDDArray.h:144
MGNDDArray & operator=(const MGNDDArray &vec2)
Assignment.
Defines non-decreasing double data array.
Definition: NDDArray.h:27
Defines Array of Knots.
Definition: KnotArray.h:26
virtual int dump(MGOfstream &) const
Dump Function.
double operator()(int i) const
Definition: NDDArray.h:117
virtual int locate_multi(int start, int multi, int &index) const
double param_e() const
Return end parameter value.
Definition: KnotVector.h:196
double param_s() const
Return start parameter value.
Definition: KnotVector.h:199
MGNDDArray operator+(double) const
int bdim() const
Definition: KnotVector.h:122