SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Represent the neighborhood of a sweepline point, x. More...
#include <Neighborhood.h>
Public Member Functions | |
Neighborhood (SweeplinePosition &x, FragmentArray &fragments, SweepEventSet &eventQueue, ActiveFragmentTree &active, smtk::session::polygon::SessionPtr sess) | |
int | sweep () |
template<typename T > | |
void | getLoops (T evaluator) |
RegionId | lowerRegionJustAbove (FragmentId frag) |
Return the region ID neighboring a fragment from above. | |
RegionId | upperRegionJustBelow (FragmentId frag) |
Return the region ID neighboring a fragment from below. | |
RegionId | lowerRegionJustAbove (const internal::Point &pt) const |
Return the region ID neighboring a point from above. | |
RegionId | upperRegionJustBelow (const internal::Point &pt) const |
Return the region ID neighboring a point from below. | |
bool | isFragmentOutgoing (const EdgeFragment &frag) |
Return the orientation of a fragment relative to the neighborhood. More... | |
void | relateNeighborhoods (FragmentId fA, EdgeFragment &fragA, bool isOutA, FragmentId fB, EdgeFragment &fragB, bool isOutB, RegionId region) |
Relate a region between 2 fragments A & B which share a vertex x to neighborhoods just before and after x. | |
void | mergeRelated () |
void | assignAndMergeRegions (const std::list< FragmentId >::iterator &ringA, const std::list< FragmentId >::iterator &ringB) |
The space between ringA and ringB is not interrupted; mark coedges of A/B as same region. | |
bool | insertFragmentBetween (const std::list< FragmentId >::iterator &ringA, const std::list< FragmentId >::iterator &ringB, FragmentId fragId, EdgeFragment &frag, const internal::Point &other) |
Insert fragId into m_ring if it is between ringA and ringB. | |
void | insertFragment (FragmentId fragId, EdgeFragment &frag, const internal::Point &other) |
Insert frag where it belongs in the ring of fragments incident to m_point. More... | |
void | queueActiveEdge (FragmentId fragId, EdgeFragment &frag) |
void | removeActiveEdge (FragmentId fragId) |
void | processFragmentEndEvents () |
void | processFragmentStartEvents () |
void | processNeighbors () |
Process the neighborhood of one or more event endpoints. More... | |
void | advanceSweeplineTo (const internal::Point &pt) |
Advance the sweepline to the next event's point. More... | |
void | removeDeactivatedEdges () |
Process all edges passed to removeActiveEdge(). This is called each time (just before) the sweepline is advanced. | |
void | dumpRegions () |
RegionId | traverseLoop (OrientedEdges &result, std::set< RegionId > &neighborRegions, FragmentId fragId, bool orientation) |
void | dumpLoop (OrientedEdges &loopEdges, RegionId contained, std::set< RegionId > &neighborRegions) |
void | dumpRegions2 () |
void | setDebugLevel (int lvl) |
template<typename T > | |
T::Ptr | findStorage (const smtk::common::UUID &uid) |
Public Attributes | |
SweeplinePosition * | m_point |
internal::Point | m_nextPoint |
FragmentArray * | m_fragments |
SweepEventSet * | m_eventQueue |
ActiveFragmentTree * | m_activeEdges |
RegionIdSet | m_regionIds |
RegionDefinitions | m_regions |
std::vector< FragmentId > | m_fragmentsToQueue |
std::set< FragmentId > | m_fragmentsToDeactivate |
std::list< FragmentId > | m_ring |
std::set< std::pair< RegionId, RegionId > > | m_related |
RegionId | m_outside |
smtk::model::Resource::Ptr | m_resource |
smtk::session::polygon::SessionPtr | m_session |
int | m_debugLevel { 0 } |
Represent the neighborhood of a sweepline point, x.
This holds a CCW-ordered list of edges incident to x, plus an array of fragments
void smtk::session::polygon::Neighborhood::advanceSweeplineTo | ( | const internal::Point & | pt | ) |
Advance the sweepline to the next event's point.
This may do nothing if the next event is coincident with the current point. This may advance to some position other than pt if any queued edge fragments end or cross before pt.
void smtk::session::polygon::Neighborhood::insertFragment | ( | FragmentId | fragId, |
EdgeFragment & | frag, | ||
const internal::Point & | other | ||
) |
Insert frag where it belongs in the ring of fragments incident to m_point.
The other point is the end of frag which is not m_point. This algorithm works by traversing pre-existing neighborhood fragments to identify when dot(cross(fragIt-m_point x other-m_point),(0,0,1)) changes sign from - to +. Or, identically, it inserts frag between a neighboring pair of points on the ring (a,b) when dot(cross(a-m_point x other-m_point),(0,0,1)) > 0 && dot(cross(other-m_point x b-m_point),(0,0,1)) > 0.
If either cross product has zero magnitude, the fragment is collinear with an existing segment. In that case, (1) the shorter fragment is kept in the ring; (2) a new SegmentStart event is queued for the uncovered portion of the longer fragment; (3) the longer fragment is discarded; and (4?) a warning is logged.
bool smtk::session::polygon::Neighborhood::isFragmentOutgoing | ( | const EdgeFragment & | frag | ) |
Return the orientation of a fragment relative to the neighborhood.
Returns true when the neighborhood is placed at the left/lower end of the fragment and true otherwise. This is used to obtain the proper region ID when winding around the edges incident to the neighborhood.
void smtk::session::polygon::Neighborhood::processNeighbors | ( | ) |
Process the neighborhood of one or more event endpoints.
When this method is called, m_ring contains a CCW-ordered list of fragments incident to the sweepline position.