Download presentation
Presentation is loading. Please wait.
1
Creating Meshes Through Functions
Lecture 22 Fri, Oct 28, 2005
2
Surfaces Defined Explicitly
Let z = f(x, y) be a function of two variables. This function defines a surface over the xy-plane. For every point (x, y) in the plane, the function produces a z-coordinate, giving a point (x, y, z) in space.
3
Coordinate Systems For now we will use the traditional mathematical system. Later we can permute the variables. z y x y x z
4
Example: A plane Let z = 4 – x – y. z (0, 0, 4) (0, 4, 0) y (4, 0, 0)
(4, 4, -4)
5
Example: A hemisphere z = (1 – x2 – y2).
This equation produces the upper hemisphere of a sphere of radius 1.
6
Creating a Rectangular Mesh
It is clear that we can create a rectangular mesh for a surface represented explicitly as z = f(x, y) over a rectangular region [a, b] [c, d]. Simply subdivide the range [a, b] of values of x into a = x0, x1, …, xm = b. Similarly, subdivide the range [c, d] of values of y into c = y0, y1, …, yn = d.
7
Example: A Mesh z = 4 – x – y. m = n = 4. 4 x y z
8
Normals In order for the lighting effects to be computed properly, we must also create a unit normal vector at each grid point. This normal should be perpendicular to the tangent plane. To compute it, we take the cross product of two vectors lying in the tangent plane.
9
Tangent Planes Let u be the tangent vector parallel to the xz-plane.
It is constant in the y-direction. Its “slope,” or rate of change, is f/x in the x-direction. Therefore, its components are (1, 0, f/x). Similarly, if v is the tangent vector parallel to the yz-plane. Then v = (0, 1, f/y).
10
The Normal Vector Thus, a normal vector N is given by N = u v.
Specifically, the normal N is N = (-f/x, -f/y, 1). Normalize this to the unit vector n = N/|N|.
11
Example: The Plane Let z = 4 – x – y. Then f/x = -1 and f/y = -1.
Therefore, n = (1/3, 1/3, 1/3).
12
Example: A Hemisphere Let z = (1 – x2 – y2). Then Therefore,
normalized.
13
Example: A Hemisphere However, the length of this vector is
|N| = 1/(1 – x2 – y2). Therefore, the normalized vector is N = (x, y, (1 – x2 – y2)) = (x, y, z).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.