MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
CompositeCurve.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGCompositeCurve_HH_
6 #define _MGCompositeCurve_HH_
7 
8 #include <deque>
9 #include "mg/Interval.h"
10 #include "mg/Position_list.h"
11 #include "mg/Straight.h"
12 #include "mg/RLBRep.h"
13 #include "mg/Ellipse.h"
14 #include "mg/LBRep.h"
15 #include "mg/SurfCurve.h"
16 #include "mg/BSumCurve.h"
17 
18 class MGPlane;
20 class MGSurfCurve;
21 class MGStraight;
22 class MGCompositeCurve;
23 class mgVBO;
24 
30 
39 class MG_DLL_DECLR MGCompositeCurve:public MGCurve{
40 
41 public:
42 typedef std::deque<MGCurve*> container_type;
43 typedef container_type::iterator iterator;
44 typedef container_type::const_iterator const_iterator;
45 typedef container_type::reverse_iterator reverse_iterator;
46 typedef container_type::const_reverse_iterator const_reverse_iterator;
47 
48 MG_DLL_DECLR friend MGCompositeCurve operator+ (const MGVector& v, const MGCompositeCurve& lb);
49 MG_DLL_DECLR friend MGCompositeCurve operator* (double scale, const MGCompositeCurve&);
50 
52 
55 
58 explicit MGCompositeCurve(MGCurve* crv);
59 
62 
65 
67 
71 MGCompositeCurve& operator=(const MGGel& gel2);
73 
75 MGCompositeCurve operator+ (const MGVector& v) const;
76 MGCompositeCurve operator- (const MGVector& v) const;
77 MGCompositeCurve operator* (double scale) const;
78 MGCompositeCurve operator* (const MGMatrix& mat) const;
79 MGCompositeCurve operator* (const MGTransf& tr) const;
80 
84 MGCompositeCurve& operator*=(double scale);
87 
89 bool is_same_curve(const MGCurve& curve2)const;
90 bool operator==(const MGCompositeCurve& gel2)const;
91 bool operator==(const MGGel& gel2)const;
92 bool operator==(const MGTrimmedCurve& gel2)const;
93 bool operator<(const MGCompositeCurve& gel2)const;
94 bool operator<(const MGGel& gel2)const;
95 
97 
104  MGLBRep& lb,
105  int ordr=0,
106  int parameter_normalization=0,
108 
113  bool neglectMulti=false
114 )const;
117 
120 int bdim() const;
121 
122 const_iterator begin()const{return m_composite.begin();};
123 iterator begin(){return m_composite.begin();};
124 
128  const MGInterval&
129 ) const;
130 
133  int sdim,
134  int start1=0,
135  int start2=0
136 );
137 
140 void change_range(
141  double t0,
142  double t1
143 );
144 
146 double closest(const MGPosition& point) const;
147 
168 int common(
169  const MGCurve& crv2,
170  std::vector<double>& vecComSpan,
171  MGCCisect_list& isect
172 )const;
173 
191 int common(
192  const MGCurve& crv2,
193  std::vector<double>& vecComSpan
194 )const;
195 
216 MGInterval connect(MGCurve* add_curve);
217 MGInterval connect_to_end(MGCurve* add_curve);
218 MGInterval connect_to_start(MGCurve* add_curve);
219 
223 
226 MGCompositeCurve* clone() const;
227 
232 MGCurve* copy_as_nurbs() const;
233 
238  int sdim,
239  int start1=0,
240  int start2=0
241 )const;
242 
244 const MGCurve& curve(int i)const{return *(m_composite[i]);};
245 MGCurve& curve(int i){return *(m_composite[i]);};
246 
251 double curvilinear_integral(double t1, double t2) const;
252 
257 double curvilinear_integral() const;
258 
259 void display_break_points(mgSysGL& sgl)const;
260 void display_control_polygon(mgSysGL& sgl)const;
261 void display_curvatures(
262  mgSysGL& sgl,
263  double scale,
264  int density,
265  bool use_radius
266 )const;
267 
270 int divide_multi(
271  MGPvector<MGCurve>& crv_list,
272  int multiplicity=-1
273 ) const;
276 
277 void drawSE(
278  mgVBO& vbo,
279  double span_length,
280  double t0,
281  double t1
282 )const;
284 
285 const_iterator end()const{return m_composite.end();};
286 iterator end(){return m_composite.end();};
287 
289 MGVector eval(
290  double t,
291  int nderiv=0,
292  int left=0
293 )const;
295 
298 void extend(
299  double length,
300  bool start=false
301 );
303 
308 int find(double t, bool right_continuous=true) const;
309 
311 long identify_type() const;
312 
316 bool is_planar(MGPlane& plane)const;
317 
319 MGCCisect_list isect(const MGCurve& crv2) const;
320 MGCCisect_list isect(const MGStraight& curve2)const;
321 MGCCisect_list isect(const MGRLBRep& curve2)const;
322 MGCCisect_list isect(const MGEllipse& curve2)const;
323 MGCCisect_list isect(const MGLBRep& curve2)const;
324 MGCCisect_list isect(const MGSurfCurve& curve2)const;
325 MGCCisect_list isect(const MGBSumCurve& curve2)const;
326 MGCCisect_list isect(const MGTrimmedCurve& curve2)const;
327 MGCCisect_list isect(const MGCompositeCurve& curve2)const;
328 
330 MGCSisect_list isect(const MGSurface& surf) const;
331 MGCSisect_list isect(const MGPlane& surf) const;
332 MGCSisect_list isect(const MGSphere& surf)const;
333 MGCSisect_list isect(const MGCylinder& surf)const;
334 MGCSisect_list isect(const MGSBRep& surf)const;
335 MGCSisect_list isect(const MGRSBRep& surf)const;
336 MGCSisect_list isect(const MGBSumSurf& surf)const;
337 
339 double knot(int i) const;
340 
343 const MGKnotVector& knot_vector() const;
344 
349 double length(double t1, double t2) const;
350 double length()const{return MGCurve::length();}
351 
354 MGCompositeCurve& limit(const MGInterval& rng);
355 
357 void negate();
358 
360 double negate_param(double t)const;
361 
363 int number_of_curves()const{return int(m_composite.size());};
364 
365 //****Offset of CompositeCurve is CompositeCurve of the offsets of each
366 //member curves********
367 
376  double ofs_value,
377  const MGVector& norm_vector = mgNULL_VEC
378 ) const;
379 
389  const MGLBRep& ofs_value_lb,
390  const MGVector& norm_vector = mgNULL_VEC
391 )const;
392 
401  double ofs_value,
402  const MGVector& norm_vector = mgNULL_VEC
403 ) const;
404 
414  const MGLBRep& ofs_value_lb,
415  const MGVector& norm_vector = mgNULL_VEC
416 ) const;
417 
424 bool on(
425  const MGPosition&,
426  double&
427 )const;
428 
431 int order() const;
432 
434 double param_e() const;
435 
438 double param_normalize(double t) const;
439 
441 double param_s() const;
442 
446 MGCurve* part(
447  double t0,
448  double t1,
449  int multiple=0
450 ) const;
452 
458 int perp_guess(
459  double t0,
460  double t1,
461  const MGPosition& P,
462  double tg,
463  double& t
464 ) const;
465 
471 int perp_guess(
472  double s0,
473  double s1,
474  const MGCurve& curve2,
475  double t0,
476  double t1,
477  double sg,
478  double tg,
479  MGPosition& st
480 ) const;
483 
491 MGPosition_list perps(const MGCurve& crv2)const{return perps_1by1(crv2);};
492 MGPosition_list perps(const MGStraight& crv2)const{return perps_1by1(crv2);};
493 MGPosition_list perps(const MGRLBRep& crv2)const{return perps_1by1(crv2);};
494 MGPosition_list perps(const MGEllipse& crv2)const{return perps_1by1(crv2);};
495 MGPosition_list perps(const MGLBRep& crv2)const{return perps_1by1(crv2);};
496 MGPosition_list perps(const MGSurfCurve& crv2)const;
497 MGPosition_list perps(const MGBSumCurve& crv2)const{return perps_1by1(crv2);};
498 
504  const MGPosition& P
505 ) const;
506 
509 void polygonize(
510  double error,
511  MGLBRep& lb2
512 )const;
513 
537 int project(
538  const MGFSurface& surf, //given surface.
539  MGPvector<MGCurve>& vec_crv_uv, //uv projection curve will be appended.
540  MGPvector<MGCurve>& vec_crv, //3d projection curve will be appended.
541  const MGVector& vec //projection vector.
542  //if vec = NULL then calculate perpendicular project.
543 )const;
544 
553 size_t project_onto_surface(
554  const MGFSurface& srf,
555  MGPvector<MGCurve>& vec_crv_uv,
557  MGPvector<MGCurve>& vec_crv,
559  const MGVector& vec
560 )const;
561 
564 MGCurve* release_back();
565 
568 MGCurve* release_front();
569 
574 void remove_knot();
575 
578 int sdim() const;
579 
586  const MGUnit_vector& uvec,
587  double start_dist,
588  double end_dist
589 ) const;
590 
593 
595 MGCurve& unlimit();
596 
600 
604 
606 std::ostream& out(std::ostream&) const;
607 
609 int out_to_IGES(
610  MGIgesOfstream& igesfile,
611  int SubordinateEntitySwitch=0
612 )const;
613 
614 protected:
615 
619  double f,
620  int coordinate=0
621 ) const;
622 
627 std::auto_ptr<MGCurve> oneD(
628  const double g[4]
629 ) const;
630 
634 void ReadMembers(MGIfstream& buf);
635 
639 void WriteMembers(MGOfstream& buf) const;
640 
641 std::string whoami()const{return "CompositeCurve";};
642 
643 private:
644 
645  container_type m_composite;
646 
650 MGBox* compute_box() const;
651 
654 int intersect_dnum() const;
655 
657 MGCCisect_list isect_1by1(const MGCurve& crv2) const;
658 
661 MGCSisect_list isect_1by1(const MGSurface& surf) const;
662 
670 MGPosition_list perps_1by1(
671  const MGCurve& crv2
672 )const;
673 
674 friend class MGHHisect;
675 
676 };
677  // end of GEO group
679 #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
virtual void remove_knot()
Remove redundant knot, and reduce the b-rep dimension.
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
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 order() const =0
Returns the order.
virtual int common(const MGCurve &curve2, std::vector< double > &vecComSpan, MGCCisect_list &isect) const
Test if this has a common line part with the 2nd curve.
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 int perp_guess(double t0, double t1, const MGPosition &P, double tg, double &t) const
Return perpendicular point from a point P.
virtual void negate()=0
Negate the curve direction(曲線の方向を反転する).
std::deque< MGCurve * > container_type
Definition: CompositeCurve.h:42
virtual double negate_param(double t) const =0
Obtain the parameter value to t when this curve is negated by "negate()".
virtual void drawSE(mgVBO &vbo, double span_length, double t0, double t1) const
Draw this curve into vbo, approximating with polyline.
virtual MGPvector< MGCurve > offset(double ofs_value, const MGVector &norm_vector=mgNULL_VEC) const
Offset of costant deviation from this curve.
virtual MGLBRep offset_c2(double ofs_value, const MGVector &norm_vector=mgNULL_VEC) const
Costant offset curve of C2 continuous curve.
MGCompositeCurve is a composite of other leaf curves.
Definition: CompositeCurve.h:39
MGCurve & curve(int i)
Definition: CompositeCurve.h:245
virtual MGCurve & operator+=(const MGVector &v)=0
Object transformation.
virtual MGCurve * clone() const =0
Construct new geometry object by copying to newed area.
virtual MGCurve & coordinate_exchange(int i, int j)=0
Exchange ordering of the coordinates.
container_type::reverse_iterator reverse_iterator
Definition: CompositeCurve.h:45
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
virtual void display_break_points(mgSysGL &sgl) const
virtual int sdim() const =0
Return space dimension.
container_type::const_iterator const_iterator
Definition: CompositeCurve.h:44
friend class MGCompositeCurve
Definition: Curve.h:1255
MGLBRep is a class for B-SPline representation.
Definition: LBRep.h:41
MGIgesDirectoryEntry describes a directory entry section of an IGES file.
Definition: IgesDirectoryEntry.h:20
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.
Vector of a general n space dimension.
Definition: Vector.h:26
virtual int bdim() const =0
Returns B-Rep Dimension.
Defines a Box of any space dimendion.
Definition: Box.h:34
Define MGBSumCurve Class(Boolean sum curve of three curves).
Definition: BSumCurve.h:28
container_type::const_reverse_iterator const_reverse_iterator
Definition: CompositeCurve.h:46
virtual void change_range(double t1, double t2)=0
Change parameter range.
MGPosition_list perps(const MGBSumCurve &crv2) const
Definition: CompositeCurve.h:497
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.
iterator begin()
Definition: CompositeCurve.h:123
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.
std::string whoami() const
Definition: CompositeCurve.h:641
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)
const_iterator begin() const
Definition: CompositeCurve.h:122
MGPosition_list perps(const MGStraight &crv2) const
Definition: CompositeCurve.h:492
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_iterator end() const
Definition: CompositeCurve.h:285
MGCSisect_list defines linked list of MGCSisect.
Definition: CSisect_list.h:22
Defines Knot vector of B-Representation.
Definition: KnotVector.h:28
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 double closest(const MGPosition &point) const
Compute the closest point parameter value of this curve from a point.
virtual MGSurface * sweep(const MGUnit_vector &uvec, double start_dist, double end_dist) const =0
Return sweep surface from crv.
MGCompositeCurve(Composite Curve)
Definition: MGCL.h:151
container_type::iterator iterator
Definition: CompositeCurve.h:43
virtual MGCurve & operator-=(const MGVector &v)=0
iterator end()
Definition: CompositeCurve.h:286
MGParam_Vector provides a list to store parameters of a curve.
Definition: CParam_list.h:18
int number_of_curves() const
Get the number of included curves in this CompositeCurve.
Definition: CompositeCurve.h:363
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 const MGKnotVector & knot_vector() const =0
Returns the knot vector of the curve.
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
MGPosition_list provides a list of Positions.
Definition: Position_list.h:27
virtual MGCurve & operator*=(double scale)=0
MGCompositeCurve()
Void constructor(初期化なしでオブジェクトを作成する。)
Definition: CompositeCurve.h:54
virtual double length() const
Compute whole curve length.
Definition: Curve.h:624
MGPosition_list perps(const MGLBRep &crv2) const
Definition: CompositeCurve.h:495
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 on(const MGPosition &point, double &t) const
Test if given point is on the curve or not.
const MGCurve & curve(int i) const
Get the i-th curve in this CompositeCurve.
Definition: CompositeCurve.h:244
virtual bool operator==(const MGCompositeCurve &crv) const
Comparison.
Defines Surface B-Representation, that is , B-Spline surface.
Definition: SBRep.h:48
virtual std::auto_ptr< MGCurve > oneD(const double g[4]) const =0
Obtain transformed 1D curve expression of this curve.
MGPosition_list perps(const MGRLBRep &crv2) const
Definition: CompositeCurve.h:493
virtual MGCurve * copy_as_nurbs() const =0
copy as a newed curve.
MGEllipse is a class to define an ellipse of 2D or 3D.
Definition: Ellipse.h:38
MGPosition_list perps(const MGCurve &crv2) const
Definition: CompositeCurve.h:491
virtual int divide_multi(MGPvector< MGCurve > &crv_list, int multiplicity=-1) const
Divide this curve at the designated knot multiplicity point.
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 MGCParam_list intersect_1D(double f, int coordinate=0) const
Compute intersection point of 1D sub curve of original curve.
virtual double param_e() const =0
Return ending parameter value.
virtual double curvilinear_integral() const
Definition: Curve.h:299
MGHHisect is to represent one continuous intersection line of shells.
Definition: HHisect.h:43
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.
mgSysGL is a class to provide a facility to draw temporal pictures.
Definition: sysGL.h:26
virtual bool is_planar(MGPlane &plane) const
Test if this cure is planar or not.
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
virtual void display_control_polygon(mgSysGL &sgl) const
Definition: Gel.h:194
MGCURVE_TYPE type() const
Return curve type(曲線のタイプを返す)
Definition: CompositeCurve.h:592
virtual void polygonize(double error, MGLBRep &lb2) const
Approximate this curve by a polyline and output to lb2.
virtual void display_curvatures(mgSysGL &sgl, double scale, int density, bool use_radius) const
MGPosition_list perps(const MGEllipse &crv2) const
Definition: CompositeCurve.h:494
Define a unit vector, is a MGVector.
Definition: Unit_vector.h:17
double length() const
Compute whole curve length.
Definition: CompositeCurve.h:350
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