Finish with EDA_ANGLE.
This commit is contained in:
parent
4b7fe5bce3
commit
e61144d45a
|
@ -488,8 +488,8 @@ private:
|
||||||
void addSolidAreasShapes( const ZONE* aZoneContainer, CONTAINER_2D_BASE* aDstContainer,
|
void addSolidAreasShapes( const ZONE* aZoneContainer, CONTAINER_2D_BASE* aDstContainer,
|
||||||
PCB_LAYER_ID aLayerId );
|
PCB_LAYER_ID aLayerId );
|
||||||
|
|
||||||
void transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart, double aArcAngle,
|
void transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
||||||
int aCircleToSegmentsCount, int aWidth,
|
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount, int aWidth,
|
||||||
CONTAINER_2D_BASE* aDstContainer, const BOARD_ITEM& aBoardItem );
|
CONTAINER_2D_BASE* aDstContainer, const BOARD_ITEM& aBoardItem );
|
||||||
|
|
||||||
void buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, int aWidth );
|
void buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, int aWidth );
|
||||||
|
|
|
@ -260,9 +260,8 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs
|
||||||
circlesegcount = std::max( 1, std::min( circlesegcount, 128 ) );
|
circlesegcount = std::max( 1, std::min( circlesegcount, 128 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
transformArcToSegments( VECTOR2I( center.x, center.y ), arc->GetStart(),
|
transformArcToSegments( VECTOR2I( center.x, center.y ), arc->GetStart(), arc_angle,
|
||||||
arc_angle.AsTenthsOfADegree(), circlesegcount, arc->GetWidth(),
|
circlesegcount, arc->GetWidth(), aDstContainer, *arc );
|
||||||
aDstContainer, *arc );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,31 +531,30 @@ void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDs
|
||||||
// based on TransformArcToPolygon function from
|
// based on TransformArcToPolygon function from
|
||||||
// common/convert_basic_shapes_to_polygon.cpp
|
// common/convert_basic_shapes_to_polygon.cpp
|
||||||
void BOARD_ADAPTER::transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
void BOARD_ADAPTER::transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
||||||
double aArcAngle, int aCircleToSegmentsCount,
|
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount,
|
||||||
int aWidth, CONTAINER_2D_BASE* aDstContainer,
|
int aWidth, CONTAINER_2D_BASE* aDstContainer,
|
||||||
const BOARD_ITEM& aBoardItem )
|
const BOARD_ITEM& aBoardItem )
|
||||||
{
|
{
|
||||||
VECTOR2I arc_start, arc_end;
|
VECTOR2I arc_start, arc_end;
|
||||||
int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree
|
EDA_ANGLE arcAngle( aArcAngle );
|
||||||
|
EDA_ANGLE delta = ANGLE_360 / aCircleToSegmentsCount; // rotate angle
|
||||||
|
|
||||||
arc_end = arc_start = aStart;
|
arc_end = arc_start = aStart;
|
||||||
|
|
||||||
if( aArcAngle != 3600 )
|
if( arcAngle != ANGLE_360 )
|
||||||
{
|
RotatePoint( arc_end, aCentre, -arcAngle );
|
||||||
RotatePoint( arc_end, aCentre, -aArcAngle );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( aArcAngle < 0 )
|
if( arcAngle < ANGLE_0 )
|
||||||
{
|
{
|
||||||
std::swap( arc_start, arc_end );
|
std::swap( arc_start, arc_end );
|
||||||
aArcAngle = -aArcAngle;
|
arcAngle = -arcAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the ends of segments and creates poly
|
// Compute the ends of segments and creates poly
|
||||||
VECTOR2I curr_end = arc_start;
|
VECTOR2I curr_end = arc_start;
|
||||||
VECTOR2I curr_start = arc_start;
|
VECTOR2I curr_start = arc_start;
|
||||||
|
|
||||||
for( int ii = delta; ii < aArcAngle; ii += delta )
|
for( EDA_ANGLE ii = delta; ii < arcAngle; ii += delta )
|
||||||
{
|
{
|
||||||
curr_end = arc_start;
|
curr_end = arc_start;
|
||||||
RotatePoint( curr_end, aCentre, -ii );
|
RotatePoint( curr_end, aCentre, -ii );
|
||||||
|
@ -659,9 +657,8 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aDstCo
|
||||||
{
|
{
|
||||||
unsigned int segCount = GetCircleSegmentCount( aShape->GetBoundingBox().GetSizeMax() );
|
unsigned int segCount = GetCircleSegmentCount( aShape->GetBoundingBox().GetSizeMax() );
|
||||||
|
|
||||||
transformArcToSegments( aShape->GetCenter(), aShape->GetStart(),
|
transformArcToSegments( aShape->GetCenter(), aShape->GetStart(), aShape->GetArcAngle(),
|
||||||
aShape->GetArcAngle().AsTenthsOfADegree(), segCount, linewidth,
|
segCount, linewidth, aDstContainer, *aShape );
|
||||||
aDstContainer, *aShape );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,7 @@ void DRAWING_SHEET_PARSER::parsePolygon( DS_DATA_ITEM_POLYGONS * aItem )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_rotate:
|
case T_rotate:
|
||||||
aItem->m_Orient = parseDouble();
|
aItem->m_Orient = EDA_ANGLE( parseDouble(), DEGREES_T );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -381,7 +381,6 @@ const wxString DS_DATA_ITEM::GetClassName() const
|
||||||
DS_DATA_ITEM_POLYGONS::DS_DATA_ITEM_POLYGONS() :
|
DS_DATA_ITEM_POLYGONS::DS_DATA_ITEM_POLYGONS() :
|
||||||
DS_DATA_ITEM( DS_POLYPOLYGON )
|
DS_DATA_ITEM( DS_POLYPOLYGON )
|
||||||
{
|
{
|
||||||
m_Orient = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -445,12 +444,12 @@ int DS_DATA_ITEM_POLYGONS::GetPenSizeUi()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const DPOINT DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
|
const VECTOR2D DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
|
||||||
{
|
{
|
||||||
DPOINT pos = m_Corners[aIdx];
|
VECTOR2D pos = m_Corners[aIdx];
|
||||||
|
|
||||||
// Rotation:
|
// Rotation:
|
||||||
RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
|
RotatePoint( &pos.x, &pos.y, m_Orient );
|
||||||
pos += GetStartPos( aRepeat );
|
pos += GetStartPos( aRepeat );
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
@ -465,15 +464,15 @@ void DS_DATA_ITEM_POLYGONS::SetBoundingBox()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPOINT pos;
|
VECTOR2I pos;
|
||||||
pos = m_Corners[0];
|
pos = m_Corners[0];
|
||||||
RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
|
RotatePoint( &pos.x, &pos.y, m_Orient );
|
||||||
m_minCoord = m_maxCoord = pos;
|
m_minCoord = m_maxCoord = pos;
|
||||||
|
|
||||||
for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
|
for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
|
||||||
{
|
{
|
||||||
pos = m_Corners[ii];
|
pos = m_Corners[ii];
|
||||||
RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
|
RotatePoint( &pos.x, &pos.y, m_Orient );
|
||||||
|
|
||||||
if( m_minCoord.x > pos.x )
|
if( m_minCoord.x > pos.x )
|
||||||
m_minCoord.x = pos.x;
|
m_minCoord.x = pos.x;
|
||||||
|
|
|
@ -341,8 +341,8 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) co
|
||||||
|
|
||||||
formatRepeatParameters( aItem );
|
formatRepeatParameters( aItem );
|
||||||
|
|
||||||
if( aItem->m_Orient )
|
if( !aItem->m_Orient.IsZero() )
|
||||||
m_out->Print( 0, " (rotate %s)", double2Str(aItem->m_Orient ).c_str() );
|
m_out->Print( 0, " (rotate %s)", double2Str( aItem->m_Orient.AsDegrees() ).c_str() );
|
||||||
|
|
||||||
if( aItem->m_LineWidth )
|
if( aItem->m_LineWidth )
|
||||||
m_out->Print( 0, " (linewidth %s)\n", double2Str( aItem->m_LineWidth ).c_str() );
|
m_out->Print( 0, " (linewidth %s)\n", double2Str( aItem->m_LineWidth ).c_str() );
|
||||||
|
|
|
@ -181,14 +181,16 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
bool EDA_RECT::Intersects( const EDA_RECT& aRect, const EDA_ANGLE& aRotation ) const
|
||||||
{
|
{
|
||||||
if( !m_init )
|
if( !m_init )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Most rectangles will be axis aligned.
|
double rotation = aRotation.AsTenthsOfADegree();
|
||||||
* It is quicker to check for this case and pass the rect
|
|
||||||
* to the simpler intersection test
|
/*
|
||||||
|
* Most rectangles will be axis aligned. It is quicker to check for this case and pass
|
||||||
|
* the rect to the simpler intersection test.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Prevent floating point comparison errors
|
// Prevent floating point comparison errors
|
||||||
|
@ -197,21 +199,19 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||||
static const double ROT_PARALLEL[] = { -3600, -1800, 0, 1800, 3600 };
|
static const double ROT_PARALLEL[] = { -3600, -1800, 0, 1800, 3600 };
|
||||||
static const double ROT_PERPENDICULAR[] = { -2700, -900, 0, 900, 2700 };
|
static const double ROT_PERPENDICULAR[] = { -2700, -900, 0, 900, 2700 };
|
||||||
|
|
||||||
NORMALIZE_ANGLE_POS<double>( aRot );
|
NORMALIZE_ANGLE_POS<double>( rotation );
|
||||||
|
|
||||||
// Test for non-rotated rectangle
|
// Test for non-rotated rectangle
|
||||||
for( int ii = 0; ii < 5; ii++ )
|
for( int ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
if( std::fabs( aRot - ROT_PARALLEL[ii] ) < ROT_EPS )
|
if( std::fabs( rotation - ROT_PARALLEL[ii] ) < ROT_EPS )
|
||||||
{
|
|
||||||
return Intersects( aRect );
|
return Intersects( aRect );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for rectangle rotated by multiple of 90 degrees
|
// Test for rectangle rotated by multiple of 90 degrees
|
||||||
for( int jj = 0; jj < 4; jj++ )
|
for( int jj = 0; jj < 4; jj++ )
|
||||||
{
|
{
|
||||||
if( std::fabs( aRot - ROT_PERPENDICULAR[jj] ) < ROT_EPS )
|
if( std::fabs( rotation - ROT_PERPENDICULAR[jj] ) < ROT_EPS )
|
||||||
{
|
{
|
||||||
EDA_RECT rotRect;
|
EDA_RECT rotRect;
|
||||||
|
|
||||||
|
@ -242,13 +242,11 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||||
for( int i = 0; i < 4; i++ )
|
for( int i = 0; i < 4; i++ )
|
||||||
{
|
{
|
||||||
VECTOR2I delta = corners[i] - rCentre;
|
VECTOR2I delta = corners[i] - rCentre;
|
||||||
RotatePoint( delta, -aRot );
|
RotatePoint( delta, -rotation );
|
||||||
delta += rCentre;
|
delta += rCentre;
|
||||||
|
|
||||||
if( aRect.Contains( delta ) )
|
if( aRect.Contains( delta ) )
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test B : Any corners of rotated rect exist in this one? */
|
/* Test B : Any corners of rotated rect exist in this one? */
|
||||||
|
@ -264,13 +262,11 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||||
// Rotate and test each corner
|
// Rotate and test each corner
|
||||||
for( int j = 0; j < 4; j++ )
|
for( int j = 0; j < 4; j++ )
|
||||||
{
|
{
|
||||||
RotatePoint( corners[j], aRot );
|
RotatePoint( corners[j], rotation );
|
||||||
corners[j] += rCentre;
|
corners[j] += rCentre;
|
||||||
|
|
||||||
if( Contains( corners[j] ) )
|
if( Contains( corners[j] ) )
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test C : Any sides of rotated rect intersect this */
|
/* Test C : Any sides of rotated rect intersect this */
|
||||||
|
@ -510,7 +506,8 @@ EDA_RECT EDA_RECT::Common( const EDA_RECT& aRect ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const VECTOR2I& aRotCenter, double aAngle ) const
|
const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const VECTOR2I& aRotCenter,
|
||||||
|
const EDA_ANGLE& aAngle ) const
|
||||||
{
|
{
|
||||||
VECTOR2I corners[4];
|
VECTOR2I corners[4];
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ void EDA_SHAPE::scale( double aScale )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, double aAngle )
|
void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
||||||
{
|
{
|
||||||
switch( m_shape )
|
switch( m_shape )
|
||||||
{
|
{
|
||||||
|
@ -239,7 +239,7 @@ void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, double aAngle )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::RECT:
|
case SHAPE_T::RECT:
|
||||||
if( KiROUND( aAngle ) % 900 == 0 )
|
if( aAngle.IsCardinal() )
|
||||||
{
|
{
|
||||||
RotatePoint( m_start, aRotCentre, aAngle );
|
RotatePoint( m_start, aRotCentre, aAngle );
|
||||||
RotatePoint( m_end, aRotCentre, aAngle );
|
RotatePoint( m_end, aRotCentre, aAngle );
|
||||||
|
@ -258,7 +258,7 @@ void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, double aAngle )
|
||||||
KI_FALLTHROUGH;
|
KI_FALLTHROUGH;
|
||||||
|
|
||||||
case SHAPE_T::POLY:
|
case SHAPE_T::POLY:
|
||||||
m_poly.Rotate( -DECIDEG2RAD( aAngle ), VECTOR2I( aRotCentre ) );
|
m_poly.Rotate( -aAngle.AsRadians(), aRotCentre );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::BEZIER:
|
case SHAPE_T::BEZIER:
|
||||||
|
@ -878,14 +878,10 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
||||||
// Polygons in footprints use coordinates relative to the footprint.
|
// Polygons in footprints use coordinates relative to the footprint.
|
||||||
// Therefore, instead of using m_poly, we make a copy which is translated
|
// Therefore, instead of using m_poly, we make a copy which is translated
|
||||||
// to the actual location in the board.
|
// to the actual location in the board.
|
||||||
double orientation = 0.0;
|
|
||||||
VECTOR2I offset = getParentPosition();
|
VECTOR2I offset = getParentPosition();
|
||||||
|
|
||||||
if( getParentOrientation() )
|
|
||||||
orientation = -DECIDEG2RAD( getParentOrientation() );
|
|
||||||
|
|
||||||
SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
|
SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
|
||||||
poly.Rotate( orientation );
|
poly.Rotate( -getParentOrientation().AsRadians() );
|
||||||
poly.Move( offset );
|
poly.Move( offset );
|
||||||
|
|
||||||
int count = poly.GetPointCount();
|
int count = poly.GetPointCount();
|
||||||
|
@ -966,7 +962,7 @@ std::vector<VECTOR2I> EDA_SHAPE::GetRectCorners() const
|
||||||
VECTOR2I botRight = GetEnd();
|
VECTOR2I botRight = GetEnd();
|
||||||
|
|
||||||
// Un-rotate rect topLeft and botRight
|
// Un-rotate rect topLeft and botRight
|
||||||
if( KiROUND( getParentOrientation() ) % 900 != 0 )
|
if( !getParentOrientation().IsCardinal() )
|
||||||
{
|
{
|
||||||
topLeft -= getParentPosition();
|
topLeft -= getParentPosition();
|
||||||
RotatePoint( topLeft, -getParentOrientation() );
|
RotatePoint( topLeft, -getParentOrientation() );
|
||||||
|
@ -982,7 +978,7 @@ std::vector<VECTOR2I> EDA_SHAPE::GetRectCorners() const
|
||||||
pts.emplace_back( topLeft.x, botRight.y );
|
pts.emplace_back( topLeft.x, botRight.y );
|
||||||
|
|
||||||
// Now re-rotate the 4 corners to get a diamond
|
// Now re-rotate the 4 corners to get a diamond
|
||||||
if( KiROUND( getParentOrientation() ) % 900 != 0 )
|
if( !getParentOrientation().IsCardinal() )
|
||||||
{
|
{
|
||||||
for( VECTOR2I& pt : pts )
|
for( VECTOR2I& pt : pts )
|
||||||
{
|
{
|
||||||
|
@ -1137,7 +1133,7 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
|
||||||
{
|
{
|
||||||
SHAPE_LINE_CHAIN l = GetPolyShape().COutline( 0 );
|
SHAPE_LINE_CHAIN l = GetPolyShape().COutline( 0 );
|
||||||
|
|
||||||
l.Rotate( -DECIDEG2RAD( getParentOrientation() ) );
|
l.Rotate( -getParentOrientation().AsRadians() );
|
||||||
l.Move( getParentPosition() );
|
l.Move( getParentPosition() );
|
||||||
|
|
||||||
if( IsFilled() && !aEdgeOnly )
|
if( IsFilled() && !aEdgeOnly )
|
||||||
|
@ -1547,8 +1543,8 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// The polygon is expected to be a simple polygon; not self intersecting, no hole.
|
// The polygon is expected to be a simple polygon; not self intersecting, no hole.
|
||||||
double orientation = getParentOrientation();
|
EDA_ANGLE orientation = getParentOrientation();
|
||||||
VECTOR2I offset = getParentPosition();
|
VECTOR2I offset = getParentPosition();
|
||||||
|
|
||||||
// Build the polygon with the actual position and orientation:
|
// Build the polygon with the actual position and orientation:
|
||||||
std::vector<VECTOR2I> poly;
|
std::vector<VECTOR2I> poly;
|
||||||
|
|
|
@ -627,7 +627,7 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
|
||||||
if( aContains )
|
if( aContains )
|
||||||
return rect.Contains( GetTextBox() );
|
return rect.Contains( GetTextBox() );
|
||||||
|
|
||||||
return rect.Intersects( GetTextBox(), GetTextAngle().AsTenthsOfADegree() );
|
return rect.Intersects( GetTextBox(), GetTextAngle() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -871,16 +871,16 @@ void GERBER_PLOTTER::plotArc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAn
|
||||||
const EDA_ANGLE& aEndAngle, int aRadius, bool aPlotInRegion )
|
const EDA_ANGLE& aEndAngle, int aRadius, bool aPlotInRegion )
|
||||||
{
|
{
|
||||||
VECTOR2I start, end;
|
VECTOR2I start, end;
|
||||||
start.x = aCenter.x + KiROUND( aRadius * cos( aStartAngle.AsRadians() ) );
|
start.x = aCenter.x + KiROUND( aRadius * aStartAngle.Cos() );
|
||||||
start.y = aCenter.y - KiROUND( aRadius * sin( aStartAngle.AsRadians() ) );
|
start.y = aCenter.y - KiROUND( aRadius * aStartAngle.Sin() );
|
||||||
|
|
||||||
if( !aPlotInRegion )
|
if( !aPlotInRegion )
|
||||||
MoveTo( start );
|
MoveTo( start );
|
||||||
else
|
else
|
||||||
LineTo( start );
|
LineTo( start );
|
||||||
|
|
||||||
end.x = aCenter.x + KiROUND( aRadius * cos( aEndAngle.AsRadians() ) );
|
end.x = aCenter.x + KiROUND( aRadius * aEndAngle.Cos() );
|
||||||
end.y = aCenter.y - KiROUND( aRadius * sin( aEndAngle.AsRadians() ) );
|
end.y = aCenter.y - KiROUND( aRadius * aEndAngle.Sin() );
|
||||||
DPOINT devEnd = userToDeviceCoordinates( end );
|
DPOINT devEnd = userToDeviceCoordinates( end );
|
||||||
DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
|
DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
|
||||||
|
|
||||||
|
@ -1589,8 +1589,8 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const VECTOR2I& aRectCenter, const V
|
||||||
// small difference, mainly for rotated pads.
|
// small difference, mainly for rotated pads.
|
||||||
// calculate last point (end of last arc):
|
// calculate last point (end of last arc):
|
||||||
VECTOR2I last_pt;
|
VECTOR2I last_pt;
|
||||||
last_pt.x = arc_last_center.x + KiROUND( aCornerRadius * cos( arc_last_angle.AsRadians() ) );
|
last_pt.x = arc_last_center.x + KiROUND( aCornerRadius * arc_last_angle.Cos() );
|
||||||
last_pt.y = arc_last_center.y - KiROUND( aCornerRadius * sin( arc_last_angle.AsRadians() ) );
|
last_pt.y = arc_last_center.y - KiROUND( aCornerRadius * arc_last_angle.Sin() );
|
||||||
|
|
||||||
VECTOR2I first_pt = rr_outline[0].m_start;
|
VECTOR2I first_pt = rr_outline[0].m_start;
|
||||||
|
|
||||||
|
|
|
@ -593,8 +593,8 @@ void HPGL_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||||
angle.Normalize180();
|
angle.Normalize180();
|
||||||
|
|
||||||
// Calculate arc start point:
|
// Calculate arc start point:
|
||||||
VECTOR2I cmap( aCenter.x + KiROUND( aRadius * cos( aStartAngle.AsRadians() ) ),
|
VECTOR2I cmap( aCenter.x + KiROUND( aRadius * aStartAngle.Cos() ),
|
||||||
aCenter.y - KiROUND( aRadius * sin( aStartAngle.AsRadians() ) ) );
|
aCenter.y - KiROUND( aRadius * aStartAngle.Sin() ) );
|
||||||
VECTOR2D cmap_dev = userToDeviceCoordinates( cmap );
|
VECTOR2D cmap_dev = userToDeviceCoordinates( cmap );
|
||||||
|
|
||||||
startOrAppendItem( cmap_dev, wxString::Format( "AA %.0f,%.0f,%.0f,%g",
|
startOrAppendItem( cmap_dev, wxString::Format( "AA %.0f,%.0f,%.0f,%g",
|
||||||
|
|
|
@ -288,21 +288,21 @@ void PDF_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( aWidth );
|
||||||
|
|
||||||
// Usual trig arc plotting routine...
|
// Usual trig arc plotting routine...
|
||||||
start.x = aCenter.x + KiROUND( aRadius * cos( -startAngle.AsRadians() ) );
|
start.x = aCenter.x + KiROUND( aRadius * -startAngle.Cos() );
|
||||||
start.y = aCenter.y + KiROUND( aRadius * sin( -startAngle.AsRadians() ) );
|
start.y = aCenter.y + KiROUND( aRadius * -startAngle.Sin() );
|
||||||
DPOINT pos_dev = userToDeviceCoordinates( start );
|
DPOINT pos_dev = userToDeviceCoordinates( start );
|
||||||
fprintf( workFile, "%g %g m ", pos_dev.x, pos_dev.y );
|
fprintf( workFile, "%g %g m ", pos_dev.x, pos_dev.y );
|
||||||
|
|
||||||
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
|
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
|
||||||
{
|
{
|
||||||
end.x = aCenter.x + KiROUND( aRadius * cos( -ii.AsRadians() ) );
|
end.x = aCenter.x + KiROUND( aRadius * -ii.Cos() );
|
||||||
end.y = aCenter.y + KiROUND( aRadius * sin( -ii.AsRadians() ) );
|
end.y = aCenter.y + KiROUND( aRadius * -ii.Sin() );
|
||||||
pos_dev = userToDeviceCoordinates( end );
|
pos_dev = userToDeviceCoordinates( end );
|
||||||
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
end.x = aCenter.x + KiROUND( aRadius * cos( -endAngle.AsRadians() ) );
|
end.x = aCenter.x + KiROUND( aRadius * -endAngle.Cos() );
|
||||||
end.y = aCenter.y + KiROUND( aRadius * sin( -endAngle.AsRadians() ) );
|
end.y = aCenter.y + KiROUND( aRadius * -endAngle.Sin() );
|
||||||
pos_dev = userToDeviceCoordinates( end );
|
pos_dev = userToDeviceCoordinates( end );
|
||||||
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
||||||
|
|
||||||
|
|
|
@ -168,8 +168,8 @@ void PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( aWidth );
|
||||||
|
|
||||||
/* Please NOTE the different sign due to Y-axis flip */
|
/* Please NOTE the different sign due to Y-axis flip */
|
||||||
start.x = aCenter.x + KiROUND( aRadius * cos( -startAngle.AsRadians() ) );
|
start.x = aCenter.x + KiROUND( aRadius * -startAngle.Cos() );
|
||||||
start.y = aCenter.y + KiROUND( aRadius * sin( -startAngle.AsRadians() ) );
|
start.y = aCenter.y + KiROUND( aRadius * -startAngle.Sin() );
|
||||||
|
|
||||||
if( aFill != FILL_T::NO_FILL )
|
if( aFill != FILL_T::NO_FILL )
|
||||||
{
|
{
|
||||||
|
@ -183,13 +183,13 @@ void PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||||
|
|
||||||
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
|
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
|
||||||
{
|
{
|
||||||
end.x = aCenter.x + KiROUND( aRadius * cos( -ii.AsRadians() ) );
|
end.x = aCenter.x + KiROUND( aRadius * -ii.Cos() );
|
||||||
end.y = aCenter.y + KiROUND( aRadius * sin( -ii.AsRadians() ) );
|
end.y = aCenter.y + KiROUND( aRadius * -ii.Sin() );
|
||||||
LineTo( end );
|
LineTo( end );
|
||||||
}
|
}
|
||||||
|
|
||||||
end.x = aCenter.x + KiROUND( aRadius * cos( -endAngle.AsRadians() ) );
|
end.x = aCenter.x + KiROUND( aRadius * -endAngle.Cos() );
|
||||||
end.y = aCenter.y + KiROUND( aRadius * sin( -endAngle.AsRadians() ) );
|
end.y = aCenter.y + KiROUND( aRadius * -endAngle.Sin() );
|
||||||
|
|
||||||
if( aFill != FILL_T::NO_FILL )
|
if( aFill != FILL_T::NO_FILL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2618,9 +2618,8 @@ void CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment( EDA_TEXT* aKiCadTextIte
|
||||||
{
|
{
|
||||||
if( !aKiCadTextItem->GetText().IsEmpty() )
|
if( !aKiCadTextItem->GetText().IsEmpty() )
|
||||||
{
|
{
|
||||||
int txtAngleDecideg = aKiCadTextItem->GetTextAngle().AsTenthsOfADegree();
|
|
||||||
VECTOR2I positionOffset( 0, aKiCadTextItem->GetInterline() );
|
VECTOR2I positionOffset( 0, aKiCadTextItem->GetInterline() );
|
||||||
RotatePoint( positionOffset, txtAngleDecideg );
|
RotatePoint( positionOffset, aKiCadTextItem->GetTextAngle() );
|
||||||
|
|
||||||
EDA_ITEM* textEdaItem = dynamic_cast<EDA_ITEM*>( aKiCadTextItem );
|
EDA_ITEM* textEdaItem = dynamic_cast<EDA_ITEM*>( aKiCadTextItem );
|
||||||
|
|
||||||
|
|
|
@ -152,10 +152,8 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int
|
||||||
|
|
||||||
if( i % 2 == 0 )
|
if( i % 2 == 0 )
|
||||||
{
|
{
|
||||||
VECTOR2I a( center.x + r * cos( startAngle.AsRadians() ),
|
VECTOR2I a( center.x + r * startAngle.Cos(), center.y + r * startAngle.Sin() );
|
||||||
center.y + r * sin( startAngle.AsRadians() ) );
|
VECTOR2I b( center.x + r * endAngle.Cos(), center.y + r * endAngle.Sin() );
|
||||||
VECTOR2I b( center.x + r * cos( endAngle.AsRadians() ),
|
|
||||||
center.y + r * sin( endAngle.AsRadians() ) );
|
|
||||||
|
|
||||||
aStroker( a, b );
|
aStroker( a, b );
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ void LIB_FIELD::MirrorVertical( const VECTOR2I& center )
|
||||||
|
|
||||||
void LIB_FIELD::Rotate( const VECTOR2I& center, bool aRotateCCW )
|
void LIB_FIELD::Rotate( const VECTOR2I& center, bool aRotateCCW )
|
||||||
{
|
{
|
||||||
int rot_angle = aRotateCCW ? -900 : 900;
|
EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
|
||||||
|
|
||||||
VECTOR2I pt = GetTextPos();
|
VECTOR2I pt = GetTextPos();
|
||||||
RotatePoint( pt, center, rot_angle );
|
RotatePoint( pt, center, rot_angle );
|
||||||
|
|
|
@ -1004,7 +1004,7 @@ void LIB_PIN::MirrorVertical( const VECTOR2I& aCenter )
|
||||||
|
|
||||||
void LIB_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
void LIB_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||||
{
|
{
|
||||||
int rot_angle = aRotateCCW ? -900 : 900;
|
EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
|
||||||
|
|
||||||
RotatePoint( m_position, aCenter, rot_angle );
|
RotatePoint( m_position, aCenter, rot_angle );
|
||||||
|
|
||||||
|
@ -1162,13 +1162,13 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
|
||||||
{
|
{
|
||||||
case PIN_UP:
|
case PIN_UP:
|
||||||
// Pin is rotated and texts positions are mirrored
|
// Pin is rotated and texts positions are mirrored
|
||||||
RotatePoint( begin, VECTOR2I( 0, 0 ), -900 );
|
RotatePoint( begin, VECTOR2I( 0, 0 ), -ANGLE_90 );
|
||||||
RotatePoint( end, VECTOR2I( 0, 0 ), -900 );
|
RotatePoint( end, VECTOR2I( 0, 0 ), -ANGLE_90 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PIN_DOWN:
|
case PIN_DOWN:
|
||||||
RotatePoint( begin, VECTOR2I( 0, 0 ), 900 );
|
RotatePoint( begin, VECTOR2I( 0, 0 ), ANGLE_90 );
|
||||||
RotatePoint( end, VECTOR2I( 0, 0 ), 900 );
|
RotatePoint( end, VECTOR2I( 0, 0 ), ANGLE_90 );
|
||||||
begin.x = -begin.x;
|
begin.x = -begin.x;
|
||||||
end.x = -end.x;
|
end.x = -end.x;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -102,7 +102,7 @@ void LIB_SHAPE::MirrorVertical( const VECTOR2I& aCenter )
|
||||||
|
|
||||||
void LIB_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
void LIB_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||||
{
|
{
|
||||||
int rot_angle = aRotateCCW ? -900 : 900;
|
EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
|
||||||
|
|
||||||
rotate( aCenter, rot_angle );
|
rotate( aCenter, rot_angle );
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ private:
|
||||||
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
|
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
double getParentOrientation() const override { return 0.0; }
|
EDA_ANGLE getParentOrientation() const override { return ANGLE_0; }
|
||||||
VECTOR2I getParentPosition() const override { return VECTOR2I(); }
|
VECTOR2I getParentPosition() const override { return VECTOR2I(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
if( aContained )
|
if( aContained )
|
||||||
return rect.Contains( textBox );
|
return rect.Contains( textBox );
|
||||||
|
|
||||||
return rect.Intersects( textBox, GetTextAngle().AsTenthsOfADegree() );
|
return rect.Intersects( textBox, GetTextAngle() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPenWidth() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
|
@ -144,7 +144,7 @@ void SCH_BITMAP::MirrorHorizontally( int aCenter )
|
||||||
|
|
||||||
void SCH_BITMAP::Rotate( const VECTOR2I& aCenter )
|
void SCH_BITMAP::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
RotatePoint( m_pos, aCenter, 900 );
|
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||||
m_image->Rotate( false );
|
m_image->Rotate( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ void SCH_BUS_ENTRY_BASE::MirrorHorizontally( int aCenter )
|
||||||
void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter )
|
void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
RotatePoint( m_pos, aCenter, 900 );
|
RotatePoint( m_pos, aCenter, 900 );
|
||||||
RotatePoint( &m_size.x, &m_size.y, 900 );
|
RotatePoint( &m_size.x, &m_size.y, ANGLE_90 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -686,7 +686,7 @@ bool SCH_FIELD::Replace( const wxFindReplaceData& aSearchData, void* aAuxData )
|
||||||
void SCH_FIELD::Rotate( const VECTOR2I& aCenter )
|
void SCH_FIELD::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
VECTOR2I pt = GetPosition();
|
VECTOR2I pt = GetPosition();
|
||||||
RotatePoint( pt, aCenter, 900 );
|
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||||
SetPosition( pt );
|
SetPosition( pt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ void SCH_JUNCTION::MirrorHorizontally( int aCenter )
|
||||||
|
|
||||||
void SCH_JUNCTION::Rotate( const VECTOR2I& aCenter )
|
void SCH_JUNCTION::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
RotatePoint( m_pos, aCenter, 900 );
|
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -418,22 +418,22 @@ void SCH_LINE::MirrorHorizontally( int aCenter )
|
||||||
void SCH_LINE::Rotate( const VECTOR2I& aCenter )
|
void SCH_LINE::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
if( m_flags & STARTPOINT )
|
if( m_flags & STARTPOINT )
|
||||||
RotatePoint( m_start, aCenter, 900 );
|
RotatePoint( m_start, aCenter, ANGLE_90 );
|
||||||
|
|
||||||
if( m_flags & ENDPOINT )
|
if( m_flags & ENDPOINT )
|
||||||
RotatePoint( m_end, aCenter, 900 );
|
RotatePoint( m_end, aCenter, ANGLE_90 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LINE::RotateStart( const VECTOR2I& aCenter )
|
void SCH_LINE::RotateStart( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
RotatePoint( m_start, aCenter, 900 );
|
RotatePoint( m_start, aCenter, ANGLE_90 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LINE::RotateEnd( const VECTOR2I& aCenter )
|
void SCH_LINE::RotateEnd( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
RotatePoint( m_end, aCenter, 900 );
|
RotatePoint( m_end, aCenter, ANGLE_90 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ void SCH_NO_CONNECT::MirrorHorizontally( int aCenter )
|
||||||
|
|
||||||
void SCH_NO_CONNECT::Rotate( const VECTOR2I& aCenter )
|
void SCH_NO_CONNECT::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
RotatePoint( m_pos, aCenter, 900 );
|
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -501,7 +501,7 @@ void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition,
|
||||||
box.Inflate( 0, aAttrs.m_StrokeWidth * 1.5 );
|
box.Inflate( 0, aAttrs.m_StrokeWidth * 1.5 );
|
||||||
|
|
||||||
box.Normalize(); // Make h and v sizes always >= 0
|
box.Normalize(); // Make h and v sizes always >= 0
|
||||||
box = box.GetBoundingBoxRotated( (VECTOR2I) aPosition, aAttrs.m_Angle.AsTenthsOfADegree() );
|
box = box.GetBoundingBoxRotated( (VECTOR2I) aPosition, aAttrs.m_Angle );
|
||||||
box.RevertYAxis();
|
box.RevertYAxis();
|
||||||
|
|
||||||
m_gal->SetIsFill( true );
|
m_gal->SetIsFill( true );
|
||||||
|
|
|
@ -1321,8 +1321,8 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
|
||||||
SCH_SHAPE* arc = new SCH_SHAPE( SHAPE_T::ARC, SCH_LAYER_ID::LAYER_NOTES );
|
SCH_SHAPE* arc = new SCH_SHAPE( SHAPE_T::ARC, SCH_LAYER_ID::LAYER_NOTES );
|
||||||
EDA_ANGLE includedAngle( elem.endAngle - elem.startAngle, DEGREES_T );
|
EDA_ANGLE includedAngle( elem.endAngle - elem.startAngle, DEGREES_T );
|
||||||
EDA_ANGLE startAngle( elem.endAngle, DEGREES_T );
|
EDA_ANGLE startAngle( elem.endAngle, DEGREES_T );
|
||||||
VECTOR2I startOffset( KiROUND( elem.radius * cos( startAngle.AsRadians() ) ),
|
VECTOR2I startOffset( KiROUND( elem.radius * startAngle.Cos() ),
|
||||||
-KiROUND( elem.radius * sin( startAngle.AsRadians() ) ) );
|
-KiROUND( elem.radius * startAngle.Sin() ) );
|
||||||
|
|
||||||
arc->SetCenter( elem.center + m_sheetOffset );
|
arc->SetCenter( elem.center + m_sheetOffset );
|
||||||
arc->SetStart( elem.center + startOffset + m_sheetOffset );
|
arc->SetStart( elem.center + startOffset + m_sheetOffset );
|
||||||
|
|
|
@ -83,7 +83,7 @@ void SCH_SHAPE::MirrorVertically( int aCenter )
|
||||||
|
|
||||||
void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
|
void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
rotate( aCenter, 900 );
|
rotate( aCenter, ANGLE_90 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||||
|
|
||||||
double getParentOrientation() const override { return 0.0; }
|
EDA_ANGLE getParentOrientation() const override { return ANGLE_0; }
|
||||||
VECTOR2I getParentPosition() const override { return VECTOR2I(); }
|
VECTOR2I getParentPosition() const override { return VECTOR2I(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -774,8 +774,8 @@ void SCH_SHEET::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
VECTOR2I prev = m_pos;
|
VECTOR2I prev = m_pos;
|
||||||
|
|
||||||
RotatePoint( m_pos, aCenter, 900 );
|
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||||
RotatePoint( &m_size.x, &m_size.y, 900 );
|
RotatePoint( &m_size.x, &m_size.y, ANGLE_90 );
|
||||||
|
|
||||||
if( m_size.x < 0 )
|
if( m_size.x < 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,7 +252,7 @@ void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter )
|
||||||
VECTOR2I pt = GetTextPos();
|
VECTOR2I pt = GetTextPos();
|
||||||
VECTOR2I delta = pt - aCenter;
|
VECTOR2I delta = pt - aCenter;
|
||||||
|
|
||||||
RotatePoint( pt, aCenter, 900 );
|
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||||
|
|
||||||
SHEET_SIDE oldSide = GetSide();
|
SHEET_SIDE oldSide = GetSide();
|
||||||
ConstrainOnEdge( pt );
|
ConstrainOnEdge( pt );
|
||||||
|
|
|
@ -1488,7 +1488,7 @@ void SCH_SYMBOL::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
VECTOR2I prev = m_pos;
|
VECTOR2I prev = m_pos;
|
||||||
|
|
||||||
RotatePoint( m_pos, aCenter, 900 );
|
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||||
|
|
||||||
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
|
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ void SCH_TEXT::MirrorVertically( int aCenter )
|
||||||
void SCH_TEXT::Rotate( const VECTOR2I& aCenter )
|
void SCH_TEXT::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
VECTOR2I pt = GetTextPos();
|
VECTOR2I pt = GetTextPos();
|
||||||
RotatePoint( pt, aCenter, 900 );
|
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||||
VECTOR2I offset = pt - GetTextPos();
|
VECTOR2I offset = pt - GetTextPos();
|
||||||
|
|
||||||
Rotate90( false );
|
Rotate90( false );
|
||||||
|
@ -746,7 +746,7 @@ VECTOR2I SCH_LABEL_BASE::GetSchematicTextOffset( const RENDER_SETTINGS* aSetting
|
||||||
void SCH_LABEL_BASE::Rotate( const VECTOR2I& aCenter )
|
void SCH_LABEL_BASE::Rotate( const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
VECTOR2I pt = GetTextPos();
|
VECTOR2I pt = GetTextPos();
|
||||||
RotatePoint( pt, aCenter, 900 );
|
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||||
VECTOR2I offset = pt - GetTextPos();
|
VECTOR2I offset = pt - GetTextPos();
|
||||||
|
|
||||||
Rotate90( false );
|
Rotate90( false );
|
||||||
|
@ -804,7 +804,7 @@ void SCH_LABEL_BASE::Rotate90( bool aClockwise )
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTOR2I pos = field.GetTextPos();
|
VECTOR2I pos = field.GetTextPos();
|
||||||
RotatePoint( pos, GetPosition(), aClockwise ? -900 : 900 );
|
RotatePoint( pos, GetPosition(), aClockwise ? -ANGLE_90 : ANGLE_90 );
|
||||||
field.SetTextPos( pos );
|
field.SetTextPos( pos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,13 +95,13 @@ bool TRANSFORM::MapAngles( EDA_ANGLE* aAngle1, EDA_ANGLE* aAngle2 ) const
|
||||||
*aAngle2 += epsilon;
|
*aAngle2 += epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = cos( aAngle1->AsRadians() );
|
x = aAngle1->Cos();
|
||||||
y = sin( aAngle1->AsRadians() );
|
y = aAngle1->Sin();
|
||||||
v = VECTOR2D( x * x1 + y * y1, x * x2 + y * y2 );
|
v = VECTOR2D( x * x1 + y * y1, x * x2 + y * y2 );
|
||||||
*aAngle1 = EDA_ANGLE( v );
|
*aAngle1 = EDA_ANGLE( v );
|
||||||
|
|
||||||
x = cos( aAngle2->AsRadians() );
|
x = aAngle2->Cos();
|
||||||
y = sin( aAngle2->AsRadians() );
|
y = aAngle2->Sin();
|
||||||
v = VECTOR2D( x * x1 + y * y1, x * x2 + y * y2 );
|
v = VECTOR2D( x * x1 + y * y1, x * x2 + y * y2 );
|
||||||
*aAngle2 = EDA_ANGLE( v );
|
*aAngle2 = EDA_ANGLE( v );
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @return the coordinate (in mm) of the corner \a aIdx and the repeated item \a aRepeat
|
* @return the coordinate (in mm) of the corner \a aIdx and the repeated item \a aRepeat
|
||||||
*/
|
*/
|
||||||
const DPOINT GetCornerPosition( unsigned aIdx, int aRepeat = 0 ) const;
|
const VECTOR2D GetCornerPosition( unsigned aIdx, int aRepeat = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the coordinate (in draw/plot units) of the corner \a aIdx and the repeated
|
* @return the coordinate (in draw/plot units) of the corner \a aIdx and the repeated
|
||||||
|
@ -284,13 +284,13 @@ public:
|
||||||
|
|
||||||
bool IsInsidePage( int ii ) const override;
|
bool IsInsidePage( int ii ) const override;
|
||||||
|
|
||||||
double m_Orient; // Orientation in degrees
|
EDA_ANGLE m_Orient; // Orientation
|
||||||
std::vector<DPOINT> m_Corners; // corner list
|
std::vector<VECTOR2D> m_Corners; // corner list
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<unsigned> m_polyIndexEnd; // index of the last point of each polygon
|
std::vector<unsigned> m_polyIndexEnd; // index of the last point of each polygon
|
||||||
DPOINT m_minCoord; // min coord of corners, relative to m_Pos
|
VECTOR2D m_minCoord; // min coord of corners, relative to m_Pos
|
||||||
DPOINT m_maxCoord; // max coord of corners, relative to m_Pos
|
VECTOR2D m_maxCoord; // max coord of corners, relative to m_Pos
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
#include <math/box2.h>
|
#include <math/box2.h>
|
||||||
|
#include <geometry/eda_angle.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the component boundary box.
|
* Handle the component boundary box.
|
||||||
|
@ -228,9 +229,9 @@ public:
|
||||||
* Tests for a common area between this rectangle, and a rectangle with arbitrary rotation
|
* Tests for a common area between this rectangle, and a rectangle with arbitrary rotation
|
||||||
*
|
*
|
||||||
* @param aRect a rectangle to test intersection with.
|
* @param aRect a rectangle to test intersection with.
|
||||||
* @param aRot rectangle rotation (in 1/10 degrees).
|
* @param aRot rectangle rotation.
|
||||||
*/
|
*/
|
||||||
bool Intersects( const EDA_RECT& aRect, double aRot ) const;
|
bool Intersects( const EDA_RECT& aRect, const EDA_ANGLE& aRotation ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for a common area between a segment and this rectangle.
|
* Test for a common area between a segment and this rectangle.
|
||||||
|
@ -349,13 +350,12 @@ public:
|
||||||
EDA_RECT Common( const EDA_RECT& aRect ) const;
|
EDA_RECT Common( const EDA_RECT& aRect ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful to calculate bounding box of rotated items, when rotation if not k*90 degrees.
|
* Useful to calculate bounding box of rotated items, when rotation is not k*90 degrees.
|
||||||
*
|
*
|
||||||
* @param aAngle the rotation angle in 0.1 deg.
|
|
||||||
* @param aRotCenter the rotation point.
|
|
||||||
* @return the bounding box of this, after rotation.
|
* @return the bounding box of this, after rotation.
|
||||||
*/
|
*/
|
||||||
const EDA_RECT GetBoundingBoxRotated( const VECTOR2I& aRotCenter, double aAngle ) const;
|
const EDA_RECT GetBoundingBoxRotated( const VECTOR2I& aRotCenter,
|
||||||
|
const EDA_ANGLE& aAngle ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VECTOR2I m_pos; // Rectangle Origin
|
VECTOR2I m_pos; // Rectangle Origin
|
||||||
|
|
|
@ -275,12 +275,12 @@ protected:
|
||||||
VECTOR2I getPosition() const;
|
VECTOR2I getPosition() const;
|
||||||
|
|
||||||
void move( const VECTOR2I& aMoveVector );
|
void move( const VECTOR2I& aMoveVector );
|
||||||
void rotate( const VECTOR2I& aRotCentre, double aAngle );
|
void rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle );
|
||||||
void flip( const VECTOR2I& aCentre, bool aFlipLeftRight );
|
void flip( const VECTOR2I& aCentre, bool aFlipLeftRight );
|
||||||
void scale( double aScale );
|
void scale( double aScale );
|
||||||
|
|
||||||
// To be implemented by concrete classes
|
// To be implemented by concrete classes
|
||||||
virtual double getParentOrientation() const = 0;
|
virtual EDA_ANGLE getParentOrientation() const = 0;
|
||||||
virtual VECTOR2I getParentPosition() const = 0;
|
virtual VECTOR2I getParentPosition() const = 0;
|
||||||
|
|
||||||
const EDA_RECT getBoundingBox() const;
|
const EDA_RECT getBoundingBox() const;
|
||||||
|
|
|
@ -128,8 +128,8 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aSta
|
||||||
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
||||||
*/
|
*/
|
||||||
void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition,
|
void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition,
|
||||||
const VECTOR2I& aSize, double aRotation, int aDeltaX, int aDeltaY,
|
const VECTOR2I& aSize, const EDA_ANGLE& aRotation, int aDeltaX,
|
||||||
int aInflate, int aError, ERROR_LOC aErrorLoc );
|
int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
|
* Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
* @return this arc.
|
* @return this arc.
|
||||||
*/
|
*/
|
||||||
SHAPE_ARC& ConstructFromStartEndAngle( const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
SHAPE_ARC& ConstructFromStartEndAngle( const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||||
double aAngle, double aWidth = 0 );
|
const EDA_ANGLE& aAngle, double aWidth = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this arc from the given start, end and center.
|
* Constructs this arc from the given start, end and center.
|
||||||
|
|
|
@ -138,7 +138,8 @@ inline void RotatePoint( VECTOR2D& point, const VECTOR2D& aCenter, const EDA_ANG
|
||||||
*/
|
*/
|
||||||
const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
|
const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
|
||||||
const VECTOR2D CalcArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, const VECTOR2D& aEnd );
|
const VECTOR2D CalcArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, const VECTOR2D& aEnd );
|
||||||
const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle );
|
const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||||
|
const EDA_ANGLE& aAngle );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the subtended angle for a given arc.
|
* Return the subtended angle for a given arc.
|
||||||
|
|
|
@ -362,8 +362,8 @@ void CornerListRemoveDuplicates( std::vector<ROUNDED_CORNER>& aCorners )
|
||||||
|
|
||||||
|
|
||||||
void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition,
|
void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition,
|
||||||
const VECTOR2I& aSize, double aRotation, int aDeltaX, int aDeltaY,
|
const VECTOR2I& aSize, const EDA_ANGLE& aRotation, int aDeltaX,
|
||||||
int aInflate, int aError, ERROR_LOC aErrorLoc )
|
int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc )
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET outline;
|
SHAPE_POLY_SET outline;
|
||||||
VECTOR2I size( aSize / 2 );
|
VECTOR2I size( aSize / 2 );
|
||||||
|
@ -426,8 +426,8 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I&
|
||||||
|
|
||||||
CornerListToPolygon( outline, corners, aInflate, aError, aErrorLoc );
|
CornerListToPolygon( outline, corners, aInflate, aError, aErrorLoc );
|
||||||
|
|
||||||
if( aRotation != 0.0 )
|
if( !aRotation.IsZero() )
|
||||||
outline.Rotate( DECIDEG2RAD( -aRotation ), VECTOR2I( 0, 0 ) );
|
outline.Rotate( -aRotation.AsRadians(), VECTOR2I( 0, 0 ) );
|
||||||
|
|
||||||
outline.Move( VECTOR2I( aPosition ) );
|
outline.Move( VECTOR2I( aPosition ) );
|
||||||
aCornerBuffer.Append( outline );
|
aCornerBuffer.Append( outline );
|
||||||
|
@ -522,8 +522,8 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa
|
||||||
EDA_ANGLE rot = aStartAngle;
|
EDA_ANGLE rot = aStartAngle;
|
||||||
rot += ( aArcAngle * i ) / n;
|
rot += ( aArcAngle * i ) / n;
|
||||||
|
|
||||||
double x = aCenter.x + aRadius * cos( rot.AsRadians() );
|
double x = aCenter.x + aRadius * rot.Cos();
|
||||||
double y = aCenter.y + aRadius * sin( rot.AsRadians() );
|
double y = aCenter.y + aRadius * rot.Sin();
|
||||||
|
|
||||||
aPolyline.Append( KiROUND( x ), KiROUND( y ) );
|
aPolyline.Append( KiROUND( x ), KiROUND( y ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ const SHAPE_LINE_CHAIN DIRECTION_45::BuildInitialTrace( const VECTOR2I& aP0, con
|
||||||
{
|
{
|
||||||
// Positive tangentLength, diagonal start: arc goes at the start
|
// Positive tangentLength, diagonal start: arc goes at the start
|
||||||
arcEndpoint = aP1 - mp0.Resize( tangentLength );
|
arcEndpoint = aP1 - mp0.Resize( tangentLength );
|
||||||
arc.ConstructFromStartEndAngle( aP0, arcEndpoint, 45 * rotationSign );
|
arc.ConstructFromStartEndAngle( aP0, arcEndpoint, ANGLE_45 * rotationSign );
|
||||||
|
|
||||||
if( arc.GetP0() == arc.GetP1() )
|
if( arc.GetP0() == arc.GetP1() )
|
||||||
pl.Append( aP0 );
|
pl.Append( aP0 );
|
||||||
|
@ -156,7 +156,7 @@ const SHAPE_LINE_CHAIN DIRECTION_45::BuildInitialTrace( const VECTOR2I& aP0, con
|
||||||
{
|
{
|
||||||
// Negative tangentLength, diagonal start: arc goes at the end
|
// Negative tangentLength, diagonal start: arc goes at the end
|
||||||
arcEndpoint = aP0 + mp1.Resize( std::abs( tangentLength ) );
|
arcEndpoint = aP0 + mp1.Resize( std::abs( tangentLength ) );
|
||||||
arc.ConstructFromStartEndAngle( arcEndpoint, aP1, 45 * rotationSign );
|
arc.ConstructFromStartEndAngle( arcEndpoint, aP1, ANGLE_45 * rotationSign );
|
||||||
|
|
||||||
pl.Append( aP0 );
|
pl.Append( aP0 );
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ const SHAPE_LINE_CHAIN DIRECTION_45::BuildInitialTrace( const VECTOR2I& aP0, con
|
||||||
{
|
{
|
||||||
// Positive tangentLength: arc goes at the end
|
// Positive tangentLength: arc goes at the end
|
||||||
arcEndpoint = aP0 + mp0.Resize( tangentLength );
|
arcEndpoint = aP0 + mp0.Resize( tangentLength );
|
||||||
arc.ConstructFromStartEndAngle( arcEndpoint, aP1, 45 * rotationSign );
|
arc.ConstructFromStartEndAngle( arcEndpoint, aP1, ANGLE_45 * rotationSign );
|
||||||
|
|
||||||
pl.Append( aP0 );
|
pl.Append( aP0 );
|
||||||
|
|
||||||
|
@ -198,12 +198,12 @@ const SHAPE_LINE_CHAIN DIRECTION_45::BuildInitialTrace( const VECTOR2I& aP0, con
|
||||||
if( std::abs( endpoint.y - aP1.y ) < SHAPE_ARC::MIN_PRECISION_IU )
|
if( std::abs( endpoint.y - aP1.y ) < SHAPE_ARC::MIN_PRECISION_IU )
|
||||||
{
|
{
|
||||||
VECTOR2I fixedEnd( endpoint.x, aP1.y );
|
VECTOR2I fixedEnd( endpoint.x, aP1.y );
|
||||||
ca.ConstructFromStartEndAngle( ca.GetP0(), fixedEnd, 45 * rotationSign );
|
ca.ConstructFromStartEndAngle( ca.GetP0(), fixedEnd, ANGLE_45 * rotationSign );
|
||||||
}
|
}
|
||||||
else if( std::abs( endpoint.x - aP1.x ) < SHAPE_ARC::MIN_PRECISION_IU )
|
else if( std::abs( endpoint.x - aP1.x ) < SHAPE_ARC::MIN_PRECISION_IU )
|
||||||
{
|
{
|
||||||
VECTOR2I fixedEnd( aP1.x, endpoint.y );
|
VECTOR2I fixedEnd( aP1.x, endpoint.y );
|
||||||
ca.ConstructFromStartEndAngle( ca.GetP0(), fixedEnd, 45 * rotationSign );
|
ca.ConstructFromStartEndAngle( ca.GetP0(), fixedEnd, ANGLE_45 * rotationSign );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ca.GetP0() == ca.GetP1() )
|
if( ca.GetP0() == ca.GetP1() )
|
||||||
|
|
|
@ -126,7 +126,7 @@ SHAPE_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, i
|
||||||
m_mid = m_start;
|
m_mid = m_start;
|
||||||
|
|
||||||
VECTOR2I arcCenter = aSegmentA.Center();
|
VECTOR2I arcCenter = aSegmentA.Center();
|
||||||
RotatePoint( m_mid, arcCenter, 900.0 ); // mid point at 90 degrees
|
RotatePoint( m_mid, arcCenter, ANGLE_90 ); // mid point at 90 degrees
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -148,8 +148,8 @@ SHAPE_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, i
|
||||||
EDA_ANGLE angPC = pToAangle - alpha / 2;
|
EDA_ANGLE angPC = pToAangle - alpha / 2;
|
||||||
VECTOR2I arcCenter;
|
VECTOR2I arcCenter;
|
||||||
|
|
||||||
arcCenter.x = p.get().x + KiROUND( distPC * cos( angPC.AsRadians() ) );
|
arcCenter.x = p.get().x + KiROUND( distPC * angPC.Cos() );
|
||||||
arcCenter.y = p.get().y + KiROUND( distPC * sin( angPC.AsRadians() ) );
|
arcCenter.y = p.get().y + KiROUND( distPC * angPC.Sin() );
|
||||||
|
|
||||||
// The end points of the arc are the orthogonal projected lines from the line segments
|
// The end points of the arc are the orthogonal projected lines from the line segments
|
||||||
// to the center of the arc
|
// to the center of the arc
|
||||||
|
@ -184,7 +184,7 @@ SHAPE_ARC::SHAPE_ARC( const SHAPE_ARC& aOther )
|
||||||
|
|
||||||
|
|
||||||
SHAPE_ARC& SHAPE_ARC::ConstructFromStartEndAngle( const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
SHAPE_ARC& SHAPE_ARC::ConstructFromStartEndAngle( const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||||
double aAngle, double aWidth )
|
const EDA_ANGLE& aAngle, double aWidth )
|
||||||
{
|
{
|
||||||
m_start = aStart;
|
m_start = aStart;
|
||||||
m_mid = aStart;
|
m_mid = aStart;
|
||||||
|
@ -193,7 +193,7 @@ SHAPE_ARC& SHAPE_ARC::ConstructFromStartEndAngle( const VECTOR2I& aStart, const
|
||||||
|
|
||||||
VECTOR2I center( CalcArcCenter( aStart, aEnd, aAngle ) );
|
VECTOR2I center( CalcArcCenter( aStart, aEnd, aAngle ) );
|
||||||
|
|
||||||
RotatePoint( m_mid, center, -aAngle * 10.0 / 2.0 );
|
RotatePoint( m_mid, center, -aAngle / 2.0 );
|
||||||
|
|
||||||
update_bbox();
|
update_bbox();
|
||||||
|
|
||||||
|
@ -498,8 +498,8 @@ const SHAPE_LINE_CHAIN SHAPE_ARC::ConvertToPolyline( double aAccuracy,
|
||||||
if( n != 0 )
|
if( n != 0 )
|
||||||
a += ( ca * i ) / n;
|
a += ( ca * i ) / n;
|
||||||
|
|
||||||
double x = c.x + r * cos( a.AsRadians() );
|
double x = c.x + r * a.Cos();
|
||||||
double y = c.y + r * sin( a.AsRadians() );
|
double y = c.y + r * a.Sin();
|
||||||
|
|
||||||
rv.Append( KiROUND( x ), KiROUND( y ) );
|
rv.Append( KiROUND( x ), KiROUND( y ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,14 +423,14 @@ bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance, int* aActual
|
||||||
|
|
||||||
void SHAPE_LINE_CHAIN::Rotate( double aAngle, const VECTOR2I& aCenter )
|
void SHAPE_LINE_CHAIN::Rotate( double aAngle, const VECTOR2I& aCenter )
|
||||||
{
|
{
|
||||||
for( auto& pt : m_points )
|
for( VECTOR2I& pt : m_points )
|
||||||
{
|
{
|
||||||
pt -= aCenter;
|
pt -= aCenter;
|
||||||
pt = pt.Rotate( aAngle );
|
pt = pt.Rotate( aAngle );
|
||||||
pt += aCenter;
|
pt += aCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto& arc : m_arcs )
|
for( SHAPE_ARC& arc : m_arcs )
|
||||||
arc.Rotate( aAngle, aCenter );
|
arc.Rotate( aAngle, aCenter );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,29 +360,31 @@ void RotatePoint( double* pX, double* pY, double angle )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle )
|
const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||||
|
const EDA_ANGLE& aAngle )
|
||||||
{
|
{
|
||||||
VECTOR2I start = aStart;
|
EDA_ANGLE angle( aAngle );
|
||||||
VECTOR2I end = aEnd;
|
VECTOR2I start = aStart;
|
||||||
|
VECTOR2I end = aEnd;
|
||||||
|
|
||||||
if( aAngle < 0 )
|
if( angle < ANGLE_0 )
|
||||||
{
|
{
|
||||||
std::swap( start, end );
|
std::swap( start, end );
|
||||||
aAngle = abs( aAngle );
|
angle = -angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aAngle > 180 )
|
if( angle > ANGLE_180 )
|
||||||
{
|
{
|
||||||
std::swap( start, end );
|
std::swap( start, end );
|
||||||
aAngle = 360 - aAngle;
|
angle = ANGLE_360 - angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
int chord = ( start - end ).EuclideanNorm();
|
int chord = ( start - end ).EuclideanNorm();
|
||||||
int r = ( chord / 2 ) / sin( aAngle * M_PI / 360.0 );
|
int r = ( chord / 2 ) / angle.Sin();
|
||||||
|
|
||||||
VECTOR2I vec = end - start;
|
VECTOR2I vec = end - start;
|
||||||
vec = vec.Resize( r );
|
vec = vec.Resize( r );
|
||||||
vec = vec.Rotate( ( 180.0 - aAngle ) * M_PI / 360.0 );
|
vec = vec.Rotate( ( ANGLE_180 - angle ).AsRadians() );
|
||||||
|
|
||||||
return (VECTOR2I) ( start + vec );
|
return (VECTOR2I) ( start + vec );
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,7 +287,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
||||||
|
|
||||||
// Rotation (poly and text)
|
// Rotation (poly and text)
|
||||||
msg.Printf( wxT("%.3f"), item->m_Orient );
|
msg.Printf( wxT("%.3f"), item->m_Orient.AsDegrees() );
|
||||||
m_textCtrlRotation->SetValue( msg );
|
m_textCtrlRotation->SetValue( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
||||||
|
|
||||||
msg = m_textCtrlRotation->GetValue();
|
msg = m_textCtrlRotation->GetValue();
|
||||||
item->m_Orient = DoubleValueFromString( EDA_UNITS::UNSCALED, msg );
|
item->m_Orient = EDA_ANGLE( DoubleValueFromString( EDA_UNITS::UNSCALED, msg ), DEGREES_T );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
|
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
|
||||||
|
|
|
@ -59,9 +59,6 @@ private:
|
||||||
|
|
||||||
bool m_flipStartEnd;
|
bool m_flipStartEnd;
|
||||||
|
|
||||||
wxFloatingPointValidator<double> m_AngleValidator;
|
|
||||||
double m_AngleValue;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem );
|
DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem );
|
||||||
~DIALOG_GRAPHIC_ITEM_PROPERTIES() {};
|
~DIALOG_GRAPHIC_ITEM_PROPERTIES() {};
|
||||||
|
@ -97,9 +94,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
|
||||||
m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
|
m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
|
||||||
m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
|
m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
|
||||||
m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
|
m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
|
||||||
m_flipStartEnd( false ),
|
m_flipStartEnd( false )
|
||||||
m_AngleValidator( 1, &m_AngleValue ),
|
|
||||||
m_AngleValue( 0.0 )
|
|
||||||
{
|
{
|
||||||
m_parent = aParent;
|
m_parent = aParent;
|
||||||
m_item = dynamic_cast<PCB_SHAPE*>( aItem );
|
m_item = dynamic_cast<PCB_SHAPE*>( aItem );
|
||||||
|
@ -116,9 +111,6 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
|
||||||
m_bezierCtrl2Y.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
|
m_bezierCtrl2Y.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
|
||||||
|
|
||||||
m_angle.SetUnits( EDA_UNITS::DEGREES );
|
m_angle.SetUnits( EDA_UNITS::DEGREES );
|
||||||
m_AngleValidator.SetRange( -360.0, 360.0 );
|
|
||||||
m_angleCtrl->SetValidator( m_AngleValidator );
|
|
||||||
m_AngleValidator.SetWindow( m_angleCtrl );
|
|
||||||
|
|
||||||
// Do not allow locking items in the footprint editor
|
// Do not allow locking items in the footprint editor
|
||||||
m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
|
m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
|
||||||
|
@ -228,7 +220,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
||||||
|
|
||||||
case SHAPE_T::ARC:
|
case SHAPE_T::ARC:
|
||||||
SetTitle( _( "Arc Properties" ) );
|
SetTitle( _( "Arc Properties" ) );
|
||||||
m_AngleValue = m_item->GetArcAngle().AsDegrees();
|
m_angle.SetAngleValue( m_item->GetArcAngle() );
|
||||||
m_filledCtrl->Show( false );
|
m_filledCtrl->Show( false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -365,7 +357,10 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_item->GetShape() == SHAPE_T::ARC )
|
if( m_item->GetShape() == SHAPE_T::ARC )
|
||||||
m_item->SetCenter( CalcArcCenter( m_item->GetStart(), m_item->GetEnd(), m_AngleValue ) );
|
{
|
||||||
|
m_item->SetCenter( CalcArcCenter( m_item->GetStart(), m_item->GetEnd(),
|
||||||
|
m_angle.GetAngleValue() ) );
|
||||||
|
}
|
||||||
|
|
||||||
if( m_fp_item )
|
if( m_fp_item )
|
||||||
{
|
{
|
||||||
|
@ -430,7 +425,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
|
||||||
{
|
{
|
||||||
case SHAPE_T::ARC:
|
case SHAPE_T::ARC:
|
||||||
// Check angle of arc.
|
// Check angle of arc.
|
||||||
if( m_angle.GetValue() == 0 )
|
if( m_angle.GetAngleValue() == ANGLE_0 )
|
||||||
error_msgs.Add( _( "The arc angle cannot be zero." ) );
|
error_msgs.Add( _( "The arc angle cannot be zero." ) );
|
||||||
|
|
||||||
KI_FALLTHROUGH;
|
KI_FALLTHROUGH;
|
||||||
|
|
|
@ -119,7 +119,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
||||||
m_endY.SetValue( m_shape->GetCenter().y );
|
m_endY.SetValue( m_shape->GetCenter().y );
|
||||||
m_radiusLabel->SetLabel( _( "Angle:" ) );
|
m_radiusLabel->SetLabel( _( "Angle:" ) );
|
||||||
m_radius.SetUnits( EDA_UNITS::DEGREES );
|
m_radius.SetUnits( EDA_UNITS::DEGREES );
|
||||||
m_radius.SetValue( m_shape->GetArcAngle().AsTenthsOfADegree() );
|
m_radius.SetAngleValue( m_shape->GetArcAngle() );
|
||||||
m_ctrl1X.Show( false, true );
|
m_ctrl1X.Show( false, true );
|
||||||
m_ctrl1Y.Show( false, true );
|
m_ctrl1Y.Show( false, true );
|
||||||
m_ctrl2X.Show( false, true );
|
m_ctrl2X.Show( false, true );
|
||||||
|
|
|
@ -94,7 +94,7 @@ bool FP_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
|
||||||
if( aContains )
|
if( aContains )
|
||||||
return rect.Contains( GetBoundingBox() );
|
return rect.Contains( GetBoundingBox() );
|
||||||
else
|
else
|
||||||
return rect.Intersects( GetTextBox(), GetDrawRotation().AsTenthsOfADegree() );
|
return rect.Intersects( GetTextBox(), GetDrawRotation() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,10 +218,10 @@ void FP_TEXT::SetLocalCoord()
|
||||||
|
|
||||||
const EDA_RECT FP_TEXT::GetBoundingBox() const
|
const EDA_RECT FP_TEXT::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
double angle = GetDrawRotation().AsTenthsOfADegree();
|
EDA_ANGLE angle = GetDrawRotation();
|
||||||
EDA_RECT text_area = GetTextBox();
|
EDA_RECT text_area = GetTextBox();
|
||||||
|
|
||||||
if( angle )
|
if( !angle.IsZero() )
|
||||||
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||||
|
|
||||||
return text_area;
|
return text_area;
|
||||||
|
@ -336,10 +336,10 @@ EDA_ITEM* FP_TEXT::Clone() const
|
||||||
|
|
||||||
const BOX2I FP_TEXT::ViewBBox() const
|
const BOX2I FP_TEXT::ViewBBox() const
|
||||||
{
|
{
|
||||||
double angle = GetDrawRotation().AsTenthsOfADegree();
|
EDA_ANGLE angle = GetDrawRotation();
|
||||||
EDA_RECT text_area = GetTextBox();
|
EDA_RECT text_area = GetTextBox();
|
||||||
|
|
||||||
if( angle )
|
if( !angle.IsZero() )
|
||||||
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||||
|
|
||||||
return BOX2I( text_area.GetPosition(), text_area.GetSize() );
|
return BOX2I( text_area.GetPosition(), text_area.GetSize() );
|
||||||
|
|
|
@ -1538,8 +1538,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
int ddy = GetShape() == PAD_SHAPE::TRAPEZOID ? m_deltaSize.y / 2 : 0;
|
int ddy = GetShape() == PAD_SHAPE::TRAPEZOID ? m_deltaSize.y / 2 : 0;
|
||||||
|
|
||||||
SHAPE_POLY_SET outline;
|
SHAPE_POLY_SET outline;
|
||||||
TransformTrapezoidToPolygon( outline, padShapePos, m_size, m_orient.AsTenthsOfADegree(),
|
TransformTrapezoidToPolygon( outline, padShapePos, m_size, m_orient, ddx, ddy,
|
||||||
ddx, ddy, aClearanceValue, aError, aErrorLoc );
|
aClearanceValue, aError, aErrorLoc );
|
||||||
aCornerBuffer.Append( outline );
|
aCornerBuffer.Append( outline );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1059,7 +1059,7 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
{
|
{
|
||||||
PCB_BASE_FRAME::SaveSettings( aCfg );
|
PCB_BASE_FRAME::SaveSettings( aCfg );
|
||||||
|
|
||||||
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||||
wxASSERT( cfg );
|
wxASSERT( cfg );
|
||||||
|
|
||||||
if( cfg )
|
if( cfg )
|
||||||
|
|
|
@ -108,7 +108,7 @@ void PCB_SHAPE::Scale( double aScale )
|
||||||
|
|
||||||
void PCB_SHAPE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
void PCB_SHAPE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
||||||
{
|
{
|
||||||
rotate( aRotCentre, aAngle.AsTenthsOfADegree() );
|
rotate( aRotCentre, aAngle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,12 +129,12 @@ FOOTPRINT* PCB_SHAPE::GetParentFootprint() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double PCB_SHAPE::getParentOrientation() const
|
EDA_ANGLE PCB_SHAPE::getParentOrientation() const
|
||||||
{
|
{
|
||||||
if( GetParentFootprint() )
|
if( GetParentFootprint() )
|
||||||
return GetParentFootprint()->GetOrientation().AsTenthsOfADegree();
|
return GetParentFootprint()->GetOrientation();
|
||||||
else
|
else
|
||||||
return 0.0;
|
return ANGLE_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double getParentOrientation() const override;
|
EDA_ANGLE getParentOrientation() const override;
|
||||||
VECTOR2I getParentPosition() const override;
|
VECTOR2I getParentPosition() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ const EDA_RECT PCB_TEXT::GetBoundingBox() const
|
||||||
EDA_RECT rect = GetTextBox();
|
EDA_RECT rect = GetTextBox();
|
||||||
|
|
||||||
if( !GetTextAngle().IsZero() )
|
if( !GetTextAngle().IsZero() )
|
||||||
rect = rect.GetBoundingBoxRotated( GetTextPos(), GetTextAngle().AsTenthsOfADegree() );
|
rect = rect.GetBoundingBoxRotated( GetTextPos(), GetTextAngle() );
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1929,8 +1929,8 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
|
||||||
EDA_ANGLE includedAngle( elem.endangle - elem.startangle, DEGREES_T );
|
EDA_ANGLE includedAngle( elem.endangle - elem.startangle, DEGREES_T );
|
||||||
EDA_ANGLE startAngle( elem.endangle, DEGREES_T );
|
EDA_ANGLE startAngle( elem.endangle, DEGREES_T );
|
||||||
|
|
||||||
VECTOR2I startOffset( KiROUND( elem.radius * cos( startAngle.AsRadians() ) ),
|
VECTOR2I startOffset( KiROUND( elem.radius * startAngle.Cos() ),
|
||||||
-KiROUND( elem.radius * sin( startAngle.AsRadians() ) ) );
|
-KiROUND( elem.radius * startAngle.Sin() ) );
|
||||||
|
|
||||||
shape.SetCenter( elem.center );
|
shape.SetCenter( elem.center );
|
||||||
shape.SetStart( elem.center + startOffset );
|
shape.SetStart( elem.center + startOffset );
|
||||||
|
|
|
@ -147,8 +147,8 @@ void PCB_ARC::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
|
||||||
if( lNode )
|
if( lNode )
|
||||||
m_Angle = EDA_ANGLE( StrToInt1Units( lNode->GetNodeContent() ), TENTHS_OF_A_DEGREE_T );
|
m_Angle = EDA_ANGLE( StrToInt1Units( lNode->GetNodeContent() ), TENTHS_OF_A_DEGREE_T );
|
||||||
|
|
||||||
m_StartX = m_positionX + KiROUND( r * cos( a.AsRadians() ) );
|
m_StartX = m_positionX + KiROUND( r * a.Cos() );
|
||||||
m_StartY = m_positionY - KiROUND( r * sin( a.AsRadians() ) );
|
m_StartY = m_positionY - KiROUND( r * a.Sin() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -930,7 +930,7 @@ std::unique_ptr<PNS::SOLID> PNS_KICAD_IFACE_BASE::syncPad( PAD* aPad )
|
||||||
solid->SetNet( aPad->GetNetCode() );
|
solid->SetNet( aPad->GetNetCode() );
|
||||||
solid->SetParent( aPad );
|
solid->SetParent( aPad );
|
||||||
solid->SetPadToDie( aPad->GetPadToDieLength() );
|
solid->SetPadToDie( aPad->GetPadToDieLength() );
|
||||||
solid->SetOrientation( aPad->GetOrientation().AsTenthsOfADegree() );
|
solid->SetOrientation( aPad->GetOrientation() );
|
||||||
|
|
||||||
VECTOR2I wx_c = aPad->ShapePos();
|
VECTOR2I wx_c = aPad->ShapePos();
|
||||||
VECTOR2I offset = aPad->GetOffset();
|
VECTOR2I offset = aPad->GetOffset();
|
||||||
|
|
|
@ -1146,7 +1146,7 @@ bool LINE_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
|
||||||
else if( aStartItem && aStartItem->Kind() == ITEM::SOLID_T &&
|
else if( aStartItem && aStartItem->Kind() == ITEM::SOLID_T &&
|
||||||
static_cast<SOLID*>( aStartItem )->Parent()->Type() == PCB_PAD_T )
|
static_cast<SOLID*>( aStartItem )->Parent()->Type() == PCB_PAD_T )
|
||||||
{
|
{
|
||||||
double angle = static_cast<SOLID*>( aStartItem )->GetOrientation() / 10.0;
|
double angle = static_cast<SOLID*>( aStartItem )->GetOrientation().AsDegrees();
|
||||||
angle = ( angle + 22.5 ) / 45.0;
|
angle = ( angle + 22.5 ) / 45.0;
|
||||||
initialDir = DIRECTION_45( static_cast<DIRECTION_45::Directions>( int( angle ) ) );
|
initialDir = DIRECTION_45( static_cast<DIRECTION_45::Directions>( int( angle ) ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ public:
|
||||||
{
|
{
|
||||||
m_movable = false;
|
m_movable = false;
|
||||||
m_padToDie = 0;
|
m_padToDie = 0;
|
||||||
m_orientation = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~SOLID()
|
~SOLID()
|
||||||
|
@ -117,8 +116,8 @@ public:
|
||||||
VECTOR2I Offset() const { return m_offset; }
|
VECTOR2I Offset() const { return m_offset; }
|
||||||
void SetOffset( const VECTOR2I& aOffset ) { m_offset = aOffset; }
|
void SetOffset( const VECTOR2I& aOffset ) { m_offset = aOffset; }
|
||||||
|
|
||||||
double GetOrientation() const { return m_orientation; }
|
EDA_ANGLE GetOrientation() const { return m_orientation; }
|
||||||
void SetOrientation( double aOrientation ) { m_orientation = aOrientation; }
|
void SetOrientation( const EDA_ANGLE& aOrientation ) { m_orientation = aOrientation; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VECTOR2I m_pos;
|
VECTOR2I m_pos;
|
||||||
|
@ -126,7 +125,7 @@ private:
|
||||||
SHAPE* m_hole;
|
SHAPE* m_hole;
|
||||||
VECTOR2I m_offset;
|
VECTOR2I m_offset;
|
||||||
int m_padToDie;
|
int m_padToDie;
|
||||||
double m_orientation; // in 1/10 degrees, matching PAD
|
EDA_ANGLE m_orientation;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -697,11 +697,11 @@ void ZONE::Rotate( const VECTOR2I& aCentre, const EDA_ANGLE& aAngle )
|
||||||
for( SEG& seg : pair.second )
|
for( SEG& seg : pair.second )
|
||||||
{
|
{
|
||||||
VECTOR2I a( seg.A );
|
VECTOR2I a( seg.A );
|
||||||
RotatePoint( a, aCentre, -aAngle.AsRadians() );
|
RotatePoint( a, aCentre, -aAngle );
|
||||||
seg.A = a;
|
seg.A = a;
|
||||||
|
|
||||||
VECTOR2I b( seg.B );
|
VECTOR2I b( seg.B );
|
||||||
RotatePoint( b, aCentre, -aAngle.AsRadians() );
|
RotatePoint( b, aCentre, -aAngle );
|
||||||
seg.B = a;
|
seg.B = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue