Differential D15540 Diff 43017 plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.cpp
Changeset View
Changeset View
Standalone View
Standalone View
plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.cpp
Show First 20 Lines • Show All 282 Lines • ▼ Show 20 Line(s) | 282 | if (strokeWidth < MINIMUM_STROKE_WIDTH) { | |||
---|---|---|---|---|---|
283 | strokeWidth = MINIMUM_STROKE_WIDTH; | 283 | strokeWidth = MINIMUM_STROKE_WIDTH; | ||
284 | } | 284 | } | ||
285 | 285 | | |||
286 | return strokeWidth; | 286 | return strokeWidth; | ||
287 | } | 287 | } | ||
288 | 288 | | |||
289 | qreal KarbonCalligraphyTool::calculateAngle(const QPointF &oldSpeed, const QPointF &newSpeed) | 289 | qreal KarbonCalligraphyTool::calculateAngle(const QPointF &oldSpeed, const QPointF &newSpeed) | ||
290 | { | 290 | { | ||
291 | // calculate the avarage of the speed (sum of the normalized values) | 291 | // calculate the average of the speed (sum of the normalized values) | ||
292 | qreal oldLength = QLineF(QPointF(0, 0), oldSpeed).length(); | 292 | qreal oldLength = QLineF(QPointF(0, 0), oldSpeed).length(); | ||
293 | qreal newLength = QLineF(QPointF(0, 0), newSpeed).length(); | 293 | qreal newLength = QLineF(QPointF(0, 0), newSpeed).length(); | ||
294 | QPointF oldSpeedNorm = !qFuzzyCompare(oldLength + 1, 1) ? | 294 | QPointF oldSpeedNorm = !qFuzzyCompare(oldLength + 1, 1) ? | ||
295 | oldSpeed / oldLength : QPointF(0, 0); | 295 | oldSpeed / oldLength : QPointF(0, 0); | ||
296 | QPointF newSpeedNorm = !qFuzzyCompare(newLength + 1, 1) ? | 296 | QPointF newSpeedNorm = !qFuzzyCompare(newLength + 1, 1) ? | ||
297 | newSpeed / newLength : QPointF(0, 0); | 297 | newSpeed / newLength : QPointF(0, 0); | ||
298 | QPointF speed = oldSpeedNorm + newSpeedNorm; | 298 | QPointF speed = oldSpeedNorm + newSpeedNorm; | ||
299 | 299 | | |||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |