Download presentation
Presentation is loading. Please wait.
1
Meshes Generated by Functions
Lecture 25 Fri, Oct 26, 2007
2
Surfaces Defined Explicitly
Let y = f(x, z) be a function of two variables. The function gives the height of the surface over the point (x, 0, z). For every point (x, z) in the plane, the function produces a y-coordinate, giving a point (x, y, z) in space.
3
Example: A plane Let y = 4 – x – z. y (0, 0, 4) (0, 4, 0) x (4, 0, 0)
(4, 4, -4)
4
Example: A hemisphere y = (1 – x2 – z2).
This equation produces the upper hemisphere of a sphere of radius 1.
5
Creating a Rectangular Mesh
It is clear that we can create a rectangular mesh for a surface represented explicitly as y = f(x, z) 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 z into c = z0, z1, …, zn = d.
6
Example: A Mesh y = 4 – x – z. m = n = 4. 4 z x y
7
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.
8
Tangent Planes Let u be the tangent vector parallel to the xy-plane.
It is constant in the z-direction. Its “slope,” or rate of change, is f/x in the x-direction. Therefore, its components are (1, f/x, 0). Similarly, if v is the tangent vector parallel to the yz-plane. Then v = (0, f/z , 1).
9
The Normal Vector Thus, a normal vector N is given by N = v u.
Specifically, the normal N is N = (-f/x, 1, -f/z). Normalize this to the unit vector n = N/|N|.
10
Example: The Plane Let y = 4 – x – z. Then f/x = –1 and f/z = –1.
Therefore, n = (1/3, 1/3, 1/3).
11
Example: A Hemisphere Let y = (1 – x2 – z2). Then Therefore,
normalized.
12
Example: A Hemisphere However, the length of this vector is
|N| = 1/(1 – x2 – z2). Therefore, the normalized vector is n = (x, (1 – x2 – z2), z) = (x, y, z). (That is a characteristic of circles and spheres.)
13
A Problem In the last example, the function y = (1 – x2 – z2).
does not have a rectangular domain. It’s domain is the circle x2 + z2 = 1 and it’s interior.
14
A Problem Suppose we partition it into a 10 10 grid:
15
A Problem Then we can plot grid points only for those points that are within the circle. all 4 vertices within 3 vertices within
16
A Problem Read Run
17
A Problem For the remaining grid squares, we would have to figure out where the circle crossed them.
18
Another Problem Another problem is that the grid points are not uniformly spaced on the surface of the sphere. Where the slope of the surface is steeper, the points are more spread out.
19
Another Problem Adjacent points
20
Another Problem Adjacent points
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.