graphics - Generating Polygon Mesh From Control Points of Bezier Patch -
i wanna make program on bézier surfaces, found on internet this article, there 1 approach how it, don't understand second step , third step particularly. or may cant imagine author can mean that.
b. use blending tables calculate points in "row curve": for( u = 0; u < 10; u++ ) { blend row 0 control points -> new control point blend row 1 control points -> new control point blend row 2 control points -> new control point blend row 3 control points -> new control point for( v = 0; v < 10; v++ ) { blend 4 new control points -> point on surface } } c. generate edges , polygons grid of surface points. can explain mean? thx.
a bezier-surface bezier-curve, control-points moving along other bezier-curves, instead of being stationary.
b(0,u) = (1-u)^3 b(1,u) = 3*u*(1-u)^2 b(2,u) = 3*u^2*(1-u) b(3,u) = u^3 c[0..3, 0..3] = control points curve(t,c0,c1,c2,c3) = b(0,t)*c0 + b(1,t)*c1 + b(2,t)*c2 + b(3,t)*c3 surface(s,t,c[0..3,0..3]) = curve(t, curve(s, c[0,0], c[1,0], c[2,0], c[3,0]), curve(s, c[0,1], c[1,1], c[2,1], c[3,1]), curve(s, c[0,2], c[1,2], c[2,2], c[3,2]), curve(s, c[0,3], c[1,3], c[2,3], c[3,3])) these functions samples curve (or surface) specific values of t (and s).
the article talks caching values of bernstain polynomials (the b(i,u) function) before calculating sums. don't have recalculate each time.
it goes on talking subdivision. involves breaking 4 control points in each curve 2 groups of four. each group trace half original curve.
advancing surfaces, break each row-curve two, , each column-curve two. give 4 surfaces tracing part of original curve.
subdivision quicker sampling curve/surface.
splitcurve(c0,c1,c2,c3) = [ c0, # first control-point of first sub-curve (c0 + c1)/2, # second control-point of first sub-curve (c0 + 2*c1 + c2)/4, # third control-point of first sub-curve (c0 + 3*c1 + 3*c2 + c3)/8, # shared first/last control-point (c1 + 2*c2 + c3)/4, # second control-point of second sub-curve (c2 + c3)/2, # third control-point of second sub-curve c3 # fourth control-point of second sub-curve ] splitsurface(c[0..3,0..3]) = col0 = splitcurve(c[0,0], c[0,1], c[0,2], c[0,3]) col1 = splitcurve(c[0,0], c[0,1], c[0,2], c[0,3]) col2 = splitcurve(c[0,0], c[0,1], c[0,2], c[0,3]) col3 = splitcurve(c[0,0], c[0,1], c[0,2], c[0,3]) return [ splitcurve(col0[0], col1[0], col2[0], col3[0]), splitcurve(col0[1], col1[1], col2[1], col3[1]), splitcurve(col0[2], col1[2], col2[2], col3[2]), splitcurve(col0[3], col1[3], col2[3], col3[3]), splitcurve(col0[4], col1[4], col2[4], col3[4]), splitcurve(col0[5], col1[5], col2[5], col3[5]), splitcurve(col0[6], col1[6], col2[6], col3[6]) ] continue subdivide each sub-surface, until control points lies within same pixel. here "pixel" refers projected curve. check this, naïve way project each control point screen coordinates.
to create triangle-meshes, can subdivide control-points fixed number of times, pick top-left control point of each surface.
Comments
Post a Comment