Mechanical Design Technology (Free-form Surface)Prof. Tamotsu Murakami■Assignment #1: Free-form Surface Generation●Make a program that■ generates a bicubic Bezier surface from 4×4 defining polygon net points and■ displays the surface graphically in a way that allows the three-dimensional featuresof the surface to appear comprehensively → You will need appropriate threedimensional transformation and projection●Suppose the 4×4 defining polygon net points are specified as Bi, j = [xi, j yi, j zi, j ] (i, j =1, 2, 3, 4); According to the definition of a Bezier surface, a point on the surface P(u,w)=[xu, w yu, w zu, w] for the parameters u, w (0≦u≦1, 0≦w≦1) is calculated●By dividing the parameter range [0, 1] into 16 intervals, 17×17 points [xu, w yu, w zu, w](u, w = 0, 1/16, 2/16, … 15/16 and 1) on the surface are calculated; By connecting thecalculated points with lines and making a lattice, a mesh to approximate the Beziersurface is obtained●The program you write will need to be able to edit the shape of the surface by changing
the 4×4 defining polygon net points Bi, j●Because of the coordinate system of an NC milling machine and the work size
subsequently used in this course, use the right-hand coordinate system, and theorientation and value range for the parameters x, y, and z should be as follows■ x and y to control the horizontal range of the surface: 0≦x≦100; y: 0≦y≦75■ z to control the convex/concave shape of the surface: z≦0

Mechanical Design Technology (Free-form Surface)

April 28, 2004

1/12

■Submission●What is Expected■ One printed copy of the graphics screen displaying the Bezier surface and defining
polygon net● Do not submit the source code of your program at this time
● The program is used for Assignment #2, so do not delete it after you finish
Assignment #1●Deadline■ June 30, 2004 (at the end of the lecture) in Room 8-222■Bezier Curve●Definition■ Defining polygon points: Bi = [xi yi zi] (i = 0, 1 ,2, … , n)
■ Curve parameter: t (0≦t≦1)■ Bezier/Bernstein basis function (blending function): Jn,i (t)■ A point on the Bezier curve: P(t)=[x(t) y(t) z(t)]P (t ) = [x(t )ny (t ) z (t )] = ∑ Bi J n,i (t )(0 ≤ t ≤ 1)

i =0Bi = [xiyizi ]⎛ n⎞
J n,i (t ) = ⎜⎜ ⎟⎟ t i (1 − t ) n −i⎝i⎠Mechanical Design Technology (Free-form Surface)⎛ n⎞n!
⎜⎜ ⎟⎟ =⎝ i ⎠ i! (n − i )!
April 28, 2004

2/12

●Example: Cubic Bezier curve (n=3)
3
P (t ) = ∑ Bi J 3,i (t ) = (1 − t )3 B0 + 3t (1 − t ) 2 B1 + 3t 2 (1 − t ) B2 + t 3 B3i =0[= (1 − t )3 3t (1 − t ) 2⎡ B0 ⎤⎢ ⎥23 ⎢ B1 ⎥3t (1 − t ) t⎢ B2 ⎥⎢ ⎥⎣⎢ B3 ⎦⎥]⎧ x(t ) = (1 − t )3 x0 + 3t (1 − t ) 2 x1 + 3t 2 (1 − t ) x2 + t 3 x3⎪3223
⎨ y (t ) = (1 − t ) y0 + 3t (1 − t ) y1 + 3t (1 − t ) y2 + t y3
⎪ z (t ) = (1 − t )3 z + 3t (1 − t ) 2 z + 3t 2 (1 − t ) z + t 3 z
0123⎩■ P(t) is defined as a weighted sum of Bi, where a weight for Bi is Jn,i(t)●Some properties of the Bezier curve■ The curve generally follows the shape of the defining polygon■ Only the first and last points of the defining polygon and the curve are coincident■ The degree of the polynomial defining the curve is one less than the number ofdefining polygon points■ The curve is invariant under an affine transformation

Mechanical Design Technology (Free-form Surface)

April 28, 2004

3/12

[Rogers and Adams 1990]
Mechanical Design Technology (Free-form Surface)

April 28, 2004

4/12

[Rogers and Adams 1990]

Mechanical Design Technology (Free-form Surface)

April 28, 2004

5/12

■Bezier surface● Extension of a Bezier curve to the surface● Definition■ Defining polygon net points: Bi,j = [xi,j yi,j zi,j] (i, j = 0, 1 ,2, … , n)
■ Surface parameters: u, w (0≦u≦1, 0≦w≦1)■ Bezier/Bernstein basis functions (blending functions): Jn,i (u), Km,j (w)■ A point on the Bezier surface: P(u, w)=[x(u, w) y(u, w) z(u, w)]
nm

P (u , w) = ∑∑ Bi , j J n,i (u )K m, j ( w)

0 ≤ u ≤1 0 ≤ w ≤1i =0 j =0

Bi , j = [xi , jyi , jzi , j ]⎛n⎞
J n,i (u ) = ⎜⎜ ⎟⎟ u i (1 − u ) n −i⎝i⎠⎛m⎞
K m, j ( w) = ⎜⎜ ⎟⎟ w j (1 − w) m − j⎝ j⎠● Example: Bicubic Bezier surface (n=m=3)⎡ B0,0⎢B
1, 0
P (u , w) = [J 3,0 (u ) J 3,1 (u ) J 3, 2 (u ) J 3,3 (u )]⎢⎢ B2,0⎢⎣ B3,0Mechanical Design Technology (Free-form Surface)

B0,1B1,1B2,1B3,1B0, 2B1, 2B2, 2
B3, 2B0,3 ⎤ ⎡ K 3,0 ( w)⎤
B1,3 ⎥ ⎢ K 3,1 ( w) ⎥⎥⎢⎥B2,3 ⎥ ⎢ K 3, 2 ( w)⎥⎥⎢⎥
B3,3 ⎦ ⎣ K 3,3 ( w) ⎦April 28, 2004

6/12

[= (1 − u )3 3(1 − u ) 2 u 3(1 − u )u 2

⎡ (1 − w)3 ⎤⎢2 ⎥⎢3(1 − w) w⎥
u 3 Bi, j ⎢2⎥3(1)ww−⎥⎢
3⎥⎦⎢⎣w][ ]● Some properties of the Bezier surface■ The surface generally follows the shape of the defining polygon net■ Only the corner points of the defining polygon net and the surface are coincident■ The degree of the surface in each parametric direction is one less than the numberof defining polygon net points in that direction■ The surface is invariant under an affine transformation

Mechanical Design Technology (Free-form Surface)

April 28, 2004

7/12

[Rogers and Adams 1990]
Mechanical Design Technology (Free-form Surface)

April 28, 2004

8/12

[Rogers and Adams 1990]
Mechanical Design Technology (Free-form Surface)

April 28, 2004

9/12

[Rogers and Adams 1990]

Mechanical Design Technology (Free-form Surface)

April 28, 2004

10/12

■Three dimensional transformation●Ordinary coordinates: [x y z]
●Homogeneous coordinates: [x y z 1]
●4×4 Transformation matrix: [T][ x' y ' z ' 1] = [ x y z 1] [T ]●Composition of transformations■ Matrix multiplication[ x' y ' z ' 1] = [ x y z 1] [T1 ][T2 ]Λ [Tn ]●Scaling⎡ S x 0 0 0⎤
⎢0 S0 0⎥y⎥
[T ] = ⎢⎢ 0 0 S z 0⎥⎥⎢
⎣ 0 0 0 1⎦
●Rotation (about x axis)0⎡1⎢0 cos θ[T ] = ⎢⎢0 − sin θ⎢
0⎣00
sin θcos θ0●Rotation (about y axis)⎡cos θ
⎢ 0[T ] = ⎢⎢ sin θ⎢⎣ 00 − sin θ1000
cos θ00⎤0⎥
⎥0⎥
⎥
1⎦

●Rotation (about z axis)⎡ cos θ⎢− sin θ[T ] = ⎢⎢ 0⎢⎣ 0sin θ0 0⎤
0 0⎥
⎥
1 0⎥
⎥0 1⎦

cos θ00●Translation0⎤
0⎥
⎥
0⎥
⎥
1⎦

Mechanical Design Technology (Free-form Surface)⎡1⎢0[T ] = ⎢⎢0⎢⎣Tx010Ty

001Tz

0⎤0⎥⎥0⎥⎥1⎦■Reference● Rogers, D.F. and Adams, J.A., Mathematical

Elements for Computer Graphics, 2nd ed.,
McGraw-Hill, 1990.
April 28, 2004

11/12

■Implementation Hint
public class bicubic_bezier_surface{
private double basis_function(int i, double t){}
private vector3d surface_point(point_lattice polygon_net, double u, double w){/* Loop for i and j */polygon_net.get_point(i, j);basis_function(i, u);basis_function(j, w);}
public void draw(Graphics2D g2, point_lattice polygon_net, double[][] matrix){/* Loop for u and w */surface_point(polygon_net, u, w).transform(matrix);}}

Mechanical Design Technology (Free-form Surface)

April 28, 2004

12/12