this is related to the idea of the user (me) drawing a curve to supply the values to some function, say the hue of a gradation
The problem is given an x value I need to get the y value of the curve
I searched the forums and found
The idea in that is to find a bunch of points along the curve and then 'search' that list to find the one that has the closest x and then read the y value
I can make the assumption, restriction, that as P the parameter of the curve increases, x increases
there is a link to a subdivision sort solution on the old post but the link is broken
Find the code (implementation & test) at: http://www.autohotkey.net/~PhiLho/PointOnBezier.pde
I think what I would do is make an array like (10000,2)
Step through P normalizine to the 1000, fidning points on the curve
The x would go in (p,0) and the y in (p,1)
then given an x, 'search' this array for the closest x (p,0)
and 'read' the y (p,1)
I could normalize the x to fit the P range so the first guess of P would be the normalized x
what I could use help on:
algorithm for sub division search of the array, i.e. test, find side, take mid point etc.
Thanks, Mark
The problem is given an x value I need to get the y value of the curve
I searched the forums and found
Point to bezier line intersection
http://processing.org/discourse/beta/num_1219808869.html
unfortunately in the old closed forum
http://processing.org/discourse/beta/num_1219808869.html
The idea in that is to find a bunch of points along the curve and then 'search' that list to find the one that has the closest x and then read the y value
I can make the assumption, restriction, that as P the parameter of the curve increases, x increases
there is a link to a subdivision sort solution on the old post but the link is broken
Find the code (implementation & test) at: http://www.autohotkey.net/~PhiLho/PointOnBezier.pde
I think what I would do is make an array like (10000,2)
Step through P normalizine to the 1000, fidning points on the curve
The x would go in (p,0) and the y in (p,1)
then given an x, 'search' this array for the closest x (p,0)
and 'read' the y (p,1)
I could normalize the x to fit the P range so the first guess of P would be the normalized x
what I could use help on:
algorithm for sub division search of the array, i.e. test, find side, take mid point etc.
Thanks, Mark
1