Obtaining modified curves as close as possible to the originals may have several interpretations, but it could be considered that the preservation of end points and tangents far from constant connection points may correspond. Thus, the points P0 , P1 , P3 = Q0 , Q2 , Q3 are constant.
We can change the origin so that P3 = Q0 = 0 , ensuring the continuity of C2, can be expressed as:
P1 - 2*P2 = 2*Q1 + Q2
We can express P2=a*e^i*r and Q1=b*e^i*r in complex representations (maintaining the same angle ensures the continuity of C2. Calculate
(P1 - Q2)/2 = c*e^i*s
Forced continuity C2 must choose r=s and find a combination of a and b such that a+b =c . There are infinitely many solutions, but heuristics can be used, such as changing a if it is the smallest (thereby making less reasonable changes).
If this does not lead to small enough changes, try two-step optimization: first change P1 and Q2 to get s closer to r , then apply the steps above.
Shuba
source share