⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 generate.sh

📁 penMesh is a generic and efficient data structure for representing and manipulating polygonal meshes
💻 SH
字号:
#!/bin/bash#------------------------------------------------------------------------------# generate_iterator( TargetType, n_elements, has_element_status )function generate_iterator{    NonConstIter=$1"IterT"    ConstIter="Const"$NonConstIter    TargetType="typename Mesh::"$1    TargetHandle="typename Mesh::"$1"Handle"    cat iterators_template.hh \    | sed -e "s/IteratorT/$NonConstIter/; s/IteratorT/$NonConstIter/;	      s/NonConstIterT/$NonConstIter/;	      s/ConstIterT/$ConstIter/;              s/TargetType/$TargetType/;	      s/TargetHandle/$TargetHandle/;	      s/IsConst/0/;	      s/n_elements/$2/;	      s/has_element_status/$3/;"    cat iterators_template.hh \    | sed -e "s/IteratorT/$ConstIter/; s/IteratorT/$ConstIter/;	      s/NonConstIterT/$NonConstIter/;	      s/ConstIterT/$ConstIter/;              s/TargetType/$TargetType/;	      s/TargetHandle/$TargetHandle/;	      s/IsConst/1/;	      s/n_elements/$2/;	      s/has_element_status/$3/;"}#------------------------------------------------------------------------------# generate_circulator( NonConstName, SourceType, TargetType, #                      post_init,#                      increment, decrement,#                      get_handle,#                      [Name] )function generate_circulator{    NonConstCirc=$1    ConstCirc="Const"$NonConstCirc    SourceHandle="typename Mesh::"$2"Handle"    TargetHandle="typename Mesh::"$3"Handle"    TargetType="typename Mesh::"$3    cat circulators_template.hh \    | sed -e "s/CirculatorT/$NonConstCirc/; s/CirculatorT/$NonConstCirc/;	      s/NonConstCircT/$NonConstCirc/;	      s/ConstCircT/$ConstCirc/;	      s/SourceHandle/$SourceHandle/;	      s/TargetHandle/$TargetHandle/;              s/TargetType/$TargetType/;	      s/IsConst/0/;              s/post_init/$4/;              s/increment/$5/;              s/decrement/$6/;	      s/get_handle/$7/;"    cat circulators_template.hh \    | sed -e "s/CirculatorT/$ConstCirc/; s/CirculatorT/$ConstCirc/;	      s/NonConstCircT/$NonConstCirc/;	      s/ConstCircT/$ConstCirc/;	      s/SourceHandle/$SourceHandle/;	      s/TargetHandle/$TargetHandle/;              s/TargetType/$TargetType/;	      s/IsConst/1/;              s/post_init/$4/;              s/increment/$5/;              s/decrement/$6/;	      s/get_handle/$7/;"}#------------------------------------------------------------------------------### Generate IteratorsT.hhcat iterators_header.hh > IteratorsT.hhgenerate_iterator Vertex   n_vertices   has_vertex_status    >> IteratorsT.hhgenerate_iterator Halfedge n_halfedges  has_halfedge_status  >> IteratorsT.hhgenerate_iterator Edge     n_edges      has_edge_status      >> IteratorsT.hhgenerate_iterator Face     n_faces      has_face_status      >> IteratorsT.hhcat footer.hh >> IteratorsT.hh#------------------------------------------------------------------------------### Generate CirculatorsT.hhcat circulators_header.hh > CirculatorsT.hhgenerate_circulator VertexVertexIterT Vertex Vertex \    " " \    "heh_=mesh_->cw_rotated_halfedge_handle(heh_);" \    "heh_=mesh_->ccw_rotated_halfedge_handle(heh_);" \    "mesh_->to_vertex_handle(heh_);" \    >> CirculatorsT.hhgenerate_circulator VertexOHalfedgeIterT Vertex Halfedge \    " " \    "heh_=mesh_->cw_rotated_halfedge_handle(heh_);" \    "heh_=mesh_->ccw_rotated_halfedge_handle(heh_);" \    "heh_" \    >> CirculatorsT.hhgenerate_circulator VertexIHalfedgeIterT Vertex Halfedge \    " " \    "heh_=mesh_->cw_rotated_halfedge_handle(heh_);" \    "heh_=mesh_->ccw_rotated_halfedge_handle(heh_);" \    "mesh_->opposite_halfedge_handle(heh_)" \    >> CirculatorsT.hhgenerate_circulator VertexEdgeIterT Vertex Edge \    " " \    "heh_=mesh_->cw_rotated_halfedge_handle(heh_);" \    "heh_=mesh_->ccw_rotated_halfedge_handle(heh_);" \    "mesh_->edge_handle(heh_)" \    >> CirculatorsT.hhgenerate_circulator VertexFaceIterT Vertex Face \    "if (heh_.is_valid() \&\& !handle().is_valid()) operator++();" \    "do heh_=mesh_->cw_rotated_halfedge_handle(heh_);  while ((*this) \&\& (!handle().is_valid()));" \    "do	heh_=mesh_->ccw_rotated_halfedge_handle(heh_); while ((*this) \&\& (!handle().is_valid()));" \    "mesh_->face_handle(heh_)" \    >> CirculatorsT.hhgenerate_circulator FaceVertexIterT Face Vertex \    " " \    "heh_=mesh_->next_halfedge_handle(heh_);" \    "heh_=mesh_->prev_halfedge_handle(heh_);" \    "mesh_->to_vertex_handle(heh_)" \    >> CirculatorsT.hhgenerate_circulator FaceHalfedgeIterT Face Halfedge \    " " \    "heh_=mesh_->next_halfedge_handle(heh_);" \    "heh_=mesh_->prev_halfedge_handle(heh_);" \    "heh_" \    >> CirculatorsT.hhgenerate_circulator FaceEdgeIterT Face Edge \    " " \    "heh_=mesh_->next_halfedge_handle(heh_);" \    "heh_=mesh_->prev_halfedge_handle(heh_);" \    "mesh_->edge_handle(heh_)" \    >> CirculatorsT.hhgenerate_circulator FaceFaceIterT Face Face \    "if (heh_.is_valid() \&\& !handle().is_valid()) operator++();" \    "do heh_=mesh_->next_halfedge_handle(heh_); while ((*this) \&\& (!handle().is_valid()));" \    "do heh_=mesh_->prev_halfedge_handle(heh_); while ((*this) \&\& (!handle().is_valid()));" \    "mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_))" \    >> CirculatorsT.hhcat footer.hh >> CirculatorsT.hh#------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -