|
|
#1 |
|
Junior Member
Join Date: Jan 2004
Location: berlin, germany
Posts: 44
|
inverse-bezier-curve math problem
after playing around a lot with those cute bezier-curves, i tried to make some kind of inverse-bezier-curve.
you simply "tell" the curve through which points it should pass and then it calculates the required control-points. doing this for a cubic bezier-curve was easy as 3.1415926. then i tried the same for a quartic curve, in order to find some kind of universal formula for inverse-bezier-curve, and must've made a mistake. the curve deforms almost as expected, just a bit too much. i'll post my solution for the equations here, maybe you can find what i missed. (sorry for my math-english) the basics: 4 points, which lie on the curve, are defined. i=0, i=1/3, i=2/3 and i=1 beziercurvefunction: (ni=1-i P1,P2,P3 and P4 are the four control points)) ni*ni*ni*P1 + 3*ni*ni*i*P2 + 3*ni*i*i*P3 + i*i*i*P4 so the following applies for the four custom points: for i=0: P1 for i=1/3: 8*P1/27 + 12*P2/27 + 6*P3/27 + P4/27 for i=2/3: P1/27 + 6*P2/27 + 12*P3/27 + 8*P4/27 for i=1: P4 so we've got P1 and P4, now we need formulas for P2 and P3 (P(1/3) is the second custom point, the others are control points) P2 = 27/12*(P(1/3) - 8*P1/27 - 6*P3/27 - P4/27); P3 = 27/12*(P(2/3) - P1/27 - 6*P2/27 - 8*P4/27); now i combine these two equations to this one P3 = 27/12*(P(2/3) - P1/27 - 6*(27/12*(P(1/3) - 8*P1/27 - 6*P3/27 - P4/27))/27 - 8*P4/27); |apply factors P3 = 27/12*(P(2/3) - P1/27 - 0.5*(P(1/3) - 8*P1/27 - 6*P3/27 - P4/27) - 8*P4/27); |again P3 = 27/12*(P(2/3) - 5*P1/27 - 0.5*P(1/3) - 3*P3/27 - 8.5*P4/27); |sum up P3 = 27*P(2/3)/12 - 5*P1/12 - 27*P(1/3)/24 - P3/4 - 17*P4/24; |apply factors again P3 = 4/5*(27*P(2/3)/12 - 5*P1/12 - 27*P(1/3)/24 - 17*P4/24); |+P3/4 |/1.25 P3 = 1.8*P(2/3)3 - P1/3 - 0.9*P(1/3) - 17*P4/30 |apply factors one last time so for P2 we've got: P2 = 1.8*P(1/3)3 - P4/3 - 0.9*P(2/3) - 17*P1/30 that's it. i've already killed tons of stupid mistakes, but there must be one very persistent mistake. btw: if you know this holy universal inverse-bezier-curve-formula-thingy, please tell me! ![]() thanks in advance. |
|
|
|
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|