# Bezier surfaces

• 11-06-2004
Sang-drax
Bezier surfaces
I'm genrating a bezier surface using a control grid of these points:
(0,0,0) (1,0,0)
(0,1,0) (1,1,1)

And the surface should be equal to z = xy. My rendering lies on z=xy, but doesn't extend to two of the control points.

But, if I have a bezier surface derived from a control net of only four points, the surface should touch all those four points, right?
• 11-06-2004
Sang-drax
I solved the problem. Matlab indexing starts at 1, not 0 and I thought I had compensated for this, but I forgot one place. :)

Attached is a bezier surface with this control net:
(0,0,0) (1,0,0) (2,0,0)
(0,1,0) (0,1,1) (0,1,2)
(1,1,1) (2,1,1) (2,2,1)
• 11-07-2004
Darkness
I'm glad you figured it out. Incidentally I am also learning to use Matlab.
• 11-07-2004
Sang-drax
I've found myself able to produce code very fast using Matlab, but the readability of the code is often suffering a bit.
• 11-07-2004
Darkness
Would you like to share some of it? Currently, I am only a few weeks into it, and I am doing it for engineering at my school. We are learning how to handle vectors and matrices, range variables, that type of stuff, so far.

Are you doing this for your studies, or just because it's cool? :)
• 11-08-2004
Sang-drax
Quote:

Originally Posted by Darkness
Are you doing this for your studies, or just because it's cool? :)

I'm taking a course in Geometry which involves lots of Beizer curves and a little Bezier surfaces. Actually drawing them instead of just doing the math helps understanding.
I'm also taking a course in Matlab programming atm.
Quote:

Originally Posted by Darkness
Would you like to share some of it?

Yes, but I've only jsut started doing Matlab programming, so there are probaby better/faster ways of doing many things.

I've attached an .m file that draws a Bezier surface with a m*n control net given by a m*n*3 matrix.
To draw a random surface, just do:
Code:

`BezierSurf(rand(3,3,3));`
• 11-08-2004
Darkness
Cool, that'll help me learn some things, thanks.