Remove unit-less angles from geometry lib APIs.

This commit is contained in:
Jeff Young 2022-01-20 20:54:22 +00:00
parent ba3a810e55
commit 4eac8d7c66
29 changed files with 82 additions and 102 deletions

View File

@ -258,7 +258,7 @@ void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
KI_FALLTHROUGH;
case SHAPE_T::POLY:
m_poly.Rotate( -aAngle.AsRadians(), aRotCentre );
m_poly.Rotate( aAngle, aRotCentre );
break;
case SHAPE_T::BEZIER:
@ -880,7 +880,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
VECTOR2I offset = getParentPosition();
SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
poly.Rotate( -getParentOrientation().AsRadians() );
poly.Rotate( getParentOrientation() );
poly.Move( offset );
int count = poly.GetPointCount();
@ -1112,7 +1112,7 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
{
SHAPE_LINE_CHAIN l = GetPolyShape().COutline( 0 );
l.Rotate( -getParentOrientation().AsRadians() );
l.Rotate( getParentOrientation() );
l.Move( getParentPosition() );
if( IsFilled() && !aEdgeOnly )

View File

@ -78,7 +78,7 @@ void D_CODE::Clear_D_CODE_Data()
m_InUse = false;
m_Defined = false;
m_Macro = nullptr;
m_Rotation = 0.0;
m_Rotation = ANGLE_0;
m_EdgesCount = 0;
m_Polygon.RemoveAllContours();
}
@ -371,7 +371,7 @@ void D_CODE::ConvertShapeToPolygon()
m_Polygon.Append( initialpos ); // close outline
if( m_Size.y > m_Size.x ) // vertical oval, rotate polygon.
m_Polygon.Rotate( -M_PI / 2 );
m_Polygon.Rotate( ANGLE_90 );
addHoleToPolygon( &m_Polygon, m_DrillShape, m_Drill, initialpos );
}
@ -399,11 +399,8 @@ void D_CODE::ConvertShapeToPolygon()
addHoleToPolygon( &m_Polygon, m_DrillShape, m_Drill, initialpos );
if( m_Rotation ) // rotate polygonal shape:
{
double angle = m_Rotation * M_PI / 180;
m_Polygon.Rotate( angle, VECTOR2I( 0, 0 ) );
}
if( !m_Rotation.IsZero() ) // rotate polygonal shape:
m_Polygon.Rotate( m_Rotation );
break;

View File

@ -191,7 +191,7 @@ public:
wxSize m_Drill; ///< dimension of the hole (if any) (drill file)
APERTURE_DEF_HOLETYPE m_DrillShape; ///< shape of the hole (0 = no hole, round = 1,
///< rect = 2).
double m_Rotation; ///< shape rotation in degrees
EDA_ANGLE m_Rotation; ///< shape rotation
int m_EdgesCount; ///< in aperture definition Polygon only:
///< number of edges for the polygon
bool m_InUse; ///< false if the aperture (previously defined)

View File

@ -820,7 +820,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
if( *aText == 'X' )
{
aText++;
dcode->m_Rotation = ReadDouble( aText );
dcode->m_Rotation = EDA_ANGLE( ReadDouble( aText ), DEGREES_T );
}
while( *aText == ' ' )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -29,6 +29,7 @@
#include <sstream>
#include <vector>
#include <geometry/seg.h>
#include <geometry/eda_angle.h>
#include <math/vector2d.h>
#include <math/box2.h>
@ -220,9 +221,9 @@ public:
/**
* @param aCenter is the rotation center.
* @param aAngle rotation angle in radians.
* @param aAngle rotation angle.
*/
virtual void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) = 0;
virtual void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) = 0;
virtual void Move( const VECTOR2I& aVector ) = 0;

View File

@ -170,9 +170,9 @@ public:
* Rotate the arc by a given angle about a point.
*
* @param aCenter is the rotation center.
* @param aAngle rotation angle in radians.
* @param aAngle rotation angle.
*/
void Rotate( double aAngle, const VECTOR2I& aCenter ) override;
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter ) override;
void Mirror( bool aX = true, bool aY = false, const VECTOR2I& aVector = { 0, 0 } );

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2013 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -30,6 +30,7 @@
#include <geometry/circle.h>
#include <math/box2.h>
#include <math/vector2d.h>
#include <trigo.h>
#include <algorithm>
@ -124,11 +125,9 @@ public:
m_circle.Center += aVector;
}
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
{
m_circle.Center -= aCenter;
m_circle.Center = m_circle.Center.Rotate( aAngle );
m_circle.Center += aCenter;
RotatePoint( m_circle.Center, aCenter, aAngle );
}
bool IsSolid() const override

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016-2020 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -30,6 +30,7 @@
#include <math/box2.h>
#include <list>
#include <vector>
#include "eda_angle.h"
class SHAPE_SIMPLE;
@ -107,7 +108,7 @@ public:
return m_shapes.size();
}
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override;
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override;
bool IsSolid() const override;

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2013 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Copyright (C) 2013-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -748,9 +748,9 @@ public:
* Rotate all vertices by a given angle.
*
* @param aCenter is the rotation center.
* @param aAngle is the rotation angle in radians.
* @param aAngle is the rotation angle.
*/
void Rotate( double aAngle, const VECTOR2I& aCenter = VECTOR2I( 0, 0 ) ) override;
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override;
bool IsSolid() const override
{

View File

@ -67,7 +67,7 @@ public:
{
}
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
{
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2019 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
@ -83,7 +83,8 @@ public:
{
}
virtual void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override {};
virtual void Rotate( const EDA_ANGLE& aAngle,
const VECTOR2I& aCenter = { 0, 0 } ) override {};
virtual void Move( const VECTOR2I& aVector ) override {};
@ -1063,9 +1064,9 @@ public:
* Rotate all vertices by a given angle.
*
* @param aCenter is the rotation center.
* @param aAngle is the rotation angle in radians.
* @param aAngle is the rotation angle.
*/
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override;
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override;
/// @copydoc SHAPE::IsSolid()
bool IsSolid() const override

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
@ -32,6 +32,7 @@
#include <geometry/shape_line_chain.h>
#include <math/box2.h>
#include <math/vector2d.h>
#include <trigo.h>
class SHAPE_RECT : public SHAPE
{
@ -152,13 +153,11 @@ public:
* the rectangle. If you might need to handle non-90° rotations then the SHAPE_RECT should
* first be converted to a SHAPE_SIMPLE which can then be free-rotated.
*/
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
{
m_p0 -= aCenter;
m_p0 = m_p0.Rotate( aAngle );
m_p0 += aCenter;
RotatePoint( m_p0, aCenter, aAngle );
if( abs( sin( aAngle ) ) == 1 )
if( abs( aAngle.Sin() ) == 1 )
std::swap( m_h, m_w );
}

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -29,6 +30,7 @@
#include <geometry/shape.h>
#include <math/box2.h>
#include <math/vector2d.h>
#include <trigo.h>
#include <algorithm>
@ -143,16 +145,10 @@ public:
return true;
}
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
{
m_seg.A -= aCenter;
m_seg.B -= aCenter;
m_seg.A = m_seg.A.Rotate( aAngle );
m_seg.B = m_seg.B.Rotate( aAngle );
m_seg.A += aCenter;
m_seg.B += aCenter;
RotatePoint( m_seg.A, aCenter, aAngle );
RotatePoint( m_seg.B, aCenter, aAngle );
}
void Move( const VECTOR2I& aVector ) override

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -155,7 +155,7 @@ public:
return m_points.Collide( aSeg, aClearance, aActual, aLocation );
}
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
{
m_points.Rotate( aAngle, aCenter );
}

View File

@ -216,7 +216,7 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aSta
// due to the shape of initial polygons
// Rotate and move the polygon to its right location
polyshape.Rotate( delta_angle.AsRadians(), VECTOR2I( 0, 0 ) );
polyshape.Rotate( -delta_angle );
polyshape.Move( startp );
aCornerBuffer.Append( polyshape);
@ -437,7 +437,7 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I&
CornerListToPolygon( outline, corners, aInflate, aError, aErrorLoc );
if( !aRotation.IsZero() )
outline.Rotate( -aRotation.AsRadians(), VECTOR2I( 0, 0 ) );
outline.Rotate( aRotation );
outline.Move( VECTOR2I( aPosition ) );
aCornerBuffer.Append( outline );
@ -504,7 +504,7 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, const
CornerListToPolygon( outline, corners, aInflate, aError, aErrorLoc );
if( !aRotation.IsZero() )
outline.Rotate( -aRotation.AsRadians(), VECTOR2I( 0, 0 ) );
outline.Rotate( aRotation );
outline.Move( aPosition );
aCornerBuffer.Append( outline );
@ -577,10 +577,10 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStar
EDA_ANGLE arc_angle_end = arc_angle_start + arc_angle;
if( arc_angle_start != ANGLE_0 && arc_angle_start != ANGLE_180 )
polyshape.Outline(0).Rotate( arc_angle_start.AsRadians(), aStart );
polyshape.Outline(0).Rotate( -arc_angle_start, aStart );
if( arc_angle_end != ANGLE_0 && arc_angle_end != ANGLE_180 )
polyshape.Outline(1).Rotate( arc_angle_end.AsRadians(), aEnd );
polyshape.Outline(1).Rotate( -arc_angle_end, aEnd );
VECTOR2I center = arc.GetCenter();
int radius = arc.GetRadius();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 CERN
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -522,19 +522,11 @@ void SHAPE_ARC::Move( const VECTOR2I& aVector )
}
void SHAPE_ARC::Rotate( double aAngle, const VECTOR2I& aCenter )
void SHAPE_ARC::Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter )
{
m_start -= aCenter;
m_end -= aCenter;
m_mid -= aCenter;
m_start = m_start.Rotate( aAngle );
m_end = m_end.Rotate( aAngle );
m_mid = m_mid.Rotate( aAngle );
m_start += aCenter;
m_end += aCenter;
m_mid += aCenter;
RotatePoint( m_start, aCenter, aAngle );
RotatePoint( m_end, aCenter, aAngle );
RotatePoint( m_mid, aCenter, aAngle );
update_bbox();
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers
* Copyright (C) 2020-2022 KiCad Developers
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -102,7 +102,7 @@ int SHAPE_COMPOUND::Distance( const SEG& aSeg ) const
}
void SHAPE_COMPOUND::Rotate( double aAngle, const VECTOR2I& aCenter )
void SHAPE_COMPOUND::Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter )
{
assert( false );
}

View File

@ -2,10 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2017 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* Copyright (C) 2013-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Copyright (C) 2013-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -37,6 +35,7 @@
#include <math/box2.h> // for BOX2I
#include <math/util.h> // for rescale
#include <math/vector2d.h> // for VECTOR2, VECTOR2I
#include <trigo.h> // for RotatePoint
class SHAPE;
@ -419,14 +418,10 @@ 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( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter )
{
for( VECTOR2I& pt : m_points )
{
pt -= aCenter;
pt = pt.Rotate( aAngle );
pt += aCenter;
}
RotatePoint( pt, aCenter, aAngle );
for( SHAPE_ARC& arc : m_arcs )
arc.Rotate( aAngle, aCenter );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2019 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
*
@ -1838,7 +1838,7 @@ void SHAPE_POLY_SET::Mirror( bool aX, bool aY, const VECTOR2I& aRef )
}
void SHAPE_POLY_SET::Rotate( double aAngle, const VECTOR2I& aCenter )
void SHAPE_POLY_SET::Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter )
{
for( POLYGON& poly : m_polys )
{

View File

@ -218,7 +218,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
poly.Append( bbox.GetRight(), y_sign*bbox.GetTop() );
poly.SetClosed( true );
poly.Rotate( -footprint->GetOrientation().AsRadians(), VECTOR2I( 0, 0 ) );
poly.Rotate( footprint->GetOrientation() );
poly.Move( footprint->GetPosition() );
plotter.PLOTTER::PlotPoly( poly, FILL_T::NO_FILL, line_thickness, &gbr_metadata );
}

View File

@ -1737,7 +1737,7 @@ void FOOTPRINT::SetOrientation( const EDA_ANGLE& aNewAngle )
m_visibleBBoxCacheTimeStamp = 0;
m_textExcludedBBoxCacheTimeStamp = 0;
m_cachedHull.Rotate( - angleChange.AsRadians(), GetPosition() );
m_cachedHull.Rotate( angleChange, GetPosition() );
}

View File

@ -488,7 +488,7 @@ void FP_TEXT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffe
const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
if( parentFootprint )
buffer.Rotate( GetDrawRotation().AsRadians(), GetTextPos() );
buffer.Rotate( -GetDrawRotation(), GetTextPos() );
aCornerBuffer.Append( buffer );
}

View File

@ -417,7 +417,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
corners.Append( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
corners.Append( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
corners.Rotate( - m_orient.AsRadians() );
corners.Rotate( m_orient );
corners.Move( shapePos );
// GAL renders rectangles faster than 4-point polygons so it's worth checking if our
@ -482,7 +482,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
{
for( SHAPE* shape : primitive->MakeEffectiveShapes() )
{
shape->Rotate( - m_orient.AsRadians() );
shape->Rotate( m_orient );
shape->Move( shapePos );
add( shape );
}
@ -1563,7 +1563,7 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
{
SHAPE_POLY_SET outline;
MergePrimitivesAsPolygon( &outline, aErrorLoc );
outline.Rotate( - m_orient.AsRadians() );
outline.Rotate( m_orient );
outline.Move( VECTOR2I( m_pos ) );
if( aClearanceValue )

View File

@ -612,7 +612,7 @@ void PCB_DIM_ALIGNED::updateGeometry()
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( -m_text.GetTextAngle().AsRadians(), textBox.GetCenter() );
polyBox.Rotate( m_text.GetTextAngle(), textBox.GetCenter() );
// The ideal crossbar, if the text doesn't collide
SEG crossbar( m_crossBarStart, m_crossBarEnd );
@ -794,7 +794,7 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( -m_text.GetTextAngle().AsRadians(), textBox.GetCenter() );
polyBox.Rotate( m_text.GetTextAngle(), textBox.GetCenter() );
// The ideal crossbar, if the text doesn't collide
SEG crossbar( m_crossBarStart, m_crossBarEnd );
@ -978,7 +978,7 @@ void PCB_DIM_LEADER::updateGeometry()
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( -m_text.GetTextAngle().AsRadians(), textBox.GetCenter() );
polyBox.Rotate( m_text.GetTextAngle(), textBox.GetCenter() );
VECTOR2I firstLine( m_end - m_start );
VECTOR2I start( m_start );
@ -1170,7 +1170,7 @@ void PCB_DIM_RADIAL::updateGeometry()
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( -m_text.GetTextAngle().AsRadians(), textBox.GetCenter() );
polyBox.Rotate( m_text.GetTextAngle(), textBox.GetCenter() );
VECTOR2I radial( m_end - m_start );
radial = radial.Resize( m_leaderLength );

View File

@ -127,7 +127,7 @@ void ALTIUM_PCB::HelperShapeSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponen
FOOTPRINT* fp = m_components.at( aComponent );
polyShape.Move( -fp->GetPosition() );
polyShape.Rotate( -fp->GetOrientation().AsRadians() );
polyShape.Rotate( fp->GetOrientation() );
}
}
}
@ -147,7 +147,7 @@ void ALTIUM_PCB::HelperShapeSetLocalCoord( FP_SHAPE* aShape )
if( fp )
{
polyShape.Move( -fp->GetPosition() );
polyShape.Rotate( -fp->GetOrientation().AsRadians() );
polyShape.Rotate( fp->GetOrientation() );
}
}
}

View File

@ -2344,11 +2344,11 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
if( src->mirror )
{
poly_outline.Mirror( false, true, VECTOR2I( 0, ( pin->pin_y - src->y ) ) );
poly_outline.Rotate( ( -src->rotate + pin->rotation ) * M_PI / 180.0 );
poly_outline.Rotate( EDA_ANGLE( src->rotate - pin->rotation, DEGREES_T ) );
}
else
{
poly_outline.Rotate( ( src->rotate - pin->rotation ) * M_PI / 180.0 );
poly_outline.Rotate( EDA_ANGLE( -src->rotate + pin->rotation, DEGREES_T ) );
}
newpad->AddPrimitivePoly( poly_outline, 0, true );

View File

@ -450,8 +450,7 @@ bool TEARDROP_MANAGER::ComputePointsOnPadVia( TEARDROP_PARAMETERS* aCurrParams,
VECTOR2I ref_on_track = ( aPts[0] + aPts[1] ) / 2;
VECTOR2I teardrop_axis( aPts[3] - ref_on_track );
double orient = teardrop_axis.Angle();
teardrop_axis.Rotate( -orient );
EDA_ANGLE orient( teardrop_axis );
int len = teardrop_axis.EuclideanNorm();
// Build the constraint polygon: a rectangle with
@ -466,7 +465,7 @@ bool TEARDROP_MANAGER::ComputePointsOnPadVia( TEARDROP_PARAMETERS* aCurrParams,
clipping_rect.Append( len, halfsize );
clipping_rect.Append( len, - halfsize );
clipping_rect.Rotate( orient );
clipping_rect.Rotate( -orient );
clipping_rect.Move( ref_on_track );
// Clip the shape to the max allowed teadrop area

View File

@ -685,12 +685,12 @@ void ZONE::MoveEdge( const VECTOR2I& offset, int aEdge )
void ZONE::Rotate( const VECTOR2I& aCentre, const EDA_ANGLE& aAngle )
{
m_Poly->Rotate( -aAngle.AsRadians(), VECTOR2I( aCentre ) );
m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
HatchBorder();
/* rotate filled areas: */
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Rotate( -aAngle.AsRadians(), aCentre );
pair.second.Rotate( aAngle, aCentre );
for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
{

View File

@ -1404,7 +1404,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer,
}
// Rotate and move the spokes tho the right position
spoke.Rotate( - ( pad->GetOrientation() + spokesAngle ).AsRadians() );
spoke.Rotate( pad->GetOrientation() + spokesAngle );
spoke.Move( shapePos );
spoke.SetClosed( true );
@ -1436,7 +1436,7 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer
// Use a area that contains the rotated bbox by orientation, and after rotate the result
// by -orientation.
if( !aZone->GetHatchOrientation().IsZero() )
filledPolys.Rotate( aZone->GetHatchOrientation().AsRadians(), VECTOR2I( 0, 0 ) );
filledPolys.Rotate( - aZone->GetHatchOrientation() );
BOX2I bbox = filledPolys.BBox( 0 );
@ -1542,7 +1542,7 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer
holes.Move( bbox.GetPosition() );
if( !aZone->GetHatchOrientation().IsZero() )
holes.Rotate( -aZone->GetHatchOrientation().AsRadians(), VECTOR2I( 0, 0 ) );
holes.Rotate( aZone->GetHatchOrientation() );
DUMP_POLYS_TO_COPPER_LAYER( holes, In10_Cu, "hatch-holes" );