Skip to content

Commit 1b5893c

Browse files
committed
Removed std::is_same for C++11 compatibility
1 parent 80c83be commit 1b5893c

3 files changed

Lines changed: 12 additions & 23 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.1)
22
project(TriangleMeshDistance)
3-
set(CMAKE_CXX_STANDARD 17)
3+
set(CMAKE_CXX_STANDARD 11)
44

55
add_subdirectory(tests)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# TriangleMeshDistance
2-
Header only, single file, simple and efficient C++ library to compute the signed distance function to a triangle mesh.
2+
Header only, single file, simple and efficient C++11 library to compute the signed distance function to a triangle mesh.
33

44
The distance computation to the triangle collection is accelerated with a sphere bounding volume hierarchy. The signed of the distance is resolved with the method presented in *"Generating Signed Distance Fields From Triangle Meshes"* by Bærentzen, Andreas & Aanæs, Henrik. (2002).
55

TriangleMeshDistance/include/tmd/TriangleMeshDistance.h

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -189,28 +189,17 @@ inline void tmd::TriangleMeshDistance::construct(const FLOAT* vertices, const SI
189189
template<typename IndexableVector3double, typename IndexableVector3int>
190190
inline void tmd::TriangleMeshDistance::construct(const std::vector<IndexableVector3double>& vertices, const std::vector<IndexableVector3int>& triangles)
191191
{
192-
if constexpr (std::is_same<IndexableVector3double, Eigen::Vector3d>::value) {
193-
this->vertices = vertices;
192+
this->vertices.resize(vertices.size());
193+
for (size_t i = 0; i < vertices.size(); i++) {
194+
this->vertices[i][0] = (double)vertices[i][0];
195+
this->vertices[i][1] = (double)vertices[i][1];
196+
this->vertices[i][2] = (double)vertices[i][2];
194197
}
195-
else {
196-
this->vertices.resize(vertices.size());
197-
for (size_t i = 0; i < vertices.size(); i++) {
198-
this->vertices[i][0] = (double)vertices[i][0];
199-
this->vertices[i][1] = (double)vertices[i][1];
200-
this->vertices[i][2] = (double)vertices[i][2];
201-
}
202-
}
203-
204-
if constexpr (std::is_same<IndexableVector3int, std::array<int, 3>>::value) {
205-
this->triangles = triangles;
206-
}
207-
else {
208-
this->triangles.resize(triangles.size());
209-
for (size_t i = 0; i < triangles.size(); i++) {
210-
this->triangles[i][0] = (int)triangles[i][0];
211-
this->triangles[i][1] = (int)triangles[i][1];
212-
this->triangles[i][2] = (int)triangles[i][2];
213-
}
198+
this->triangles.resize(triangles.size());
199+
for (size_t i = 0; i < triangles.size(); i++) {
200+
this->triangles[i][0] = (int)triangles[i][0];
201+
this->triangles[i][1] = (int)triangles[i][1];
202+
this->triangles[i][2] = (int)triangles[i][2];
214203
}
215204
this->_construct();
216205
}

0 commit comments

Comments
 (0)