Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple hanging edges and zero overlaps #143

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/ci_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ jobs:
name: "Ubuntu",
os: ubuntu-latest
}
# Disable macOS untill https://github.com/conan-io/conan/issues/14835 is fixed in Conan 2.0.13
# - {
# name: "macOS",
# os: macos-latest
# }
- {
name: "macOS",
os: macos-latest
}

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions CDT/include/CDTUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ CDT_EXPORT T distance(const V2d<T>& a, const V2d<T>& b);
template <typename T>
CDT_EXPORT T distanceSquared(const V2d<T>& a, const V2d<T>& b);

/// Check if any of triangle's vertices belongs to a super-triangle
CDT_EXPORT bool touchesSuperTriangle(const Triangle& t);

} // namespace CDT

#ifndef CDT_USE_AS_COMPILED_LIBRARY
Expand Down
5 changes: 5 additions & 0 deletions CDT/include/CDTUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,9 @@ T distanceSquared(const V2d<T>& a, const V2d<T>& b)
return distanceSquared(a.x, a.y, b.x, b.y);
}

bool touchesSuperTriangle(const Triangle& t)
{
return t.vertices[0] < 3 || t.vertices[1] < 3 || t.vertices[2] < 3;
}

} // namespace CDT
34 changes: 33 additions & 1 deletion CDT/include/Triangulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,40 @@ class CDT_EXPORT Triangulation
*/
void finalizeTriangulation(const TriIndUSet& removedTriangles);
TriIndUSet growToBoundary(std::stack<TriInd> seeds) const;
void fixEdge(const Edge& edge, BoundaryOverlapCount overlaps);
void fixEdge(const Edge& edge);
void fixEdge(const Edge& edge, const Edge& originalEdge);
/**
* Split existing constraint (fixed) edge
* @param edge fixed edge to split
* @param iSplitVert index of the vertex to be used as a split vertex
*/
void splitFixedEdge(const Edge& edge, const VertInd iSplitVert);
/**
* Add a vertex that splits an edge into the triangulation
* @param splitVert position of split vertex
* @param iT index of a first triangle adjacent to the split edge
* @param iTopo index of a second triangle adjacent to the split edge
* (opposed to the first triangle)
* @return index of a newly added split vertex
*/
VertInd addSplitEdgeVertex(
const V2d<T>& splitVert,
const TriInd iT,
const TriInd iTopo);
/**
* Split fixed edge and add a split vertex into the triangulation
* @param edge fixed edge to split
* @param splitVert position of split vertex
* @param iT index of a first triangle adjacent to the split edge
* @param iTopo index of a second triangle adjacent to the split edge
* (opposed to the first triangle)
* @return index of a newly added split vertex
*/
VertInd splitFixedEdgeAt(
const Edge& edge,
const V2d<T>& splitVert,
const TriInd iT,
const TriInd iTopo);
/**
* Flag triangle as dummy
* @note Advanced method for manually modifying the triangulation from
Expand Down Expand Up @@ -551,6 +582,7 @@ class CDT_EXPORT Triangulation
VertInd superGeomVertCount,
V2d<T> boxMin,
V2d<T> boxMax);
std::pair<TriInd, TriInd> edgeTriangles(VertInd a, VertInd b) const;
bool hasEdge(VertInd a, VertInd b) const;
void setAdjacentTriangle(const VertInd v, const TriInd t);
void pivotVertexTriangleCW(VertInd v);
Expand Down
Loading