Developer Documentation

MeshSelectionT.hh
Go to the documentation of this file.
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 //
50 //=============================================================================
51
52
53 #ifndef MESHSELECTION_HH
54 #define MESHSELECTION_HH
55
56
62 //== INCLUDES =================================================================
63
64 #include <OpenMesh/Core/Mesh/Handles.hh>
65 #include <vector>
66
67 //== FORWARDDECLARATIONS ======================================================
68
69 //== NAMESPACES ===============================================================
70
71 namespace MeshSelection {
72
73 //== DEFINITIONS ==============================================================
74
75
76 //===========================================================================
79 //===========================================================================
80
85 template< typename MeshT >
86 inline
87 void selectVertices(MeshT* _mesh, const std::vector< int >& _vertices);
88
94 template< typename MeshT >
95 inline
96 void selectElements(MeshT* _mesh, const std::vector< int >& _vertices, OpenMesh::VertexHandle /*_tag*/)
97 {
98 selectVertices(_mesh, _vertices);
99 }
100
101
106 template< typename MeshT >
107 inline
108 void unselectVertices(MeshT* _mesh, const std::vector< int >& _vertices);
109
113 template< typename MeshT >
114 inline
115 void selectAllVertices(MeshT* _mesh);
116
120 template< typename MeshT >
121 inline
122 void clearVertexSelection(MeshT* _mesh);
123
127 template< typename MeshT >
128 inline
129 void invertVertexSelection(MeshT* _mesh);
130
135 template< typename MeshT >
136 inline
137 void selectBoundaryVertices(MeshT* _mesh);
138
142 template< typename MeshT >
143 inline
144 void shrinkVertexSelection(MeshT* _mesh) ;
145
149 template< typename MeshT >
150 inline
151 void growVertexSelection(MeshT* _mesh);
152
158 template< typename MeshT >
159 inline
160 std::vector< int > getVertexSelection(MeshT* _mesh);
161
167 template< typename MeshT >
168 inline
169 std::vector< int > getVertexSelection(MeshT* _mesh, bool& _invert);
170
180 template< typename MeshT >
181 inline
182 void selectBoundaryVertices(MeshT* _mesh, const typename MeshT::VertexHandle& _vh);
183
189 template< typename MeshT >
190 inline
191 void convertVertexToEdgeSelection(MeshT* _mesh, const std::vector< int >& _vertices);
192
197 template< typename MeshT >
198 inline
199 void convertVertexToEdgeSelection(MeshT* _mesh);
200
206 template< typename MeshT >
207 inline
208 void convertVertexToHalfedgeSelection(MeshT* _mesh, const std::vector< int >& _vertices);
209
214 template< typename MeshT >
215 inline
216 void convertVertexToHalfedgeSelection(MeshT* _mesh);
217
223 template< typename MeshT >
224 inline
225 void convertVertexToFaceSelection(MeshT* _mesh, const std::vector< int >& _vertices);
226
231 template< typename MeshT >
232 inline
233 void convertVertexToFaceSelection(MeshT* _mesh);
234
239 template< typename MeshT >
240 inline
241 void convertVertexSelectionToFeatureVertices(MeshT* _mesh);
242
247 template< typename MeshT >
248 inline
249 void convertFeatureVerticesToVertexSelection(MeshT* _mesh);
250
255 template< typename MeshT >
256 inline
257 void clearFeatureVertices(MeshT* _mesh);
258
261 //===========================================================================
264 //===========================================================================
265
273 template< typename MeshT >
274 inline
275 void setArea(MeshT* _mesh, const std::vector< int >& _vertices , unsigned int _type, bool _state);
276
283 template< typename MeshT >
284 inline
285 void setArea(MeshT* _mesh , unsigned int _type, bool _state);
286
289 template< typename MeshT >
290 inline
291 std::vector< int > getArea(MeshT* _mesh, unsigned int _type);
292
299 template< typename MeshT >
300 inline
301 std::vector< int > getArea(MeshT* _mesh, unsigned int _type , bool& _invert);
302
305 //===========================================================================
308 //===========================================================================
309
315 template< typename MeshT >
316 inline
317 void selectEdges(MeshT* _mesh, const std::vector< int >& _edges, const double _dihedral_angle_threshold = 0.0);
318
319
326 template< typename MeshT >
327 inline
328 void selectElements(MeshT* _mesh, const std::vector< int >& _edges, OpenMesh::EdgeHandle /*_tag*/)
329 {
330 selectEdges(_mesh, _edges);
331 }
332
334 template< typename MeshT >
335 inline
336 void unselectEdges(MeshT* _mesh, const std::vector< int >& _edges);
337
339 template< typename MeshT >
340 inline
341 void selectAllEdges(MeshT* _mesh);
342
344 template< typename MeshT >
345 inline
346 void clearEdgeSelection(MeshT* _mesh);
347
349 template< typename MeshT >
350 inline
351 void invertEdgeSelection(MeshT* _mesh);
352
354 template< typename MeshT >
355 inline
356 void growEdgeSelection(MeshT* _mesh);
357
359 template< typename MeshT >
360 void selectBoundaryEdges(MeshT* _mesh);
361
364 template< typename MeshT >
365 inline
366 std::vector< int > getEdgeSelection(MeshT* _mesh);
367
372 template< typename MeshT >
373 inline
374 std::vector< int > getEdgeSelection(MeshT* _mesh, bool& _invert);
375
381 template< typename MeshT >
382 inline
383 void convertEdgeToVertexSelection(MeshT* _mesh, const std::vector< int >& _edges);
384
388 template< typename MeshT >
389 inline
390 void convertEdgeToVertexSelection(MeshT* _mesh);
391
397 template< typename MeshT >
398 inline
399 void convertEdgeToFaceSelection(MeshT* _mesh, const std::vector< int >& _edges);
400
404 template< typename MeshT >
405 inline
406 void convertEdgeToFaceSelection(MeshT* _mesh);
407
411 template< typename MeshT >
412 inline
413 void convertEdgeToHalfedgeSelection(MeshT* _mesh);
414
418 template< typename MeshT >
419 inline
420 void convertEdgeSelectionToFeatureEdges(MeshT* _mesh);
421
425 template< typename MeshT >
426 inline
427 void convertFeatureEdgesToEdgeSelection(MeshT* _mesh);
428
432 template< typename MeshT >
433 inline
434 void clearFeatureEdges(MeshT* _mesh);
435
436
439 //===========================================================================
442 //===========================================================================
443
448 template< typename MeshT >
449 inline
450 void selectHalfedges(MeshT* _mesh, const std::vector< int >& _halfedges);
451
457 template< typename MeshT >
458 inline
459 void selectElements(MeshT* _mesh, const std::vector< int >& _halfedges, OpenMesh::HalfedgeHandle /*_tag*/)
460 {
461 selectHalfedges(_mesh, _halfedges);
462 }
463
465 template< typename MeshT >
466 inline
467 void unselectHalfedges(MeshT* _mesh, const std::vector< int >& _halfedges);
468
470 template< typename MeshT >
471 inline
472 void selectAllHalfedges(MeshT* _mesh);
473
475 template< typename MeshT >
476 inline
477 void clearHalfedgeSelection(MeshT* _mesh);
478
480 template< typename MeshT >
481 inline
482 void invertHalfedgeSelection(MeshT* _mesh);
483
485 template< typename MeshT >
486 void selectBoundaryHalfedges(MeshT* _mesh);
487
490 template< typename MeshT >
491 inline
492 std::vector< int > getHalfedgeSelection(MeshT* _mesh);
493
497 template< typename MeshT >
498 inline
499 void convertHalfedgeToVertexSelection(MeshT* _mesh);
500
504 template< typename MeshT >
505 inline
506 void convertHalfedgeToEdgeSelection(MeshT* _mesh);
507
511 template< typename MeshT >
512 inline
513 void convertHalfedgeToFaceSelection(MeshT* _mesh);
514
515 //===========================================================================
518 //===========================================================================
519
524 template< typename MeshT >
525 inline
526 void selectFaces(MeshT* _mesh, const std::vector< int >& _faces );
527
533 template< typename MeshT >
534 inline
535 void selectElements(MeshT* _mesh, const std::vector< int >& _faces, OpenMesh::FaceHandle /*_tag*/)
536 {
537 selectFaces(_mesh, _faces);
538 }
539
541 template< typename MeshT >
542 inline
543 void unselectFaces(MeshT* _mesh, const std::vector< int >& _faces );
544
546 template< typename MeshT >
547 inline
548 void selectAllFaces(MeshT* _mesh);
549
551 template< typename MeshT >
552 inline
553 void clearFaceSelection(MeshT* _mesh);
554
556 template< typename MeshT >
557 inline
558 void invertFaceSelection(MeshT* _mesh);
559
561 template< typename MeshT >
562 void selectBoundaryFaces(MeshT* _mesh);
563
568 template< typename MeshT >
569 inline
570 void shrinkFaceSelection(MeshT* _mesh);
571
576 template< typename MeshT >
577 inline
578 void growFaceSelection(MeshT* _mesh);
579
582 template< typename MeshT >
583 inline
584 std::vector< int > getFaceSelection(MeshT* _mesh);
585
591 template< typename MeshT >
592 inline
593 std::vector< int > getFaceSelection(MeshT* _mesh, bool& _invert);
594
601 template< typename MeshT >
602 inline
603 void convertFaceToVertexSelection(MeshT* _mesh, const std::vector< int >& _faces);
604
608 template< typename MeshT >
609 inline
610 void convertFaceToVertexSelection(MeshT* _mesh);
611
615 template< typename MeshT >
616 inline
617 void convertFaceToEdgeSelection(MeshT* _mesh);
618
622 template< typename MeshT >
623 inline
624 void convertFaceToHalfedgeSelection(MeshT* _mesh);
625
629 template< typename MeshT >
630 inline
631 void convertFaceSelectionToFeatureFaces(MeshT* _mesh);
632
636 template< typename MeshT >
637 inline
638 void convertFeatureFacesToFaceSelection(MeshT* _mesh);
639
643 template< typename MeshT >
644 inline
645 void clearFeatureFaces(MeshT* _mesh);
646
649 //=============================================================================
650 } // MeshSelection Namespace
651 //=============================================================================
652 #if defined(INCLUDE_TEMPLATES) && !defined(MESHSELECTION_C)
653 #define MESHSELECTION_TEMPLATES
654 #include "MeshSelectionT_impl.hh"
655 #endif
656 //=============================================================================
657 #endif // MESHSELECTION_HH defined
658 //=============================================================================
659
OpenMesh::EdgeHandle
Handle for a edge entity.
Definition: Handles.hh:134
OpenMesh::FaceHandle
Handle for a face entity.
Definition: Handles.hh:141
MeshSelection::selectFaces
void selectFaces(MeshT *_mesh, const std::vector< int > &_faces)
Select given faces of a mesh.
Definition: MeshSelectionT_impl.hh:930
MeshSelection::convertVertexSelectionToFeatureVertices
void convertVertexSelectionToFeatureVertices(MeshT *_mesh)
Convert vertex selection to feature selection.
Definition: MeshSelectionT_impl.hh:415
MeshSelection::convertHalfedgeToEdgeSelection
void convertHalfedgeToEdgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:899
MeshSelection::clearEdgeSelection
void clearEdgeSelection(MeshT *_mesh)
Set all edges to unselected.
Definition: MeshSelectionT_impl.hh:558
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::shrinkFaceSelection
void shrinkFaceSelection(MeshT *_mesh)
Shrink Face selection.
Definition: MeshSelectionT_impl.hh:1010
MeshSelection::convertFeatureEdgesToEdgeSelection
void convertFeatureEdgesToEdgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:771
MeshSelection::unselectHalfedges
void unselectHalfedges(MeshT *_mesh, const std::vector< int > &_halfedges)
Unselect given edges of a mesh.
Definition: MeshSelectionT_impl.hh:814
MeshSelection::invertEdgeSelection
void invertEdgeSelection(MeshT *_mesh)
Invert Edge selection.
Definition: MeshSelectionT_impl.hh:569
OpenMesh::HalfedgeHandle
Handle for a halfedge entity.
Definition: Handles.hh:127
MeshSelection::convertFaceToEdgeSelection
void convertFaceToEdgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1154
MeshSelection::getVertexSelection
std::vector< int > getVertexSelection(MeshT *_mesh)
Get the current vertex selection.
Definition: MeshSelectionT_impl.hh:204
MeshSelection::clearVertexSelection
void clearVertexSelection(MeshT *_mesh)
Set all vertices to unselected.
Definition: MeshSelectionT_impl.hh:114
MeshSelection::convertFeatureFacesToFaceSelection
void convertFeatureFacesToFaceSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1199
MeshSelection::clearFaceSelection
void clearFaceSelection(MeshT *_mesh)
Set all faces to unselected.
Definition: MeshSelectionT_impl.hh:970
MeshSelection::selectBoundaryFaces
void selectBoundaryFaces(MeshT *_mesh)
Select all boundary faces of a mesh.
Definition: MeshSelectionT_impl.hh:993
MeshSelection::convertEdgeToVertexSelection
void convertEdgeToVertexSelection(MeshT *_mesh, const std::vector< int > &_edges)
Definition: MeshSelectionT_impl.hh:660
OpenMesh::VertexHandle
Handle for a vertex entity.
Definition: Handles.hh:120
MeshSelection::invertVertexSelection
void invertVertexSelection(MeshT *_mesh)
invert vertex selection
Definition: MeshSelectionT_impl.hh:125
MeshSelection::selectAllFaces
void selectAllFaces(MeshT *_mesh)
Select all faces of a mesh.
Definition: MeshSelectionT_impl.hh:958
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::clearFeatureVertices
void clearFeatureVertices(MeshT *_mesh)
Clear all features.
Definition: MeshSelectionT_impl.hh:445
MeshSelection::convertFaceToVertexSelection
void convertFaceToVertexSelection(MeshT *_mesh, const std::vector< int > &_faces)
Definition: MeshSelectionT_impl.hh:1107
MeshSelection::shrinkVertexSelection
void shrinkVertexSelection(MeshT *_mesh)
Shrink vertex selection.
Definition: MeshSelectionT_impl.hh:151
MeshSelection::unselectFaces
void unselectFaces(MeshT *_mesh, const std::vector< int > &_faces)
Unselect given faces of a mesh.
Definition: MeshSelectionT_impl.hh:944
MeshSelection::convertHalfedgeToFaceSelection
void convertHalfedgeToFaceSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:911
MeshSelection::selectElements
void selectElements(MeshT *_mesh, const std::vector< int > &_vertices, OpenMesh::VertexHandle)
Select given vertices of a mesh Same as selectVertices.
Definition: MeshSelectionT.hh:96
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::convertEdgeToHalfedgeSelection
void convertEdgeToHalfedgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:743
MeshSelection::clearFeatureFaces
void clearFeatureFaces(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1214
MeshSelection::getHalfedgeSelection
std::vector< int > getHalfedgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:874
MeshSelection::invertHalfedgeSelection
void invertHalfedgeSelection(MeshT *_mesh)
Invert Edge selection.
Definition: MeshSelectionT_impl.hh:850
MeshSelection::selectHalfedges
void selectHalfedges(MeshT *_mesh, const std::vector< int > &_halfedges)
Select given halfedges of a mesh.
Definition: MeshSelectionT_impl.hh:800
MeshSelection::convertEdgeToFaceSelection
void convertEdgeToFaceSelection(MeshT *_mesh, const std::vector< int > &_edges)
Definition: MeshSelectionT_impl.hh:695
MeshSelection::selectAllHalfedges
void selectAllHalfedges(MeshT *_mesh)
Select all edges of a mesh.
Definition: MeshSelectionT_impl.hh:828
MeshSelection::convertHalfedgeToVertexSelection
void convertHalfedgeToVertexSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:886
MeshSelection::convertFaceSelectionToFeatureFaces
void convertFaceSelectionToFeatureFaces(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1184
MeshSelection::unselectEdges
void unselectEdges(MeshT *_mesh, const std::vector< int > &_edges)
Unselect given edges of a mesh.
Definition: MeshSelectionT_impl.hh:533
MeshSelection::getEdgeSelection
std::vector< int > getEdgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:623
MeshSelection::convertFaceToHalfedgeSelection
void convertFaceToHalfedgeSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1169
MeshSelection
Definition: MeshSelectionT.hh:71
MeshSelection::unselectVertices
void unselectVertices(MeshT *_mesh, const std::vector< int > &_vertices)
Unselect given vertices of a mesh.
Definition: MeshSelectionT_impl.hh:88
MeshSelection::getArea
std::vector< int > getArea(MeshT *_mesh, unsigned int _type)
Definition: MeshSelectionT_impl.hh:478
MeshSelection::growFaceSelection
void growFaceSelection(MeshT *_mesh)
Grow Face selection.
Definition: MeshSelectionT_impl.hh:1045
MeshSelection::convertFeatureVerticesToVertexSelection
void convertFeatureVerticesToVertexSelection(MeshT *_mesh)
Convert feature selection to vertex selection.
Definition: MeshSelectionT_impl.hh:430
MeshSelection::invertFaceSelection
void invertFaceSelection(MeshT *_mesh)
Invert face selection.
Definition: MeshSelectionT_impl.hh:982
MeshSelection::growVertexSelection
void growVertexSelection(MeshT *_mesh)
Grow vertex selection.
Definition: MeshSelectionT_impl.hh:181
MeshSelection::clearHalfedgeSelection
void clearHalfedgeSelection(MeshT *_mesh)
Set all edges to unselected.
Definition: MeshSelectionT_impl.hh:839
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::selectAllEdges
void selectAllEdges(MeshT *_mesh)
Select all edges of a mesh.
Definition: MeshSelectionT_impl.hh:547
MeshSelection::convertEdgeSelectionToFeatureEdges
void convertEdgeSelectionToFeatureEdges(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:756
MeshSelection::selectBoundaryEdges
void selectBoundaryEdges(MeshT *_mesh)
Select all boundary edges of a mesh.
Definition: MeshSelectionT_impl.hh:610
MeshSelection::selectBoundaryVertices
void selectBoundaryVertices(MeshT *_mesh)
Select all vertices of the mesh which are boundary vertices.
Definition: MeshSelectionT_impl.hh:137
MeshSelection::getFaceSelection
std::vector< int > getFaceSelection(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:1070
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::growEdgeSelection
void growEdgeSelection(MeshT *_mesh)
Invert Edge selection.
Definition: MeshSelectionT_impl.hh:580
MeshSelection::clearFeatureEdges
void clearFeatureEdges(MeshT *_mesh)
Definition: MeshSelectionT_impl.hh:786
MeshSelection::selectAllVertices
void selectAllVertices(MeshT *_mesh)
Select all vertices of a mesh.
Definition: MeshSelectionT_impl.hh:102
MeshSelection::selectBoundaryHalfedges
void selectBoundaryHalfedges(MeshT *_mesh)
Select all boundary edges of a mesh.
Definition: MeshSelectionT_impl.hh:862
MeshSelection::selectVertices
void selectVertices(MeshT *_mesh, const std::vector< int > &_vertices)
Select given vertices of a mesh.
Definition: MeshSelectionT_impl.hh:74