/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #ifndef _MGPosition_list_HH_ #define _MGPosition_list_HH_ /** @file */ /** @addtogroup IsectContainer * @{ */ #include #include "mg/Position.h" //Forward class declaration. class MGBox; class MGCurve; class MGFSurface; class MGIfstream; class MGOfstream; class MGSSisect; ///MGPosition_list provides a list of Positions. ///MGPosition_list is used to store curve or surface parameter as ///two objects intersection data. class MG_DLL_DECLR MGPosition_list{ public: typedef std::list container_type; typedef container_type::iterator iterator; typedef container_type::const_iterator const_iterator; //////////// Constructor //////////// /// Void constructor(Constructor of length 0). MGPosition_list(){;}; /// Constructor of length 1. MGPosition_list(const MGPosition& P): m_Plist(1,P){;}; ///Construct MGPosition_list by replacing each element P of list by Q, ///where, Q=MGPosition(P.sdim(),P,start1,start2). MGPosition_list( const MGPosition_list& list,///0 is specified, the first n coordinates of the position data in ///the list are checked if included in the box. ///If n==0 is specified, all the coordinate data are checked. bool in(const MGBox& box, const_iterator& id, int n=0) const; bool in(const MGBox& box, iterator& id, int n=0); ///Inserts position at the index i. ///This index must be between zero and the number of items in the list, /// or behavior is undefined. void insertAt(iterator i, const MGPosition& pos) {m_Plist.insert(i, pos);}; ///Return true (1) if there are no items in the list, /// false(0) otherwise. bool isEmpty() const{return m_Plist.empty();}; bool empty() const{return m_Plist.empty();}; /// Return(but does not remove) last element in the list. /// If list is empty, behavior is undefined. const MGPosition& last() const{return m_Plist.back();}; const MGPosition& back() const{return m_Plist.back();}; MGPosition& last(){return m_Plist.back();}; MGPosition& back(){return m_Plist.back();}; ///Erase the last element of m_Plist if not null. void pop_back(){m_Plist.pop_back();} ///Erase the first element of m_Plist if not null. void pop_front(){m_Plist.pop_front();} /// Adds the parameter to the beginning of the list. void prepend(const MGPosition& pos){m_Plist.push_front(pos);}; void push_front(const MGPosition& pos){m_Plist.push_front(pos);}; ///Add parameter pair uvuv of surface srf1 and sur2 to the beginning of list ///if uvuv is not included in the list already. bool prepend( const MGFSurface& srf1, const MGFSurface& srf2, const MGPosition& uvuv ){ return add(false,srf1,srf2,uvuv);}; ///Remove position in the list that is the same point as P. ///When distace of the two point is within error, they are regarded as same. ///Function's return value is num of points deleted. int remove( double error, ///