point evaluation of NURBS curve given an axial coordinate -
my question how second coordinate (in 2d) of point lies on curve defined nurbs curve given axial coordinate. have knot vector, control points, weights , basis functions.
i looked through similar questions (how find out y coordinate of specific point in bezier curve in canvas?) did not find answer far. thanks, m
this not easy task if need implement scratch. nevertheless, codes this:
each non-null knot interval in knot vector of nurbs { extract bezier curve b(t) nurbs knot interval [a, b]; compute minimum , maximum x values of bezier curve's control points. if ( x0 within [xmin, xmax] ) { t0 = a; t1 = b; epsilon = 1.0e-06; // small value;while ( (t1-t0) > epsilon ) { subdivide b(t) @ t=0.5 generate 2 bezier curves: b1(t) , b2(t); compute [xmin1, xmax1] b1(t) , [xmin2, xmax2] b2(t); if ( x0 within [xmin1, xmax1] ) { b(t) = b1(t); t0 = a; t1 = (a+b)/2; } else { b(t) = b2(t); t0 = (a+b)/2; t1 = b; } } // end while loop return ((t0+t1)/2); // parameter value looking } // end if()
} // end loop
the (t0+t1)/2 parameter value looking for. please note might find multiple solutions given same x0 value.
Comments
Post a Comment