From f8e3509644fc1d639c9e03a8f7db03fd84030da7 Mon Sep 17 00:00:00 2001 From: Nicholas Sharp Date: Thu, 28 Dec 2023 17:48:50 -0500 Subject: [PATCH] add missing SurfaceMesh register w/ permutation functions for compatibility --- include/polyscope/surface_mesh.h | 6 ++++++ include/polyscope/surface_mesh.ipp | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/polyscope/surface_mesh.h b/include/polyscope/surface_mesh.h index e614d797..111762f1 100644 --- a/include/polyscope/surface_mesh.h +++ b/include/polyscope/surface_mesh.h @@ -423,6 +423,12 @@ template SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices); template 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 +SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices, + const std::array, 3>& perms); template SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices, const std::array, 5>& perms); diff --git a/include/polyscope/surface_mesh.ipp b/include/polyscope/surface_mesh.ipp index a34e005d..7d35e279 100644 --- a/include/polyscope/surface_mesh.ipp +++ b/include/polyscope/surface_mesh.ipp @@ -40,6 +40,26 @@ SurfaceMesh* registerSurfaceMesh2D(std::string name, const V& vertexPositions, c return registerSurfaceMesh(name, positions3D, faceIndices); } +template +SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices, + const std::array, 3>& perms) { + SurfaceMesh* mesh = registerSurfaceMesh(name, vertexPositions, faceIndices); + if (mesh) { + mesh->setAllPermutations(perms); + } + return mesh; +} + +template +SurfaceMesh* registerSurfaceMesh(std::string name, const V& vertexPositions, const F& faceIndices, + const std::array, 5>& perms) { + SurfaceMesh* mesh = registerSurfaceMesh(name, vertexPositions, faceIndices); + if (mesh) { + mesh->setAllPermutations(perms); + } + return mesh; +} + template void SurfaceMesh::updateVertexPositions(const V& newPositions) { validateSize(newPositions, vertexDataSize, "newPositions");