1 // Copyright (c) 2005-2008 Fernando Luis Cacciola Carballal. All rights reserved. 2 // 3 // This file is part of CGAL (www.cgal.org). 4 // 5 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Straight_skeleton_2/include/CGAL/Straight_skeleton_halfedge_base_2.h $ 6 // $Id: Straight_skeleton_halfedge_base_2.h b6333ed 2020-10-05T18:29:34+02:00 Mael Rouxel-Labbé 7 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial 8 // 9 // Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar> 10 // 11 #ifndef CGAL_STRAIGHT_SKELETON_HALFEDGE_BASE_2_H 12 #define CGAL_STRAIGHT_SKELETON_HALFEDGE_BASE_2_H 1 13 14 #include <CGAL/license/Straight_skeleton_2.h> 15 16 17 #include <CGAL/tags.h> 18 #include <CGAL/enum.h> 19 20 namespace CGAL { 21 22 template < class Refs > 23 class Straight_skeleton_halfedge_base_base_2 24 { 25 public: 26 27 typedef Refs HalfedgeDS; 28 typedef Tag_true Supports_halfedge_prev; 29 typedef Tag_true Supports_halfedge_vertex; 30 typedef Tag_true Supports_halfedge_face; 31 32 typedef typename Refs::Vertex_handle Vertex_handle; 33 typedef typename Refs::Vertex_const_handle Vertex_const_handle; 34 typedef typename Refs::Halfedge_handle Halfedge_handle; 35 typedef typename Refs::Halfedge_const_handle Halfedge_const_handle; 36 typedef typename Refs::Face_handle Face_handle; 37 typedef typename Refs::Face_const_handle Face_const_handle; 38 typedef typename Refs::Vertex Vertex; 39 typedef typename Refs::Face Face; 40 41 typedef Straight_skeleton_halfedge_base_base_2<Refs> Base_base ; 42 43 protected: 44 Straight_skeleton_halfedge_base_base_2()45 Straight_skeleton_halfedge_base_base_2() : mF(Face_handle()), mID(-1), mSlope(ZERO) {} 46 Straight_skeleton_halfedge_base_base_2(int aID)47 Straight_skeleton_halfedge_base_base_2( int aID ) : mF(Face_handle()), mID(aID), mSlope(ZERO) {} 48 Straight_skeleton_halfedge_base_base_2(int aID,Sign aSlope)49 Straight_skeleton_halfedge_base_base_2( int aID, Sign aSlope ) : mF(Face_handle()), mID(aID), mSlope(aSlope) {} 50 51 public: 52 id()53 int id() const { return mID ; } 54 is_bisector()55 bool is_bisector() const 56 { 57 return !this->is_border() && !this->opposite()->is_border() ; 58 } 59 is_inner_bisector()60 bool is_inner_bisector() const 61 { 62 return !this->vertex()->is_contour() && !this->opposite()->vertex()->is_contour(); 63 } 64 has_null_segment()65 bool has_null_segment() const { return this->vertex()->has_null_point() ; } 66 has_infinite_time()67 bool has_infinite_time() const { return this->vertex()->has_infinite_time() ; } 68 defining_contour_edge()69 Halfedge_const_handle defining_contour_edge() const { return this->face()->halfedge() ; } defining_contour_edge()70 Halfedge_handle defining_contour_edge() { return this->face()->halfedge() ; } 71 opposite()72 Halfedge_handle opposite() { return mOpp;} opposite()73 Halfedge_const_handle opposite() const { return mOpp;} next()74 Halfedge_handle next () { return mNxt;} next()75 Halfedge_const_handle next () const { return mNxt;} prev()76 Halfedge_handle prev () { return mPrv; } prev()77 Halfedge_const_handle prev () const { return mPrv; } vertex()78 Vertex_handle vertex () { return mV; } vertex()79 Vertex_const_handle vertex () const { return mV; } face()80 Face_handle face () { return mF; } face()81 Face_const_handle face () const { return mF; } 82 slope()83 Sign slope() const { return mSlope ; } 84 is_border()85 bool is_border() const { return mF == Face_handle();} 86 set_opposite(Halfedge_handle h)87 void set_opposite( Halfedge_handle h) { mOpp = h; } set_next(Halfedge_handle h)88 void set_next ( Halfedge_handle h) { mNxt = h; } set_prev(Halfedge_handle h)89 void set_prev ( Halfedge_handle h) { mPrv = h; } set_vertex(Vertex_handle w)90 void set_vertex ( Vertex_handle w) { mV = w; } set_face(Face_handle g)91 void set_face ( Face_handle g) { mF = g; } 92 set_slope(Sign aSlope)93 void set_slope( Sign aSlope ) { mSlope = aSlope ; } 94 reset_id(int aID)95 void reset_id ( int aID ) { mID = aID ; } 96 97 private: 98 99 Halfedge_handle mOpp; 100 Halfedge_handle mNxt; 101 Halfedge_handle mPrv; 102 Vertex_handle mV; 103 Face_handle mF; 104 int mID ; 105 Sign mSlope ; 106 }; 107 108 template < class Refs > 109 class Straight_skeleton_halfedge_base_2 : public Straight_skeleton_halfedge_base_base_2<Refs> 110 { 111 public: 112 113 typedef typename Refs::Vertex_handle Vertex_handle; 114 typedef typename Refs::Halfedge_handle Halfedge_handle; 115 typedef typename Refs::Face_handle Face_handle; 116 117 typedef Straight_skeleton_halfedge_base_base_2<Refs> Base_base ; 118 typedef Straight_skeleton_halfedge_base_2<Refs> Base ; 119 Straight_skeleton_halfedge_base_2()120 Straight_skeleton_halfedge_base_2() {} 121 Straight_skeleton_halfedge_base_2(int aID)122 Straight_skeleton_halfedge_base_2( int aID ) : Base_base(aID) {} 123 Straight_skeleton_halfedge_base_2(int aID,Sign aSlope)124 Straight_skeleton_halfedge_base_2( int aID, Sign aSlope ) : Base_base(aID,aSlope) {} 125 set_opposite(Halfedge_handle h)126 void set_opposite( Halfedge_handle h ) { Base_base::opposite(h) ; } set_next(Halfedge_handle h)127 void set_next ( Halfedge_handle h ) { Base_base::set_next(h) ; } set_prev(Halfedge_handle h)128 void set_prev ( Halfedge_handle h ) { Base_base::set_prev(h) ; } set_vertex(Vertex_handle w)129 void set_vertex ( Vertex_handle w ) { Base_base::set_vertex(w); } set_face(Face_handle g)130 void set_face ( Face_handle g ) { Base_base::set_face(g) ; } set_slope(Sign s)131 void set_slope ( Sign s ) { Base_base::set_slope(s) ; } reset_id(int i)132 void reset_id ( int i ) { Base_base::reset_id(i) ; } 133 134 } ; 135 136 } // end namespace CGAL 137 138 #endif // CGAL_STRAIGHT_SKELETON_HALFEDGE_BASE_2_H // 139 // EOF // 140 141