Add cg::fill_missing_faces that creates faces for edge loops without a connected face
This commit is contained in:
parent
51e6f8ad9c
commit
92ad22f656
1 changed files with 17 additions and 0 deletions
|
|
@ -587,6 +587,23 @@ namespace psemek::cg
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Point, typename Edge, typename Face, typename Index>
|
||||||
|
void fill_missing_faces(dcel<Point, Edge, Face, Index> & dcel)
|
||||||
|
{
|
||||||
|
for (Index i = 0; i < dcel.edges.size(); ++i)
|
||||||
|
{
|
||||||
|
if (dcel.edges[i].face != dcel.null) continue;
|
||||||
|
|
||||||
|
auto e = dcel.edge(i);
|
||||||
|
auto f = dcel.push_face();
|
||||||
|
f.edge(e);
|
||||||
|
e.face(f);
|
||||||
|
|
||||||
|
for (e = e.next(); e.index() != i; e = e.next())
|
||||||
|
e.face(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Index = std::size_t, typename Iterator>
|
template <typename Index = std::size_t, typename Iterator>
|
||||||
auto polygon_dcel(Iterator begin, Iterator end)
|
auto polygon_dcel(Iterator begin, Iterator end)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue