router: add strict/loose area restriction constraint. WIP
This commit is contained in:
parent
24574aa2f5
commit
045d02f818
|
@ -224,6 +224,8 @@ bool AREA_CONSTRAINT::Check( int aVertex1, int aVertex2, const LINE* aOriginLine
|
|||
|
||||
bool p1_in = m_allowedArea.Contains( p1 );
|
||||
bool p2_in = m_allowedArea.Contains( p2 );
|
||||
bool p1n_in = false;
|
||||
bool p2n_in = false;
|
||||
|
||||
return p1_in || p2_in;
|
||||
}
|
||||
|
@ -672,6 +674,7 @@ bool OPTIMIZER::mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, int step
|
|||
bool ok = false;
|
||||
if ( !checkColliding( aLine, bypass ) )
|
||||
{
|
||||
//printf("Chk-constraints: %d %d\n", n, n+step+1 );
|
||||
ok = checkConstraints ( n, n + step + 1, aLine, aCurrentPath, bypass );
|
||||
}
|
||||
|
||||
|
|
|
@ -145,9 +145,10 @@ public:
|
|||
m_effortLevel |= OPTIMIZER::RESTRICT_VERTEX_RANGE;
|
||||
}
|
||||
|
||||
void SetRestrictArea( const BOX2I& aArea )
|
||||
void SetRestrictArea( const BOX2I& aArea, bool aStrict = true )
|
||||
{
|
||||
m_restrictArea = aArea;
|
||||
m_restrictAreaIsStrict = aStrict;
|
||||
}
|
||||
|
||||
void ClearConstraints();
|
||||
|
@ -208,6 +209,7 @@ private:
|
|||
VECTOR2I m_preservedVertex;
|
||||
std::pair<int, int> m_restrictedVertexRange;
|
||||
BOX2I m_restrictArea;
|
||||
bool m_restrictAreaIsStrict;
|
||||
};
|
||||
|
||||
|
||||
|
@ -259,9 +261,10 @@ private:
|
|||
class AREA_CONSTRAINT : public OPT_CONSTRAINT
|
||||
{
|
||||
public:
|
||||
AREA_CONSTRAINT( NODE* aWorld, const BOX2I& aAllowedArea ) :
|
||||
AREA_CONSTRAINT( NODE* aWorld, const BOX2I& aAllowedArea, bool aAllowedAreaStrict ) :
|
||||
OPT_CONSTRAINT( aWorld ),
|
||||
m_allowedArea ( aAllowedArea )
|
||||
m_allowedArea ( aAllowedArea ),
|
||||
m_allowedAreaStrict ( aAllowedAreaStrict )
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -271,6 +274,7 @@ public:
|
|||
|
||||
private:
|
||||
BOX2I m_allowedArea;
|
||||
bool m_allowedAreaStrict;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue