Skip to content

Commit

Permalink
add missing SurfaceMesh register w/ permutation functions for
Browse files Browse the repository at this point in the history
compatibility
  • Loading branch information
nmwsharp committed Dec 28, 2023
1 parent 71a1e64 commit f8e3509
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/polyscope/surface_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ template <class V, class F>
SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices);
template <class V, class F>
SurfaceMesh* registerSurfaceMesh2D(std::string name, const V& vertexPositions, const F& faceIndices);

// register functions that also set perms
// these are kept mainly for backward compatability, prefer setting perms after registering
template <class V, class F, class P>
SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices,
const std::array<std::pair<P, size_t>, 3>& perms);
template <class V, class F, class P>
SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices,
const std::array<std::pair<P, size_t>, 5>& perms);
Expand Down
20 changes: 20 additions & 0 deletions include/polyscope/surface_mesh.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@ SurfaceMesh* registerSurfaceMesh2D(std::string name, const V& vertexPositions, c
return registerSurfaceMesh(name, positions3D, faceIndices);
}

template <class V, class F, class P>
SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices,
const std::array<std::pair<P, size_t>, 3>& perms) {
SurfaceMesh* mesh = registerSurfaceMesh(name, vertexPositions, faceIndices);
if (mesh) {
mesh->setAllPermutations(perms);
}
return mesh;
}

template <class V, class F, class P>
SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices,
const std::array<std::pair<P, size_t>, 5>& perms) {
SurfaceMesh* mesh = registerSurfaceMesh(name, vertexPositions, faceIndices);
if (mesh) {
mesh->setAllPermutations(perms);
}
return mesh;
}

template <class V>
void SurfaceMesh::updateVertexPositions(const V& newPositions) {
validateSize(newPositions, vertexDataSize, "newPositions");
Expand Down

0 comments on commit f8e3509

Please sign in to comment.