Emplace_back a bit a in clipper

This commit is contained in:
Marek Roszko 2022-02-05 21:00:34 -05:00
parent 41f54349a5
commit 28ce11212c
2 changed files with 61 additions and 25 deletions

View File

@ -73,6 +73,7 @@
"items_not_allowed": "error",
"length_out_of_range": "error",
"lib_footprint_issues": "error",
"lib_footprint_mismatch": "error",
"malformed_courtyard": "error",
"microvia_drill_out_of_range": "error",
"missing_courtyard": "ignore",
@ -121,6 +122,46 @@
"solder_mask_to_copper_clearance": 0.0,
"use_height_for_length_calcs": true
},
"teardrop_options": [
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 5,
"td_on_pad_in_zone": false,
"td_onpadsmd": true,
"td_onroundshapesonly": false,
"td_ontrackend": false,
"td_onviapad": true
}
],
"teardrop_parameters": [
{
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_target_name": "td_round_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_target_name": "td_rect_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_target_name": "td_track_end",
"td_width_to_size_filter_ratio": 0.9
}
],
"track_widths": [],
"via_dimensions": [],
"zones_allow_external_fillets": false,

View File

@ -5203,9 +5203,8 @@ void ClipperOffset::DoOffset( double delta )
for( cInt j = 1; j <= steps; j++ )
{
m_destPoly.push_back( IntPoint(
Round( m_srcPoly[0].X + X * delta ),
Round( m_srcPoly[0].Y + Y * delta ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[0].X + X * delta ),
Round( m_srcPoly[0].Y + Y * delta ) );
double X2 = X;
X = X * m_cos - m_sin * Y;
Y = X2 * m_sin + Y * m_cos;
@ -5217,9 +5216,8 @@ void ClipperOffset::DoOffset( double delta )
for( int j = 0; j < 4; ++j )
{
m_destPoly.push_back( IntPoint(
Round( m_srcPoly[0].X + X * delta ),
Round( m_srcPoly[0].Y + Y * delta ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[0].X + X * delta ),
Round( m_srcPoly[0].Y + Y * delta ) );
if( X < 0 )
X = 1;
@ -5361,8 +5359,8 @@ void ClipperOffset::OffsetPoint( int j, int& k, JoinType jointype )
if( cosA > 0 ) // angle => 0 degrees
{
m_destPoly.push_back( IntPoint( Round( m_srcPoly[j].X + m_normals[k].X * m_delta ),
Round( m_srcPoly[j].Y + m_normals[k].Y * m_delta ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[j].X + m_normals[k].X * m_delta ),
Round( m_srcPoly[j].Y + m_normals[k].Y * m_delta ) );
return;
}
@ -5375,11 +5373,11 @@ void ClipperOffset::OffsetPoint( int j, int& k, JoinType jointype )
if( m_sinA * m_delta < 0 )
{
m_destPoly.push_back( IntPoint( Round( m_srcPoly[j].X + m_normals[k].X * m_delta ),
Round( m_srcPoly[j].Y + m_normals[k].Y * m_delta ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[j].X + m_normals[k].X * m_delta ),
Round( m_srcPoly[j].Y + m_normals[k].Y * m_delta ) );
m_destPoly.push_back( m_srcPoly[j] );
m_destPoly.push_back( IntPoint( Round( m_srcPoly[j].X + m_normals[j].X * m_delta ),
Round( m_srcPoly[j].Y + m_normals[j].Y * m_delta ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[j].X + m_normals[j].X * m_delta ),
Round( m_srcPoly[j].Y + m_normals[j].Y * m_delta ) );
}
else
switch( jointype )
@ -5433,8 +5431,8 @@ void ClipperOffset::DoMiter( int j, int k, double r )
{
double q = m_delta / r;
m_destPoly.push_back( IntPoint( Round( m_srcPoly[j].X + (m_normals[k].X + m_normals[j].X) * q ),
Round( m_srcPoly[j].Y + (m_normals[k].Y + m_normals[j].Y) * q ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[j].X + ( m_normals[k].X + m_normals[j].X ) * q ),
Round( m_srcPoly[j].Y + ( m_normals[k].Y + m_normals[j].Y ) * q ) );
}
@ -5451,9 +5449,8 @@ void ClipperOffset::DoRound( int j, int k )
for( int i = 0; i < takenSteps; ++i )
{
m_destPoly.push_back( IntPoint(
Round( m_srcPoly[j].X + X * m_delta ),
Round( m_srcPoly[j].Y + Y * m_delta ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[j].X + X * m_delta ),
Round( m_srcPoly[j].Y + Y * m_delta ) );
X2 = X;
X = X * m_cos - m_sin * Y;
Y = X2 * m_sin + Y * m_cos;
@ -5463,14 +5460,12 @@ void ClipperOffset::DoRound( int j, int k )
// from generating geometrically noisy solutions.
if( steps > takenSteps + 0.1 )
{
m_destPoly.push_back( IntPoint(
Round( m_srcPoly[j].X + X * m_delta ),
Round( m_srcPoly[j].Y + Y * m_delta ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[j].X + X * m_delta ),
Round( m_srcPoly[j].Y + Y * m_delta ) );
}
m_destPoly.push_back( IntPoint(
Round( m_srcPoly[j].X + m_normals[j].X * m_delta ),
Round( m_srcPoly[j].Y + m_normals[j].Y * m_delta ) ) );
m_destPoly.emplace_back( Round( m_srcPoly[j].X + m_normals[j].X * m_delta ),
Round( m_srcPoly[j].Y + m_normals[j].Y * m_delta ) );
}
@ -5801,7 +5796,7 @@ void Minkowski( const Path& poly, const Path& path,
p.reserve( polyCnt );
for( size_t j = 0; j < poly.size(); ++j )
p.push_back( IntPoint( path[i].X + poly[j].X, path[i].Y + poly[j].Y ) );
p.emplace_back( path[i].X + poly[j].X, path[i].Y + poly[j].Y );
pp.push_back( p );
}
@ -5814,7 +5809,7 @@ void Minkowski( const Path& poly, const Path& path,
p.reserve( polyCnt );
for( size_t j = 0; j < poly.size(); ++j )
p.push_back( IntPoint( path[i].X - poly[j].X, path[i].Y - poly[j].Y ) );
p.emplace_back( path[i].X - poly[j].X, path[i].Y - poly[j].Y );
pp.push_back( p );
}