Cubic Bezier Curve Problem

vendredi 31 janvier 2014

Hello.



I have a program that, given a value for (x), needs to find the corresponding y-value along a cubic Bezier curve. So long as the Bezier does not switch direction in (x), there is always one, and only one, value of (y) for every value of (x).



In solving for (y), I discovered that the solution was a cubic (not surprising, since the very name of this type of Bezier is "cubic"). Now, my experience with quadratics and what cubics I run into rarely, is that the way to find out which solution to use is to just test it...Most often, one will always work while the others will not, or in some rare cases all of them will work...Assuming that the values are always Real.



At any rate, after testing the program, I found that, indeed, none of the three solutions always offered a Real result. Sometimes all three were Real, sometimes a mix of Real and Complex, other times all Complex. So my conundrum is this: I need a scalar (Real) value for (y), but when I move one of the control points of the Bezier, I run into a majority of cases where the result for (y) is complex, and no solution reliably results in a Real, scalar value for it. Therefore, there is no way to test for which solution to use.



My question is, how am I to interpret a Complex result in this situation? It is a vector with an Imaginary component, when I need a scalar value. Proofing my math results suggests that I have the correct solutions, and whenever a Real value results, that (y) value is always correct. As far as I know, a Complex value may indicate that something is going on in a separate dimension, so I assume that since the Bezier I am using is 2-dimensional, that the Complex result is telling me that there is activity in a third, orthogonal direction. But that makes no sense as far as this Bezier is concerned.



I am stumped. :(



Any guidance would be really helpful.



Many thanks!





0 commentaires:

Enregistrer un commentaire