📄 sweep_line_event.h
字号:
bool is_intersection() const { return ((m_type & INTERSECTION ) != 0); } bool is_action() const { return ((m_type & ACTION ) != 0); } bool is_query() const { return ((m_type & QUERY ) != 0); } bool is_weak_intersection() const { return((m_type & WEAK_INTERSECTION) != 0); } bool is_overlap() const { return ((m_type & OVERLAP ) != 0); } void set_left_end() { m_type |= LEFT_END; } void set_right_end() { m_type |= RIGHT_END; } void set_intersection() { m_type |= INTERSECTION; } void set_action() { m_type |= ACTION; } void set_query() { m_type |= QUERY; } void set_weak_intersection() { m_type |= WEAK_INTERSECTION; } void set_overlap() { m_type |= OVERLAP; } void set_attribute(Attribute type) { m_type |= type; } void set_minus_infinite_x() { m_type |= MINUS_INNO_BOUNDARY_X; } void set_plus_infinite_x() { m_type |= PLUS_INNO_BOUNDARY_X; } void set_finite_x() { m_type |= NO_BOUNDARY_X; } void set_finite_y() { m_type |= NO_BOUNDARY_Y; } void set_finite() { m_type |= NO_BOUNDARY_X; m_type |= NO_BOUNDARY_Y; } void set_minus_infinite_y() { m_type |= MINUS_INNO_BOUNDARY_Y; } void set_plus_infinite_y() { m_type |= PLUS_INNO_BOUNDARY_Y; } inline bool is_finite() const { return ((m_type & NO_BOUNDARY_X ) != 0) && ((m_type & NO_BOUNDARY_Y ) != 0); } /*inline bool is_finite() const { return is_finite_impl(Has_boundary_category()); } inline bool is_finite_impl(Tag_false) const { return (true); } inline bool is_finite_impl(Tag_true) const { return ((m_type & NO_BOUNDARY_X ) != 0) && ((m_type & NO_BOUNDARY_Y ) != 0); }*/ bool is_minus_boundary_in_x() const { return ((m_type & MINUS_INNO_BOUNDARY_X ) != 0); } bool is_plus_boundary_in_x() const { return ((m_type & PLUS_INNO_BOUNDARY_X ) != 0); } bool is_finite_in_x() const { return ((m_type & NO_BOUNDARY_X ) != 0); } bool is_finite_in_y() const { return ((m_type & NO_BOUNDARY_Y ) != 0); } bool is_minus_boundary_in_y() const { return ((m_type & MINUS_INNO_BOUNDARY_Y ) != 0); } bool is_plus_boundary_in_y() const { return ((m_type & PLUS_INNO_BOUNDARY_Y ) != 0); } Boundary_type infinity_at_x() const { if((m_type & MINUS_INNO_BOUNDARY_X ) != 0) return MINUS_INFINITY; if((m_type & PLUS_INNO_BOUNDARY_X ) != 0) return PLUS_INFINITY; CGAL_assertion((m_type & NO_BOUNDARY_X ) != 0); return NO_BOUNDARY; } Boundary_type infinity_at_y() const { if((m_type & MINUS_INNO_BOUNDARY_Y ) != 0) return MINUS_INFINITY; if((m_type & PLUS_INNO_BOUNDARY_Y ) != 0) return PLUS_INFINITY; CGAL_assertion((m_type & NO_BOUNDARY_Y ) != 0); return NO_BOUNDARY; } template <class InputIterator> void replace_left_curves(InputIterator begin, InputIterator end) { SubCurveIter left_iter = m_leftCurves.begin(); for(InputIterator itr = begin; itr != end; ++itr , ++left_iter) { *left_iter = static_cast<SubCurve*>(*itr); } m_leftCurves.erase(left_iter, m_leftCurves.end()); } bool is_right_curve_bigger(SubCurve* c1, SubCurve* c2) { for(SubCurveIter iter = m_rightCurves.begin(); iter != m_rightCurves.end(); ++iter) { if(*iter == c1 || static_cast<SubCurve*>((*iter)->get_orig_subcurve1()) == c1 || static_cast<SubCurve*>((*iter)->get_orig_subcurve2()) == c1) return false; if(*iter == c2 || static_cast<SubCurve*>((*iter)->get_orig_subcurve1()) == c2 || static_cast<SubCurve*>((*iter)->get_orig_subcurve2()) == c2) return true; } return true; } bool are_left_neighbours(SubCurve* c1, SubCurve* c2) { SubCurveIter left_iter = m_leftCurves.begin(); for( ; left_iter != m_leftCurves.end(); ++left_iter) { if(*left_iter == c1) { SubCurveIter temp = left_iter; ++temp; if(temp!=m_leftCurves.end()) { return (*temp == c2); } return false; } if(*left_iter == c2) { SubCurveIter temp = left_iter; ++temp; if(temp!=m_leftCurves.end()) { return (*temp == c1); } return false; } } return false; } #ifdef VERBOSE void Print() ;#endif protected: /*! The point of the event */ Point_2 m_point; /*! A list of curves on the left side of the event (or traverse at event)*/ SubcurveContainer m_leftCurves; /*! A list of curves on the right side of the event(or traverse at event), sorted by their y value to the right of the point */ SubcurveContainer m_rightCurves; /*! */ int m_type;};#ifdef VERBOSEtemplate<class SweepLineTraits_2, class CurveWrap>void Sweep_line_event<SweepLineTraits_2, CurveWrap>::Print() { std::cout << "\tEvent info: " << "\n" ; if(this->is_finite()) std::cout << "\t" << m_point << "\n" ; else { std::cout << "\t"; Boundary_type x = this->infinity_at_x(), y = this->infinity_at_y(); switch(x) { case MINUS_INFINITY: std::cout<<" X = -00 "; break; case PLUS_INFINITY: std::cout<<" X = +00 "; break; case NO_BOUNDARY: { switch(y) { case MINUS_INFINITY: std::cout<<" Y = -00 "; break; case PLUS_INFINITY: std::cout<<" Y = +00 "; break; case NO_BOUNDARY: CGAL_assertion(false); } } } } std::cout<<"\n"; std::cout << "\tLeft curves: \n" ; for ( SubCurveIter iter = m_leftCurves.begin() ; iter != m_leftCurves.end() ; ++iter ) { std::cout << "\t"; (*iter)->Print(); std::cout << "\n"; } std::cout << std::endl; std::cout << "\tRight curves: \n" ; for ( SubCurveIter iter1 = m_rightCurves.begin() ; iter1 != m_rightCurves.end() ; ++iter1 ) { std::cout << "\t"; (*iter1)->Print(); std::cout << "\n"; } std::cout << std::endl;} #endif // NDEBUGCGAL_END_NAMESPACE#endif // CGAL_SWEEP_LINE_EVENT_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -