Use maxError when converting bezier to polyline.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20312

(cherry picked from commit e44c5a7fcda30137965251edf6e231436e602287)
This commit is contained in:
Jeff Young 2025-05-26 13:34:41 +01:00
parent 4634705f1c
commit 29d0cdb546
5 changed files with 21 additions and 2 deletions

View File

@ -435,7 +435,8 @@ void EDA_SHAPE::SetLength( const double& aLength )
switch( m_shape )
{
case SHAPE_T::SEGMENT:
m_segmentLength = aLength; break;
m_segmentLength = aLength;
break;
default:
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
@ -1638,7 +1639,7 @@ std::vector<SHAPE*> EDA_SHAPE::makeEffectiveShapes( bool aEdgeOnly, bool aLineCh
case SHAPE_T::BEZIER:
{
std::vector<VECTOR2I> bezierPoints = buildBezierToSegmentsPointsList( width / 2 );
std::vector<VECTOR2I> bezierPoints = buildBezierToSegmentsPointsList( getMaxError() );
VECTOR2I start_pt = bezierPoints[0];
for( unsigned int jj = 1; jj < bezierPoints.size(); jj++ )

View File

@ -137,6 +137,11 @@ protected:
m_fill = aFlag ? FILL_T::FILLED_WITH_COLOR : FILL_T::NO_FILL;
}
int getMaxError() const override
{
return schIUScale.mmToIU( ARC_HIGH_DEF_MM );
}
/**
* @copydoc SCH_ITEM::compare()
*

View File

@ -431,6 +431,8 @@ protected:
// fixme: move to shape_compound
std::vector<SHAPE*> makeEffectiveShapes( bool aEdgeOnly, bool aLineChainOnly = false ) const;
virtual int getMaxError() const { return 100; }
protected:
bool m_endsSwapped; // true if start/end were swapped e.g. SetArcAngleAndEnd
SHAPE_T m_shape; // Shape: line, Circle, Arc

View File

@ -731,6 +731,15 @@ std::shared_ptr<SHAPE> PCB_SHAPE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHI
}
int PCB_SHAPE::getMaxError() const
{
if( const BOARD* board = GetBoard() )
return board->GetDesignSettings().m_MaxError;
return ARC_HIGH_DEF;
}
void PCB_SHAPE::swapData( BOARD_ITEM* aImage )
{
PCB_SHAPE* image = dynamic_cast<PCB_SHAPE*>( aImage );

View File

@ -196,6 +196,8 @@ public:
protected:
void swapData( BOARD_ITEM* aImage ) override;
int getMaxError() const override;
struct cmp_drawings
{
bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;