bezier curves

• 12-15-2004
linuxdude
bezier curves
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?
• 12-16-2004
Perspective
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.
• 12-16-2004
just2peachy

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
• 12-16-2004
Sang-drax
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.
• 12-16-2004
Sang-drax
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.
• 12-16-2004
Sang-drax
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.
• 12-17-2004
linuxdude
thanks I'll check it when I get home
• 12-18-2004
Sang-drax
Quote:

Originally Posted by just2peachy

One thing about that site: It suggests using cross-product to obtain the surface normals:
Quote:

Originally Posted by gamedev.net
Now we have a way to describe two tangent vectors on each point on the surface. This mean that we will be able to calculate the normal vector of any point on the surface.

In general, if you have two vectors, V={vx, vy, vz} and U={ux, uy, uz} then those two vectors can be 'crossed' to produce a new vector N={nx, ny, nz} that is orthogonal to both V and U (Two vectors beeing orthogonal means that the angle between them are 90°).

I haven't studied multi-variable calculus yet, so someone please correct me if I'm wrong, but isn't

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?
• 12-21-2004
just2peachy
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.
• 12-23-2004
Sang-drax
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.