my question is how to get the second coordinate (in 2D) of a point that lies on a curve defined as a NURBS curve given the axial coordinate. I have the knot vector, control points, their weights and basis functions.
I looked through similar questions (How to find out Y coordinate of specific point in bezier curve in canvas?) but did not find a good answer so far. Thanks, M
This is not an easy task if you need to implement everything from scratch. Nevertheless, the codes will look like this:
for each non-null knot interval in the knot vector of the NURBS { extract Bezier curve B(t) from the NURBS for this knot interval [a, b]; compute the minimum and maximum X values of the Bezier curve's control points. if ( X0 is within [Xmin, Xmax] ) { t0 = a; t1 = b; epsilon = 1.0e-06; // a small value;} // end for loop
The (t0+t1)/2 is the parameter value you are looking for. Please note that you might find multiple solutions given the same X0 value.