Archived

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

warpexplorer

Anybody know anything about NURBS?

Recommended Posts

Ok all i need is just a little help. Maybe just a bit of code on how to draw 2D NURBS curves. I have plenty of equations but i dont understand them enough to turn them into code yet. if you think you can give me any help at all i''ll apreciate it Here is the equation for a nurbs curve: sum(i = 0, n){w_i * P_i * N_i,k(u)} C(u) = ------------------------------------- sum(i = 0, n){w_i * N_i,k(u)} This is a NURBS equation where w_i : weights P_i : control points (vector) N_i,k : normalized B-spline basis functions of degree k Here is an equation for a NURBS projection: { ( wx/w, wy/w, wz/w) if w !=0 H(wx,wy,wz,w)={ { ( direction(wx, wy) if w = 0 These variables are the part i dont get. I dont understand how to incorperate P_i as a vector I think w_i is a vector too but i dont know. Any help with these equations will be greatly apriciated. Oh, and if any of you have any code for openGL that draws just pixels (as in PutPixel(x,y,R,G,B) that would be nice too. thanks for you help. the alignment on the equations is alittle messed up on the seconed equation you need to line up the ''{'' to make it look right, by the way the ''{'' are really supposed to be one big ''{''. The first equation looks ok but not perfect.

Share this post


Link to post
Share on other sites
I''v never been good at nurbs, but a few things I do know-

w_i is not a vector - it is a scalar assigned to each point, a value of 1 means the line passes through that point, 0 means it has no effect, or somthing like that - used to add fine controll to the curve.

Your missing somthing - you need a formular for N_i,k(u).

Beyond that I don''t know, but some advice - don''t bother to learn nurbs yet. You would be better of learning somthing like beizer curves, at least at first, as they are simple - and there are several *very* good articles on them at www.gamasutra.com, they even include source code. Another thing - nurbs are slow, but with beizer curves there are some tricks you can use to speed them up big time - thats why games like Quake 3 etc use them.
-Lethe

Share this post


Link to post
Share on other sites