42constexpr double COORD_LIMIT = std::numeric_limits<int>::max() / 2.0;
53 return aAngle / 1000.0;
68inline void PointRotate(
double aPx,
double aPy, int32_t aAngle,
double aCx,
double aCy, int32_t& aOutX,
76 double c = std::cos( aAngle *
M_PI / 180000.0 );
77 double s = std::sin( aAngle *
M_PI / 180000.0 );
79 if( aAngle == 90000 || aAngle == 270000 )
82 s = aAngle == 90000 ? 1.0 : -1.0;
84 else if( aAngle == 180000 )
90 double dx = aPx - aCx;
91 double dy = aPy - aCy;
92 x = ( c * dx + aCx ) - s * dy;
93 y = s * dx + aCy + c * dy;
96 aOutX =
static_cast<int32_t
>( x );
97 aOutY =
static_cast<int32_t
>( y );
101inline void PointRotate( int32_t& aX, int32_t& aY, int32_t aAngle, int32_t aCx, int32_t aCy )
constexpr double COORD_LIMIT
Half of KiCad's integer range, so shape code rotating or adding coordinates cannot overflow.
void PointRotate(double aPx, double aPy, int32_t aAngle, double aCx, double aCy, int32_t &aOutX, int32_t &aOutY)
Rotate aPx, aPy anticlockwise by aAngle about aCx, aCy as Easy-PC places points: in double with exact...
constexpr int32_t NormalizeAngle(int32_t aAngle)
Wrap an angle into [0, ANGLE_FULL_TURN)
constexpr double AngleToDegrees(int32_t aAngle)
constexpr int ANGLE_FULL_TURN
constexpr int64_t NM_PER_DSU
constexpr int64_t DsuToNm(int64_t aDsu)