|
KiCad PCB EDA Suite
|
#include <snap_resolver.h>
Public Types | |
| using | CLOCK = std::chrono::steady_clock |
| using | CLOCK_CALLBACK = std::function<CLOCK::time_point()> |
| using | FEASIBILITY_CALLBACK |
| using | TRACE_CALLBACK = std::function<void( const std::string& )> |
Public Member Functions | |
| void | AddCandidate (SNAP_CANDIDATE aCandidate) |
| void | Clear () |
| void | SetRetainedCandidate (std::optional< SNAP_STABLE_ID > aId) |
| void | SetStickyCandidates (std::vector< SNAP_STABLE_ID > aIds) |
| Bias the ranking toward candidates accepted on a previous resolve so the chosen snap stays put until a competitor is clearly closer. | |
| void | SetRankingHysteresis (double aNormalizedResidual) |
| Set how strongly a candidate with hysteresis is favoured, as a fraction of the snap radius. | |
| void | SetFeasibilityCallback (FEASIBILITY_CALLBACK aCallback) |
| void | SetTraceCallback (TRACE_CALLBACK aCallback) |
| void | SetClock (CLOCK_CALLBACK aClock) |
| void | SetDeadline (CLOCK::duration aDeadline) |
| SNAP_RESULT | Resolve (const SNAP_SOURCE_CONTEXT &aContext) const |
Private Member Functions | |
| bool | hasHysteresis (const SNAP_STABLE_ID &aId) const |
| True when a candidate should earn the ranking hysteresis (retained or sticky). | |
Private Attributes | |
| std::vector< SNAP_CANDIDATE > | m_candidates |
| std::optional< SNAP_STABLE_ID > | m_retainedCandidate |
| std::vector< SNAP_STABLE_ID > | m_stickyCandidates |
| double | m_rankingHysteresis = SNAP_DEFAULT_RANKING_HYSTERESIS |
| FEASIBILITY_CALLBACK | m_feasibilityCallback |
| TRACE_CALLBACK | m_traceCallback |
| CLOCK_CALLBACK | m_clock |
| CLOCK::duration | m_deadline = std::chrono::milliseconds( 8 ) |
Definition at line 254 of file snap_resolver.h.
| using SNAP_RESOLVER::CLOCK = std::chrono::steady_clock |
Definition at line 257 of file snap_resolver.h.
| using SNAP_RESOLVER::CLOCK_CALLBACK = std::function<CLOCK::time_point()> |
Definition at line 258 of file snap_resolver.h.
Definition at line 260 of file snap_resolver.h.
| using SNAP_RESOLVER::TRACE_CALLBACK = std::function<void( const std::string& )> |
Definition at line 262 of file snap_resolver.h.
| void SNAP_RESOLVER::AddCandidate | ( | SNAP_CANDIDATE | aCandidate | ) |
Definition at line 572 of file snap_resolver.cpp.
References m_candidates.
Referenced by BOARD_CONSTRAINT_MOVE_SESSION::ResolveCandidates(), and BOARD_CONSTRAINT_ADAPTER::SolveRigidSnapRelations().
| void SNAP_RESOLVER::Clear | ( | ) |
Definition at line 578 of file snap_resolver.cpp.
References m_candidates.
|
private |
True when a candidate should earn the ranking hysteresis (retained or sticky).
Definition at line 602 of file snap_resolver.cpp.
References m_retainedCandidate, and m_stickyCandidates.
Referenced by Resolve().
| SNAP_RESULT SNAP_RESOLVER::Resolve | ( | const SNAP_SOURCE_CONTEXT & | aContext | ) | const |
Definition at line 635 of file snap_resolver.cpp.
References ANGLE, AUTHORED_INTRINSIC, BUDGET_EXHAUSTED, hasHysteresis(), SNAP_REFERENCE_PREFERENCE::horizontalFeature, SNAP_CANDIDATE::id, INTRINSIC_ANCHOR, SNAP_REFERENCE_PREFERENCE::kind, m_candidates, m_clock, m_deadline, m_feasibilityCallback, m_rankingHysteresis, m_retainedCandidate, m_stickyCandidates, m_traceCallback, SNAP_CANDIDATE::normalizedScreenResidual, SNAP_CANDIDATE::origin, SNAP_CANDIDATE::priority, SNAP_CANDIDATE::referenceAffinity, SNAP_SOURCE_CONTEXT::referencePreference, SNAP_CANDIDATE::relation, result, SNAP_SOURCE_CONTEXT::sourcePoint, SUCCESS, SNAP_REFERENCE_PREFERENCE::verticalFeature, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOARD_CONSTRAINT_MOVE_SESSION::ResolveCandidates(), and BOARD_CONSTRAINT_ADAPTER::SolveRigidSnapRelations().
| void SNAP_RESOLVER::SetClock | ( | CLOCK_CALLBACK | aClock | ) |
Definition at line 623 of file snap_resolver.cpp.
References m_clock.
| void SNAP_RESOLVER::SetDeadline | ( | CLOCK::duration | aDeadline | ) |
Definition at line 629 of file snap_resolver.cpp.
References m_deadline.
| void SNAP_RESOLVER::SetFeasibilityCallback | ( | FEASIBILITY_CALLBACK | aCallback | ) |
Definition at line 611 of file snap_resolver.cpp.
References m_feasibilityCallback.
| void SNAP_RESOLVER::SetRankingHysteresis | ( | double | aNormalizedResidual | ) |
Set how strongly a candidate with hysteresis is favoured, as a fraction of the snap radius.
Definition at line 596 of file snap_resolver.cpp.
References m_rankingHysteresis.
| void SNAP_RESOLVER::SetRetainedCandidate | ( | std::optional< SNAP_STABLE_ID > | aId | ) |
Definition at line 584 of file snap_resolver.cpp.
References m_retainedCandidate.
| void SNAP_RESOLVER::SetStickyCandidates | ( | std::vector< SNAP_STABLE_ID > | aIds | ) |
Bias the ranking toward candidates accepted on a previous resolve so the chosen snap stays put until a competitor is clearly closer.
Unlike the retained candidate these are not forced into the result, they only earn the ranking hysteresis that prevents frame-to-frame jitter between near-equal solutions.
Definition at line 590 of file snap_resolver.cpp.
References m_stickyCandidates.
| void SNAP_RESOLVER::SetTraceCallback | ( | TRACE_CALLBACK | aCallback | ) |
Definition at line 617 of file snap_resolver.cpp.
References m_traceCallback.
|
private |
Definition at line 292 of file snap_resolver.h.
Referenced by AddCandidate(), Clear(), and Resolve().
|
private |
Definition at line 298 of file snap_resolver.h.
Referenced by Resolve(), and SetClock().
|
private |
Definition at line 302 of file snap_resolver.h.
Referenced by Resolve(), and SetDeadline().
|
private |
Definition at line 296 of file snap_resolver.h.
Referenced by Resolve(), and SetFeasibilityCallback().
|
private |
Definition at line 295 of file snap_resolver.h.
Referenced by Resolve(), and SetRankingHysteresis().
|
private |
Definition at line 293 of file snap_resolver.h.
Referenced by hasHysteresis(), Resolve(), and SetRetainedCandidate().
|
private |
Definition at line 294 of file snap_resolver.h.
Referenced by hasHysteresis(), Resolve(), and SetStickyCandidates().
|
private |
Definition at line 297 of file snap_resolver.h.
Referenced by Resolve(), and SetTraceCallback().