Hyperlynx arcs are always CW
Previous test comparing start/end angles doesn't account for all cases. This adds a more robust test to ensure all arcs are output in CW fashion Fixes https://gitlab.com/kicad/code/kicad/issues/10782
This commit is contained in:
parent
e1ee1ef7e5
commit
a43fcd045f
|
@ -480,7 +480,7 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector<BOARD_ITEM*>& 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",
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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" );
|
||||
|
|
Loading…
Reference in New Issue