coudl someone show me an example please. Like who one is supposed to create a curved surface. I chose x control points, but how do I control the curve?
Printable View
coudl someone show me an example please. Like who one is supposed to create a curved surface. I chose x control points, but how do I control the curve?
you need to calculate n intermediate points using your x control points and generate a line (for 2D) or a mesh (for 3D). NeHe has a bezier example. There are a few different ways to do the calculation, the most popular seems to be the using the bernstein polynomial, but there are alternative approches.
I found this link helpful as well.
Is there a way to choose control points if you know the curve and it's equation, but want to play with it a bit.
All examples and articles speak of using the control points, but none really address how to arbitrarily choose them.
thanks
Here's the formula for a bezier surface with m*n control points called P.
(u,v) are the surface parameters and they should be in the interval [0,1].
Calculate as many points as you wish and then connect them with triangles.
OK, the image didn't turn out that well when I saved it as gif.
To use lightning on your surface you need to calculate normals
to the surface. For this, to need to be able to derive the surface. Here's the formula for d/du and d/dv looks very similar.
Hmm, I forgot the definition of B(u).
This is called a Berstein polynomial and is defined as following:
BTW, my suggestion is that you learn Bezier curves before starting to work with surfaces. If you need any matlab code I posted some here a while ago.
thanks I'll check it when I get home
One thing about that site: It suggests using cross-product to obtain the surface normals:Quote:
Originally Posted by just2peachy
I haven't studied multi-variable calculus yet, so someone please correct me if I'm wrong, but isn'tQuote:
Originally Posted by gamedev.net
grad f + (0,0,-1) a normal to the plane z = f(x,y)?
Could there be some similar way to calculate normals to the bezier surface without cross product?
I'm not sure what the role of + (0,0,1) does. Could you explain what you mean by that?
I think there are conditions to your proposal.
Here's what MathWorld states:
Quote:
If grad f is nonzero, then the gradient is perpendicular to the level curve through (Xo,Yo) if z=f(x,y) and perpendicular to the level surface through (Xo,Yo,Zo) if F(x,y,z)= 0.
Consider the surface z = f(x,y).
Create a new function g(x,y,z) = f(x,y) - z. Then our surface is equivalent to g(x,y,z)=0.
But g(x,y,z)=0 is a level surface, so grad(g) must be perpendicular to the surface.
grad g = (dg/dx , dg/y , dg/dz ) = (df/dx , df/dy , -1) = grad f - (0,0,1)
Hmm, the plus sign should've been a minus sign.