0

Like in Illustrator, for example. I. e., grabbing the curve with the mouse and moving the mouse a certain distance.

This is a similar topic: Drag a bezier curve to edit it

I tried to reproduce tfinniga's answer:

P1 = P1 + k1 * V;
P2 = P2 + k2 * V;

P0 and P3 must remain in place.

Even adding 1 to K, the result does not meet the expectation.

image, point shifted 100 up

Victor W
  • 3
  • 2

1 Answers1

0

You misunderstood the answer from tfinniga's post.

From tfinniga's post, we have

P = k0*P0 + k1*P1 + k2*P2 + k3*P3 and 
P' = k0*P0' + k1*P1' + k2*P2' + k3*P3'

Since you require P0 and P3 unchanged, we have two identities for V

V = k1*(P1'-P1) + k2*(P2'-P2)

and

V = P' - P0

So, you can choose

  P1' = P1 + c/k1 * V, 
  P2' = P2 + (1-c)/k2 * V

where c is a constant between 0 and 1.

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
fang
  • 3,473
  • 1
  • 13
  • 19
  • Thanks. How to set **c1** properly? This is the **t**? – Victor W Apr 16 '20 at 10:41
  • No, 'c1' is not the same as 't' . For 't' value, you have to find it out itself (which I assume you already knew how to do it as you can compute k1 and k2). For 'c1' value, you can choose any value between 0 and 1. A typical choice would be using 0.0 if k2 > k1, 1.0 if k1 > k2 or simply use 0.5 regardless k1, k2 values. – fang Apr 16 '20 at 17:08
  • Looks like the **c1** should depend on the location of the click. Maybe from the value of curvature, for example? On [this image](https://www.dropbox.com/s/xj5ehp3f9xtqcvf/Image000630.png?dl=0) the upper part is the result of two popular programs. Bottom part - **c1** equal to **0.5**. – Victor W Apr 17 '20 at 20:31
  • **0.07** gives a valid result for this point, but, of course, the result is not correct when dragging any other point. – Victor W Apr 17 '20 at 20:42
  • Moreover, this result is obtained for `V = P'-P`. For `V = P'-P0` moving point does not match mouse position. – Victor W Apr 19 '20 at 13:47
  • You may want to use a `c1` value _based_ on `t`, using the cubic ratio value described in https://pomax.github.io/bezierinfo/#abc, so: `c1 = (1-t)³ / (t³ + (1-t)³)`. – Mike 'Pomax' Kamermans Apr 25 '20 at 17:58