H.Calculating Normal Vectors



Similar documents
Section 12.6: Directional Derivatives and the Gradient Vector

Curves and Surfaces. Goals. How do we draw surfaces? How do we specify a surface? How do we approximate a surface?

Computer Graphics CS 543 Lecture 12 (Part 1) Curves. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Math 241, Exam 1 Information.

We can display an object on a monitor screen in three different computer-model forms: Wireframe model Surface Model Solid model

1 3 4 = 8i + 20j 13k. x + w. y + w

MA 323 Geometric Modelling Course Notes: Day 02 Model Construction Problem

( 1) = 9 = 3 We would like to make the length 6. The only vectors in the same direction as v are those

CHAPTER FIVE. 5. Equations of Lines in R 3

10.5. Click here for answers. Click here for solutions. EQUATIONS OF LINES AND PLANES. 3x 4y 6z 9 4, 2, 5. x y z. z 2. x 2. y 1.

Figure 2.1: Center of mass of four points.

A QUICK GUIDE TO THE FORMULAS OF MULTIVARIABLE CALCULUS

DERIVATIVES AS MATRICES; CHAIN RULE

SOLUTIONS. f x = 6x 2 6xy 24x, f y = 3x 2 6y. To find the critical points, we solve

Angles that are between parallel lines, but on opposite sides of a transversal.

Surface Normals and Tangent Planes

3D shapes. Level A. 1. Which of the following is a 3-D shape? A) Cylinder B) Octagon C) Kite. 2. What is another name for 3-D shapes?

Solutions to old Exam 1 problems

(a) We have x = 3 + 2t, y = 2 t, z = 6 so solving for t we get the symmetric equations. x 3 2. = 2 y, z = 6. t 2 2t + 1 = 0,

Grade 7 & 8 Math Circles Circles, Circles, Circles March 19/20, 2013

Adding vectors We can do arithmetic with vectors. We ll start with vector addition and related operations. Suppose you have two vectors

Angle - a figure formed by two rays or two line segments with a common endpoint called the vertex of the angle; angles are measured in degrees

Parametric Curves. (Com S 477/577 Notes) Yan-Bin Jia. Oct 8, 2015

Bicycle Math. presented to the Olivetti Club. Timothy E. Goldberg. March 30, Cornell University Ithaca, New York

Computer Graphics. Geometric Modeling. Page 1. Copyright Gotsman, Elber, Barequet, Karni, Sheffer Computer Science - Technion. An Example.

cos Newington College HSC Mathematics Ext 1 Trial Examination 2011 QUESTION ONE (12 Marks) (b) Find the exact value of if

The Essentials of CAGD

L 2 : x = s + 1, y = s, z = 4s Suppose that C has coordinates (x, y, z). Then from the vector equality AC = BD, one has

Shape Dictionary YR to Y6

ABSTRACT. For example, circle orders are the containment orders of circles (actually disks) in the plane (see [8,9]).

Solutions for Review Problems

88 CHAPTER 2. VECTOR FUNCTIONS. . First, we need to compute T (s). a By definition, r (s) T (s) = 1 a sin s a. sin s a, cos s a

GeoGebra. 10 lessons. Gerrit Stols

Review Sheet for Test 1

Exam 1 Sample Question SOLUTIONS. y = 2x

CIRCLE COORDINATE GEOMETRY

Modeling Tools Objectives. Sweeps and Lofts. Loft Feature

2.2 Creaseness operator

Copyright 2011 Casa Software Ltd. Centre of Mass

If Σ is an oriented surface bounded by a curve C, then the orientation of Σ induces an orientation for C, based on the Right-Hand-Rule.

Section 9.5: Equations of Lines and Planes

Name Class. Date Section. Test Form A Chapter 11. Chapter 11 Test Bank 155

Chapter 19. General Matrices. An n m matrix is an array. a 11 a 12 a 1m a 21 a 22 a 2m A = a n1 a n2 a nm. The matrix A has n row vectors

Geometric Patterns. Introduction. Geometric Patterns 1 ~ Border Patterns. Geometric Patterns 2 ~ Tile Patterns

Basic controls of Rhinoceros 3D software

Lecture 6. Weight. Tension. Normal Force. Static Friction. Cutnell+Johnson: , second half of section 4.7

Circle Name: Radius: Diameter: Chord: Secant:

EdExcel Decision Mathematics 1

Solving Simultaneous Equations and Matrices

Investigating Area Under a Curve

Lecture 14: Section 3.3

Determine whether the following lines intersect, are parallel, or skew. L 1 : x = 6t y = 1 + 9t z = 3t. x = 1 + 2s y = 4 3s z = s

Algebra I Vocabulary Cards

Mathematics on the Soccer Field

Geometric Modelling & Curves

BALTIC OLYMPIAD IN INFORMATICS Stockholm, April 18-22, 2009 Page 1 of?? ENG rectangle. Rectangle

1. Briefly explain what an indifference curve is and how it can be graphically derived.

13.4 THE CROSS PRODUCT

Slope and Rate of Change

4.2. LINE INTEGRALS ; z = t. ; y = sin

Pro/ENGINEER Wildfire 5.0 Introduction to Surface Modeling

Map Patterns and Finding the Strike and Dip from a Mapped Outcrop of a Planar Surface

Geometry Review Flash Cards

Quickstart for Desktop Version

SOLUTIONS TO HOMEWORK ASSIGNMENT #4, MATH 253

Copyrighted Material. Chapter 1 DEGREE OF A CURVE

Fundamental Theorems of Vector Calculus

Classroom Tips and Techniques: The Student Precalculus Package - Commands and Tutors. Content of the Precalculus Subpackage

Biggar High School Mathematics Department. National 5 Learning Intentions & Success Criteria: Assessing My Progress

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

Geometry Chapter Point (pt) 1.1 Coplanar (1.1) 1.1 Space (1.1) 1.2 Line Segment (seg) 1.2 Measure of a Segment

Math 241 Lines and Planes (Solutions) x = 3 3t. z = 1 t. x = 5 + t. z = 7 + 3t

MATHS LEVEL DESCRIPTORS

MATHEMATICS: PAPER I. 5. You may use an approved non-programmable and non-graphical calculator, unless otherwise stated.

CSU Fresno Problem Solving Session. Geometry, 17 March 2012

2.2 Derivative as a Function

Practice Final Math 122 Spring 12 Instructor: Jeff Lang

Number Sense and Operations

Edge detection. (Trucco, Chapt 4 AND Jain et al., Chapt 5) -Edges are significant local changes of intensity in an image.

The Fourth International DERIVE-TI92/89 Conference Liverpool, U.K., July Derive 5: The Easiest... Just Got Better!

This makes sense. t /t 2 dt = 1. t t 2 + 1dt = 2 du = 1 3 u3/2 u=5

Section 13.5 Equations of Lines and Planes

Algebra Academic Content Standards Grade Eight and Grade Nine Ohio. Grade Eight. Number, Number Sense and Operations Standard

Duplicating Segments and Angles

Average rate of change of y = f(x) with respect to x as x changes from a to a + h:

MATH STUDENT BOOK. 8th Grade Unit 6

Introduction to Algebraic Geometry. Bézout s Theorem and Inflection Points

Don't Forget the Differential Equations: Finishing 2005 BC4

Creating Smart Models From Scan Data

Geometer s Sketchpad. Discovering the incenter of a triangle

SAT Subject Test Practice Test II: Math Level II Time 60 minutes, 50 Questions

Polynomial and Rational Functions

CSE 167: Lecture 13: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Activity Set 4. Trainer Guide

OD1641 PRINCIPLES OF DRAFTING AND SHOP DRAWINGS

FURTHER VECTORS (MEI)

With the Tan function, you can calculate the angle of a triangle with one corner of 90 degrees, when the smallest sides of the triangle are given:

Specular reflection. Dielectrics and Distribution in Ray Tracing. Snell s Law. Ray tracing dielectrics

A vector is a directed line segment used to represent a vector quantity.

2006 Geometry Form A Page 1

Transcription:

Appendix H H.Calculating Normal Vectors This appendix describes how to calculate normal vectors for surfaces. You need to define normals to use the OpenGL lighting facility, which is described in Chapter 5. Normal Vectors in Chapter 2 introduces normals and the OpenGL command for specifying them. This appendix goes through the details of calculating them. It has the following major sections: Finding Normals for Analytic Surfaces Finding Normals from Polygonal Data 1

Since normals are perpendicular to a surface, you can find the normal at a particular point on a surface by first finding the flat plane that just touches the surface at that point. The normal is the vector that s perpendicular to that plane. On a perfect sphere, for example, the normal at a point on the surface is in the same direction as the vector from the center of the sphere to that point. For other types of surfaces, there are other, better means of determining the normals, depending on how the surface is specified. Recall that smooth curved surfaces are approximated by large numbers of small flat polygons. If the vectors perpendicular to these polygons are used as the surface normals in such an approximation, the surface appears faceted, since the normal direction is discontinuous across the polygonal boundaries. In many cases, however, an exact mathematical description exists for the surface, and true surface normals can be calculated at every point. Using the true normals improves the rendering considerably, as shown in Figure H-1. Even if you don t have a mathematical description, you can do better than the faceted look shown in the figure. The two major sections in this appendix describe how to calculate normal vectors for these two cases: Finding Normals for Analytic Surfaces explains what to do when you have a mathematical description of a surface. Finding Normals from Polygonal Data covers the case in which you have only the polygonal data to describe a surface. Figure H-1 Rendering with Polygonal Normals versus True Normals 2 Appendix H: Calculating Normal Vectors

Finding Normals for Analytic Surfaces An analytic surface is a smooth, differentiable surface that is described by a mathematical equation (or set of equations). In many cases, the easiest surfaces to find normals for are analytic surfaces for which you have an explicit definition in the following form: V(s, t) = [ X(s, t) Y(s, t) Z(s, t) ] where s and t are constrained to be in some domain, and X, Y, and Z are differentiable functions of two variables. To calculate the normal, find which are vectors tangent to the surface in the s- and t-directions. The cross product is perpendicular to both and, hence, to the surface. The following shows how to calculate the cross product of two vectors. (Watch out for the degenerate cases where the cross product has zero length.) [ v x v y v z ] x [ w x w y w z ] = [(v y w z w y v z ) (w x v z v x w z ) (v x w y w x v y )] You should probably normalize the resulting vector. To normalize a vector [x y z], calculate its length Length = x 2 + y 2 + z 2 and divide each component of the vector by the length. As an example of these calculations, consider the analytic surface V(s, t) = [ s 2 t 3 3 st ] From this we have Finding Normals for Analytic Surfaces 3

For example, when s = 1 and t = 2, the corresponding point on the surface is (1, 8, 1), and the vector ( 24, 2, 24) is perpendicular to the surface at that point. The length of this vector is 34, so the unit normal vector is ( 24/34, 2/34, 24/34) = ( 0.70588, 0.058823, 0.70588). For analytic surfaces that are described implicitly, as F(x, y, z) = 0, the problem is harder. In some cases, you can solve for one of the variables, say z = G(x, y), and put it in the explicit form given previously: V(s, t) = [ s t G(s, t) ] Then continue as described earlier. If you can t get the surface equation in an explicit form, you might be able to make use of the fact that the normal vector is given by the gradient evaluated at a particular point (x, y, z). Calculating the gradient might be easy, but finding a point that lies on the surface can be difficult. As an example of an implicitly defined analytic function, consider the equation of a sphere of radius 1 centered at the origin: x 2 + y 2 + z 2 1 = 0 This means that F(x, y, z) = x 2 + y 2 + z 2 1 which can be solved for z to yield z = + 1 x 2 y 2 Thus, normals can be calculated from the explicit form V(s, t) = [ s t 1 s 2 t 2 ] as described previously. 4 Appendix H: Calculating Normal Vectors

If you could not solve for z, you could have used the gradient F = 2x 2y 2z as long as you could find a point on the surface. In this case, it s not so hard to find a point for example, (2/3, 1/3, 2/3) lies on the surface. Using the gradient, the normal at this point is (4/3, 2/3, 4/3). The unit-length normal is (2/3, 1/3, 2/3), which is the same as the point on the surface, as expected. Finding Normals from Polygonal Data As mentioned previously, you often want to find normals for surfaces that are described with polygonal data such that the surfaces appear smooth rather than faceted. In most cases, the easiest way to do this (although it might not be the most efficient way) is to calculate the normal vectors for each of the polygonal facets and then average the normals for neighboring facets. Use the averaged normal for the vertex that the neighboring facets have in common. Figure H-2 shows a surface and its polygonal approximation. (Of course, if the polygons represent the exact surface and aren t merely an approximation if you re drawing a cube or a cut diamond, for example don t do the averaging. Calculate the normal for each facet as described in the following paragraphs, and use that same normal for each vertex of the facet.) To find the normal for a flat polygon, take any three vertices v 1, v 2, and v 3 of the polygon that do not lie in a straight line. The cross product [v 1 v 2 ] [v 2 v 3 ] is perpendicular to the polygon. (Typically, you want to normalize the resulting vector.) Then you need to average the normals for adjoining facets to avoid giving too much weight to one of them. For instance, in the example shown in Figure H-2, if n 1, n 2, n 3, and n 4 are the normals for the four polygons meeting at point P, calculate n 1 + n 2 + n 3 + n 4 and then normalize it. (You can get a better average if you weight the normals by the size of the angles at the shared intersection.) The resulting vector can be used as the normal for point P. Finding Normals from Polygonal Data 5

n 1 P n 3 n2 Q n 4 R Figure H-2 Averaging Normal Vectors Sometimes, you need to vary this method for particular situations. For instance, at the boundary of a surface (such as point Q in Figure H-2), you might be able to choose a better normal based on your knowledge of how the surface should look. Sometimes the best you can do is average the polygon normals on the boundary as well. Similarly, some models have some smooth parts and some sharp corners (point R is on such an edge in Figure H-2). In this case, the normals on either side of the crease shouldn t be averaged. Instead, polygons on one side of the crease should be drawn with one normal, and polygons on the other side with another. 6 Appendix H: Calculating Normal Vectors