Skip to content

Commit

Permalink
use latest quickhull version to reduce compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed Apr 17, 2024
1 parent 8b3cddd commit a4087ca
Show file tree
Hide file tree
Showing 8 changed files with 234 additions and 169 deletions.
29 changes: 16 additions & 13 deletions libtascar/src/quickhull/ConvexHull.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ namespace quickhull {
if (faceStack.size()==0) {
return;
}


const size_t iCCW = CCW ? 1 : 0;
const size_t finalMeshFaceCount = mesh.m_faces.size() - mesh.m_disabledFaces.size();
m_indices.reserve(finalMeshFaceCount*3);

Expand All @@ -116,26 +117,20 @@ namespace quickhull {
auto vertices = mesh.getVertexIndicesOfFace(mesh.m_faces[top]);
if (!useOriginalIndices) {
for (auto& v : vertices) {
auto it = vertexIndexMapping.find(v);
if (it == vertexIndexMapping.end()) {
auto itV = vertexIndexMapping.find(v);
if (itV == vertexIndexMapping.end()) {
m_optimizedVertexBuffer->push_back(pointCloud[v]);
vertexIndexMapping[v] = m_optimizedVertexBuffer->size()-1;
v = m_optimizedVertexBuffer->size()-1;
}
else {
v = it->second;
v = itV->second;
}
}
}
m_indices.push_back(vertices[0]);
if (CCW) {
m_indices.push_back(vertices[2]);
m_indices.push_back(vertices[1]);
}
else {
m_indices.push_back(vertices[1]);
m_indices.push_back(vertices[2]);
}
m_indices.push_back(vertices[1 + iCCW]);
m_indices.push_back(vertices[2 - iCCW]);
}
}

Expand All @@ -151,12 +146,20 @@ namespace quickhull {
return m_indices;
}

const std::vector<size_t>& getIndexBuffer() const {
return m_indices;
}

VertexDataSource<T>& getVertexBuffer() {
return m_vertices;
}

const VertexDataSource<T>& getVertexBuffer() const {
return m_vertices;
}

// Export the mesh to a Waveform OBJ file
void writeWaveformOBJ(const std::string& filename, const std::string& objectName = "quickhull")
void writeWaveformOBJ(const std::string& filename, const std::string& objectName = "quickhull") const
{
std::ofstream objFile;
objFile.open (filename);
Expand Down
Loading

0 comments on commit a4087ca

Please sign in to comment.