Developer Documentation

MeshSelectionT_impl.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42
43
44
45
46
47 //=============================================================================
48 //
49 // IMPLEMENTATION
50 //
51 //=============================================================================
52
53 #define MESHSELECTION_C
54
55 //== INCLUDES =================================================================
56
57 #include "MeshSelectionT.hh"
58 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
59
60 #include <stack>
61 #include <set>
62 //== NAMESPACES ===============================================================
63
64 namespace MeshSelection {
65
66 //== IMPLEMENTATION ==========================================================
67
68 //=========================================================
69 //== Vertex Selection =====================================
70 //=========================================================
71
72 template< typename MeshT >
73 inline
74 void selectVertices(MeshT* _mesh, const std::vector< int >& _vertices) {
75 const int n_vertices = (int)_mesh->n_vertices();
76
77 for ( uint i = 0 ; i < _vertices.size() ; ++i )
78 if ( (_vertices[i] >= 0) && ( _vertices[i] < n_vertices ) ) {
79 typename MeshT::VertexHandle vh(_vertices[i]);
80 _mesh->status(vh).set_selected(true);
81 }
82 }
83
84 //=========================================================
85
86 template< typename MeshT >
87 inline
88 void unselectVertices(MeshT* _mesh, const std::vector< int >& _vertices) {
89 const int n_vertices = (int)_mesh->n_vertices();
90
91 for ( uint i = 0 ; i < _vertices.size() ; ++i )
92 if ( (_vertices[i] >= 0) && ( _vertices[i] < n_vertices ) ) {
93 typename MeshT::VertexHandle vh(_vertices[i]);
94 _mesh->status(vh).set_selected(false);
95 }
96 }
97
98 //=========================================================
99
100 template< typename MeshT >
101 inline
102 void selectAllVertices(MeshT* _mesh) {
103 typename MeshT::VertexIter v_it, v_end=_mesh->vertices_end();
104
105 for (v_it = _mesh->vertices_begin(); v_it != v_end ; ++v_it)
106 _mesh->status(*v_it).set_selected(true);
107
108 }
109
110 //=========================================================
111
112 template< typename MeshT >
113 inline
114 void clearVertexSelection(MeshT* _mesh) {
115 typename MeshT::VertexIter v_it, v_end=_mesh->vertices_end();
116
117 for (v_it = _mesh->vertices_begin(); v_it != v_end ; ++v_it)
118 _mesh->status(*v_it).set_selected(false);
119 }
120
121 //=========================================================
122
123 template< typename MeshT >
124 inline
125 void invertVertexSelection(MeshT* _mesh) {
126 typename MeshT::VertexIter v_it, v_end=_mesh->vertices_end();
127
128 for (v_it = _mesh->vertices_begin(); v_it != v_end ; ++v_it)
129 _mesh->status(*v_it).set_selected( ! _mesh->status(*v_it).selected());
130 }
131
132 //=========================================================
133
134
135 template< typename MeshT >
136 inline
137 void selectBoundaryVertices(MeshT* _mesh) {
138 typename MeshT::HalfedgeIter he_it, he_end=_mesh->halfedges_end();
139
140 for (he_it = _mesh->halfedges_begin(); he_it != he_end ; ++he_it)
141 if (_mesh->is_boundary(*he_it) ) {
142 _mesh->status(_mesh->to_vertex_handle(*he_it)).set_selected(true);
143 _mesh->status(_mesh->from_vertex_handle(*he_it)).set_selected(true);
144 }
145 }
146
147 //-----------------------------------------------------------------------------
148
149 template< typename MeshT >
150 inline
151 void shrinkVertexSelection(MeshT* _mesh) {
152 OpenMesh::VPropHandleT< bool > temp_shrink;
153
154 _mesh->add_property( temp_shrink, "Temp property for Vertex selection shrinking" );
155
156 typename MeshT::VertexIter v_it, v_end=_mesh->vertices_end();
157
158 // initialize property ( copy status to new property )
159 for (v_it = _mesh->vertices_begin(); v_it != v_end ; ++v_it)
160 _mesh->property(temp_shrink,*v_it) = _mesh->status(*v_it).selected();
161
162 // update selection
163 for (v_it = _mesh->vertices_begin(); v_it != v_end ; ++v_it)
164 if ( _mesh->property(temp_shrink,*v_it) ) {
165 _mesh->status(*v_it).set_selected( true );
166
167 for ( typename MeshT::VertexVertexIter vv_it(*_mesh,*v_it); vv_it.is_valid(); ++vv_it)
168 if ( ! _mesh->property(temp_shrink,*vv_it) ){
169 _mesh->status(*v_it).set_selected( false );
170 break;
171 }
172 }
173
174 _mesh->remove_property(temp_shrink);
175 }
176
177 //=========================================================
178
179 template< typename MeshT >
180 inline
181 void growVertexSelection(MeshT* _mesh) {
182 OpenMesh::VPropHandleT< bool > temp_grow;
183
184 _mesh->add_property( temp_grow, "Temp property for Vertex selection growing" );
185
186 // initialize property ( copy status to new property )
187 typename MeshT::VertexIter v_it, v_end=_mesh->vertices_end();
188 for (v_it = _mesh->vertices_begin(); v_it != v_end ; ++v_it)
189 _mesh->property(temp_grow,*v_it) = _mesh->status(*v_it).selected();
190
191 // update selection
192 for (v_it = _mesh->vertices_begin(); v_it != v_end ; ++v_it)
193 if ( _mesh->property(temp_grow,*v_it) )
194 for ( typename MeshT::VertexVertexIter vv_it(*_mesh,*v_it); vv_it.is_valid(); ++vv_it)
195 _mesh->status(*vv_it).set_selected( true );
196
197 _mesh->remove_property(temp_grow);
198 }
199
200 //=========================================================
201
202 template< typename MeshT >
203 inline
204 std::vector< int > getVertexSelection(MeshT* _mesh) {
205 std::vector< int > selection;
206
207 for ( typename MeshT::VertexIter v_it= _mesh->vertices_begin() ; v_it != _mesh->vertices_end() ; ++v_it )
208 if ( _mesh->status(*v_it).selected() )
209 selection.push_back( v_it->idx() );
210
211 return selection;
212 }
213
214 //=========================================================
215
216 template< typename MeshT >
217 inline
218 std::vector< int > getVertexSelection(MeshT* _mesh, bool& _invert) {
219 std::vector< int > selection;
220
221 int count = 0;
222
223 for ( typename MeshT::VertexIter v_it= _mesh->vertices_begin() ; v_it != _mesh->vertices_end() ; ++v_it )
224 if ( _mesh->status(*v_it).selected() )
225 ++count;
226
227 if ( count > (int)( _mesh->n_vertices() / 2) )
228 _invert = true;
229 else
230 _invert = false;
231
232 for ( typename MeshT::VertexIter v_it= _mesh->vertices_begin() ; v_it != _mesh->vertices_end() ; ++v_it )
233 if ( _mesh->status(*v_it).selected() ^ _invert )
234 selection.push_back( v_it->idx() );
235
236 return selection;
237 }
238
239
240 template< typename MeshT >
241 inline
242 void selectBoundaryVertices(MeshT* _mesh, const typename MeshT::VertexHandle& _vh){
243
244 OpenMesh::VPropHandleT< bool > visited;
245 _mesh->add_property(visited, "Visited Vertices");
246
247 typename MeshT::VertexIter v_it, v_end = _mesh->vertices_end();
248 for (v_it = _mesh->vertices_begin(); v_it != v_end; ++v_it)
249 _mesh->property(visited, *v_it) = false;
250
251 std::stack< typename MeshT::VertexHandle > stack;
252 stack.push( _vh );
253
254 while (!stack.empty()){
255
256 typename MeshT::VertexHandle vh = stack.top();
257 stack.pop();
258
259 if (_mesh->property(visited,vh))
260 continue;
261
262 //find outgoing boundary-edges
263 for (typename MeshT::VertexOHalfedgeIter voh_it(*_mesh,vh); voh_it.is_valid(); ++voh_it)
264 if ( _mesh->is_boundary( _mesh->edge_handle( *voh_it ) ) )
265 stack.push( _mesh->to_vertex_handle(*voh_it) );
266
267 //select vertex
268 _mesh->property(visited,vh) = true;
269 _mesh->status( vh ).set_selected(true);
270 }
271 _mesh->remove_property(visited);
272 }
273
274 template< typename MeshT >
275 inline
276 void convertVertexToEdgeSelection(MeshT* _mesh, const std::vector< int >& _vertices) {
277
278 for ( std::vector<int>::const_iterator v = _vertices.begin(); v != _vertices.end(); ++v) {
279
280 typename MeshT::VertexHandle vh(*v);
281 typename MeshT::VertexOHalfedgeIter ohe_iter = _mesh->voh_iter(vh);
282
283 for (; ohe_iter.is_valid(); ++ohe_iter) {
284 // test if both incident vertices are in _vertices
285 typename MeshT::VertexHandle ovh = _mesh->to_vertex_handle(*ohe_iter);
286 // search for ovh in _vertices
287 for(std::vector<int>::const_iterator it = _vertices.begin(); it != _vertices.end(); ++it) {
288 if((*it) == ovh.idx()) {
289 _mesh->status(_mesh->edge_handle(*ohe_iter)).set_selected(true);
290 break;
291 }
292 }
293 }
294 }
295 }
296
297 template< typename MeshT >
298 inline
299 void convertVertexToEdgeSelection(MeshT* _mesh) {
300
301 typename MeshT::VertexIter v_it, v_end = _mesh->vertices_end();
302 for (v_it = _mesh->vertices_begin(); v_it != v_end; ++v_it) {
303
304 if ( _mesh->status( *v_it ).selected() ) {
305 typename MeshT::VertexOHalfedgeIter ohe_iter = _mesh->voh_iter(*v_it);
306
307 for (; ohe_iter.is_valid(); ++ohe_iter) {
308 // test if both incident vertices are in _vertices
309 typename MeshT::VertexHandle ovh = _mesh->to_vertex_handle(*ohe_iter);
310 if (_mesh->status(ovh).selected())
311 _mesh->status(_mesh->edge_handle(*ohe_iter)).set_selected(true);
312 }
313 }
314 }
315 }
316
317 template< typename MeshT >
318 inline
319 void convertVertexToHalfedgeSelection(MeshT* _mesh, const std::vector< int >& _vertices) {
320
321 for (std::vector<int>::const_iterator v = _vertices.begin(); v != _vertices.end(); ++v) {
322
323 typename MeshT::VertexHandle vh(*v);
324 typename MeshT::VertexOHalfedgeIter ohe_iter = _mesh->voh_iter(vh);
325
326 for (; ohe_iter.is_valid(); ++ohe_iter) {
327 // test if both incident vertices are in _vertices
328 typename MeshT::VertexHandle ovh = _mesh->to_vertex_handle(*ohe_iter);
329 // search for ovh in _vertices
330 for(std::vector<int>::const_iterator it = _vertices.begin(); it != _vertices.end(); ++it) {
331 if((*it) == ovh.idx()) {
332 _mesh->status(*ohe_iter).set_selected(true);
333 _mesh->status(_mesh->opposite_halfedge_handle(*ohe_iter)).set_selected(true);
334 break;
335 }
336 }
337 }
338 }
339 }
340
341 template< typename MeshT >
342 inline
343 void convertVertexToHalfedgeSelection(MeshT* _mesh) {
344
345 typename MeshT::VertexIter v_it, v_end = _mesh->vertices_end();
346
347 for (v_it = _mesh->vertices_begin(); v_it != v_end; ++v_it) {
348
349 if ( _mesh->status( *v_it ).selected() ) {
350
351 typename MeshT::VertexOHalfedgeIter ohe_iter = _mesh->voh_iter(*v_it);
352
353 for (; ohe_iter.is_valid(); ++ohe_iter) {
354 // test if both incident vertices are in _vertices
355 typename MeshT::VertexHandle ovh = _mesh->to_vertex_handle(*ohe_iter);
356 if (_mesh->status(ovh).selected()) {
357 _mesh->status(*ohe_iter).set_selected(true);
358 _mesh->status(_mesh->opposite_halfedge_handle(*ohe_iter)).set_selected(true);
359 }
360 }
361 }
362 }
363 }
364
365 template< typename MeshT >
366 inline
367 void convertVertexToFaceSelection(MeshT* _mesh, const std::vector< int >& _vertices) {
368
369 for(typename MeshT::FaceIter f_it = _mesh->faces_begin(); f_it != _mesh->faces_end(); ++f_it) {
370 typename MeshT::FaceVertexIter fv_it = _mesh->fv_iter(*f_it);
371 // go over each vertex of each face and test if it's selected
372 bool allfound = true;
373 for(; fv_it.is_valid(); ++fv_it) {
374 // search fv_it in _vertices
375 bool onefound = false;
376 for(std::vector<int>::const_iterator it = _vertices.begin(); it != _vertices.end(); ++it) {
377 if((*it) == fv_it->idx()) { onefound = true; break; }
378 }
379 if(!onefound) {
380 allfound = false;
381 break;
382 }
383 }
384 if(allfound) {
385 // all incident vertices are selected -> select face
386 _mesh->status(*f_it).set_selected(true);
387 }
388 }
389 }
390
391 template< typename MeshT >
392 inline
393 void convertVertexToFaceSelection(MeshT* _mesh) {
394
395 typename MeshT::FaceIter f_it, f_end = _mesh->faces_end();
396
397 for (f_it = _mesh->faces_begin(); f_it != f_end; ++f_it) {
398
399 typename MeshT::FaceVertexIter fv_it = _mesh->fv_iter(*f_it);
400 // test if all incident vertices are selected
401 bool allfound = true;
402 for(; fv_it.is_valid(); ++fv_it) {
403 if(!_mesh->status(*fv_it).selected()) {
404 allfound = false;
405 break;
406 }
407 }
408 if(allfound)
409 _mesh->status(*f_it).set_selected(true);
410 }
411 }
412
413 template< typename MeshT >
414 inline
415 void convertVertexSelectionToFeatureVertices(MeshT* _mesh) {
416
417 for (typename MeshT::VertexIter v_it = _mesh->vertices_begin(); v_it != _mesh->vertices_end(); ++v_it) {
418
419 if (_mesh->status(*v_it).selected()) {
420
421 _mesh->status(*v_it).set_feature(true);
422 } else {
423 _mesh->status(*v_it).set_feature(false);
424 }
425 }
426 }
427
428 template< typename MeshT >
429 inline
430 void convertFeatureVerticesToVertexSelection(MeshT* _mesh) {
431
432 for (typename MeshT::VertexIter v_it = _mesh->vertices_begin(); v_it != _mesh->vertices_end(); ++v_it) {
433
434 if (_mesh->status(*v_it).feature()) {
435
436 _mesh->status(*v_it).set_selected(true);
437 } else {
438 _mesh->status(*v_it).set_selected(false);
439 }
440 }
441 }
442
443 template< typename MeshT >
444 inline
445 void clearFeatureVertices(MeshT* _mesh) {
446
447 for (typename MeshT::VertexIter v_it = _mesh->vertices_begin(); v_it != _mesh->vertices_end(); ++v_it) {
448
449 _mesh->status(*v_it).set_feature(false);
450 }
451 }
452
453 //=========================================================
454 //== Modeling Regions =====================================
455 //=========================================================
456
457 template< typename MeshT >
458 inline
459 void setArea(MeshT* _mesh, const std::vector< int >& _vertices , unsigned int _type, bool _state) {
460 for ( uint i = 0 ; i < _vertices.size() ; ++i ) {
461 if ( _vertices[i] > (int)_mesh->n_vertices() )
462 continue;
463
464 typename MeshT::VertexHandle vh(_vertices[i]);
465 _mesh->status(vh).change_bit(_type, _state);
466 }
467 }
468
469 template< typename MeshT >
470 inline
471 void setArea(MeshT* _mesh , unsigned int _type, bool _state) {
472 for ( typename MeshT::VertexIter v_it= _mesh->vertices_begin() ; v_it != _mesh->vertices_end() ; ++v_it )
473 _mesh->status(*v_it).change_bit(_type, _state);
474 }
475
476 template< typename MeshT >
477 inline
478 std::vector< int > getArea(MeshT* _mesh, unsigned int _type) {
479 std::vector< int > selection;
480
481 for ( typename MeshT::VertexIter v_it= _mesh->vertices_begin() ; v_it != _mesh->vertices_end() ; ++v_it )
482 if ( _mesh->status(*v_it).is_bit_set( _type ) )
483 selection.push_back( v_it->idx() );
484
485 return selection;
486 }
487
488 template< typename MeshT >
489 inline
490 std::vector< int > getArea(MeshT* _mesh, unsigned int _type , bool& _invert) {
491 std::vector< int > selection;
492
493 int count = 0;
494
495 for ( typename MeshT::VertexIter v_it= _mesh->vertices_begin() ; v_it != _mesh->vertices_end() ; ++v_it )
496 if ( _mesh->status(*v_it).is_bit_set( _type ) )
497 ++count;
498
499 if ( count > (int)( _mesh->n_vertices() / 2) )
500 _invert = true;
501 else
502 _invert = false;
503
504 for ( typename MeshT::VertexIter v_it= _mesh->vertices_begin() ; v_it != _mesh->vertices_end() ; ++v_it )
505 if ( _mesh->status(*v_it).is_bit_set( _type ) ^ _invert )
506 selection.push_back( v_it->idx() );
507
508 return selection;
509 }
510
511
512 //=========================================================
513 //== Edge Selection =====================================
514 //=========================================================
515
516 template< typename MeshT >
517 inline
518 void selectEdges(MeshT* _mesh, const std::vector< int >& _edges, const double _dihedral_angle_threshold) {
519 const int n_edges = (int)_mesh->n_edges();
520
521 for ( uint i = 0 ; i < _edges.size() ; ++i )
522 if ( (_edges[i] >= 0) && ( _edges[i] < n_edges ) ) {
523 typename MeshT::EdgeHandle eh(_edges[i]);
524 if(!_mesh->has_face_normals() || std::abs(_mesh->calc_dihedral_angle_fast(eh)) >= _dihedral_angle_threshold)
525 _mesh->status(eh).set_selected(true);
526 }
527 }
528
529 //=========================================================
530
531 template< typename MeshT >
532 inline
533 void unselectEdges(MeshT* _mesh, const std::vector< int >& _edges) {
534 const int n_edges = (int)_mesh->n_edges();
535
536 for ( uint i = 0 ; i < _edges.size() ; ++i )
537 if ( (_edges[i] >= 0) && ( _edges[i] < n_edges ) ) {
538 typename MeshT::EdgeHandle eh(_edges[i]);
539 _mesh->status(eh).set_selected(false);
540 }
541 }
542
543 //=========================================================
544
545 template< typename MeshT >
546 inline
547 void selectAllEdges(MeshT* _mesh) {
548 typename MeshT::EdgeIter e_it, e_end=_mesh->edges_end();
549
550 for (e_it = _mesh->edges_begin(); e_it != e_end ; ++e_it)
551 _mesh->status(*e_it).set_selected(true);
552 }
553
554 //=========================================================
555
556 template< typename MeshT >
557 inline
558 void clearEdgeSelection(MeshT* _mesh) {
559 typename MeshT::EdgeIter e_it, e_end=_mesh->edges_end();
560
561 for (e_it = _mesh->edges_begin(); e_it != e_end ; ++e_it)
562 _mesh->status(*e_it).set_selected(false);
563 }
564
565 //=========================================================
566
567 template< typename MeshT >
568 inline
569 void invertEdgeSelection(MeshT* _mesh) {
570 typename MeshT::EdgeIter e_it, e_end=_mesh->edges_end();
571
572 for (e_it = _mesh->edges_begin(); e_it != e_end ; ++e_it)
573 _mesh->status(*e_it).set_selected( ! _mesh->status(*e_it).selected());
574 }
575
576 //=========================================================
577
578 template<typename MeshT>
579 inline
580 void growEdgeSelection(MeshT* _mesh) {
581 std::set<typename MeshT::EdgeHandle> selectedEhs;
582 for (typename MeshT::EdgeIter e_it = _mesh->edges_begin(), e_end = _mesh->edges_end();
583 e_it != e_end; ++e_it) {
584
585 if (!_mesh->status(*e_it).selected()) continue;
586
587 const typename MeshT::HalfedgeHandle he = _mesh->halfedge_handle(*e_it, 0);
588 const typename MeshT::VertexHandle vhs[] = { _mesh->from_vertex_handle(he),
589 _mesh->to_vertex_handle(he) };
590
591 for (int i = 0; i < 2; ++i) {
592 for (typename MeshT::VertexEdgeIter ve_it = _mesh->ve_begin(vhs[i]), ve_end = _mesh->ve_end(vhs[i]);
593 ve_it != ve_end; ++ve_it) {
594
595 selectedEhs.insert(*ve_it);
596 }
597 }
598
599 }
600
601 for (typename std::set<typename MeshT::EdgeHandle>::const_iterator it = selectedEhs.begin(); it != selectedEhs.end(); ++it)
602 _mesh->status(*it).set_selected(true);
603 }
604
605 //=========================================================
606
607
608 template< typename MeshT >
609 inline
610 void selectBoundaryEdges(MeshT* _mesh) {
611 typename MeshT::EdgeIter e_it, e_end=_mesh->edges_end();
612
613 for (e_it = _mesh->edges_begin(); e_it != e_end ; ++e_it)
614 if ( _mesh->is_boundary( _mesh->halfedge_handle(*e_it,0) ) ||
615 _mesh->is_boundary( _mesh->halfedge_handle(*e_it,1) ) )
616 _mesh->status(*e_it).set_selected( true );
617 }
618
619 //=========================================================
620
621 template< typename MeshT >
622 inline
623 std::vector< int > getEdgeSelection(MeshT* _mesh) {
624 std::vector< int > selection;
625
626 for ( typename MeshT::EdgeIter e_it= _mesh->edges_begin() ; e_it != _mesh->edges_end() ; ++e_it )
627 if ( _mesh->status(*e_it).selected() )
628 selection.push_back( e_it->idx() );
629
630 return selection;
631 }
632
633 //=========================================================
634
635 template< typename MeshT >
636 inline
637 std::vector< int > getEdgeSelection(MeshT* _mesh, bool& _invert) {
638 std::vector< int > selection;
639
640 int count = 0;
641
642 for ( typename MeshT::VertexIter e_it= _mesh->edges_begin() ; e_it != _mesh->edges_end() ; ++e_it )
643 if ( _mesh->status(*e_it).selected() )
644 ++count;
645
646 if ( count > (int)( _mesh->n_vertices() / 2) )
647 _invert = true;
648 else
649 _invert = false;
650
651 for ( typename MeshT::VertexIter e_it= _mesh->edges_begin() ; e_it != _mesh->edges_end() ; ++e_it )
652 if ( _mesh->status(*e_it).selected() ^ _invert )
653 selection.push_back( e_it->idx() );
654
655 return selection;
656 }
657
658 template< typename MeshT >
659 inline
660 void convertEdgeToVertexSelection(MeshT* _mesh, const std::vector< int >& _edges) {
661
662 for (std::vector<int>::const_iterator e = _edges.begin(); e != _edges.end(); ++e) {
663
664 typename MeshT::EdgeHandle eh(*e);
665 typename MeshT::HalfedgeHandle heh0 = _mesh->halfedge_handle(eh, 0);
666
667 typename MeshT::VertexHandle vh0 = _mesh->to_vertex_handle(heh0);
668 typename MeshT::VertexHandle vh1 = _mesh->from_vertex_handle(heh0);
669
670 _mesh->status(vh0).set_selected(true);
671 _mesh->status(vh1).set_selected(true);
672 }
673 }
674
675 template< typename MeshT >
676 inline
677 void convertEdgeToVertexSelection(MeshT* _mesh) {
678
679 for ( typename MeshT::EdgeIter e_it= _mesh->edges_begin() ; e_it != _mesh->edges_end() ; ++e_it )
680
681 if ( _mesh->status(*e_it).selected() ){
682
683 typename MeshT::HalfedgeHandle heh0 = _mesh->halfedge_handle(*e_it, 0);
684
685 typename MeshT::VertexHandle vh0 = _mesh->to_vertex_handle(heh0);
686 typename MeshT::VertexHandle vh1 = _mesh->from_vertex_handle(heh0);
687
688 _mesh->status(vh0).set_selected(true);
689 _mesh->status(vh1).set_selected(true);
690 }
691 }
692
693 template< typename MeshT >
694 inline
695 void convertEdgeToFaceSelection(MeshT* _mesh, const std::vector< int >& _edges) {
696
697 for(typename MeshT::FaceIter f_it = _mesh->faces_begin(); f_it != _mesh->faces_end(); ++f_it) {
698 typename MeshT::FaceEdgeIter fe_it = _mesh->fe_iter(*f_it);
699 // go over each edge of each face and test if it's selected
700 bool allfound = true;
701 for(; fe_it.is_valid(); ++fe_it) {
702 // search fe_it in _edges
703 bool onefound = false;
704 for(std::vector<int>::const_iterator it = _edges.begin(); it != _edges.end(); ++it) {
705 if((*it) == fe_it->idx()) { onefound = true; break; }
706 }
707 if(!onefound) {
708 allfound = false;
709 break;
710 }
711 }
712 if(allfound) {
713 // all incident vertices are selected -> select face
714 _mesh->status(*f_it).set_selected(true);
715 }
716 }
717 }
718
719 template< typename MeshT >
720 inline
721 void convertEdgeToFaceSelection(MeshT* _mesh) {
722
723 typename MeshT::FaceIter f_it, f_end = _mesh->faces_end();
724
725 for (f_it = _mesh->faces_begin(); f_it != f_end; ++f_it) {
726
727 typename MeshT::FaceEdgeIter fe_it = _mesh->fe_iter(*f_it);
728 // test if all incident edges are selected
729 bool allfound = true;
730 for(; fe_it.is_valid(); ++fe_it) {
731 if(!_mesh->status(*fe_it).selected()) {
732 allfound = false;
733 break;
734 }
735 }
736 if(allfound)
737 _mesh->status(*f_it).set_selected(true);
738 }
739 }
740
741 template< typename MeshT >
742 inline
743 void convertEdgeToHalfedgeSelection(MeshT* _mesh) {
744
745 for ( typename MeshT::EdgeIter e_it= _mesh->edges_begin() ; e_it != _mesh->edges_end() ; ++e_it )
746
747 if ( _mesh->status(*e_it).selected() ){
748
749 _mesh->status(_mesh->halfedge_handle(*e_it, 0)).set_selected(true);
750 _mesh->status(_mesh->halfedge_handle(*e_it, 1)).set_selected(true);
751 }
752 }
753
754 template< typename MeshT >
755 inline
756 void convertEdgeSelectionToFeatureEdges(MeshT* _mesh) {
757
758 for (typename MeshT::EdgeIter e_it = _mesh->edges_begin(); e_it != _mesh->edges_end(); ++e_it) {
759
760 if (_mesh->status(*e_it).selected()) {
761
762 _mesh->status(*e_it).set_feature(true);
763 } else {
764 _mesh->status(*e_it).set_feature(false);
765 }
766 }
767 }
768
769 template< typename MeshT >
770 inline
771 void convertFeatureEdgesToEdgeSelection(MeshT* _mesh) {
772
773 for (typename MeshT::EdgeIter e_it = _mesh->edges_begin(); e_it != _mesh->edges_end(); ++e_it) {
774
775 if (_mesh->status(*e_it).feature()) {
776
777 _mesh->status(*e_it).set_selected(true);
778 } else {
779 _mesh->status(*e_it).set_selected(false);
780 }
781 }
782 }
783
784 template< typename MeshT >
785 inline
786 void clearFeatureEdges(MeshT* _mesh) {
787
788 for (typename MeshT::EdgeIter e_it = _mesh->edges_begin(); e_it != _mesh->edges_end(); ++e_it) {
789
790 _mesh->status(*e_it).set_feature(false);
791 }
792 }
793
794 //=========================================================
795 //== Halfedge Selection =====================================
796 //=========================================================
797
798 template< typename MeshT >
799 inline
800 void selectHalfedges(MeshT* _mesh, const std::vector< int >& _halfedges) {
801 const int n_halfedges = (int)_mesh->n_halfedges();
802
803 for ( uint i = 0 ; i < _halfedges.size() ; ++i )
804 if ( (_halfedges[i] >= 0) && ( _halfedges[i] < n_halfedges ) ) {
805 typename MeshT::HalfedgeHandle heh(_halfedges[i]);
806 _mesh->status(heh).set_selected(true);
807 }
808 }
809
810 //=========================================================
811
812 template< typename MeshT >
813 inline
814 void unselectHalfedges(MeshT* _mesh, const std::vector< int >& _halfedges) {
815 const int n_halfedges = (int)_mesh->n_halfedges();
816
817 for ( uint i = 0 ; i < _halfedges.size() ; ++i )
818 if ( (_halfedges[i] >= 0) && ( _halfedges[i] < n_halfedges ) ) {
819 typename MeshT::HalfedgeHandle heh(_halfedges[i]);
820 _mesh->status(heh).set_selected(false);
821 }
822 }
823
824 //=========================================================
825
826 template< typename MeshT >
827 inline
828 void selectAllHalfedges(MeshT* _mesh) {
829 typename MeshT::HalfedgeIter he_it, he_end=_mesh->halfedges_end();
830
831 for (he_it = _mesh->halfedges_begin(); he_it != he_end ; ++he_it)
832 _mesh->status(*he_it).set_selected(true);
833 }
834
835 //=========================================================
836
837 template< typename MeshT >
838 inline
839 void clearHalfedgeSelection(MeshT* _mesh) {
840 typename MeshT::HalfedgeIter he_it, he_end=_mesh->halfedges_end();
841
842 for (he_it = _mesh->halfedges_begin(); he_it != he_end ; ++he_it)
843 _mesh->status(*he_it).set_selected(false);
844 }
845
846 //=========================================================
847
848 template< typename MeshT >
849 inline
850 void invertHalfedgeSelection(MeshT* _mesh) {
851 typename MeshT::HalfedgeIter he_it, he_end=_mesh->halfedges_end();
852
853 for (he_it = _mesh->halfedges_begin(); he_it != he_end ; ++he_it)
854 _mesh->status(*he_it).set_selected( ! _mesh->status(*he_it).selected());
855 }
856
857 //=========================================================
858
859
860 template< typename MeshT >
861 inline
862 void selectBoundaryHalfedges(MeshT* _mesh) {
863 typename MeshT::HalfedgeIter he_it, he_end=_mesh->halfedges_end();
864
865 for (he_it = _mesh->halfedges_begin(); he_it != he_end ; ++he_it)
866 if ( _mesh->is_boundary( *he_it))
867 _mesh->status(*he_it).set_selected( true );
868 }
869
870 //=========================================================
871
872 template< typename MeshT >
873 inline
874 std::vector< int > getHalfedgeSelection(MeshT* _mesh) {
875 std::vector< int > selection;
876
877 for ( typename MeshT::HalfedgeIter he_it= _mesh->halfedges_begin() ; he_it != _mesh->halfedges_end() ; ++he_it )
878 if ( _mesh->status(*he_it).selected() )
879 selection.push_back( he_it->idx() );
880
881 return selection;
882 }
883
884 template< typename MeshT >
885 inline
886 void convertHalfedgeToVertexSelection(MeshT* _mesh) {
887
888 for ( typename MeshT::HalfedgeIter he_it= _mesh->halfedges_begin() ; he_it != _mesh->halfedges_end() ; ++he_it ) {
889
890 if(_mesh->status(*he_it).selected()) {
891 _mesh->status(_mesh->to_vertex_handle(*he_it)).set_selected(true);
892 _mesh->status(_mesh->from_vertex_handle(*he_it)).set_selected(true);
893 }
894 }
895 }
896
897 template< typename MeshT >
898 inline
899 void convertHalfedgeToEdgeSelection(MeshT* _mesh) {
900
901 for ( typename MeshT::HalfedgeIter he_it= _mesh->halfedges_begin() ; he_it != _mesh->halfedges_end() ; ++he_it ) {
902
903 if(_mesh->status(*he_it).selected()) {
904 _mesh->status(_mesh->edge_handle(*he_it)).set_selected(true);
905 }
906 }
907 }
908
909 template< typename MeshT >
910 inline
911 void convertHalfedgeToFaceSelection(MeshT* _mesh) {
912 // Note: A face is not only selected
913 // iff all incident halfedges are selected but
914 // at least one of them. This is, however,
915 // desired in some cases.
916 for ( typename MeshT::HalfedgeIter he_it= _mesh->halfedges_begin() ; he_it != _mesh->halfedges_end() ; ++he_it ) {
917
918 if(_mesh->status(*he_it).selected()) {
919 _mesh->status(_mesh->face_handle(*he_it)).set_selected(true);
920 }
921 }
922 }
923
924 //=========================================================
925 //== Face Selection =======================================
926 //=========================================================
927
928 template< typename MeshT >
929 inline
930 void selectFaces(MeshT* _mesh, const std::vector< int >& _faces) {
931 const int n_faces = (int)_mesh->n_faces();
932
933 for ( uint i = 0 ; i < _faces.size() ; ++i )
934 if ( (_faces[i] >= 0) && ( _faces[i] < n_faces ) ) {
935 typename MeshT::FaceHandle fh(_faces[i]);
936 _mesh->status(fh).set_selected(true);
937 }
938 }
939
940 //=========================================================
941
942 template< typename MeshT >
943 inline
944 void unselectFaces(MeshT* _mesh, const std::vector< int >& _faces) {
945 const int n_faces = (int)_mesh->n_faces();
946
947 for ( uint i = 0 ; i < _faces.size() ; ++i )
948 if ( (_faces[i] >= 0) && ( _faces[i] < n_faces ) ) {
949 typename MeshT::FaceHandle fh(_faces[i]);
950 _mesh->status(fh).set_selected(false);
951 }
952 }
953
954 //=========================================================
955
956 template< typename MeshT >
957 inline
958 void selectAllFaces(MeshT* _mesh) {
959 typename MeshT::FaceIter f_it, f_end=_mesh->faces_end();
960
961 for (f_it = _mesh->faces_begin(); f_it != f_end ; ++f_it)
962 _mesh->status(*f_it).set_selected(true);
963 }
964
965 //=========================================================
966
967
968 template< typename MeshT >
969 inline
970 void clearFaceSelection(MeshT* _mesh) {
971 typename MeshT::FaceIter f_it, f_end=_mesh->faces_end();
972
973 for (f_it = _mesh->faces_begin(); f_it != f_end ; ++f_it)
974 _mesh->status(*f_it).set_selected(false);
975 }
976
977 //-----------------------------------------------------------------------------
978
979
980 template< typename MeshT >
981 inline
982 void invertFaceSelection(MeshT* _mesh) {
983 typename MeshT::FaceIter f_it, f_end=_mesh->faces_end();
984
985 for (f_it = _mesh->faces_begin(); f_it != f_end ; ++f_it)
986 _mesh->status(*f_it).set_selected( ! _mesh->status(*f_it).selected());
987 }
988
989 //=========================================================
990
991 template< typename MeshT >
992 inline
993 void selectBoundaryFaces(MeshT* _mesh) {
994 typename MeshT::HalfedgeIter he_it, he_end=_mesh->halfedges_end();
995
996 for (he_it = _mesh->halfedges_begin(); he_it != he_end ; ++he_it)
997 if (_mesh->is_boundary(*he_it) ) {
998 for (typename MeshT::VertexFaceIter vf_it(*_mesh ,_mesh->to_vertex_handle(*he_it) ) ; vf_it.is_valid() ; ++vf_it)
999 _mesh->status(*vf_it).set_selected(true);
1000 for (typename MeshT::VertexFaceIter vf_it(*_mesh ,_mesh->from_vertex_handle(*he_it) ) ; vf_it.is_valid() ; ++vf_it)
1001 _mesh->status(*vf_it).set_selected(true);
1002 }
1003 }
1004
1005 //=========================================================
1006
1007
1008 template< typename MeshT >
1009 inline
1010 void shrinkFaceSelection(MeshT* _mesh) {
1011 OpenMesh::FPropHandleT< bool > temp_shrink;
1012
1013 _mesh->add_property( temp_shrink, "Temp property for Face selection shrinking" );
1014
1015 typename MeshT::FaceIter f_it, f_end=_mesh->faces_end();
1016
1017 // initialize property ( copy status to new property )
1018 for (f_it = _mesh->faces_begin(); f_it != f_end ; ++f_it)
1019 _mesh->property(temp_shrink,*f_it) = _mesh->status(*f_it).selected();
1020
1021 // Shrink selection ( deselects all faces which are adjacent to a boundary vertex of the original selection)
1022 for (f_it = _mesh->faces_begin(); f_it != f_end ; ++f_it)
1023 if ( _mesh->property(temp_shrink,*f_it) ) {
1024 bool boundary = false;
1025 for ( typename MeshT::FaceVertexIter fv_it(*_mesh,*f_it); fv_it.is_valid() ; ++fv_it) {
1026 for ( typename MeshT::VertexFaceIter vf_it(*_mesh,*fv_it); vf_it.is_valid() ; ++vf_it) {
1027 if ( ! _mesh->property(temp_shrink,*vf_it) ) {
1028 boundary = true;
1029 }
1030 }
1031 if ( boundary )
1032 break;
1033 }
1034
1035 _mesh->status(*f_it).set_selected( !boundary );
1036 }
1037
1038 _mesh->remove_property(temp_shrink);
1039 }
1040
1041 //=========================================================
1042
1043 template< typename MeshT >
1044 inline
1045 void growFaceSelection(MeshT* _mesh) {
1046 OpenMesh::FPropHandleT< bool > temp_grow;
1047
1048 _mesh->add_property( temp_grow, "Temp property for Face selection growing" );
1049
1050 typename MeshT::FaceIter f_it, f_end=_mesh->faces_end();
1051
1052 // initialize property ( copy status to new property )
1053 for (f_it = _mesh->faces_begin(); f_it != f_end ; ++f_it)
1054 _mesh->property(temp_grow,*f_it) = _mesh->status(*f_it).selected();
1055
1056 // Grow selection ( selects all faces which are adjacent to a vertex of a already selected face)
1057 for (f_it = _mesh->faces_begin(); f_it != f_end ; ++f_it)
1058 if ( _mesh->property(temp_grow,*f_it) )
1059 for ( typename MeshT::FaceVertexIter fv_it(*_mesh,*f_it); fv_it.is_valid() ; ++fv_it)
1060 for ( typename MeshT::VertexFaceIter vf_it(*_mesh,*fv_it); vf_it.is_valid() ; ++vf_it)
1061 _mesh->status(*vf_it).set_selected( true );
1062
1063 _mesh->remove_property(temp_grow);
1064 }
1065
1066 //=========================================================
1067
1068 template< typename MeshT >
1069 inline
1070 std::vector< int > getFaceSelection(MeshT* _mesh) {
1071 std::vector< int > selection;
1072
1073 for ( typename MeshT::FaceIter f_it= _mesh->faces_begin() ; f_it != _mesh->faces_end() ; ++f_it )
1074 if ( _mesh->status(*f_it).selected() )
1075 selection.push_back( f_it->idx() );
1076
1077 return selection;
1078 }
1079
1080 //=========================================================
1081
1082 template< typename MeshT >
1083 inline
1084 std::vector< int > getFaceSelection(MeshT* _mesh, bool& _invert) {
1085 std::vector< int > selection;
1086
1087 int count = 0;
1088
1089 for ( typename MeshT::FaceIter f_it= _mesh->faces_begin() ; f_it != _mesh->faces_end() ; ++f_it )
1090 if ( _mesh->status(*f_it).selected() )
1091 ++count;
1092
1093 if ( count > (int)( _mesh->n_vertices() / 2) )
1094 _invert = true;
1095 else
1096 _invert = false;
1097
1098 for ( typename MeshT::FaceIter f_it= _mesh->faces_begin() ; f_it != _mesh->faces_end() ; ++f_it )
1099 if ( _mesh->status(*f_it).selected() ^ _invert )
1100 selection.push_back( f_it->idx() );
1101
1102 return selection;
1103 }
1104
1105 template< typename MeshT >
1106 inline
1107 void convertFaceToVertexSelection(MeshT* _mesh, const std::vector< int >& _faces) {
1108
1109 for (std::vector<int>::const_iterator f = _faces.begin(); f != _faces.end(); ++f) {
1110
1111 typename MeshT::FaceHandle fh(*f);
1112
1113 typename MeshT::FaceVertexIter v_iter = _mesh->fv_iter(fh);
1114
1115 for (; v_iter.is_valid(); ++v_iter) {
1116 _mesh->status(*v_iter).set_selected(true);
1117 }
1118 }
1119 }
1120
1121 template< typename MeshT >
1122 inline
1123 void convertFaceToVertexSelection(MeshT* _mesh) {
1124
1125 for ( typename MeshT::FaceIter f_it= _mesh->faces_begin() ; f_it != _mesh->faces_end() ; ++f_it )
1126
1127 if ( _mesh->status(*f_it).selected() ){
1128
1129 typename MeshT::FaceVertexIter v_iter = _mesh->fv_iter(*f_it);
1130
1131 for (; v_iter.is_valid(); ++v_iter)
1132 _mesh->status(*v_iter).set_selected(true);
1133 }
1134 }
1135
1136 template< typename MeshT >
1137 inline
1138 void convertFaceToEdgeSelection(MeshT* _mesh, const std::vector< int >& _faces) {
1139
1140 for (std::vector<int>::const_iterator f = _faces.begin(); f != _faces.end(); ++f) {
1141
1142 typename MeshT::FaceHandle fh(*f);
1143
1144 typename MeshT::FaceEdgeIter e_iter = _mesh->fe_iter(fh);
1145
1146 for (; e_iter.is_valid(); ++e_iter) {
1147 _mesh->status(*e_iter).set_selected(true);
1148 }
1149 }
1150 }
1151
1152 template< typename MeshT >
1153 inline
1154 void convertFaceToEdgeSelection(MeshT* _mesh) {
1155
1156 for ( typename MeshT::FaceIter f_it= _mesh->faces_begin() ; f_it != _mesh->faces_end() ; ++f_it )
1157
1158 if ( _mesh->status(*f_it).selected() ){
1159
1160 typename MeshT::FaceEdgeIter e_iter = _mesh->fe_iter(*f_it);
1161
1162 for (; e_iter.is_valid(); ++e_iter)
1163 _mesh->status(*e_iter).set_selected(true);
1164 }
1165 }
1166
1167 template< typename MeshT >
1168 inline
1169 void convertFaceToHalfedgeSelection(MeshT* _mesh) {
1170
1171 for ( typename MeshT::FaceIter f_it= _mesh->faces_begin() ; f_it != _mesh->faces_end() ; ++f_it )
1172
1173 if ( _mesh->status(*f_it).selected() ){
1174
1175 typename MeshT::FaceHalfedgeIter fh_iter = _mesh->fh_iter(*f_it);
1176
1177 for (; fh_iter.is_valid(); ++fh_iter)
1178 _mesh->status(*fh_iter).set_selected(true);
1179 }
1180 }
1181
1182 template< typename MeshT >
1183 inline
1184 void convertFaceSelectionToFeatureFaces(MeshT* _mesh) {
1185
1186 for (typename MeshT::FaceIter f_it = _mesh->faces_begin(); f_it != _mesh->faces_end(); ++f_it) {
1187
1188 if (_mesh->status(*f_it).selected()) {
1189
1190 _mesh->status(*f_it).set_feature(true);
1191 } else {
1192 _mesh->status(*f_it).set_feature(false);
1193 }
1194 }
1195 }
1196
1197 template< typename MeshT >
1198 inline
1199 void convertFeatureFacesToFaceSelection(MeshT* _mesh) {
1200
1201 for (typename MeshT::FaceIter f_it = _mesh->faces_begin(); f_it != _mesh->faces_end(); ++f_it) {
1202
1203 if (_mesh->status(*f_it).feature()) {
1204
1205 _mesh->status(*f_it).set_selected(true);
1206 } else {
1207 _mesh->status(*f_it).set_selected(false);
1208 }
1209 }
1210 }
1211
1212 template< typename MeshT >
1213 inline
1214 void clearFeatureFaces(MeshT* _mesh) {
1215
1216 for (typename MeshT::FaceIter f_it = _mesh->faces_begin(); f_it != _mesh->faces_end(); ++f_it) {
1217
1218 _mesh->status(*f_it).set_feature(false);
1219 }
1220 }
1221
1222 //=============================================================================
1223 } // MeshSelection Namespace
1224 //=============================================================================
MeshSelection::convertEdgeToHalfedgeSelection
void convertEdgeToHalfedgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:743
MeshSelection::unselectEdges
void unselectEdges(MeshT *_mesh, const std::vector< int > &_edges)
Unselect given edges of a mesh.
Definition: MeshSelectionT_impl.hh:533
MeshSelection::convertEdgeToFaceSelection
void convertEdgeToFaceSelection(MeshT *_mesh, const std::vector< int > &_edges)
Definition: MeshSelectionT_impl.hh:695
MeshSelection::clearFeatureFaces
void clearFeatureFaces(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1214
MeshSelection::selectHalfedges
void selectHalfedges(MeshT *_mesh, const std::vector< int > &_halfedges)
Select given edges of a mesh.
Definition: MeshSelectionT_impl.hh:800
MeshSelection::invertHalfedgeSelection
void invertHalfedgeSelection(MeshT *_mesh)
Invert Edge selection.
Definition: MeshSelectionT_impl.hh:850
MeshSelection::selectAllEdges
void selectAllEdges(MeshT *_mesh)
Select all edges of a mesh.
Definition: MeshSelectionT_impl.hh:547
MeshSelection::clearFeatureVertices
void clearFeatureVertices(MeshT *_mesh)
Clear all features.
Definition: MeshSelectionT_impl.hh:445
MeshSelection::selectBoundaryEdges
void selectBoundaryEdges(MeshT *_mesh)
Select all boundary edges of a mesh.
Definition: MeshSelectionT_impl.hh:610
MeshSelection::convertVertexSelectionToFeatureVertices
void convertVertexSelectionToFeatureVertices(MeshT *_mesh)
Convert vertex selection to feature selection.
Definition: MeshSelectionT_impl.hh:415
MeshSelection::growVertexSelection
void growVertexSelection(MeshT *_mesh)
Grow vertex selection.
Definition: MeshSelectionT_impl.hh:181
MeshSelection::selectAllHalfedges
void selectAllHalfedges(MeshT *_mesh)
Select all edges of a mesh.
Definition: MeshSelectionT_impl.hh:828
MeshSelection::convertFeatureVerticesToVertexSelection
void convertFeatureVerticesToVertexSelection(MeshT *_mesh)
Convert feature selection to vertex selection.
Definition: MeshSelectionT_impl.hh:430
MeshSelection
Definition: MeshSelectionT.hh:70
MeshSelection::selectEdges
void selectEdges(MeshT *_mesh, const std::vector< int > &_edges, const double _dihedral_angle_threshold=0.0)
Select given edges of a mesh.
Definition: MeshSelectionT_impl.hh:518
MeshSelection::unselectHalfedges
void unselectHalfedges(MeshT *_mesh, const std::vector< int > &_halfedges)
Unselect given edges of a mesh.
Definition: MeshSelectionT_impl.hh:814
MeshSelection::convertHalfedgeToVertexSelection
void convertHalfedgeToVertexSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:886
MeshSelection::growEdgeSelection
void growEdgeSelection(MeshT *_mesh)
Invert Edge selection.
Definition: MeshSelectionT_impl.hh:580
MeshSelection::selectAllVertices
void selectAllVertices(MeshT *_mesh)
Select all vertices of a mesh.
Definition: MeshSelectionT_impl.hh:102
MeshSelection::convertFaceToEdgeSelection
void convertFaceToEdgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1154
MeshSelection::selectVertices
void selectVertices(MeshT *_mesh, const std::vector< int > &_vertices)
Select given vertices of a mesh.
Definition: MeshSelectionT_impl.hh:74
MeshSelection::invertEdgeSelection
void invertEdgeSelection(MeshT *_mesh)
Invert Edge selection.
Definition: MeshSelectionT_impl.hh:569
MeshSelection::clearHalfedgeSelection
void clearHalfedgeSelection(MeshT *_mesh)
Set all edges to unselected.
Definition: MeshSelectionT_impl.hh:839
MeshSelection::convertEdgeToVertexSelection
void convertEdgeToVertexSelection(MeshT *_mesh, const std::vector< int > &_edges)
Definition: MeshSelectionT_impl.hh:660
MeshSelection::shrinkVertexSelection
void shrinkVertexSelection(MeshT *_mesh)
Shrink vertex selection.
Definition: MeshSelectionT_impl.hh:151
MeshSelection::convertVertexToHalfedgeSelection
void convertVertexToHalfedgeSelection(MeshT *_mesh, const std::vector< int > &_vertices)
Select for each vertex in _vertices all incident halfedges.
Definition: MeshSelectionT_impl.hh:319
MeshSelection::getFaceSelection
std::vector< int > getFaceSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1070
MeshSelection::selectAllFaces
void selectAllFaces(MeshT *_mesh)
Select all faces of a mesh.
Definition: MeshSelectionT_impl.hh:958
MeshSelectionT.hh
Functions for selection on a mesh.
MeshSelection::getHalfedgeSelection
std::vector< int > getHalfedgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:874
MeshSelection::clearEdgeSelection
void clearEdgeSelection(MeshT *_mesh)
Set all edges to unselected.
Definition: MeshSelectionT_impl.hh:558
MeshSelection::shrinkFaceSelection
void shrinkFaceSelection(MeshT *_mesh)
Shrink Face selection.
Definition: MeshSelectionT_impl.hh:1010
MeshSelection::selectBoundaryVertices
void selectBoundaryVertices(MeshT *_mesh)
Select all vertices of the mesh which are boundary vertices.
Definition: MeshSelectionT_impl.hh:137
MeshSelection::clearVertexSelection
void clearVertexSelection(MeshT *_mesh)
Set all vertices to unselected.
Definition: MeshSelectionT_impl.hh:114
MeshSelection::convertFaceSelectionToFeatureFaces
void convertFaceSelectionToFeatureFaces(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1184
MeshSelection::convertHalfedgeToFaceSelection
void convertHalfedgeToFaceSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:911
MeshSelection::convertVertexToEdgeSelection
void convertVertexToEdgeSelection(MeshT *_mesh, const std::vector< int > &_vertices)
Select for each vertex in _vertices all incident edges.
Definition: MeshSelectionT_impl.hh:276
MeshSelection::unselectFaces
void unselectFaces(MeshT *_mesh, const std::vector< int > &_faces)
Unselect given faces of a mesh.
Definition: MeshSelectionT_impl.hh:944
MeshSelection::convertFeatureEdgesToEdgeSelection
void convertFeatureEdgesToEdgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:771
MeshSelection::invertFaceSelection
void invertFaceSelection(MeshT *_mesh)
Invert face selection.
Definition: MeshSelectionT_impl.hh:982
MeshSelection::getVertexSelection
std::vector< int > getVertexSelection(MeshT *_mesh)
Get the current vertex selection.
Definition: MeshSelectionT_impl.hh:204
MeshSelection::convertVertexToFaceSelection
void convertVertexToFaceSelection(MeshT *_mesh, const std::vector< int > &_vertices)
Select for each vertex in _vertices all adjacent faces.
Definition: MeshSelectionT_impl.hh:367
MeshSelection::selectFaces
void selectFaces(MeshT *_mesh, const std::vector< int > &_faces)
Select given faces of a mesh.
Definition: MeshSelectionT_impl.hh:930
MeshSelection::convertFeatureFacesToFaceSelection
void convertFeatureFacesToFaceSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1199
MeshSelection::invertVertexSelection
void invertVertexSelection(MeshT *_mesh)
invert vertex selection
Definition: MeshSelectionT_impl.hh:125
MeshSelection::growFaceSelection
void growFaceSelection(MeshT *_mesh)
Grow Face selection.
Definition: MeshSelectionT_impl.hh:1045
MeshSelection::selectBoundaryFaces
void selectBoundaryFaces(MeshT *_mesh)
Select all boundary faces of a mesh.
Definition: MeshSelectionT_impl.hh:993
MeshSelection::clearFaceSelection
void clearFaceSelection(MeshT *_mesh)
Set all faces to unselected.
Definition: MeshSelectionT_impl.hh:970
MeshSelection::convertHalfedgeToEdgeSelection
void convertHalfedgeToEdgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:899
MeshSelection::convertFaceToHalfedgeSelection
void convertFaceToHalfedgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1169
MeshSelection::getArea
std::vector< int > getArea(MeshT *_mesh, unsigned int _type)
Definition: MeshSelectionT_impl.hh:478
MeshSelection::convertEdgeSelectionToFeatureEdges
void convertEdgeSelectionToFeatureEdges(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:756
MeshSelection::selectBoundaryHalfedges
void selectBoundaryHalfedges(MeshT *_mesh)
Select all boundary edges of a mesh.
Definition: MeshSelectionT_impl.hh:862
MeshSelection::convertFaceToVertexSelection
void convertFaceToVertexSelection(MeshT *_mesh, const std::vector< int > &_faces)
Definition: MeshSelectionT_impl.hh:1107
MeshSelection::setArea
void setArea(MeshT *_mesh, const std::vector< int > &_vertices, unsigned int _type, bool _state)
Set the area bit for all defined vertices.
Definition: MeshSelectionT_impl.hh:459
MeshSelection::unselectVertices
void unselectVertices(MeshT *_mesh, const std::vector< int > &_vertices)
Unselect given vertices of a mesh.
Definition: MeshSelectionT_impl.hh:88
OpenMesh::FPropHandleT< bool >
MeshSelection::clearFeatureEdges
void clearFeatureEdges(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:786
OpenMesh::VPropHandleT< bool >
MeshSelection::getEdgeSelection
std::vector< int > getEdgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:623