Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_experiment_paintop.cpp File Reference
#include "kis_experiment_paintop.h"
#include "kis_experiment_paintop_settings.h"
#include <cmath>
#include <QPainterPath>
#include <KoCompositeOpRegistry.h>
#include <kis_debug.h>
#include <kis_paint_device.h>
#include <kis_painter.h>
#include <kis_image.h>
#include <kis_spacing_information.h>
#include <krita_utils.h>
#include <kis_algebra_2d.h>

Go to the source code of this file.

Functions

bool tryMergePoints (QPainterPath &path, const QPointF &startPoint, const QPointF &endPoint, qreal &distance, qreal distanceThreshold, bool lastSegment)
 

Function Documentation

◆ tryMergePoints()

bool tryMergePoints ( QPainterPath & path,
const QPointF & startPoint,
const QPointF & endPoint,
qreal & distance,
qreal distanceThreshold,
bool lastSegment )

Definition at line 262 of file kis_experiment_paintop.cpp.

268{
269 qreal length = (endPoint - startPoint).manhattanLength();
270
271 if (lastSegment || length > distanceThreshold) {
272 if (distance != 0) {
273 path.lineTo(startPoint);
274 }
275 distance = 0;
276 return false;
277 }
278
279 distance += length;
280
281 if (distance > distanceThreshold) {
282 path.lineTo(endPoint);
283 distance = 0;
284 }
285
286 return true;
287}
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
qreal distance(const QPointF &p1, const QPointF &p2)

References distance(), and length().