Skip to content

Commit

Permalink
#31 Fix incomplete handling of custom super-geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-ogre committed Mar 11, 2021
1 parent a98f17f commit 01f40d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CDT/include/CDT.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ struct CDT_EXPORT SuperGeometryType
enum Enum
{
SuperTriangle, ///< conventional super-triangle
Custom, ///< user-specified custom geometry (e.g., grid)
Custom, ///< user-specified custom geometry (e.g., grid)
};
};


/// Constant representing no valid neighbor for a triangle
const static TriInd noNeighbor(std::numeric_limits<std::size_t>::max());
/// Constant representing no valid vertex for a triangle
Expand Down Expand Up @@ -131,7 +130,11 @@ class CDT_EXPORT Triangulation
TGetEdgeVertexEnd getEnd);
/// Insert constraints (fixed edges) into triangulation
void insertEdges(const std::vector<Edge>& edges);
/// Erase triangles adjacent to super triangle
/**
* Erase triangles adjacent to super triangle
*
* @note does nothing if custom geometry is used
*/
void eraseSuperTriangle();
/// Erase triangles outside of constrained boundary using growing
void eraseOuterTriangles();
Expand Down Expand Up @@ -201,7 +204,7 @@ class CDT_EXPORT Triangulation
TriInd addTriangle(); // note: invalidates triangle iterators!
void makeDummy(const TriInd iT);
void eraseDummies();
void eraseSuperTriangleVertices();
void eraseSuperTriangleVertices(); // no effect if custom geometry is used
template <typename TriIndexIter>
void eraseTrianglesAtIndices(TriIndexIter first, TriIndexIter last);
TriIndUSet growToBoundary(std::stack<TriInd> seeds) const;
Expand Down
5 changes: 5 additions & 0 deletions CDT/include/CDT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ void Triangulation<T>::eraseDummies()
template <typename T>
void Triangulation<T>::eraseSuperTriangleVertices()
{
if(m_superGeomType != SuperGeometryType::SuperTriangle)
return;
for(TriangleVec::iterator t = triangles.begin(); t != triangles.end(); ++t)
for(Index i(0); i < Index(3); ++i)
t->vertices[i] -= 3;
Expand All @@ -110,6 +112,8 @@ void Triangulation<T>::eraseSuperTriangleVertices()
template <typename T>
void Triangulation<T>::eraseSuperTriangle()
{
if(m_superGeomType != SuperGeometryType::SuperTriangle)
return;
// make dummy triangles adjacent to super-triangle's vertices
for(TriInd iT(0); iT < TriInd(triangles.size()); ++iT)
{
Expand Down Expand Up @@ -171,6 +175,7 @@ void Triangulation<T>::initializedWithCustomSuperGeometry()
}
#endif
m_nTargetVerts = vertices.size();
m_superGeomType = SuperGeometryType::Custom;
}

template <typename T>
Expand Down

0 comments on commit 01f40d5

Please sign in to comment.