- changed status to resolved
Drag a curve to edit it.
Issue #215
resolved
Like many vector editors Valentina should allow user change curve by dragging it.
Bezier curve through three points
// Magic Bezier Drag Equations follow! // "weight" describes how the influence of the drag should be distributed // among the handles; 0 = front handle only, 1 = back handle only. double weight, t = _t; if (t <= 1.0 / 6.0) weight = 0; else if (t <= 0.5) weight = (pow((6 * t - 1) / 2.0, 3)) / 2; else if (t <= 5.0 / 6.0) weight = (1 - pow((6 * (1-t) - 1) / 2.0, 3)) / 2 + 0.5; else weight = 1; Geom::Point delta = new_pos - position(); Geom::Point offset0 = ((1-weight)/(3*t*(1-t)*(1-t))) * delta; Geom::Point offset1 = (weight/(3*t*t*(1-t))) * delta; first->front()->move(first->front()->position() + offset0); second->back()->move(second->back()->position() + offset1);
Comments (1)
-
reporter - Log in to comment
Fixed issue
#215. Drag a curve to edit it.→ <<cset cba4ead252c7>>