mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-05 00:25:20 +00:00
Finish with EDA_ANGLE.
This commit is contained in:
parent
4b7fe5bce3
commit
e61144d45a
3d-viewer/3d_canvas
common
eeschema
lib_field.cpplib_pin.cpplib_shape.cpplib_shape.hlib_text.hsch_bitmap.cppsch_bus_entry.cppsch_field.cppsch_junction.cppsch_line.cppsch_no_connect.cppsch_painter.cpp
sch_plugins/altium
sch_shape.cppsch_shape.hsch_sheet.cppsch_sheet_pin.cppsch_symbol.cppsch_text.cpptransform.cppinclude
libs/kimath
include
src
pagelayout_editor/dialogs
pcbnew
@ -488,8 +488,8 @@ private:
|
||||
void addSolidAreasShapes( const ZONE* aZoneContainer, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId );
|
||||
|
||||
void transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart, double aArcAngle,
|
||||
int aCircleToSegmentsCount, int aWidth,
|
||||
void transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
||||
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount, int aWidth,
|
||||
CONTAINER_2D_BASE* aDstContainer, const BOARD_ITEM& aBoardItem );
|
||||
|
||||
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 ) );
|
||||
}
|
||||
|
||||
transformArcToSegments( VECTOR2I( center.x, center.y ), arc->GetStart(),
|
||||
arc_angle.AsTenthsOfADegree(), circlesegcount, arc->GetWidth(),
|
||||
aDstContainer, *arc );
|
||||
transformArcToSegments( VECTOR2I( center.x, center.y ), arc->GetStart(), arc_angle,
|
||||
circlesegcount, arc->GetWidth(), aDstContainer, *arc );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -532,31 +531,30 @@ void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDs
|
||||
// based on TransformArcToPolygon function from
|
||||
// common/convert_basic_shapes_to_polygon.cpp
|
||||
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,
|
||||
const BOARD_ITEM& aBoardItem )
|
||||
{
|
||||
VECTOR2I arc_start, arc_end;
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree
|
||||
VECTOR2I arc_start, arc_end;
|
||||
EDA_ANGLE arcAngle( aArcAngle );
|
||||
EDA_ANGLE delta = ANGLE_360 / aCircleToSegmentsCount; // rotate angle
|
||||
|
||||
arc_end = arc_start = aStart;
|
||||
|
||||
if( aArcAngle != 3600 )
|
||||
{
|
||||
RotatePoint( arc_end, aCentre, -aArcAngle );
|
||||
}
|
||||
if( arcAngle != ANGLE_360 )
|
||||
RotatePoint( arc_end, aCentre, -arcAngle );
|
||||
|
||||
if( aArcAngle < 0 )
|
||||
if( arcAngle < ANGLE_0 )
|
||||
{
|
||||
std::swap( arc_start, arc_end );
|
||||
aArcAngle = -aArcAngle;
|
||||
arcAngle = -arcAngle;
|
||||
}
|
||||
|
||||
// Compute the ends of segments and creates poly
|
||||
VECTOR2I curr_end = 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;
|
||||
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() );
|
||||
|
||||
transformArcToSegments( aShape->GetCenter(), aShape->GetStart(),
|
||||
aShape->GetArcAngle().AsTenthsOfADegree(), segCount, linewidth,
|
||||
aDstContainer, *aShape );
|
||||
transformArcToSegments( aShape->GetCenter(), aShape->GetStart(), aShape->GetArcAngle(),
|
||||
segCount, linewidth, aDstContainer, *aShape );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -388,7 +388,7 @@ void DRAWING_SHEET_PARSER::parsePolygon( DS_DATA_ITEM_POLYGONS * aItem )
|
||||
break;
|
||||
|
||||
case T_rotate:
|
||||
aItem->m_Orient = parseDouble();
|
||||
aItem->m_Orient = EDA_ANGLE( parseDouble(), DEGREES_T );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -381,7 +381,6 @@ const wxString DS_DATA_ITEM::GetClassName() const
|
||||
DS_DATA_ITEM_POLYGONS::DS_DATA_ITEM_POLYGONS() :
|
||||
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:
|
||||
RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
|
||||
RotatePoint( &pos.x, &pos.y, m_Orient );
|
||||
pos += GetStartPos( aRepeat );
|
||||
return pos;
|
||||
}
|
||||
@ -465,15 +464,15 @@ void DS_DATA_ITEM_POLYGONS::SetBoundingBox()
|
||||
return;
|
||||
}
|
||||
|
||||
DPOINT pos;
|
||||
VECTOR2I pos;
|
||||
pos = m_Corners[0];
|
||||
RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
|
||||
RotatePoint( &pos.x, &pos.y, m_Orient );
|
||||
m_minCoord = m_maxCoord = pos;
|
||||
|
||||
for( unsigned ii = 1; ii < m_Corners.size(); 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 )
|
||||
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 );
|
||||
|
||||
if( aItem->m_Orient )
|
||||
m_out->Print( 0, " (rotate %s)", double2Str(aItem->m_Orient ).c_str() );
|
||||
if( !aItem->m_Orient.IsZero() )
|
||||
m_out->Print( 0, " (rotate %s)", double2Str( aItem->m_Orient.AsDegrees() ).c_str() );
|
||||
|
||||
if( aItem->m_LineWidth )
|
||||
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 )
|
||||
return false;
|
||||
|
||||
/* Most rectangles will be axis aligned.
|
||||
* It is quicker to check for this case and pass the rect
|
||||
* to the simpler intersection test
|
||||
double rotation = aRotation.AsTenthsOfADegree();
|
||||
|
||||
/*
|
||||
* 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
|
||||
@ -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_PERPENDICULAR[] = { -2700, -900, 0, 900, 2700 };
|
||||
|
||||
NORMALIZE_ANGLE_POS<double>( aRot );
|
||||
NORMALIZE_ANGLE_POS<double>( rotation );
|
||||
|
||||
// Test for non-rotated rectangle
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
// Test for rectangle rotated by multiple of 90 degrees
|
||||
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;
|
||||
|
||||
@ -242,13 +242,11 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
VECTOR2I delta = corners[i] - rCentre;
|
||||
RotatePoint( delta, -aRot );
|
||||
RotatePoint( delta, -rotation );
|
||||
delta += rCentre;
|
||||
|
||||
if( aRect.Contains( delta ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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
|
||||
for( int j = 0; j < 4; j++ )
|
||||
{
|
||||
RotatePoint( corners[j], aRot );
|
||||
RotatePoint( corners[j], rotation );
|
||||
corners[j] += rCentre;
|
||||
|
||||
if( Contains( corners[j] ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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];
|
||||
|
||||
|
@ -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 )
|
||||
{
|
||||
@ -239,7 +239,7 @@ void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, double aAngle )
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
if( KiROUND( aAngle ) % 900 == 0 )
|
||||
if( aAngle.IsCardinal() )
|
||||
{
|
||||
RotatePoint( m_start, aRotCentre, aAngle );
|
||||
RotatePoint( m_end, aRotCentre, aAngle );
|
||||
@ -258,7 +258,7 @@ void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, double aAngle )
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
m_poly.Rotate( -DECIDEG2RAD( aAngle ), VECTOR2I( aRotCentre ) );
|
||||
m_poly.Rotate( -aAngle.AsRadians(), aRotCentre );
|
||||
break;
|
||||
|
||||
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.
|
||||
// Therefore, instead of using m_poly, we make a copy which is translated
|
||||
// to the actual location in the board.
|
||||
double orientation = 0.0;
|
||||
VECTOR2I offset = getParentPosition();
|
||||
|
||||
if( getParentOrientation() )
|
||||
orientation = -DECIDEG2RAD( getParentOrientation() );
|
||||
|
||||
SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
|
||||
poly.Rotate( orientation );
|
||||
poly.Rotate( -getParentOrientation().AsRadians() );
|
||||
poly.Move( offset );
|
||||
|
||||
int count = poly.GetPointCount();
|
||||
@ -966,7 +962,7 @@ std::vector<VECTOR2I> EDA_SHAPE::GetRectCorners() const
|
||||
VECTOR2I botRight = GetEnd();
|
||||
|
||||
// Un-rotate rect topLeft and botRight
|
||||
if( KiROUND( getParentOrientation() ) % 900 != 0 )
|
||||
if( !getParentOrientation().IsCardinal() )
|
||||
{
|
||||
topLeft -= getParentPosition();
|
||||
RotatePoint( topLeft, -getParentOrientation() );
|
||||
@ -982,7 +978,7 @@ std::vector<VECTOR2I> EDA_SHAPE::GetRectCorners() const
|
||||
pts.emplace_back( topLeft.x, botRight.y );
|
||||
|
||||
// Now re-rotate the 4 corners to get a diamond
|
||||
if( KiROUND( getParentOrientation() ) % 900 != 0 )
|
||||
if( !getParentOrientation().IsCardinal() )
|
||||
{
|
||||
for( VECTOR2I& pt : pts )
|
||||
{
|
||||
@ -1137,7 +1133,7 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
|
||||
{
|
||||
SHAPE_LINE_CHAIN l = GetPolyShape().COutline( 0 );
|
||||
|
||||
l.Rotate( -DECIDEG2RAD( getParentOrientation() ) );
|
||||
l.Rotate( -getParentOrientation().AsRadians() );
|
||||
l.Move( getParentPosition() );
|
||||
|
||||
if( IsFilled() && !aEdgeOnly )
|
||||
@ -1547,8 +1543,8 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
||||
break;
|
||||
|
||||
// The polygon is expected to be a simple polygon; not self intersecting, no hole.
|
||||
double orientation = getParentOrientation();
|
||||
VECTOR2I offset = getParentPosition();
|
||||
EDA_ANGLE orientation = getParentOrientation();
|
||||
VECTOR2I offset = getParentPosition();
|
||||
|
||||
// Build the polygon with the actual position and orientation:
|
||||
std::vector<VECTOR2I> poly;
|
||||
|
@ -627,7 +627,7 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
|
||||
if( aContains )
|
||||
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 )
|
||||
{
|
||||
VECTOR2I start, end;
|
||||
start.x = aCenter.x + KiROUND( aRadius * cos( aStartAngle.AsRadians() ) );
|
||||
start.y = aCenter.y - KiROUND( aRadius * sin( aStartAngle.AsRadians() ) );
|
||||
start.x = aCenter.x + KiROUND( aRadius * aStartAngle.Cos() );
|
||||
start.y = aCenter.y - KiROUND( aRadius * aStartAngle.Sin() );
|
||||
|
||||
if( !aPlotInRegion )
|
||||
MoveTo( start );
|
||||
else
|
||||
LineTo( start );
|
||||
|
||||
end.x = aCenter.x + KiROUND( aRadius * cos( aEndAngle.AsRadians() ) );
|
||||
end.y = aCenter.y - KiROUND( aRadius * sin( aEndAngle.AsRadians() ) );
|
||||
end.x = aCenter.x + KiROUND( aRadius * aEndAngle.Cos() );
|
||||
end.y = aCenter.y - KiROUND( aRadius * aEndAngle.Sin() );
|
||||
DPOINT devEnd = userToDeviceCoordinates( end );
|
||||
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.
|
||||
// calculate last point (end of last arc):
|
||||
VECTOR2I last_pt;
|
||||
last_pt.x = arc_last_center.x + KiROUND( aCornerRadius * cos( arc_last_angle.AsRadians() ) );
|
||||
last_pt.y = arc_last_center.y - KiROUND( aCornerRadius * sin( 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 * arc_last_angle.Sin() );
|
||||
|
||||
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();
|
||||
|
||||
// Calculate arc start point:
|
||||
VECTOR2I cmap( aCenter.x + KiROUND( aRadius * cos( aStartAngle.AsRadians() ) ),
|
||||
aCenter.y - KiROUND( aRadius * sin( aStartAngle.AsRadians() ) ) );
|
||||
VECTOR2I cmap( aCenter.x + KiROUND( aRadius * aStartAngle.Cos() ),
|
||||
aCenter.y - KiROUND( aRadius * aStartAngle.Sin() ) );
|
||||
VECTOR2D cmap_dev = userToDeviceCoordinates( cmap );
|
||||
|
||||
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 );
|
||||
|
||||
// Usual trig arc plotting routine...
|
||||
start.x = aCenter.x + KiROUND( aRadius * cos( -startAngle.AsRadians() ) );
|
||||
start.y = aCenter.y + KiROUND( aRadius * sin( -startAngle.AsRadians() ) );
|
||||
start.x = aCenter.x + KiROUND( aRadius * -startAngle.Cos() );
|
||||
start.y = aCenter.y + KiROUND( aRadius * -startAngle.Sin() );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( start );
|
||||
fprintf( workFile, "%g %g m ", pos_dev.x, pos_dev.y );
|
||||
|
||||
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
|
||||
{
|
||||
end.x = aCenter.x + KiROUND( aRadius * cos( -ii.AsRadians() ) );
|
||||
end.y = aCenter.y + KiROUND( aRadius * sin( -ii.AsRadians() ) );
|
||||
end.x = aCenter.x + KiROUND( aRadius * -ii.Cos() );
|
||||
end.y = aCenter.y + KiROUND( aRadius * -ii.Sin() );
|
||||
pos_dev = userToDeviceCoordinates( end );
|
||||
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
||||
}
|
||||
|
||||
end.x = aCenter.x + KiROUND( aRadius * cos( -endAngle.AsRadians() ) );
|
||||
end.y = aCenter.y + KiROUND( aRadius * sin( -endAngle.AsRadians() ) );
|
||||
end.x = aCenter.x + KiROUND( aRadius * -endAngle.Cos() );
|
||||
end.y = aCenter.y + KiROUND( aRadius * -endAngle.Sin() );
|
||||
pos_dev = userToDeviceCoordinates( end );
|
||||
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 );
|
||||
|
||||
/* Please NOTE the different sign due to Y-axis flip */
|
||||
start.x = aCenter.x + KiROUND( aRadius * cos( -startAngle.AsRadians() ) );
|
||||
start.y = aCenter.y + KiROUND( aRadius * sin( -startAngle.AsRadians() ) );
|
||||
start.x = aCenter.x + KiROUND( aRadius * -startAngle.Cos() );
|
||||
start.y = aCenter.y + KiROUND( aRadius * -startAngle.Sin() );
|
||||
|
||||
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 )
|
||||
{
|
||||
end.x = aCenter.x + KiROUND( aRadius * cos( -ii.AsRadians() ) );
|
||||
end.y = aCenter.y + KiROUND( aRadius * sin( -ii.AsRadians() ) );
|
||||
end.x = aCenter.x + KiROUND( aRadius * -ii.Cos() );
|
||||
end.y = aCenter.y + KiROUND( aRadius * -ii.Sin() );
|
||||
LineTo( end );
|
||||
}
|
||||
|
||||
end.x = aCenter.x + KiROUND( aRadius * cos( -endAngle.AsRadians() ) );
|
||||
end.y = aCenter.y + KiROUND( aRadius * sin( -endAngle.AsRadians() ) );
|
||||
end.x = aCenter.x + KiROUND( aRadius * -endAngle.Cos() );
|
||||
end.y = aCenter.y + KiROUND( aRadius * -endAngle.Sin() );
|
||||
|
||||
if( aFill != FILL_T::NO_FILL )
|
||||
{
|
||||
|
@ -2618,9 +2618,8 @@ void CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment( EDA_TEXT* aKiCadTextIte
|
||||
{
|
||||
if( !aKiCadTextItem->GetText().IsEmpty() )
|
||||
{
|
||||
int txtAngleDecideg = aKiCadTextItem->GetTextAngle().AsTenthsOfADegree();
|
||||
VECTOR2I positionOffset( 0, aKiCadTextItem->GetInterline() );
|
||||
RotatePoint( positionOffset, txtAngleDecideg );
|
||||
RotatePoint( positionOffset, aKiCadTextItem->GetTextAngle() );
|
||||
|
||||
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 )
|
||||
{
|
||||
VECTOR2I a( center.x + r * cos( startAngle.AsRadians() ),
|
||||
center.y + r * sin( startAngle.AsRadians() ) );
|
||||
VECTOR2I b( center.x + r * cos( endAngle.AsRadians() ),
|
||||
center.y + r * sin( endAngle.AsRadians() ) );
|
||||
VECTOR2I a( center.x + r * startAngle.Cos(), center.y + r * startAngle.Sin() );
|
||||
VECTOR2I b( center.x + r * endAngle.Cos(), center.y + r * endAngle.Sin() );
|
||||
|
||||
aStroker( a, b );
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void LIB_FIELD::MirrorVertical( const VECTOR2I& center )
|
||||
|
||||
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();
|
||||
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 )
|
||||
{
|
||||
int rot_angle = aRotateCCW ? -900 : 900;
|
||||
EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
|
||||
|
||||
RotatePoint( m_position, aCenter, rot_angle );
|
||||
|
||||
@ -1162,13 +1162,13 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
|
||||
{
|
||||
case PIN_UP:
|
||||
// Pin is rotated and texts positions are mirrored
|
||||
RotatePoint( begin, VECTOR2I( 0, 0 ), -900 );
|
||||
RotatePoint( end, VECTOR2I( 0, 0 ), -900 );
|
||||
RotatePoint( begin, VECTOR2I( 0, 0 ), -ANGLE_90 );
|
||||
RotatePoint( end, VECTOR2I( 0, 0 ), -ANGLE_90 );
|
||||
break;
|
||||
|
||||
case PIN_DOWN:
|
||||
RotatePoint( begin, VECTOR2I( 0, 0 ), 900 );
|
||||
RotatePoint( end, VECTOR2I( 0, 0 ), 900 );
|
||||
RotatePoint( begin, VECTOR2I( 0, 0 ), ANGLE_90 );
|
||||
RotatePoint( end, VECTOR2I( 0, 0 ), ANGLE_90 );
|
||||
begin.x = -begin.x;
|
||||
end.x = -end.x;
|
||||
break;
|
||||
|
@ -102,7 +102,7 @@ void LIB_SHAPE::MirrorVertical( const VECTOR2I& aCenter )
|
||||
|
||||
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 );
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
|
||||
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(); }
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
if( aContained )
|
||||
return rect.Contains( textBox );
|
||||
|
||||
return rect.Intersects( textBox, GetTextAngle().AsTenthsOfADegree() );
|
||||
return rect.Intersects( textBox, GetTextAngle() );
|
||||
}
|
||||
|
||||
int GetPenWidth() const override;
|
||||
|
@ -144,7 +144,7 @@ void SCH_BITMAP::MirrorHorizontally( int aCenter )
|
||||
|
||||
void SCH_BITMAP::Rotate( const VECTOR2I& aCenter )
|
||||
{
|
||||
RotatePoint( m_pos, aCenter, 900 );
|
||||
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
VECTOR2I pt = GetPosition();
|
||||
RotatePoint( pt, aCenter, 900 );
|
||||
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||
SetPosition( pt );
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ void SCH_JUNCTION::MirrorHorizontally( int 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 )
|
||||
{
|
||||
if( m_flags & STARTPOINT )
|
||||
RotatePoint( m_start, aCenter, 900 );
|
||||
RotatePoint( m_start, aCenter, ANGLE_90 );
|
||||
|
||||
if( m_flags & ENDPOINT )
|
||||
RotatePoint( m_end, aCenter, 900 );
|
||||
RotatePoint( m_end, aCenter, ANGLE_90 );
|
||||
}
|
||||
|
||||
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
RotatePoint( m_pos, aCenter, 900 );
|
||||
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user