Changeset View
Changeset View
Standalone View
Standalone View
tools/polygonal/kpToolPolygonalBase.cpp
Show First 20 Lines • Show All 264 Lines • ▼ Show 20 Line(s) | 264 | else if (fabs (KP_RADIANS_TO_DEGREES (angle) - 90) | |||
---|---|---|---|---|---|
265 | < kpPixmapFX::AngleInDegreesEpsilon) | 265 | < kpPixmapFX::AngleInDegreesEpsilon) | ||
266 | { | 266 | { | ||
267 | lineEndPoint = | 267 | lineEndPoint = | ||
268 | QPoint (lineStartPoint.x (), lineEndPoint.y ()); | 268 | QPoint (lineStartPoint.x (), lineEndPoint.y ()); | ||
269 | } | 269 | } | ||
270 | // diagonal (dist from start maintained) | 270 | // diagonal (dist from start maintained) | ||
271 | else | 271 | else | ||
272 | { | 272 | { | ||
273 | const double dist = sqrt ((double)(diffx * diffx + diffy * diffy)); | 273 | const double dist = sqrt (static_cast<double> (diffx * diffx + diffy * diffy)); | ||
274 | 274 | | |||
275 | #define sgn(a) ((a)<0?-1:1) | 275 | #define sgn(a) ((a)<0?-1:1) | ||
276 | // Round distances _before_ adding to any coordinate | 276 | // Round distances _before_ adding to any coordinate | ||
277 | // (ensures consistent rounding behaviour in x & y directions) | 277 | // (ensures consistent rounding behaviour in x & y directions) | ||
278 | const int newdx = qRound (dist * cos (angle) * sgn (diffx)); | 278 | const int newdx = qRound (dist * cos (angle) * sgn (diffx)); | ||
279 | const int newdy = qRound (dist * sin (angle) * sgn (diffy)); | 279 | const int newdy = qRound (dist * sin (angle) * sgn (diffy)); | ||
280 | #undef sgn | 280 | #undef sgn | ||
281 | 281 | | |||
▲ Show 20 Lines • Show All 214 Lines • Show Last 20 Lines |