path - Uniform discretization of Bezier curve -


i need discretise 3rd order bezier curve points equally distributed along curve. curve defined 4 points p0, p1, p2, p3 , generic point p(t) 0 < t < 1 given by:

point_t = (1 - t) * (1 - t) * (1 - t) * p0 + 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t * p3; 

my first idea discretise t = 0, t_1, ... t_n, ..., 1

this doesn't work as, in general, don't end uniform distance between discretised points.

to sum up, need algorithm discretise parametric curve that:

|| p(t_n) - p(t_n_+_1) || = d 

i thought recursively halving bezier curve casteljau algorithm required resolution, require lot of distance calculations.

any idea on how solve problem analytically?

what looking called "arc-length parametrisation".

in general, if subdivide bezier curve @ fixed interval of default parametrisation, resulting curve segments not have same arc-length. here 1 way http://pomax.github.io/bezierinfo/#tracing.

a while ago, playing around bit of code (curvature flow) needed points uniformly separated possible. here comparison (without proper labeling on axes! ;)) using linear interpolation , monotone cubic interpolation same set of quadrature samples (i used 20 samples per curve, each evaluated using 24 point gauss-legendre quadrature) reparametrise cubic curve.

enter image description here

[please note that, compared run of algorithm using lot more nodes , samples taken ground truth.]

here demo using monotone cubic interpolation reparametrise curve. function curve.getlength quadrature function.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -