15constexpr qreal minLineLengthSquared = 1e-6;
16constexpr qreal snapAngleStepRadians = 3.14159265358979323846 / 12.0;
18QPointF snappedEndpoint(
const QPointF &anchor,
const QPointF &point)
20 const QPointF delta = point - anchor;
26 const qreal angle = std::atan2(delta.y(), delta.x());
27 const qreal snappedAngle = std::round(angle / snapAngleStepRadians) * snapAngleStepRadians;
28 return anchor + QPointF(
length * std::cos(snappedAngle),
length * std::sin(snappedAngle));
101 const QPointF &strokeBegin,
102 bool checkForInitialMovement,
103 qreal moveThresholdPt)
const
109 if (checkForInitialMovement &&
KisAlgebra2D::norm(point - strokeBegin) < moveThresholdPt) {
qreal length(const QPointF &vec)
QPointF lineSecondPoint() const
void updateLine(const QPointF &secondPoint, bool snapToAngle=false)
void setLocked(bool locked)
QPointF adjustPosition(const QPointF &point, const QPointF &strokeBegin, bool checkForInitialMovement, qreal moveThresholdPt) const
InteractionMode m_interactionMode
InteractionMode interactionMode() const
void setInteractionMode(InteractionMode mode)
QPointF lineAnchor() const
void beginLine(const QPointF &anchor)
bool hasValidLine() const
static bool qFuzzyIsNull(half h)
qreal normSquared(const T &a)
PointTypeTraits< T >::value_type dotProduct(const T &a, const T &b)