/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #ifndef _MGComplex_HH_ #define _MGComplex_HH_ #include #include "mg/Box.h" #include "topo/Topology.h" // //Define MGComplex Class. class MGPosition; class MGCellNB; class MGCellMap; class MGBoundary; /** @addtogroup TOPO * @{ */ ///MGComplex is a container of parameter cells and binder cells. class MG_DLL_DECLR MGComplex: public MGTopology{ public: typedef std::list container_type; typedef container_type::iterator cellItr; typedef container_type::const_iterator const_cellItr; typedef container_type::iterator pcellItr; typedef container_type::const_iterator const_pcellItr; typedef container_type::iterator bcellItr; typedef container_type::const_iterator const_bcellItr; ///Complexのスケーリングを行い,Complexを作成する。 ///Scaling of the Complex by a double. MG_DLL_DECLR friend MGComplex operator* (double s, const MGComplex& complex); /////////Constructor///////// ///Void constructor. MGComplex(); ///Copy constructor. Copy as a boundary complex of parent. ///When parent is not specified, this is ordinary world complex. /// Not a boundary complex. MGComplex(const MGComplex& complex); ///Construct of one cell. ///The second form takes the ownership of the cell, must be newed object. MGComplex(const MGCellNB& cell); MGComplex(MGCellNB* cell); /////////Destructor///////// virtual ~MGComplex(); /////////operator overload///////// ///Assignment. ///When the leaf object of this and topo2 are not equal, this assignment ///does nothing. virtual MGComplex& operator=(const MGGel& gel2); virtual MGComplex& operator=(const MGComplex& gel2); /// Complexに平行移動を行ないオブジェクトを生成する。 ///Translation of the Complex MGComplex operator+ (const MGVector& v) const; /// Complexに逆方向の平行移動を行ないオブジェクトを生成する。 ///Translation of the Complex MGComplex operator- (const MGVector& v) const; ///Complexのスケーリングを行い,Complexを作成する。 ///Scaling of the Complex by a double. MGComplex operator* (double s) const; /// 与えられた変換でComplexの変換を行い,Complexを作成する。 ///Transformation of the Complex by a matrix. MGComplex operator* (const MGMatrix& mat) const; /// 与えられた変換によってトランスフォームをおこないComplexを生成する。 ///Transformation of the Complex by a MGTransf. MGComplex operator* (const MGTransf& tr) const; ///Object transformation. virtual MGComplex& operator+=(const MGVector& v); virtual MGComplex& operator-=(const MGVector& v); virtual MGComplex& operator*=(double scale); virtual MGComplex& operator*=(const MGMatrix& mat); virtual MGComplex& operator*=(const MGTransf& tr); ///Complexのスケーリングを行い,Complexを作成する。 ///Scaling of the Complex by a double. MGComplex operator/ (double s) const{return (*this)*(1./s);}; ///comparison virtual bool operator<(const MGComplex& gel2)const; virtual bool operator<(const MGGel& gel2)const; /////////Member Function///////// ///Obtain first bcell iterator. const_bcellItr bcell_begin() const{ return m_bcells.begin();}; bcellItr bcell_begin() { return m_bcells.begin();}; ///Obtain end bcell iterator(next of the last bcell). const_bcellItr bcell_end() const{ return m_bcells.end();}; bcellItr bcell_end() { return m_bcells.end();}; ///Obtain i-the pcell in the m_bcells sequence. MGCellNB version. const MGCellNB* bcelli(int i) const; MGCellNB* bcelli(int i); ///Obtain i-the pcell in the m_bcells sequence. MGCellNB version. const_bcellItr bcellIterator(int i) const; bcellItr bcellIterator(int i); ///Cehck if bcell exist. bool bcell_exist()const; ///Obtain the binder of i-the pcell, may be null. MGCellNB* binder(int i) const; ///Obtain binders of all the pcells of the boundary. ///i-th binder of the fucntion's returned value is the binder ///of i-th pcell of the boundary, and may be null. std::vector binders() const; ///Return the box of this complex. const MGBox& box() const; ///Compute barycenter of all the vertex(binder cell of 0D manifold ///dimension). MGPosition center() const; ///Construct new object by copying to newed area. ///User must delete this copied object by "delete". virtual MGComplex* clone() const; ///Draw 3D curve in world coordinates. ///The object is converted to curve(s) and is drawn. void drawWire( mgVBO& vbo,/// pcells(); std::vector pcells() const; ///Compute the parameter value of the closest point from the straight to ///this object. ///sl is the eye projection line whose direction is from yon to hither, and if ///sl had multiple intersection points, The closest point to the eye will be selected. MGPosition pick_closest(const MGStraight& sl)const; ///Get star cell pointer if this complex is a boundary of a cell. ///Else, null will be returned. const MGCellNB* star() const; MGCellNB* star(); protected: mutable MGBox m_box; ///& pcells); ///Binder cells of the pcells in complex will be registered in cmap. MGComplex(const MGComplex& complex, MGCellMap& cmap); ///cellmap to register binder association. ///Append a binder to the end of bcell sequence. cellItr append_bcell(MGCellNB* cell)const; ///Insert a Cell(binder or parameter) before the position loc. ///loc is the iterator of m_pcells or m_bcells according to pcell. cellItr add_cell( MGCellNB* cell, ///