Length Tuner: Allow controlling the side of the meander using the cursor
Also fixes an issue that did not allow single meanders to be placed
This commit is contained in:
parent
2225c4e4ed
commit
71156368c9
|
@ -254,7 +254,7 @@ bool DP_MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
|
|||
curIndexN = tunedN.NextShape( curIndexN );
|
||||
}
|
||||
|
||||
m_result.MeanderSegment( base );
|
||||
m_result.MeanderSegment( base, base.Side( aP ) < 0 );
|
||||
}
|
||||
|
||||
while( curIndexP < tunedP.PointCount() && curIndexP != -1 )
|
||||
|
|
|
@ -42,13 +42,13 @@ const MEANDER_SETTINGS& MEANDERED_LINE::Settings() const
|
|||
}
|
||||
|
||||
|
||||
void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
|
||||
void MEANDERED_LINE::MeanderSegment( const SEG& aBase, bool aSide, int aBaseIndex )
|
||||
{
|
||||
double base_len = aBase.Length();
|
||||
|
||||
SHAPE_LINE_CHAIN lc;
|
||||
|
||||
bool side = true;
|
||||
bool side = aSide;
|
||||
VECTOR2D dir( aBase.B - aBase.A );
|
||||
|
||||
if( !m_dual )
|
||||
|
@ -80,11 +80,13 @@ void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
|
|||
{
|
||||
for( int i = 0; i < 2; i++ )
|
||||
{
|
||||
if( m.Fit( MT_CHECK_START, aBase, m_last, i ) )
|
||||
bool checkSide = ( i == 0 ) ? side : !side;
|
||||
|
||||
if( m.Fit( MT_CHECK_START, aBase, m_last, checkSide ) )
|
||||
{
|
||||
turning = true;
|
||||
AddMeander( new MEANDER_SHAPE( m ) );
|
||||
side = !i;
|
||||
side = !checkSide;
|
||||
started = true;
|
||||
break;
|
||||
}
|
||||
|
@ -96,12 +98,14 @@ void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
|
|||
|
||||
for( int i = 0; i < 2; i++ )
|
||||
{
|
||||
if( m.Fit( MT_SINGLE, aBase, m_last, i ) )
|
||||
bool checkSide = ( i == 0 ) ? side : !side;
|
||||
|
||||
if( m.Fit( MT_SINGLE, aBase, m_last, checkSide ) )
|
||||
{
|
||||
AddMeander( new MEANDER_SHAPE( m ) );
|
||||
fail = false;
|
||||
started = false;
|
||||
side = !i;
|
||||
side = !checkSide;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -472,9 +472,10 @@ public:
|
|||
* Fit maximum amplitude meanders on a given segment and adds to the current line.
|
||||
*
|
||||
* @param aSeg the base segment to meander.
|
||||
* @param aSide Side to start meandering the segment. True=left, False=Right
|
||||
* @param aBaseIndex index of the base segment in the original line.
|
||||
*/
|
||||
void MeanderSegment( const SEG& aSeg, int aBaseIndex = 0 );
|
||||
void MeanderSegment( const SEG& aSeg, bool aSide, int aBaseIndex = 0 );
|
||||
|
||||
/// @copydoc MEANDER_SHAPE::SetBaselineOffset()
|
||||
void SetBaselineOffset( int aOffset )
|
||||
|
|
|
@ -139,7 +139,7 @@ bool MEANDER_PLACER::doMove( const VECTOR2I& aP, ITEM* aEndItem, long long int a
|
|||
|
||||
const SEG s = tuned.CSegment( i );
|
||||
m_result.AddCorner( s.A );
|
||||
m_result.MeanderSegment( s );
|
||||
m_result.MeanderSegment( s, s.Side( aP ) < 0 );
|
||||
m_result.AddCorner( s.B );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue