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

- 12-15-2004linuxdudebezier 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-2004Perspective
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-2004just2peachy
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 - 12-16-2004Sang-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-2004Sang-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-2004Sang-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-2004linuxdude
thanks I'll check it when I get home

- 12-18-2004Sang-draxQuote:

Originally Posted by**just2peachy**

Quote:

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