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;
174 newDirection =
m_direction.IsDiagonal() ? diagDirection : 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" );