diff --git a/pcbnew/exporters/export_hyperlynx.cpp b/pcbnew/exporters/export_hyperlynx.cpp index e31fe73a2f..feab85642e 100644 --- a/pcbnew/exporters/export_hyperlynx.cpp +++ b/pcbnew/exporters/export_hyperlynx.cpp @@ -480,7 +480,7 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector& aObjec VECTOR2I start = arc->GetStart(); VECTOR2I end = arc->GetEnd(); - if( arc->GetArcAngleStart() < arc->GetArcAngleEnd() ) + if( arc->IsCCW() ) std::swap( start, end ); m_out->Print( 1, "(ARC X1=%.10f Y1=%.10f X2=%.10f Y2=%.10f XC=%.10f YC=%.10f R=%.10f W=%.10f L=\"%s\")\n", diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index 3db8d0ab59..f10c9e8e01 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -315,6 +315,15 @@ void PCB_ARC::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) } +bool PCB_ARC::IsCCW() const +{ + VECTOR2I start_end = m_End - m_Start; + VECTOR2I start_mid = m_Mid - m_Start; + + return start_end.Cross( start_mid ) < 0; +} + + void PCB_VIA::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { if( aFlipLeftRight ) diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index a528b5cdea..4270cda903 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -290,6 +290,8 @@ public: virtual bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override; + bool IsCCW() const; + wxString GetClass() const override { return wxT( "PCB_ARC" );