26 auto indexIt = std::find(stitchIndices.begin(), stitchIndices.end(), localNeighbourhood.
getVertexIndex());
28 if(indexIt == stitchIndices.end())
30 return std::vector<size_t>();
33 std::list<size_t> result;
36 if(indexIt == stitchIndices.begin())
38 auto nextOnStitch = std::find(neighbours.begin(), neighbours.end(), *std::next(indexIt));
40 for(
auto it=nextOnStitch; it!=neighbours.end(); ++it)
41 result.push_back(*it);
43 else if(std::next(indexIt) == stitchIndices.end())
45 auto prevOnStitch = std::find(neighbours.begin(), neighbours.end(), *std::prev(indexIt));
47 for(
auto it=neighbours.begin(); it!=prevOnStitch; ++it)
48 result.push_back(*it);
52 while(neighbours.front() != *std::next(indexIt))
54 neighbours.push_back(neighbours.front());
55 neighbours.pop_front();
58 auto prevOnStitch = std::find(neighbours.begin(), neighbours.end(), *std::prev(indexIt));
59 for(
auto it=neighbours.begin(); it!=prevOnStitch; ++it)
60 result.push_back(*it);
64 for(
auto it=stitchIndices.begin(); it!=stitchIndices.end(); ++it)
67 std::vector<size_t> finalResult;
68 finalResult.reserve(result.size());
69 for(
auto it=result.begin(); it!=result.end(); ++it)
70 finalResult.push_back(*it);
77 const std::vector<size_t>& stitchIndices,
79 const size_t parametrizationMethod)
88 corrections.resize(N, N);
89 corrections.setZero();
99 for(
auto it=corr.begin(); it!=corr.end(); ++it)
101 corrections(i-1, *it-1) = 1;
102 corrections(*it-1, i-1) = -1;
116 size_t n = this->
m_mesh.getNumberOfInnerVertices();
117 size_t N = this->
m_mesh.getNumberOfVertices();
121 this->initParameterPoints();
132 std::vector<T> lambdas;
141 for (
size_t i = 0; i < n; i++)
144 for (
size_t j = 0; j < N; j++)
146 LHS(i, j) = ( i==j ? (T)(1) : -lambdas[j] );
152 RHS(i, 0) -= lambdas[j];
154 RHS(i, 0) += lambdas[j];
159 for (
size_t i=n; i<N; i++)
166 gsEigen::PartialPivLU<typename gsMatrix<T>::Base> LU = LHS.partialPivLu();
168 for (
size_t i = 0; i < n; i++)
181 for(
size_t i=0; i<this->
m_mesh.getNumberOfTriangles(); i++)
183 std::vector<size_t> vertices;
184 for(
size_t j=1; j<=3; ++j)
186 vertices.push_back(this->
m_mesh.getGlobalVertexIndex(j, i));
193 for (
size_t j = 1; j <= 3; ++j)
197 if( nearStitchTriangle &&
isOnStitch(vertices[j-1]) )
198 v[j - 1] = result.addVertex(point[0] + (T)(1), point[1]);
200 v[j - 1] = result.addVertex(point[0], point[1]);
202 result.addFace( v[0], v[1], v[2]);
gsHalfEdgeMesh is a gsMesh implementation that handles Halfedges
Definition gsHalfEdgeMesh.h:47
size_t getNumberOfVertices() const
Get number of vertices The number of vertices of the triangle mesh is returned.
Definition gsHalfEdgeMesh.hpp:58
size_t getNumberOfInnerVertices() const
Get number of inner vertices The number of inner vertices of the triangle mesh is returned.
Definition gsHalfEdgeMesh.hpp:70
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Class Representing a triangle mesh with 3D vertices.
Definition gsMesh.h:32
gsMesh & cleanMesh()
reorders the vertices of all faces of an .stl mesh, such that only 1 vertex is used instead of #(adja...
Definition gsMesh.hpp:250
const index_t & getInt(const std::string &label) const
Reads value for option label from options.
Definition gsOptionList.cpp:37
Class that maintains the local neighbourhood properties.
Definition gsParametrization.h:128
size_t getVertexIndex() const
Get vertex index.
Definition gsParametrization.hpp:742
const std::list< size_t > getVertexIndicesOfNeighbours() const
Get vertex indices of neighbours.
Definition gsParametrization.hpp:754
const std::vector< T > & getLambdas(const size_t i) const
Get vector of lambdas.
Definition gsParametrization.hpp:282
Class that maintains parametrization This class Parametrization stores the mesh information and the t...
Definition gsParametrization.h:47
const Point2D & getParameterPoint(size_t vertexIndex) const
Get parameter point Returns the parameter point with given vertex index.
Definition gsParametrization.hpp:160
VectorType m_parameterPoints
parameter points
Definition gsParametrization.h:58
const gsHalfEdgeMesh< T > m_mesh
mesh information
Definition gsParametrization.h:57
Definition gsPeriodicStitch.h:77
Neighbourhood(const gsHalfEdgeMesh< T > &meshInfo, const std::vector< size_t > &stitchIndices, gsSparseMatrix< int > &corrections, const size_t parametrizationMethod=2)
Definition gsPeriodicStitch.hpp:76
std::vector< size_t > computeCorrections(const std::vector< size_t > &stitchIndices, const LocalNeighbourhood &localNeighbourhood) const
Definition gsPeriodicStitch.hpp:23
gsMesh< T > createUnfoldedFlatMesh() const
Definition gsPeriodicStitch.hpp:175
void constructAndSolveEquationSystem(const Neighbourhood &neighbourhood, const size_t n, const size_t N)
Definition gsPeriodicStitch.hpp:128
void compute()
Computes the periodic parametrization.
Definition gsPeriodicStitch.hpp:108
const std::vector< size_t > m_stitchIndices
indices of the vertices on the stitch
Definition gsPeriodicStitch.h:200
bool edgeIsInCorrections(index_t beg, index_t end) const
Definition gsPeriodicStitch.h:182
bool isOnStitch(size_t vertexIndex) const
Definition gsPeriodicStitch.h:170
gsSparseMatrix< int > m_corrections
Definition gsPeriodicStitch.h:198
void calculate(const size_t paraMethod)
Definition gsPeriodicStitch.hpp:114
A Point in T^d, with an index number.
Definition gsPoint.h:27
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
gsVertex class that represents a 3D vertex for a gsMesh.
Definition gsVertex.h:27
#define index_t
Definition gsConfig.h:32
Implementation of periodic Floater parametrization using a stitch. This class is an alternative to gs...
The G+Smo namespace, containing all definitions for the library.