VCG Library
Loading...
Searching...
No Matches
selection.h
1/****************************************************************************
2* VCGLib o o *
3* Visual and Computer Graphics Library o o *
4* _ O _ *
5* Copyright(C) 2004-2016 \/)\/ *
6* Visual Computing Lab /\/| *
7* ISTI - Italian National Research Council | *
8* \ *
9* All rights reserved. *
10* *
11* This program is free software; you can redistribute it and/or modify *
12* it under the terms of the GNU General Public License as published by *
13* the Free Software Foundation; either version 2 of the License, or *
14* (at your option) any later version. *
15* *
16* This program is distributed in the hope that it will be useful, *
17* but WITHOUT ANY WARRANTY; without even the implied warranty of *
18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
20* for more details. *
21* *
22****************************************************************************/
23#ifndef __VCG_TRI_UPDATE_SELECTION
24#define __VCG_TRI_UPDATE_SELECTION
25
26#include <deque>
27
28#include <vcg/complex/base.h>
29#include <vcg/simplex/face/topology.h>
30
31#include "flag.h"
32
33namespace vcg {
34namespace tri {
37
41template <class ComputeMeshType>
43{
44 typedef typename ComputeMeshType::template PerVertexAttributeHandle< bool > vsHandle;
45 typedef typename ComputeMeshType::template PerEdgeAttributeHandle< bool > esHandle;
46 typedef typename ComputeMeshType::template PerFaceAttributeHandle< bool > fsHandle;
47 typedef typename ComputeMeshType::template PerTetraAttributeHandle< bool > tsHandle;
48
49
50public:
51 SelectionStack(ComputeMeshType &m)
52 {
53 _m=&m;
54 }
55
56 bool push()
57 {
58 vsHandle vsH = Allocator<ComputeMeshType>::template AddPerVertexAttribute< bool >(*_m);
59 esHandle esH = Allocator<ComputeMeshType>::template AddPerEdgeAttribute< bool > (*_m);
60 fsHandle fsH = Allocator<ComputeMeshType>::template AddPerFaceAttribute< bool > (*_m);
61 tsHandle tsH = Allocator<ComputeMeshType>::template AddPerTetraAttribute< bool > (*_m);
62 typename ComputeMeshType::VertexIterator vi;
63 for(vi = _m->vert.begin(); vi != _m->vert.end(); ++vi)
64 if( !(*vi).IsD() ) vsH[*vi] = (*vi).IsS() ;
65
66 typename ComputeMeshType::EdgeIterator ei;
67 for(ei = _m->edge.begin(); ei != _m->edge.end(); ++ei)
68 if( !(*ei).IsD() ) esH[*ei] = (*ei).IsS() ;
69
70 typename ComputeMeshType::FaceIterator fi;
71 for(fi = _m->face.begin(); fi != _m->face.end(); ++fi)
72 if( !(*fi).IsD() ) fsH[*fi] = (*fi).IsS() ;
73
74 typename ComputeMeshType::TetraIterator ti;
75 for(ti = _m->tetra.begin(); ti != _m->tetra.end(); ++ti)
76 if( !(*ti).IsD() ) tsH[*ti] = (*ti).IsS() ;
77
78 vsV.push_back(vsH);
79 esV.push_back(esH);
80 fsV.push_back(fsH);
81 tsV.push_back(tsH);
82 return true;
83 }
84
85 bool popOr()
86 {
87 return pop(true,false);
88 }
89
90 bool popAnd()
91 {
92 return pop(false,true);
93 }
94
99 bool pop(bool orFlag=false, bool andFlag=false)
100 {
101 if(vsV.empty()) return false;
102 if(orFlag && andFlag) return false;
103
104 vsHandle vsH = vsV.back();
105 esHandle esH = esV.back();
106 fsHandle fsH = fsV.back();
107 tsHandle tsH = tsV.back();
108
109 if(! (Allocator<ComputeMeshType>::IsValidHandle(*_m, vsH))) return false;
110
111 for(auto vi = _m->vert.begin(); vi != _m->vert.end(); ++vi)
112 if( !(*vi).IsD() )
113 {
114 if(vsH[*vi]) {
115 if(!andFlag) (*vi).SetS();
116 } else {
117 if(!orFlag) (*vi).ClearS();
118 }
119 }
120
121 for(auto ei = _m->edge.begin(); ei != _m->edge.end(); ++ei)
122 if( !(*ei).IsD() )
123 {
124 if(esH[*ei]) {
125 if(!andFlag) (*ei).SetS();
126 } else {
127 if(!orFlag) (*ei).ClearS();
128 }
129 }
130
131
132 for(auto fi = _m->face.begin(); fi != _m->face.end(); ++fi)
133 if( !(*fi).IsD() )
134 {
135 if(fsH[*fi]) {
136 if(!andFlag) (*fi).SetS();
137 } else {
138 if(!orFlag) (*fi).ClearS();
139 }
140 }
141
142 for (auto ti = _m->tetra.begin(); ti != _m->tetra.end(); ++ti)
143 if (!(*ti).IsD())
144 {
145 if (tsH[*ti]) {
146 if (!andFlag) (*ti).SetS();
147 } else {
148 if (!orFlag) (*ti).ClearS();
149 }
150 }
151
152 Allocator<ComputeMeshType>::template DeletePerVertexAttribute<bool>(*_m,vsH);
153 Allocator<ComputeMeshType>::template DeletePerEdgeAttribute<bool>(*_m,esH);
154 Allocator<ComputeMeshType>::template DeletePerFaceAttribute<bool>(*_m,fsH);
155 Allocator<ComputeMeshType>::template DeletePerTetraAttribute<bool>(*_m,tsH);
156
157 vsV.pop_back();
158 esV.pop_back();
159 fsV.pop_back();
160 tsV.pop_back();
161 return true;
162 }
163
164private:
165 ComputeMeshType *_m;
166 std::vector<vsHandle> vsV;
167 std::vector<esHandle> esV;
168 std::vector<fsHandle> fsV;
169 std::vector<tsHandle> tsV;
170
171};
172
174
176
178
182template <class ComputeMeshType>
184{
185
186public:
187typedef ComputeMeshType MeshType;
188typedef typename MeshType::ScalarType ScalarType;
189typedef typename MeshType::VertexType VertexType;
190typedef typename MeshType::VertexPointer VertexPointer;
191typedef typename MeshType::VertexIterator VertexIterator;
192typedef typename MeshType::EdgeIterator EdgeIterator;
193typedef typename MeshType::EdgeType EdgeType;
194typedef typename MeshType::FaceType FaceType;
195typedef typename MeshType::FacePointer FacePointer;
196typedef typename MeshType::FaceIterator FaceIterator;
197typedef typename MeshType::TetraType TetraType;
198typedef typename MeshType::TetraPointer TetraPointer;
199typedef typename MeshType::TetraIterator TetraIterator;
200
201typedef typename vcg::Box3<ScalarType> Box3Type;
202
204static size_t VertexAll(MeshType &m)
205{
206 for(VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
207 if( !(*vi).IsD() ) (*vi).SetS();
208 return m.vn;
209}
210
212static size_t EdgeAll(MeshType &m)
213{
214 for(EdgeIterator ei = m.edge.begin(); ei != m.edge.end(); ++ei)
215 if( !(*ei).IsD() ) (*ei).SetS();
216 return m.fn;
217}
219static size_t FaceAll(MeshType &m)
220{
221 for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
222 if( !(*fi).IsD() ) (*fi).SetS();
223 return m.fn;
224}
225
227static size_t TetraAll (MeshType & m)
228{
229 ForEachTetra(m, [] (TetraType & t) {
230 t.SetS();
231 });
232
233 return m.tn;
234}
235
237static size_t VertexClear(MeshType &m)
238{
239 for(VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
240 if( !(*vi).IsD() ) (*vi).ClearS();
241 return 0;
242}
243
245static size_t EdgeClear(MeshType &m)
246{
247 for(EdgeIterator ei = m.edge.begin(); ei != m.edge.end(); ++ei)
248 if( !(*ei).IsD() ) (*ei).ClearS();
249 return 0;
250}
251
253static size_t FaceClear(MeshType &m)
254{
255 for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
256 if( !(*fi).IsD() ) (*fi).ClearS();
257 return 0;
258}
259
261static size_t TetraClear (MeshType & m)
262{
263 ForEachTetra(m, [] (TetraType & t) {
264 t.ClearS();
265 });
266
267 return 0;
268}
269
271static void Clear(MeshType &m)
272{
273 VertexClear(m);
274 EdgeClear(m);
275 FaceClear(m);
276 TetraClear(m);
277}
278
280static size_t FaceCount(const MeshType &m)
281{
282 size_t selCnt=0;
283 ForEachFace(m, [&](const FaceType& f){
284 if(f.IsS()) ++selCnt;
285 });
286 return selCnt;
287}
288
290static size_t EdgeCount(const MeshType &m)
291{
292 size_t selCnt=0;
293 ForEachEdge(m, [&](const EdgeType& e){
294 if(e.IsS()) ++selCnt;
295 });
296 return selCnt;
297}
298
300static size_t FaceEdgeCount(const MeshType &m)
301{
302 RequireFFAdjacency(m);
303 size_t selCnt=0;
304 ForEachFace(m, [&](const FaceType& f){
305 for(int i=0;i<f.VN();++i)
306 {
307 if(f.IsFaceEdgeS(i)) ++selCnt;
308 if(f.IsFaceEdgeS(i) && face::IsBorder(f,i)) ++selCnt; // all FaceEdges are counted twice with the exception of the ones on borders
309 }
310 });
311 return selCnt/2;
312}
313
315static size_t VertexCount(const MeshType &m)
316{
317 size_t selCnt=0;
318 ForEachVertex(m, [&](const VertexType& v){
319 if(v.IsS()) ++selCnt;
320 });
321 return selCnt;
322}
323
325static size_t TetraCount (const MeshType & m)
326{
327 size_t selCnt = 0;
328 ForEachTetra(m, [&] (const TetraType & t) {
329 if (t.IsS()) ++selCnt;
330 });
331
332 return selCnt;
333}
335static size_t FaceInvert(MeshType &m)
336{
337 size_t selCnt=0;
338 for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
339 if(!(*fi).IsD())
340 {
341 if((*fi).IsS()) (*fi).ClearS();
342 else {
343 (*fi).SetS();
344 ++selCnt;
345 }
346 }
347 return selCnt;
348}
349
351static size_t EdgeInvert(MeshType &m)
352{
353 size_t selCnt=0;
354 for(EdgeIterator ei=m.edge.begin();ei!=m.edge.end();++ei)
355 if(!(*ei).IsD())
356 {
357 if((*ei).IsS()) (*ei).ClearS();
358 else {
359 (*ei).SetS();
360 ++selCnt;
361 }
362 }
363 return selCnt;
364}
365
367static size_t VertexInvert(MeshType &m)
368{
369 size_t selCnt=0;
370 for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
371 if(!(*vi).IsD())
372 {
373 if((*vi).IsS()) (*vi).ClearS();
374 else {
375 (*vi).SetS();
376 ++selCnt;
377 }
378 }
379 return selCnt;
380}
381
383static size_t TetraInvert (MeshType & m)
384{
385 size_t selCnt = 0;
386 ForEachTetra(m, [&selCnt] (TetraType & t) {
387 if (t.IsS())
388 t.ClearS();
389 else
390 {
391 t.SetS();
392 ++selCnt;
393 }
394 });
395
396 return selCnt;
397}
398
399
401static size_t VertexFromFaceLoose(MeshType &m, bool preserveSelection=false)
402{
403 size_t selCnt=0;
404
405 if(!preserveSelection) VertexClear(m);
406 for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
407 if( !(*fi).IsD() && (*fi).IsS())
408 for(int i = 0; i < (*fi).VN(); ++i)
409 if( !(*fi).V(i)->IsS()) { (*fi).V(i)->SetS(); ++selCnt; }
410 return selCnt;
411}
412
414static size_t VertexFromEdgeLoose(MeshType &m, bool preserveSelection=false)
415{
416 size_t selCnt=0;
417
418 if(!preserveSelection) VertexClear(m);
419 for(EdgeIterator ei = m.edge.begin(); ei != m.edge.end(); ++ei)
420 if( !(*ei).IsD() && (*ei).IsS())
421 {
422 if( !(*ei).V(0)->IsS()) { (*ei).V(0)->SetS(); ++selCnt; }
423 if( !(*ei).V(1)->IsS()) { (*ei).V(1)->SetS(); ++selCnt; }
424 }
425 return selCnt;
426}
427
429
431static size_t VertexFromFaceStrict(MeshType &m, bool preserveSelection=false)
432{
434 if(preserveSelection) ss.push();
436 for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
437 if( !(*fi).IsD() && !(*fi).IsS())
438 for(int i = 0; i < (*fi).VN(); ++i)
439 (*fi).V(i)->ClearS();
440
441 if(preserveSelection) ss.popOr();
442 return VertexCount(m);
443}
444
446static size_t FaceFromVertexStrict(MeshType &m, bool preserveSelection=false)
447{
449 if(preserveSelection) ss.push();
450 size_t selCnt=0;
451 FaceClear(m);
452 for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
453 if( !(*fi).IsD())
454 {
455 bool selFlag=true;
456 for(int i = 0; i < (*fi).VN(); ++i)
457 if(!(*fi).V(i)->IsS())
458 selFlag =false;
459 if(selFlag)
460 {
461 (*fi).SetS();
462 ++selCnt;
463 }
464 }
465
466 if(preserveSelection) ss.popOr();
467 return selCnt;
468}
469
471static size_t FaceFromVertexLoose(MeshType &m, bool preserveSelection=false)
472{
473 size_t selCnt=0;
474 if(!preserveSelection) FaceClear(m);
475 for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
476 if( !(*fi).IsD())
477 {
478 bool selVert=false;
479 for(int i = 0; i < (*fi).VN(); ++i)
480 if((*fi).V(i)->IsS())
481 selVert=true;
482
483 if(selVert) {
484 (*fi).SetS();
485 ++selCnt;
486 }
487 }
488 return selCnt;
489}
492static size_t FaceDilate(MeshType &m)
493{
496}
497
500static size_t FaceErode(MeshType &m)
501{
504}
505
506
508static size_t VertexFromBorderFlag(MeshType &m, bool preserveSelection=false)
509{
510 size_t selCnt=0;
511 if(!preserveSelection) VertexClear(m);
512 for(VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
513 if( !(*vi).IsD() )
514 {
515 if((*vi).IsB() )
516 {
517 (*vi).SetS();
518 ++selCnt;
519 }
520 }
521 return selCnt;
522}
523
525static size_t FaceFromBorderFlag(MeshType &m, bool preserveSelection=false)
526{
527 tri::RequireTriangularMesh(m);
528 size_t selCnt=0;
529 if(!preserveSelection) FaceClear(m);
530 for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
531 if( !(*fi).IsD() )
532 {
533 bool bordFlag=false;
534 for(int i = 0; i < 3; ++i)
535 if((*fi).IsB(i)) bordFlag=true;
536 if(bordFlag)
537 {
538 (*fi).SetS();
539 ++selCnt;
540 }
541 }
542 return selCnt;
543}
544
547static size_t FaceOutOfRangeEdge(MeshType &m, ScalarType MinEdgeThr, ScalarType MaxEdgeThr=(std::numeric_limits<ScalarType>::max)(), bool preserveSelection=false)
548{
549 if(!preserveSelection) FaceClear(m);
550 size_t selCnt = 0;
551 MinEdgeThr=MinEdgeThr*MinEdgeThr;
552 MaxEdgeThr=MaxEdgeThr*MaxEdgeThr;
553 for(FaceIterator fi=m.face.begin(); fi!=m.face.end();++fi)
554 if(!(*fi).IsD())
555 {
556 for(int i=0;i<(*fi).VN();++i)
557 {
558 const ScalarType squaredEdge=SquaredDistance((*fi).V0(i)->cP(),(*fi).V1(i)->cP());
559 if((squaredEdge<=MinEdgeThr) || (squaredEdge>=MaxEdgeThr) )
560 {
561 selCnt++;
562 (*fi).SetS();
563 break; // skip the rest of the edges of the tri
564 }
565 }
566 }
567 return selCnt;
568}
569
571static size_t FaceConnectedFF(MeshType &m)
572{
573 // it also assumes that the FF adjacency is well computed.
574 RequireFFAdjacency(m);
576
577 std::deque<FacePointer> visitStack;
578 size_t selCnt=0;
579 for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
580 if( !(*fi).IsD() && (*fi).IsS() && !(*fi).IsV() )
581 visitStack.push_back(&*fi);
582
583 while(!visitStack.empty())
584 {
585 FacePointer fp = visitStack.front();
586 visitStack.pop_front();
587 assert(!fp->IsV());
588 fp->SetV();
589 for(int i=0;i<fp->VN();++i) {
590 FacePointer ff = fp->FFp(i);
591 if(! ff->IsS())
592 {
593 ff->SetS();
594 ++selCnt;
595 visitStack.push_back(ff);
596 assert(!ff->IsV());
597 }
598 }
599 }
600 return selCnt;
601}
603static size_t FaceFromQualityRange(MeshType &m,float minq, float maxq, bool preserveSelection=false)
604{
605 size_t selCnt=0;
606 if(!preserveSelection) FaceClear(m);
607 RequirePerFaceQuality(m);
608 for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
609 if(!(*fi).IsD())
610 {
611 if( (*fi).Q()>=minq && (*fi).Q()<=maxq )
612 {
613 (*fi).SetS();
614 ++selCnt;
615 }
616 }
617 return selCnt;
618}
619
621static size_t VertexFromQualityRange(MeshType &m,float minq, float maxq, bool preserveSelection=false)
622{
623 size_t selCnt=0;
624 if(!preserveSelection) VertexClear(m);
625 RequirePerVertexQuality(m);
626 for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
627 if(!(*vi).IsD())
628 {
629 if( (*vi).Q()>=minq && (*vi).Q()<=maxq )
630 {
631 (*vi).SetS();
632 ++selCnt;
633 }
634 }
635 return selCnt;
636}
637
639static size_t VertexInBox( MeshType & m, const Box3Type &bb, bool preserveSelection=false)
640{
641 if(!preserveSelection) VertexClear(m);
642 int selCnt=0;
643 for (VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi) if(!(*vi).IsD())
644 {
645 if(bb.IsIn((*vi).cP()) ) {
646 (*vi).SetS();
647 ++selCnt;
648 }
649 }
650 return selCnt;
651}
652
656static size_t VertexCornerBorder(MeshType &m, ScalarType angleRad, bool preserveSelection=false)
657{
658 if(!preserveSelection) VertexClear(m);
659 SimpleTempData<typename MeshType::VertContainer, ScalarType > angleSumH(m.vert,0);
660 int selCnt=0;
661 for(auto vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD())
662 angleSumH[vi]=0;
663
664 for(auto fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD())
665 {
666 for(int i=0;i<(*fi).VN();++i)
667 angleSumH[fi->V(i)] += face::WedgeAngleRad(*fi,i);
668 }
669
670 for(auto vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD())
671 {
672 if(angleSumH[vi]<angleRad && vi->IsB())
673 {
674 (*vi).SetS();
675 ++selCnt;
676 }
677 }
678 return selCnt;
679}
680
681
682void VertexNonManifoldEdges(MeshType &m, bool preserveSelection=false)
683{
684 tri::RequireFFAdjacency(m);
685
686 if(!preserveSelection) VertexClear(m);
687 for (FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi) if (!fi->IsD())
688 {
689 for(int i=0;i<fi->VN();++i)
690 if(!IsManifold(*fi,i)){
691 (*fi).V0(i)->SetS();
692 (*fi).V1(i)->SetS();
693 }
694 }
695}
696
697}; // end class
698
699} // End namespace
700} // End namespace
701
702
703#endif
Definition: box3.h:42
bool IsIn(const Point3< BoxScalarType > &p) const
Definition: box3.h:194
Class to safely add and delete elements in a mesh.
Definition: allocate.h:97
A stack for saving and restoring selection.
Definition: selection.h:43
bool pop(bool orFlag=false, bool andFlag=false)
Definition: selection.h:99
Management, updating and computation of per-vertex and per-face flags (like border flags).
Definition: flag.h:44
Management, updating and conditional computation of selections (per-vertex, per-edge,...
Definition: selection.h:184
static size_t FaceEdgeCount(const MeshType &m)
This function returns the number of selected edges according to the FaceEdge Selection bit (the 3 bit...
Definition: selection.h:300
static size_t FaceFromVertexStrict(MeshType &m, bool preserveSelection=false)
Select ONLY the faces with ALL the vertices selected.
Definition: selection.h:446
static size_t FaceErode(MeshType &m)
This function erode the face selection by simply first selecting only the vertices completely surroun...
Definition: selection.h:500
static size_t VertexInvert(MeshType &m)
This function inverts the selection flag for all the vertices.
Definition: selection.h:367
static size_t TetraAll(MeshType &m)
This function select all the tetras.
Definition: selection.h:227
static size_t VertexCount(const MeshType &m)
This function returns the number of selected vertices.
Definition: selection.h:315
static size_t FaceFromQualityRange(MeshType &m, float minq, float maxq, bool preserveSelection=false)
Select the faces whose quality is in the specified closed interval.
Definition: selection.h:603
static size_t FaceOutOfRangeEdge(MeshType &m, ScalarType MinEdgeThr, ScalarType MaxEdgeThr=(std::numeric_limits< ScalarType >::max)(), bool preserveSelection=false)
This function select the faces that have an edge outside the given range. You can skip the second par...
Definition: selection.h:547
static void Clear(MeshType &m)
This function clears the selection flag for all the elements of a mesh (vertices, edges,...
Definition: selection.h:271
static size_t EdgeClear(MeshType &m)
This function clears the selection flag for all the edges.
Definition: selection.h:245
static size_t VertexFromFaceStrict(MeshType &m, bool preserveSelection=false)
Select ONLY the vertices that are touched ONLY by selected faces.
Definition: selection.h:431
static size_t FaceConnectedFF(MeshType &m)
This function expand current selection to cover the whole connected component.
Definition: selection.h:571
static size_t VertexFromBorderFlag(MeshType &m, bool preserveSelection=false)
This function select the vertices with the border flag set.
Definition: selection.h:508
static size_t EdgeCount(const MeshType &m)
This function returns the number of selected edges.
Definition: selection.h:290
static size_t TetraCount(const MeshType &m)
This function returns the number of selected tetras.
Definition: selection.h:325
static size_t VertexClear(MeshType &m)
This function clear the selection flag for all the vertices.
Definition: selection.h:237
static size_t TetraClear(MeshType &m)
This function clears the selection flag for all the tetras.
Definition: selection.h:261
static size_t VertexFromQualityRange(MeshType &m, float minq, float maxq, bool preserveSelection=false)
Select the vertices whose quality is in the specified closed interval.
Definition: selection.h:621
static size_t FaceFromBorderFlag(MeshType &m, bool preserveSelection=false)
This function select the faces that have an edge with the border flag set.
Definition: selection.h:525
static size_t FaceCount(const MeshType &m)
This function returns the number of selected faces.
Definition: selection.h:280
static size_t EdgeAll(MeshType &m)
This function select all the edges.
Definition: selection.h:212
static size_t VertexCornerBorder(MeshType &m, ScalarType angleRad, bool preserveSelection=false)
Select the border vertices that form a corner along the border with an angle that is below a certain ...
Definition: selection.h:656
static size_t FaceDilate(MeshType &m)
This function dilate the face selection by simply first selecting all the vertices touched by the fac...
Definition: selection.h:492
static size_t VertexFromEdgeLoose(MeshType &m, bool preserveSelection=false)
Select all the vertices that are touched by at least a single selected edge.
Definition: selection.h:414
static size_t FaceAll(MeshType &m)
This function select all the faces.
Definition: selection.h:219
static size_t VertexAll(MeshType &m)
This function select all the vertices.
Definition: selection.h:204
static size_t EdgeInvert(MeshType &m)
This function inverts the selection flag for all the edges.
Definition: selection.h:351
static size_t FaceClear(MeshType &m)
This function clears the selection flag for all the faces.
Definition: selection.h:253
static size_t VertexInBox(MeshType &m, const Box3Type &bb, bool preserveSelection=false)
Select the vertices contained in the specified Box.
Definition: selection.h:639
static size_t FaceFromVertexLoose(MeshType &m, bool preserveSelection=false)
Select all the faces with at least one selected vertex.
Definition: selection.h:471
static size_t TetraInvert(MeshType &m)
This function inverts the selection flag for all the tetras.
Definition: selection.h:383
static size_t FaceInvert(MeshType &m)
This function inverts the selection flag for all the faces.
Definition: selection.h:335
static size_t VertexFromFaceLoose(MeshType &m, bool preserveSelection=false)
Select all the vertices that are touched by at least a single selected faces.
Definition: selection.h:401
void ForEachTetra(const MeshType &m, Callable action)
Definition: foreach.h:270
void ForEachEdge(const MeshType &m, Callable action)
Definition: foreach.h:222
void ForEachFace(const MeshType &m, Callable action)
Definition: foreach.h:78
void ForEachVertex(const MeshType &m, Callable action)
Definition: foreach.h:126
FaceType::ScalarType WedgeAngleRad(FaceType &f, const int i)
Return the internal angle (in radians) of the i-th wedge of the triangle.
Definition: topology.h:118
bool IsBorder(FaceType const &f, const int j)
Definition: topology.h:55
Definition: color4.h:30