Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF > Class Template Reference
+ Collaboration diagram for igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >:

Classes

struct  VertexInfo
 

Public Member Functions

IGL_INLINE VertexIndexing (const Eigen::PlainObjectBase< DerivedV > &_V, const Eigen::PlainObjectBase< DerivedF > &_F, const Eigen::PlainObjectBase< DerivedV > &_Vcut, const Eigen::PlainObjectBase< DerivedF > &_Fcut, const Eigen::PlainObjectBase< DerivedF > &_TT, const Eigen::PlainObjectBase< DerivedF > &_TTi, const Eigen::Matrix< int, Eigen::Dynamic, 3 > &_Handle_MMatch, const Eigen::Matrix< int, Eigen::Dynamic, 1 > &_Handle_Singular, const Eigen::Matrix< int, Eigen::Dynamic, 3 > &_Handle_Seams)
 
IGL_INLINE void InitSeamInfo ()
 

Public Attributes

const Eigen::PlainObjectBase< DerivedV > & V
 
const Eigen::PlainObjectBase< DerivedF > & F
 
const Eigen::PlainObjectBase< DerivedV > & Vcut
 
const Eigen::PlainObjectBase< DerivedF > & Fcut
 
const Eigen::PlainObjectBase< DerivedF > & TT
 
const Eigen::PlainObjectBase< DerivedF > & TTi
 
const Eigen::Matrix< int, Eigen::Dynamic, 3 > & Handle_MMatch
 
const Eigen::Matrix< int, Eigen::Dynamic, 1 > & Handle_Singular
 
const Eigen::Matrix< int, Eigen::Dynamic, 3 > & Handle_Seams
 
MeshSystemInfo Handle_SystemInfo
 this handle for mesh TODO: move with the other global variables
 

Private Member Functions

IGL_INLINE void GetSeamInfo (const int f0, const int f1, const int indexE, int &v0, int &v1, int &v0p, int &v1p, unsigned char &_MMatch)
 
IGL_INLINE std::vector< std::vector< VertexInfo > > GetVerticesPerSeam ()
 

Detailed Description

template<typename DerivedV, typename DerivedF>
class igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >

Constructor & Destructor Documentation

◆ VertexIndexing()

template<typename DerivedV , typename DerivedF >
IGL_INLINE igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::VertexIndexing ( const Eigen::PlainObjectBase< DerivedV > &  _V,
const Eigen::PlainObjectBase< DerivedF > &  _F,
const Eigen::PlainObjectBase< DerivedV > &  _Vcut,
const Eigen::PlainObjectBase< DerivedF > &  _Fcut,
const Eigen::PlainObjectBase< DerivedF > &  _TT,
const Eigen::PlainObjectBase< DerivedF > &  _TTi,
const Eigen::Matrix< int, Eigen::Dynamic, 3 > &  _Handle_MMatch,
const Eigen::Matrix< int, Eigen::Dynamic, 1 > &  _Handle_Singular,
const Eigen::Matrix< int, Eigen::Dynamic, 3 > &  _Handle_Seams 
)
388 :
389V(_V),
390F(_F),
391Vcut(_Vcut),
392Fcut(_Fcut),
393TT(_TT),
394TTi(_TTi),
395Handle_MMatch(_Handle_MMatch),
396Handle_Singular(_Handle_Singular),
397Handle_Seams(_Handle_Seams)
398{
399 #ifdef DEBUG_PRINT
400 cerr<<igl::matlab_format(Handle_Seams,"Handle_Seams");
401#endif
402
405}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const
Definition PlainObjectBase.h:151
const Eigen::PlainObjectBase< DerivedV > & Vcut
Definition miq.cpp:83
const Eigen::PlainObjectBase< DerivedF > & TTi
Definition miq.cpp:86
MeshSystemInfo Handle_SystemInfo
this handle for mesh TODO: move with the other global variables
Definition miq.cpp:94
const Eigen::Matrix< int, Eigen::Dynamic, 3 > & Handle_Seams
Definition miq.cpp:90
const Eigen::PlainObjectBase< DerivedF > & TT
Definition miq.cpp:85
const Eigen::PlainObjectBase< DerivedV > & V
Definition miq.cpp:81
const Eigen::Matrix< int, Eigen::Dynamic, 1 > & Handle_Singular
Definition miq.cpp:89
const Eigen::PlainObjectBase< DerivedF > & Fcut
Definition miq.cpp:84
const Eigen::Matrix< int, Eigen::Dynamic, 3 > & Handle_MMatch
Definition miq.cpp:88
const Eigen::PlainObjectBase< DerivedF > & F
Definition miq.cpp:82
int num_integer_cuts
num of integer for cuts
Definition miq.cpp:70
int num_vert_variables
Definition miq.cpp:68
IGL_INLINE Eigen::IOFormat matlab_format()
Definition matlab_format.cpp:73

References igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Handle_Seams, igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Handle_SystemInfo, igl::matlab_format(), igl::copyleft::comiso::MeshSystemInfo::num_integer_cuts, igl::copyleft::comiso::MeshSystemInfo::num_vert_variables, Eigen::PlainObjectBase< Derived >::rows(), and igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Vcut.

+ Here is the call graph for this function:

Member Function Documentation

◆ GetSeamInfo()

template<typename DerivedV , typename DerivedF >
IGL_INLINE void igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::GetSeamInfo ( const int  f0,
const int  f1,
const int  indexE,
int &  v0,
int &  v1,
int &  v0p,
int &  v1p,
unsigned char &  _MMatch 
)
private
414{
415 int edgef0 = indexE;
416 v0 = Fcut(f0,edgef0);
417 v1 = Fcut(f0,(edgef0+1)%3);
419 assert(TT(f0,edgef0) == f1);
420 int edgef1 = TTi(f0,edgef0);
421 v1p = Fcut(f1,edgef1);
422 v0p = Fcut(f1,(edgef1+1)%3);
423
424 _MMatch = Handle_MMatch(f0,edgef0);
425 assert(F(f0,edgef0) == F(f1,((edgef1+1)%3)));
426 assert(F(f0,((edgef0+1)%3)) == F(f1,edgef1));
427}

◆ GetVerticesPerSeam()

template<typename DerivedV , typename DerivedF >
IGL_INLINE std::vector< std::vector< typename igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::VertexInfo > > igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::GetVerticesPerSeam
private
431{
432 // Return value
433 std::vector<std::vector<VertexInfo> >verticesPerSeam;
434
435 // for every vertex, keep track of their adjacent vertices on seams.
436 // regular vertices have two neighbors on a seam, start- and endvertices may have any other numbers of neighbors (e.g. 1 or 3)
437 std::vector<std::list<VertexInfo> > VVSeam(V.rows());
438 Eigen::MatrixXi F_hit = Eigen::MatrixXi::Zero(F.rows(), 3);
439 for (unsigned int f=0; f<F.rows();f++)
440 {
441 int f0 = f;
442 for(int k0=0; k0<3; k0++){
443 int f1 = TT(f0,k0);
444 if(f1 == -1)
445 continue;
446
447 bool seam = Handle_Seams(f0,k0);
448 if (seam && F_hit(f0,k0) == 0)
449 {
450 int v0 = F(f0, k0);
451 int v1 = F(f0, (k0+1)%3);
452 int k1 = TTi(f0,k0);
453 VVSeam[v0].push_back(VertexInfo(v1, f0, k0, f1, k1));
454 VVSeam[v1].push_back(VertexInfo(v0, f0, k0, f1, k1));
455 F_hit(f0, k0) = 1;
456 F_hit(f1, k1) = 1;
457 }
458 }
459 }
460
461 // Find start vertices, i.e. vertices that start or end a seam branch
462 std::vector<int> startVertexIndices;
463 std::vector<bool> isStartVertex(V.rows());
464 for (unsigned int i=0;i<V.rows();i++)
465 {
466 isStartVertex[i] = false;
467 // vertices with two neighbors are regular vertices, unless the vertex is a singularity, in which case it qualifies as a start vertex
468 if (VVSeam[i].size() > 0 && VVSeam[i].size() != 2 || Handle_Singular(i) == true)
469 {
470 startVertexIndices.push_back(i);
471 isStartVertex[i] = true;
472 }
473 }
474
475 // For each startVertex, walk along its seam
476 for (unsigned int i=0;i<startVertexIndices.size();i++)
477 {
478 auto startVertexNeighbors = &VVSeam[startVertexIndices[i]];
479 const int neighborSize = startVertexNeighbors->size();
480
481 // explore every seam to which this vertex is a start vertex
482 // note: a vertex can never be a start vertex and a regular vertex simultaneously
483 for (unsigned int j=0;j<neighborSize;j++)
484 {
485 std::vector<VertexInfo> thisSeam; // temporary container
486
487 // Create vertexInfo struct for start vertex
488 auto startVertex = VertexInfo(startVertexIndices[i], -1, -1, -1, -1);// -1 values are arbitrary (will never be used)
489 auto currentVertex = startVertex;
490 // Add start vertex to the seam
491 thisSeam.push_back(currentVertex);
492
493 // advance on the seam
494 auto currentVertexNeighbors = startVertexNeighbors;
495 auto nextVertex = currentVertexNeighbors->front();
496 currentVertexNeighbors->pop_front();
497
498 auto prevVertex = startVertex; // bogus initialization to get the type
499 while (true)
500 {
501 // move to the next vertex
502 prevVertex = currentVertex;
503 currentVertex = nextVertex;
504 currentVertexNeighbors = &VVSeam[nextVertex.v];
505
506 // add current vertex to this seam
507 thisSeam.push_back(currentVertex);
508
509 // remove the previous vertex
510 auto it = std::find(currentVertexNeighbors->begin(), currentVertexNeighbors->end(), prevVertex);
511 assert(it != currentVertexNeighbors->end());
512 currentVertexNeighbors->erase(it);
513
514 if (currentVertexNeighbors->size() == 1 && !isStartVertex[currentVertex.v])
515 {
516 nextVertex = currentVertexNeighbors->front();
517 currentVertexNeighbors->pop_front();
518 }
519 else
520 break;
521 }
522 verticesPerSeam.push_back(thisSeam);
523 }
524 }
525
526 return verticesPerSeam;
527}
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

◆ InitSeamInfo()

template<typename DerivedV , typename DerivedF >
IGL_INLINE void igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::InitSeamInfo
531{
532 auto verticesPerSeam = GetVerticesPerSeam();
534 int integerVar = 0;
535 // Loop over each seam
536 for(auto seam : verticesPerSeam){
537 //choose initial side of the seam such that the start vertex corresponds to Fcut(f, k) and the end vertex corresponds to Fcut(f, (k+1)%3) and not vice versa.
538 int priorVertexIdx;
539 if(seam.size() > 2){
540 auto v1 = seam[1];
541 auto v2 = seam[2];
542 if(Fcut(v1.f0, (v1.k0+1) % 3) == Fcut(v2.f0, v2.k0) || Fcut(v1.f0, (v1.k0+1) % 3) == Fcut(v2.f1, v2.k1)){
543 priorVertexIdx = Fcut(v1.f0, v1.k0);
544 }
545 else{
546 priorVertexIdx = Fcut(v1.f1, v1.k1);
547 assert(Fcut(v1.f1, (v1.k1+1) % 3) == Fcut(v2.f0, v2.k0) || Fcut(v1.f1, (v1.k1+1) % 3) == Fcut(v2.f1, v2.k1));
548 }
549 }
550 else{
551 auto v1 = seam[1];
552 priorVertexIdx = Fcut(v1.f0, v1.k0);
553 }
554
555 // Loop over each vertex of the seam
556 for(auto it=seam.begin()+1; it != seam.end(); ++it){
557 auto vertex = *it;
558 // choose the correct side of the seam
559 int f,k,ff,kk;
560 if(priorVertexIdx == Fcut(vertex.f0, vertex.k0)){
561 f = vertex.f0; ff = vertex.f1;
562 k = vertex.k0; kk = vertex.k1;
563 }
564 else{
565 f = vertex.f1; ff = vertex.f0;
566 k = vertex.k1; kk = vertex.k0;
567 assert(priorVertexIdx == Fcut(vertex.f1, vertex.k1));
568 }
569
570 int vtx0,vtx0p,vtx1,vtx1p;
571 unsigned char MM;
572 GetSeamInfo(f,ff,k,vtx0,vtx1,vtx0p,vtx1p,MM);
573 Handle_SystemInfo.EdgeSeamInfo.push_back(SeamInfo(vtx0,vtx0p,MM,integerVar));
574 if(it == seam.end() -1){
575 Handle_SystemInfo.EdgeSeamInfo.push_back(SeamInfo(vtx1,vtx1p,MM,integerVar));
576 }
577 priorVertexIdx = vtx1;
578 }
579 // use the same integer for each seam
580 integerVar++;
581 }
583
584#ifndef NDEBUG
585 int totalNVerticesOnSeams = 0;
586 for(auto seam : verticesPerSeam){
587 totalNVerticesOnSeams += seam.size();
588 }
589 assert(Handle_SystemInfo.EdgeSeamInfo.size() == totalNVerticesOnSeams);
590#endif
591}
IGL_INLINE std::vector< std::vector< VertexInfo > > GetVerticesPerSeam()
Definition miq.cpp:430
IGL_INLINE void GetSeamInfo(const int f0, const int f1, const int indexE, int &v0, int &v1, int &v0p, int &v1p, unsigned char &_MMatch)
Definition miq.cpp:408
std::vector< SeamInfo > EdgeSeamInfo
this are used for drawing purposes
Definition miq.cpp:72
TPoint< S > & vertex(S &sh, unsigned long idx, const PolygonTag &)
Definition geometry_traits.hpp:1180

Referenced by igl::copyleft::comiso::MIQ_class< DerivedV, DerivedF, DerivedU >::MIQ_class().

+ Here is the caller graph for this function:

Member Data Documentation

◆ F

template<typename DerivedV , typename DerivedF >
const Eigen::PlainObjectBase<DerivedF>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::F

◆ Fcut

template<typename DerivedV , typename DerivedF >
const Eigen::PlainObjectBase<DerivedF>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Fcut

◆ Handle_MMatch

template<typename DerivedV , typename DerivedF >
const Eigen::Matrix<int, Eigen::Dynamic, 3>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Handle_MMatch

◆ Handle_Seams

template<typename DerivedV , typename DerivedF >
const Eigen::Matrix<int, Eigen::Dynamic, 3>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Handle_Seams

◆ Handle_Singular

template<typename DerivedV , typename DerivedF >
const Eigen::Matrix<int, Eigen::Dynamic, 1>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Handle_Singular

◆ Handle_SystemInfo

template<typename DerivedV , typename DerivedF >
MeshSystemInfo igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Handle_SystemInfo

◆ TT

template<typename DerivedV , typename DerivedF >
const Eigen::PlainObjectBase<DerivedF>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::TT

◆ TTi

template<typename DerivedV , typename DerivedF >
const Eigen::PlainObjectBase<DerivedF>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::TTi

◆ V

template<typename DerivedV , typename DerivedF >
const Eigen::PlainObjectBase<DerivedV>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::V

◆ Vcut

template<typename DerivedV , typename DerivedF >
const Eigen::PlainObjectBase<DerivedV>& igl::copyleft::comiso::VertexIndexing< DerivedV, DerivedF >::Vcut

The documentation for this class was generated from the following file: