Dev:Linking to Blines - Equations
Contents
Main equations
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x_1,y_1), (x_2,y_2)} - vertices, defining bline segment
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x,y) } - current bline point
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t2}_1,y^{t2}_1), (x^{t1}_2,y^{t1}_2)} - tangent points defining bline segment
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t1},y^{t1}), (x^{t2},y^{t2})} - coordinates of yellow (t1) and red (t2) tangents (absolute)
- u - Amount of current segment, [0,1]
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x,y) = (1-u)^3 (x_1,y_1) + 3 u(1-u)^2 (x^{t2}_1,y^{t2}_1) + 3 u^2 (1-u) (x^{t1}_2,y^{t1}_2) + u^3 (x_2,y_2)} - bline point
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t1},y^{t1}) = (1-u)^2 (x_1,y_1) + 2u(1-u)(x^{t2}_1,y^{t2}_1) + u^2(x^{t1}_2,y^{t1}_2)} - coordinates of yellow tangent for current bline point
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t2},y^{t2}) = (1-u)^2 (x^{t2}_1,y^{t2}_1) + 2u(1-u)(x^{t1}_2,y^{t1}_2) + u^2(x_2,y_2)} - red tangent of bline point
How I found tangents formula
A,B,C,D defining spline segment. A,D - vertices, B,C - tangents:
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle A = (x_1,y_1); B=(x^{t2}_1,y^{t2}_1); C=(x^{t1}_2,y^{t1}_2); D = (x_2,y_2)}
- put a point on each line, some percentage of the way along each
- M on (A,B): Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x_1,y_1)(1-u) + (x^{t2}_1,y^{t2}_1)u}
- N on (B,C): Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t2}_1,y^{t2}_1)(1-u) + (x^{t1}_2,y^{t1}_2)u}
- K on (C,D): Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t1}_2,y^{t1}_2)(1-u) + (x^2,y^2)u}
- then draw new lines from the point on A-B to the point on B-C, and from the point on B-C to the point on C-D; and put new points on those 2, the same percentage of the way along each
- T1 on (M,N): Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle M(1-u) + N u = ((x_1,y_1)(1-u) + (x^{t2}_1,y^{t2}_1)u)(1-u) + ((x^{t2}_1,y^{t2}_1)(1-u) + (x^t_2,y^t_2)u)u = } Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle =(1-u)^2 (x_1,y_1) + 2u(1-u)(x^{t2}_1,y^{t2}_1) + u^2(x^{t1}_2,y^{t1}_2)}
- T2 on (N,K): Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle N(1-u) + K u = ((x^{t2}_1,y^{t2}_1)(1-u) + (x^{t1}_2,y^{t1}_2)u)(1-u) + ((x^{t1}_2,y^{t1}_2)(1-u) + (x^2,y^2)u) u = } Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle = (1-u)^2 (x^{t2}_1,y^{t2}_1) + 2u(1-u)(x^{t1}_2,y^{t1}_2) + u^2(x_2,y_2)}
Relative tangent coordinates
O'kay, I know, the Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t1},y^{t1}), (x^{t2},y^{t2})} defining absolute position of tangents, but in synfig we have their coordinates relative to vertex. Moreover, coordinates of yellow tangent are inverted.
Let's say:
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (\Delta x^{t1},\Delta y^{t1})} - relative coordinates of yellow tangent
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (\Delta x^{t2},\Delta y^{t2})} - relative coordinates of red tangent
Then:
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t1},y^{t1}) = (x,y) - (\Delta x^{t1},\Delta y^{t1})}
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x^{t2},y^{t2}) = (x,y) + (\Delta x^{t2},\Delta y^{t2})}
Make substitution:
- Bline point: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (x,y) = (1-(3u^2-2u^3)) (x_1,y_1) + 3u(1-u)^2 (\Delta x ^{t2}_1,\Delta y^{t2}_1) - 3u^2(1-u) (\Delta x^{t1}_2, \Delta y^{t1}_2) + (3u^2-2u^3) (x_2,y_2)}
- Yellow tangent: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (\Delta x ^{t1}, \Delta y ^{t1}) = (x,y) - (1-u^2) (x_1,y_1) - 2u(1-u)(\Delta x^{t2}_1, \Delta y^{t2}_1) + u^2 (\Delta x^{t1}_2, \Delta y^{t1}_2) - u^2(x_2,y_2)}
- Red tangent: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle (\Delta x ^{t2}, \Delta y ^{t2}) = (1-u)^2(x_1,y_1) + (1-u)^2(\Delta x^{t2}_1, \Delta y^{t2}_1) - 2u(1-u)( \Delta x^{t1}_2, \Delta y^{t1}_2) + (2u-u^2)(x_2,y_2) - (x,y)}
One spline
Case: Bline A. A2 linked to A (with tangent).
A2 with its tangent belongs to A, so:
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle x_{A2} = (1-u)^3 x_{A1} + 3u(1-u)^2 x^t_{A1} + 3u^2(1-u) x^t_{A2} + u^3 x_{A2}}
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle x^t_{A2} = (1-u)^2 x_{A1} + 2u(1-u) x^t_{A1} + u^2 x^t_{A2}}
Let's find Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle x_{A2}} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle x^t_{A2}} :
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle x_{A2} = \frac{(1-u)^3 x_{A1} + 3u(1-u)^2 x^t_{A1} + 3u^2(1-u) x^t_{A2} }{1 - u^3}}
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle x^t_{A2} = \frac{(1-u)^2 x_{A1} + 2u(1-u) x^t_{A1}} {1- u^2 }}
For Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle y_{A2}} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle y^t_{A2}} formulas are the analogical:
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle y_{A2} = \frac{(1-u)^3 y_{A1} + 3u(1-u)^2 y^t_{A1} + 3u^2(1-u) y^t_{A2} }{1 - u^3}}
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle y^t_{A2} = \frac{(1-u)^2 y_{A1} + 2u(1-u) y^t_{A1}} {1- u^2 }}
So if we look closely at the equations, we will see that all 4 points (2 tangents and 2 vertices) are placed on line defined by .
dooglus, can you check how this formula works in code? Something like:
- Create bline with 2 points - A1,A2
- Select point A2, right click on bline -> "Link to bline"
- Place (not link!) at the position calculated by this formula. If we'll have A2 on bline after that then it's ok for now, if not - something wrong.
I know we need a general formula but if this won't work then I definitely not right.
Two splines
...