Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when pns is walking around arcs #741

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 3rd_party/router/kimath/include/geometry/shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ class SHAPE_BASE
return m_type;
}

wxString TypeName() const
{
return SHAPE_TYPE_asString( m_type );
}

virtual bool HasIndexableSubshapes() const
{
return false;
Expand Down
47 changes: 24 additions & 23 deletions 3rd_party/router/kimath/src/geometry/shape_collisions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ static inline bool Collide( const SHAPE_LINE_CHAIN_BASE& aA, const SHAPE_LINE_CH
int aClearance, int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

int closest_dist = INT_MAX;
VECTOR2I nearest;
Expand Down Expand Up @@ -372,8 +372,8 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_LINE_CHAIN_BASE& a
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

int closest_dist = INT_MAX;
VECTOR2I nearest;
Expand Down Expand Up @@ -429,8 +429,8 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_SEGMENT& aB, int a
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );

Expand All @@ -445,8 +445,8 @@ static inline bool Collide( const SHAPE_SEGMENT& aA, const SHAPE_SEGMENT& aB, in
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );

Expand All @@ -461,8 +461,8 @@ static inline bool Collide( const SHAPE_LINE_CHAIN_BASE& aA, const SHAPE_SEGMENT
int aClearance, int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );

Expand All @@ -484,8 +484,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_RECT& aB, int aClea
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

const SHAPE_LINE_CHAIN lc( aA );

Expand All @@ -501,9 +501,10 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_RECT& aB, int aClea
static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_CIRCLE& aB, int aClearance,
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
// https://gitlab.com/kicad/code/kicad/-/commit/df9cf0a0c39ed99527b0c04e3892e8dd7ed603e7
/* wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.TypeName(),
aB.TypeName() ) ); */

const SHAPE_LINE_CHAIN lc( aA );

Expand All @@ -520,8 +521,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_LINE_CHAIN& aB, int
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

int closest_dist = INT_MAX;
VECTOR2I nearest;
Expand Down Expand Up @@ -592,8 +593,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_SEGMENT& aB, int aC
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

const SHAPE_LINE_CHAIN lc( aA );

Expand All @@ -610,8 +611,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_LINE_CHAIN_BASE& aB
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

int closest_dist = INT_MAX;
VECTOR2I nearest;
Expand Down Expand Up @@ -667,8 +668,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_ARC& aB, int aClear
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
aA.TypeName(),
aB.TypeName() ) );

SEG mediatrix( aA.GetCenter(), aB.GetCenter() );

Expand Down
Loading