Commit 1c39c0be authored by David Thompson's avatar David Thompson
Browse files

Progress on face creation.

This fixes the issue with the extended test case which had a non-simple hole.
The problem turned out not to be the complexity of the hole but rather the
angle tests used to insert fragments into a ring around the current sweep point;
when the CCW angle swept between successive fragments was large (> pi), then the
cross-product test failed to recognize that a fragment could be inserted.
parent d46a6ab1
......@@ -644,10 +644,18 @@ struct Neighborhood
RegionId other;
if (oaXyy > 0 || yyXob > 0)
{
// Either:
// oaXyy > 0 and thus fragB must be along -y (since oaXob < 0),
// or yyXob > 0 and thus fragA must be along -y (since oaXob < 0);
// thus A-B merges with the region just below: the active segment just above B
other = this->lowerRegionJustAbove(fB);
}
else // (oxXyy < 0 || yyXob < 0)
{
// Either:
// oaXyy < 0 and thus fragB must be along +y (since oaXob < 0),
// or yyXob < 0 and thus fragA must be along +y (since oaXob < 0);
// thus A-B merges with the region just above: the active segment just below A
other = this->upperRegionJustBelow(fA); // when oaXyy == 0, fA isn't in m_activeSegments yet, but the lookup is safe).
}
this->m_related.insert(std::pair<RegionId,RegionId>(region, other));
......@@ -769,7 +777,10 @@ struct Neighborhood
other.y() - this->m_point->position().y()};
internal::HighPrecisionCoord oaXoo = cross2d(oa, oo);
internal::HighPrecisionCoord ooXob = cross2d(oo, ob);
if (oaXoo > 0 && ooXob > 0)
internal::HighPrecisionCoord oaXob = cross2d(oa, ob);
if (
(oaXoo > 0 && ooXob > 0) || // oaXob < pi and "other" is between them; or...
(oaXob < 0 && !(ooXob < 0 && oaXoo < 0))) // oaXob > pi and "other" is *not between* the short CCW path between B and A.
{ // other is between ringA and ringB. Insert it just before ringB:
this->m_ring.insert(ringB, fragId);
return true;
......@@ -843,7 +854,7 @@ struct Neighborhood
if (this->insertFragmentBetween(ringA, ringB, fragId, frag, other))
return;
}
std::cerr << "Error. Unable to insert fragment into neighborhood!\n"; // FIXME. Add to log, not cerr/cout.
std::cerr << "Error. Unable to insert fragment " << fragId << " into neighborhood!\n"; // FIXME. Add to log, not cerr/cout.
}
void queueActiveEdge(FragmentId fragId, EdgeFragment& frag)
......@@ -1289,7 +1300,10 @@ smtk::model::OperatorResult CreateFaces::operateInternal()
neighborhood.advanceSweeplineTo(event->point());
event = eventQueue.begin(); // Advancing the sweepline may have changed the eventQueue.
std::cout
<< "Event " << event->type() << " posn " << event->point().x() << " " << event->point().y()
<< "Event type " <<
(event->type() == SweepEvent::SEGMENT_START ? "START" :
(event->type() == SweepEvent::SEGMENT_END ? "END" : "CROSS"))
<< " posn " << event->point().x()/2.31e13 << " " << event->point().y()/2.31e13 << "\n"
;
/*
if (event->type() == SweepEvent::SEGMENT_START)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment