87 const double areaRatioThreshold = 1.3;
90 const double areaRatioEpsilon = 0.25;
93 const double minAreaCutoffDistanceFactor = 6;
96 const int lockDistanceFactor = 30;
99 const int unlockDistanceFactor = 10;
114 double refLength =
SEG( p0, aP ).
Length();
123 double areaS = straight.
Area();
130 PNS_DBG( dbg, AddShape, &diag,
YELLOW, 100000, wxT(
"mt-diag" ) );
132 double areaDiag = diag.
Area();
133 double ratio = areaS / ( areaDiag + 1.0 );
139 PNS_DBG( dbg, Message,
"Posture: Unlocked and reset" );
156 if( trail.
Area() > areaCutoff )
160 PNS_DBG( dbg, Message, wxString::Format(
"Posture: rl %.0f thr %d tol %d as %.3f area OK %d forced %d\n", refLength, (
int)(unlockDistanceFactor *
m_tolerance),
m_tolerance, ratio, areaOk?1:0,
m_forced?1:0 ) );
169 if( !
m_forced && areaOk && ratio > areaRatioThreshold + areaRatioEpsilon )
170 newDirection = diagDirection;
171 else if( !
m_forced && areaOk && ratio < ( 1.0 / areaRatioThreshold ) - areaRatioEpsilon )
172 newDirection = straightDirection;
178 PNS_DBG( dbg, Message, wxString::Format(
"Posture: direction update %s => %s",
188 wxString::Format( wxT(
"Posture: checking direction %s against last seg %s" ),
195 PNS_DBG( dbg, Message, wxString::Format( wxT(
"Posture: forcing straight => %s" ),
196 straightDirection.
Format() ) );
205 PNS_DBG( dbg, Message, wxString::Format( wxT(
"Posture: forcing diagonal => %s" ),
206 diagDirection.
Format() ) );
218 PNS_DBG( dbg, Message, wxString::Format( wxT(
"Posture: correcting half full => %s" ),
230 PNS_DBG( dbg, Message, wxString::Format( wxT(
"Posture: correcting right => %s" ),
246 PNS_DBG( dbg, Message, wxString::Format( wxT(
"Posture: correcting obtuse => %s" ),
263 PNS_DBG( dbg, Message,
"Posture: solution locked" );
Represent route directions & corner angles in a 45-degree metric.
AngleType Angle(const DIRECTION_45 &aOther) const
Return the type of angle between directions (this) and aOther.
bool IsDiagonal() const
Returns true if the direction is diagonal (e.g.
const DIRECTION_45 Right() const
Return the direction on the right side of this (i.e.
const std::string Format() const
Format the direction in a human readable word.
void AddTrailPoint(const VECTOR2I &aP)
DIRECTION_45 m_lastSegDirection
DIRECTION_45 GetPosture(const VECTOR2I &aP)
VECTOR2I GetTrailLeadVector() const
virtual DEBUG_DECORATOR * GetDebugDecorator()=0
ROUTER_IFACE * GetInterface() const
static ROUTER * GetInstance()
ecoord SquaredDistance(const SEG &aSeg) const
VECTOR2I::extended_type ecoord
int Length() const
Return the length (this).
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_LINE_CHAIN Reverse() const
Reverse point order in the line chain.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Simplify(int aMaxError=0)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
int PointCount() const
Return the number of points (vertices) in this line chain.
void Clear()
Remove all points from the line chain.
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Return a subset of this line chain containing the [start_index, end_index] range of points.
double Area(bool aAbsolute=true) const
Return the area of this chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int SegmentCount() const
Return the number of segments in this line chain.
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
Push and Shove diff pair dimensions (gap) settings dialog.
#define PNS_DBG(dbg, method,...)
VECTOR2< int32_t > VECTOR2I