This topic is now archived and is closed to further replies.


How to draw bsplines

Recommended Posts

you can write some evaluator code to generate surface points of your bspline surface. foreach 4x4 patch of you control points iterate your s values between [0 and 1] and your t values between [0 and 1] (the step size here will determine the tesselation of your surface). Plug these values for s&t into your bspline equation (can be found in any good 3d math book) with the proper Basis Matrix. Use the 4x4 patch as ur geometry matrix. You can get the surface normals in a similar way using the first dirivitive of the bslpine equation (with respect to S and T) and cross product. You have to do more work to convert these vertices to a quad mesh (or whatever). The thing ends up being like 4 nested loop:

for (control points in U direction)
for (control points in V direction)
for (s [0,1], inc by s-step)
for (t [0,1], inc by t-step)
apointofsurface = evaluate spline at s,t with Bspline Basis and patch(u,v)
apointsnormal = cross product of results of evaluation of first dirivitive (wrt s & t)

[edited by - _walrus on May 27, 2004 10:24:23 AM]

Share this post

Link to post
Share on other sites