MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
SurfCurve.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGSurfCurve_HH_
6 #define _MGSurfCurve_HH_
7 
8 #include "mg/Default.h"
9 #include "mg/Curve.h"
10 #include "mg/Surface.h"
11 #include "mg/TrimmedCurve.h"
12 
13 //
14 //Define MGSurfCurve Class.
15 
16 class MGInterval;
17 class MGBox;
18 class MGVector;
19 class MGUnit_vector;
20 class MGPosition;
21 class MGPosition_list;
22 class MGTransf;
23 class MGCParam_list;
24 class MGStraight;
25 class MGEllipse;
26 class MGRLBRep;
27 class MGRSBRep;
28 class MGCCisect_list;
29 class MGCSisect_list;
30 class MGIfstream;
31 class MGOfstream;
37 
43 class MG_DLL_DECLR MGSurfCurve:public MGCurve{
44 
45 public:
46 
47 MG_DLL_DECLR friend MGSurfCurve operator+ (const MGVector& v, const MGSurfCurve& cv2);
48 MG_DLL_DECLR friend MGSurfCurve operator* (double scale, const MGSurfCurve& cv2);
49 
51 
53 MGSurfCurve():MGCurve(),m_surface(0){;};
54 
56 MGSurfCurve(const MGSurfCurve& sc);
57 
60  const MGSurface& srf,
61  const MGCurve& crv
62 );
63 
66  const MGFSurface& srf,
67  const MGCurve& crv
68 );
69 
71 
72 public:
73 
77 MGSurfCurve& operator=(const MGGel& gel2);
78 MGSurfCurve& operator=(const MGSurfCurve& el2);
79 
81 bool operator==(const MGSurfCurve& gel2)const;
82 bool operator==(const MGGel& gel2)const;
83 bool operator<(const MGSurfCurve& gel2)const;
84 bool operator<(const MGGel& gel2)const;
85 
87 
94  MGLBRep& lb,
95  int ordr=0,
96  int parameter_normalization=0,
103  bool neglectMulti=false
104 )const;
107 
110 const MGCompositeCurve* base_composite()const;
111 
113 const MGCurve* base_curve() const {return &m_curve;};
114 
116 const MGSurface* base_surface() const {return m_surface;};
117 
119 int bdim() const {return m_curve.bdim();}
120 
124  const MGInterval &
125 ) const;
126 
129  int sdim,
130  int start1=0,
131  int start2=0
132 );
133 
137  double t1,
138  double t2
139 ){ assert(false);}
140 
143 MGSurfCurve* clone() const;
144 
149 MGCurve* copy_as_nurbs() const;
150 
156  int sdim,
157  int start1=0,
158  int start2=0
159 )const;
160 
163 int divide_multi(
164  MGPvector<MGCurve>& crv_list,
165  int multiplicity=-1
166 )const;
169 
171 MGVector eval(
172  double,
173  int nderiv=0,
174  int left=0
175 )const;
177 
180 void extend(
181  double length,
182  bool start=false
183 );
185 
187 long identify_type() const;
188 
190 bool in_range(double t) const;
191 
193 int intersect_dnum() const;
194 
196 MGCCisect_list isect(const MGCurve& curve2) const;
197 MGCCisect_list isect(const MGStraight& curve2)const;
198 MGCCisect_list isect(const MGRLBRep& curve2)const;
199 MGCCisect_list isect(const MGEllipse& curve2)const;
200 MGCCisect_list isect(const MGLBRep& curve2)const;
201 MGCCisect_list isect(const MGSurfCurve& curve2)const;
202 MGCCisect_list isect(const MGBSumCurve& curve2)const;
203 
205 MGCSisect_list isect(const MGSurface& surf) const;
206 MGCSisect_list isect(const MGPlane& surf) const;
207 MGCSisect_list isect(const MGSphere& surf)const;
208 MGCSisect_list isect(const MGCylinder& surf)const;
209 MGCSisect_list isect(const MGSBRep& surf)const;
210 MGCSisect_list isect(const MGRSBRep& surf)const;
211 MGCSisect_list isect(const MGBSumSurf& surf)const;
212 
214 double knot(int i) const;
215 
217 const MGKnotVector& knot_vector() const{return m_curve.knot_vector();}
218 
221 MGSurfCurve& limit(const MGInterval& );
222 
224 int order() const{return m_curve.order();}
225 
227 double param_e() const;
228 
231 double param_normalize(double t) const;
232 
234 MGInterval param_range() const;
235 
237 double param_s() const;
238 
243  double t1,
244  double t2,
245  int multiple=0
246 ) const;
248 
256 MGPosition_list perps(const MGCurve& crv2)const;
257 MGPosition_list perps(const MGStraight& crv2)const;
258 MGPosition_list perps(const MGRLBRep& crv2)const;
259 MGPosition_list perps(const MGEllipse& crv2)const;
260 MGPosition_list perps(const MGLBRep& crv2)const;
261 MGPosition_list perps(const MGSurfCurve& crv2)const;
262 MGPosition_list perps(const MGBSumCurve& crv2)const;
263 
264 
288 int project(
289  const MGFSurface& surf, //given surface.
290  MGPvector<MGCurve>& vec_crv_uv, //uv projection curve will be appended.
291  MGPvector<MGCurve>& vec_crv, //3d projection curve will be appended.
292  const MGVector& vec //projection vector.
293  //if vec = NULL then calculate perpendicular project.
294 )const;
295 
298 double range(double t) const;
299 
301 int sdim() const ;
302 
309  const MGUnit_vector& uvec,
310  double start_dist,
311  double end_dist
312 )const;
313 
315 MGCurve& unlimit();
316 
320 
324 
326 MGCURVE_TYPE type() const;
327 
329 std::ostream& out(std::ostream&) const;
330 
333 int out_to_IGES(
334  MGIgesOfstream& igesfile,
335  int SubordinateEntitySwitch=0
336 )const;
337 
338 protected:
339 
345 std::auto_ptr<MGCurve> oneD(
346  const double g[4]
347 )const{assert(false); std::auto_ptr<MGCurve> tmpPtr; return tmpPtr;}
348 
352 void ReadMembers(MGIfstream& buf);
353 
357 void WriteMembers(MGOfstream& buf) const;
358 
359 std::string whoami()const{return "SurfCurve";};
360 
361 protected:
362 
365  int is,
366  int ie,
367  MGKnotVector& t,
368  MGNDDArray& tau,
370  bool neglectMulti=false
371 )const;
374 
375 private:
376 
378 
379  const MGSurface* m_surface;
380  MGTrimmedCurve m_curve;
381 
384 MGBox* compute_box() const;
385 
388 
391 MGSurfCurve& coordinate_exchange(int i, int j);
392 
394 MGCCisect_list isect_noCompo(const MGCurve& curve2)const;
395 
397 MGCCisect_list isect_noCompo(const MGStraight& curve2)const;
398 
400 MGCCisect_list isect_noCompo(const MGSurfCurve& curve2)const;
401 
403 MGCSisect_list isect_noCompo(const MGSurface& surf)const;
404 
406 MGCSisect_list isect_noCompo(const MGPlane& surf)const;
407 
410 void isect_of_each(
411  const MGCurve& curve2,
412  MGCCisect_list& list
413 )const;
414 
417 void isect_of_each(
418  const MGSurface& surf,
419  MGCSisect_list& list
420 )const;
421 
423 void negate();
424 
426 double negate_param(double t)const;
427 MGPosition negate_param(const MGPosition& t)const;
428 
430 MGPosition_list perps_noCompo(const MGCurve& curve2)const;
431 
434 void perps_of_each(
435  const MGCurve& curve2,
436  MGPosition_list& list
437 )const;
438 
440 MGSurfCurve& operator+=(const MGVector& v);
441 MGSurfCurve& operator-=(const MGVector& v);
442 MGSurfCurve& operator*=(double scale);
443 MGSurfCurve& operator*=(const MGMatrix& mat);
444 MGSurfCurve& operator*=(const MGTransf& tr);
445 
447 MGSurfCurve operator+ (const MGVector& v) const;
448 MGSurfCurve operator- (const MGVector& v) const;
449 MGSurfCurve operator* (double scale) const;
450 MGSurfCurve operator* (const MGMatrix& mat) const;
451 MGSurfCurve operator* (const MGTransf& tr) const;
452 
453 friend class MGLBRep;
454 friend class MGStraight;
455 friend class MGPlane;
456 };
457  // end of GEO group
459 #endif
virtual MGCurve & operator=(const MGCurve &gel2)
Assignment.
Definition: Curve.h:84
virtual MGCurve & unlimit_start()=0
Unlimit parameter range of the curve to the start point direction.
virtual long identify_type() const =0
Return This object's typeID.
virtual MGCurve & unlimit()=0
Unlimit parameter range of the curve(limitをはずす).
MGTrimmedCurve is a part of an original curve of a limitted parameter range.
Definition: TrimmedCurve.h:50
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
const MGSurface * base_surface() const
Return surface's pointer.
Definition: SurfCurve.h:116
MGPlane is infinite plane in 3D space.
Definition: Plane.h:38
MGTransf represents a transformation of a space dimension.
Definition: Transf.h:35
virtual MGCurve * copy_change_dimension(int sdim, int start1=0, int start2=0) const =0
Construct new curve object by changing the original object's space dimension.
MGCylinder is a Cylinder in 3D space.
Definition: Cylinder.h:37
virtual int out_to_IGES(MGIgesOfstream &igesfile, int SubordinateEntitySwitch=0) const
Definition: Gel.h:93
virtual MGCParam_list perps(const MGPosition &P) const
Compute all foot points of the perpendicular line from point to the curve.
virtual void negate()=0
Negate the curve direction(曲線の方向を反転する).
virtual double negate_param(double t) const =0
Obtain the parameter value to t when this curve is negated by "negate()".
void change_range(double t1, double t2)
Definition: SurfCurve.h:136
MGCompositeCurve is a composite of other leaf curves.
Definition: CompositeCurve.h:39
virtual MGCurve & operator+=(const MGVector &v)=0
Object transformation.
virtual MGCurve * clone() const =0
Construct new geometry object by copying to newed area.
virtual void data_points_for_approximate_as_LBRep2(int is, int ie, MGKnotVector &t, MGNDDArray &tau, bool neglectMulti=false) const
Get data points for approximate_as_LBRep2.
virtual MGCurve & coordinate_exchange(int i, int j)=0
Exchange ordering of the coordinates.
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
virtual int sdim() const =0
Return space dimension.
MGLBRep is a class for B-SPline representation.
Definition: LBRep.h:41
virtual MGInterval param_range() const
Return parameter range of the curve(パラメータ範囲を返す).
virtual int project(const MGFSurface &surf, MGPvector< MGCurve > &vec_crv_uv, MGPvector< MGCurve > &vec_crv, const MGVector &vec) const
Obtain the projected curve of a curve onto the surface.
const MGKnotVector & knot_vector() const
Returns the knot vector.
Definition: SurfCurve.h:217
std::string whoami() const
Definition: SurfCurve.h:359
Vector of a general n space dimension.
Definition: Vector.h:26
Defines a Box of any space dimendion.
Definition: Box.h:34
Define MGBSumCurve Class(Boolean sum curve of three curves).
Definition: BSumCurve.h:28
virtual MGCurve & limit(const MGInterval &rng)=0
Update this by limiting the parameter range of the curve.
MGGel is an abstract class which represents a group element.
Definition: Gel.h:53
virtual void ReadMembers(MGIfstream &buf)
メンバデータを読み出す関数.
virtual MGVector eval(double, int nderiv=0, int left=0) const =0
Evaluate n'th derivative data.
MGStraight is a curve of any space dimension, represent a straight line.
Definition: Straight.h:49
virtual MGCurve * part(double t1, double t2, int multiple=0) const =0
Compute part of this curve from parameter t1 to t2.
virtual double knot(int i) const =0
Access to i-th element of knot.
Interval of 1 dimension, i.e. MGInterval is a real line.
Definition: Interval.h:22
virtual double param_normalize(double t) const =0
Normalize parameter value t to the nearest knot if their distance is within tolerance.
MG_DLL_DECLR MGVector operator*(const MGVector &v, const MGMatrix &m)
virtual void approximate_as_LBRep(MGLBRep &lb, int ordr=0, int parameter_normalization=0, bool neglectMulti=false) const
Approximate this curve as a MGLBRep.
Represent a positional data.
Definition: Position.h:28
virtual double param_s() const =0
Return starting parameter value.
MGSurface is an abstract class of 3D surface.
Definition: Surface.h:54
const MGCurve * base_curve() const
Return parameter curve's pointer.
Definition: SurfCurve.h:113
MGCSisect_list defines linked list of MGCSisect.
Definition: CSisect_list.h:22
Defines Knot vector of B-Representation.
Definition: KnotVector.h:28
virtual double range(double t) const
Round t into curve's parameter range.
virtual MGCurve & unlimit_end()=0
Unlimit parameter range of the curve to the end point direction.
Defines Boolean sum surface.
Definition: BSumSurf.h:26
virtual MGSurface * sweep(const MGUnit_vector &uvec, double start_dist, double end_dist) const =0
Return sweep surface from crv.
virtual MGCurve & operator-=(const MGVector &v)=0
MGParam_Vector provides a list to store parameters of a curve.
Definition: CParam_list.h:18
friend class MGSurfCurve
Definition: Curve.h:1254
MGSphere is a Sphere in 3D space.
Definition: Sphere.h:42
virtual void WriteMembers(MGOfstream &buf) const
メンバデータを書き込む関数.
Defines a list of MGCCisect(curve to curve intersection).
Definition: CCisect_list.h:20
virtual std::ostream & out(std::ostream &) const
Output virtual function.
virtual void extend(double length, bool start=false)=0
Extrapolate this curve by an (approximate) chord length.
MGFSurface is an abstract class to provide the comman interfaces to MGFace and MGSurface.
Definition: FSurface.h:33
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
virtual MGCurve & change_dimension(int sdim, int start1=0, int start2=0)=0
Changing this object's space dimension.
MGCURVE_TYPE
Curve type(曲線の種類).
Definition: MGCL.h:143
virtual MGCURVE_TYPE type() const =0
Return curve type(曲線のタイプを返す).
MGPosition_list provides a list of Positions.
Definition: Position_list.h:27
virtual MGCurve & operator*=(double scale)=0
MGOgesIfstream write out to *.iges file, transforming MGCL objects to IGES objects.
Definition: IgesOfstream.h:26
Defines Surface B-Representation of rational form.
Definition: RSBRep.h:38
virtual bool operator==(const MGCompositeCurve &crv) const
Comparison.
Defines non-decreasing double data array.
Definition: NDDArray.h:27
Defines Surface B-Representation, that is , B-Spline surface.
Definition: SBRep.h:48
virtual MGCurve * copy_as_nurbs() const =0
copy as a newed curve.
int order() const
Returns the order.
Definition: SurfCurve.h:224
MGEllipse is a class to define an ellipse of 2D or 3D.
Definition: Ellipse.h:38
virtual int divide_multi(MGPvector< MGCurve > &crv_list, int multiplicity=-1) const
Divide this curve at the designated knot multiplicity point.
std::auto_ptr< MGCurve > oneD(const double g[4]) const
Definition: SurfCurve.h:345
virtual bool operator<(const MGGel &gel2) const =0
virtual MGBox box_limitted(const MGInterval &) const =0
Return minimum box that includes the curve of parameter interval.
virtual double param_e() const =0
Return ending parameter value.
int bdim() const
Returns B-Rep Dimension.
Definition: SurfCurve.h:119
virtual MGCCisect_list isect(const MGCurve &curve2) const =0
Intersection of Curve and other geometry.
virtual int intersect_dnum() const =0
Provide divide number of curve span for function intersect.
MGSurfCurve()
Void constructor(初期化なしでオブジェクトを作成する。)
Definition: SurfCurve.h:53
virtual bool in_range(double t) const
Test if input parameter value is inside parameter range of the line.
Define a unit vector, is a MGVector.
Definition: Unit_vector.h:17
MGSurfCurve is a curve on a surface.
Definition: SurfCurve.h:43
MGMatrix is a matix of m by m, where m is the space dimension.
Definition: Matrix.h:30