logo资料库

Geometric Tools for Computer Graphics.pdf

第1页 / 共1043页
第2页 / 共1043页
第3页 / 共1043页
第4页 / 共1043页
第5页 / 共1043页
第6页 / 共1043页
第7页 / 共1043页
第8页 / 共1043页
资料共1043页,剩余部分请下载后查看
1 Introduction
How to Use This Book
Issues of Numerical Computation
Low-Level Issues
High-Level Issues
A Summary of the Chapters
2 Matrices and Linear Systems
Introduction
Motivation
Organization
Notational Conventions
Tuples
Definition 15
Arithmetic Operations
Matrices
Notation and Terminology
Transposition
Arithmetic Operations
Matrix Multiplication
Linear Systems
Linear Equations
Linear Systems in Two Unknowns
General Linear Systems
Row Reductions, Echelon Form, and Rank
Square Matrices 32
Diagonal Matrices
Triangular Matrices
The Determinant
Inverse
Linear Spaces
Fields
Definition and Properties
Subspaces
Linear Combinations and Span
Linear Independence, Dimension, and Basis
Linear Mappings
Mappings in General
Linear Mappings
Matrix Representation of Linear Mappings
Cramer’s Rule 50
Eigenvalues and Eigenvectors
Euclidean Space
Inner Product Spaces
Orthogonality and Orthonormal Sets
Least Squares 56
Recommended Reading
3 Vector Algebra
Vector Basics
Vector Equivalence
Vector Addition
Vector Subtraction
Vector Scaling
Properties of Vector Addition and Scalar Multiplication
Vector Space
Span
Linear Independence
Basis, Subspaces, and Dimension
Orientation
Change of Basis
Linear Transformations 76
Affine Spaces
Euclidean Geometry
Volume, the Determinant, and the Scalar Triple Product
Frames
Affine Transformations 98
Types of Affine Maps
Composition of Affine Maps
Barycentric Coordinates and Simplexes
Barycentric Coordinates and Subspaces
Affine Independence
4 Matrices, Vector Algebra, and Transformations
Introduction
Matrix Representation of Points and Vectors
Addition, Subtraction, and Multiplication
Vector Addition and Subtraction
Point and Vector Addition and Subtraction
Subtraction of Points
Scalar Multiplication 115
Products of Vectors
Dot Product 116
Cross Product
Tensor Product
The ’Perp’ Operator and the ˇPerpÓ Dot Product
Matrix Representation of Affine Transformations
Change-of-Basis/Frame/Coordinate System
Vector Geometry of Affine Transformations
Notation
Translation
Rotation
Scaling
Reflection
Shearing
Projections
Orthographic
Oblique
Perspective
Transforming Normal Vectors
Recommended Reading
5 Geometric Primitives in 2D 171
Linear Components
Implicit Form
Parametric Form
Converting between Representations
Triangles
Rectangles
Polylines and Polygons
Quadratic Curves
Circles
Ellipses
Polynomial Curves
Bezier Curves
B-Spline Curves
NURBS Curves
6 Distance in 2D 189
Point to Linear Component
Point to Line
Point to Ray
Point to Segment
Point to Polyline
Point to Polygon 196
Point to Triangle
Point to Rectangle
Point to Orthogonal Frustum
Point to Convex Polygon
Point to Quadratic Curve
Point to Polynomial Curve
Linear Components
Line to Line
Line to Ray
Line to Segment
Ray to Ray
Ray to Segment
Segment to Segment
Linear Component to Polyline or Polygon
Linear Component to Quadratic Curve
Linear Component to Polynomial Curve
GJK Algorithm 233
Set Operations 234
Overview of the Algorithm
Alternatives to GJK
7 Intersection in 2D
Linear Components
Linear Components and Polylines
Linear Components and Quadratic Curves
Linear Components and General Quadratic Curves
Linear Components and Circular Components
Linear Components and Polynomial Curves
Algebraic Method 248
Polyline Approximation
Hierarchical Bounding
Monotone Decomposition
Rasterization
Quadratic Curves
General Quadratic Curves
Circular Components
Ellipses
Polynomial Curves
Algebraic Method 262
Polyline Approximation
Hierarchical Bounding
Rasterization
The Method of Separating Axes
Separation by Projection onto a Line
Separation of Stationary Convex Polygons
Separation of Moving Convex Polygons
Intersection Set for Stationary Convex Polygons
Contact Set for Moving Convex Polygons
8 Miscellaneous 2D Problems
Circle through Three Points
Circle Tangent to Three Lines
Line Tangent to a Circle at a Given Point
Line Tangent to a Circle through a Given Point
Lines Tangent to Two Circles
Circle through Two Points with a Given Radius 297
Circle through a Point and Tangent to a Line with a Given
Radius 298
Circles Tangent to Two Lines with a Given Radius
Circles through a Point and Tangent to a Circle with a
Given Radius
Circles Tangent to a Line and a Circle with a Given Radius 309
Circles Tangent to Two Circles with a Given Radius
Line Perpendicular to a Given Line through a Given Point
Line between and Equidistant to Two Points
Line Parallel to a Given Line at a Given Distance
Line Parallel to a Given Line at a Given Vertical (
Horizontal) Distance
Lines Tangent to a Given Circle and Normal to a Given
Line
9 Geometric Primitives in 3D 325
Linear Components
Planar Components
Planes
Coordinate System Relative to a Plane
2D Objects in a Plane
Polymeshes, Polyhedra, and Polytopes
Vertex-Edge-Face Tables 337
Connected Meshes
Manifold Meshes
Closed Meshes
Consistent Ordering 343
Platonic Solids
Quadric Surfaces
Three Nonzero Eigenvalues
Two Nonzero Eigenvalues 352
One Nonzero Eigenvalue
Torus 355
Polynomial Curves
Bezier Curves
B-Spline Curves
NURBS Curves
Polynomial Surfaces
Bezier Surfaces
B-Spline Surfaces
NURBS Surfaces
10 Distance in 3D 365
Introduction
Point to Linear Component
Point to Ray or Line Segment 367
Point to Polyline
Point to Planar Component
Point to Plane
Point to Triangle
Point to Rectangle
Point to Polygon
Point to Circle or Disk
Point to Polyhedron
General Problem
Point to Oriented Bounding Box
Point to Orthogonal Frustum
Point to Quadric Surface 401
Point to General Quadric Surface
Point to Ellipsoid
Point to Polynomial Curve
Point to Polynomial Surface 407
Linear Components
Lines and Lines
Segment/Segment, Line/Ray, Line/Segment, Ray/ Ray, Ray/
Segment
Segment to Segment, Alternative Approach
Linear Component to Triangle, Rectangle, Tetrahedron,
Oriented Box
Linear Component to Triangle
Linear Component to Rectangle
Linear Component to Tetrahedron
Linear Component to Oriented Bounding Box
Line to Quadric Surface
Line to Polynomial Surface
GJK Algorithm 468
Miscellaneous
Distance between Line and Planar Curve
Distance between Line and Planar Solid Object
Distance between Planar Curves
Geodesic Distance on Surfaces
11 Intersection in 3D
Linear Components and Planar Components 481
Linear Components and Planes
Linear Components and Triangles
Linear Components and Polygons
Linear Component and Disk
Linear Components and Polyhedra
Linear Components and Quadric Surfaces
General Quadric Surfaces
Linear Components and a Sphere
Linear Components and an Ellipsoid
Linear Components and Cylinders
Linear Components and a Cone 512
Linear Components and Polynomial Surfaces 519
Algebraic Surfaces
Free-Form Surfaces
Planar Components
Two Planes
Three Planes
Triangle and Plane
Triangle and Triangle
Planar Components and Polyhedra
Trimeshes
General Polyhedra
Planar Components and Quadric Surfaces
Plane and General Quadric Surface
Plane and Sphere
Plane and Cylinder
Plane and Cone
Triangle and Cone
Planar Components and Polynomial Surfaces
Hermite Curves
Geometry Definitions
Computing the Curves
The Algorithm
Implementation Notes
Quadric Surfaces
General Intersection
Ellipsoids
Polynomial Surfaces
Subdivision Methods
Lattice Evaluation
Analytic Methods
Marching Methods
The Method of Separating Axes
Separation of Stationary Convex Polyhedra 611
Separation of Moving Convex Polyhedra
Intersection Set for Stationary Convex Polyhedra
Contact Set for Moving Convex Polyhedra
Miscellaneous
Oriented Bounding Box and Orthogonal Frustum
Linear Component and Axis-Aligned Bounding Box
Linear Component and Oriented Bounding Box
Plane and Axis-Aligned Bounding Box
Plane and Oriented Bounding Box
Axis-Aligned Bounding Boxes
Oriented Bounding Boxes 639
Sphere and Axis-Aligned Bounding Box
Cylinders 646
Linear Component and Torus
12 Miscellaneous 3D Problems
Projection of a Point onto a Plane
Projection of a Vector onto a Plane
Angle between a Line and a Plane
Angle between Two Planes
Plane Normal to a Line and through a Given Point
Plane through Three Points
Angle between Two Lines 670
13 Computational Geometry Topics
Binary Space-Partitioning Trees in 2D 673
BSP Tree Representation of a Polygon
Minimum Splits versus Balanced Trees
Point in Polygon Using BSP Trees
Partitioning a Line Segment by a BSP Tree
Binary Space-Partitioning Trees in 3D 687
BSP Tree Representation of a Polyhedron
Minimum Splits versus Balanced Trees
Point in Polyhedron Using BSP Trees
Partitioning a Line Segment by a BSP Tree
Partitioning a Convex Polygon by a BSP Tree
Point in Polygon
Point in Triangle
Point in Convex Polygon
Point in General Polygon
Faster Point in General Polygon 706
A Grid Method
Point in Polyhedron
Point in Tetrahedron
Point in Convex Polyhedron
Point in General Polyhedron
Boolean Operations on Polygons
The Abstract Operations
The Two Primitive Operations
Boolean Operations Using BSP Trees
Other Algorithms
Boolean Operations on Polyhedra
Abstract Operations
Boolean Operations Using BSP Trees
Convex Hulls 729
Convex Hulls in 2D
Convex Hulls in 3D
Convex Hulls in Higher Dimensions
Delaunay Triangulation
Incremental Construction in 2D
Incremental Construction in General Dimensions
Construction by Convex Hull
Polygon Partitioning
Visibility Graph of a Simple Polygon
Triangulation
Triangulation by Horizontal Decomposition
Convex Partitioning
Circumscribed and Inscribed Balls
Circumscribed Ball
Inscribed Ball
Minimum Bounds for Point Sets
Minimum-Area Rectangle
Minimum-Volume Box
Minimum-Area Circle
Minimum-Volume Sphere
Miscellaneous
Area and Volume Measurements
Area of a 2D Polygon
Area of a 3D Polygon
Volume of a Polyhedron
Appendix A Numerical Methods
Solving Linear Systems
A.1.1 Special Case: Solving a Triangular System
A.1.2 Gaussian Elimination
Systems of Polynomials 832
A.2.1 Linear Equations in One Formal Variable
A.2.2 Any-Degree Equations in One Formal Variable
A.2.3 Any-Degree Equations in Any Formal Variables
Matrix Decompositions
A.3.1 Euler Angle Factorization
A.3.2 QR Decomposition
A.3.3 Eigendecomposition
A.3.4 Polar Decomposition
A.3.5 Singular Value Decomposition
Representations of 3D Rotations
A.4.1 Matrix Representation
A.4.2 Axis-Angle Representation
A.4.3 Quaternion Representation
A.4.4 Performance Issues
Root Finding
A.5.1 Methods in One Dimension
A.5.2 Methods in Many Dimensions
A.5.3 Stable Solution to Quadratic Equations
Minimization
A.6.1 Methods in One Dimension
A.6.2 Methods in Many Dimensions
A.6.3 Minimizing a Quadratic Form
A.6.4 Minimizing a Restricted Quadratic Form
Least Squares Fitting
A.7.1 Linear Fitting of Points
A.7.2 Linear Fitting of Points Using Orthogonal Regression
A.7.3 Planar Fitting of Points
A.7.4 Hyperplanar Fitting of Points Using Orthogonal Regression
A.7.5 Fitting a Circle to 2D Points
A.7.6 Fitting a Sphere to 3D Points
A.7.7 Fitting a Quadratic Curve to 2D Points
A.7.8 Fitting a Quadric Surface to 3D Points
Subdivision of Curves
A.8.1 Subdivision by Uniform Sampling
A.8.2 Subdivision by Arc Length 890
A.8.3 Subdivision by Midpoint Distance
A.8.4 Subdivision by Variation
Topics from Calculus
A.9.1 Level Sets
A.9.2 Minima and Maxima of Functions
A.9.3 Lagrange Multipliers
Appendix B Trigonometry
Introduction
B.1.1 Terminology
B.1.2 Angles
B.1.3 Conversion Examples
Trigonometric Functions
B.2.1 Definitions in Terms of Exponentials
B.2.2 Domains and Ranges
B.2.3 Graphs of Trigonometric Functions
B.2.4 Derivatives of Trigonometric Functions
B.2.5 Integration
Trigonometric Identities and Laws
B.3.1 Periodicity
B.3.2 Laws
B.3.3 Formulas
Inverse Trigonometric Functions
B.4.1 Defining arcsin and arccos in Terms of arctan
B.4.2 Domains and Ranges
B.4.3 Graphs
B.4.4 Derivatives
B.4.5 Integration
Further Reading
Appendix C Basic Formulas for Geometric Primitives
Introduction
Triangles
C.2.1 Symbols
C.2.2 Definitions
C.2.3 Right Triangles
C.2.4 Equilateral Triangle
C.2.5 General Triangle
Quadrilaterals
C.3.1 Square
C.3.2 Rectangle
C.3.3 Parallelogram
C.3.4 Rhombus
C.3.5 Trapezoid
C.3.6 General Quadrilateral
Circles
C.4.1 Symbols
C.4.2 Full Circle
C.4.3 Sector of a Circle
C.4.4 Segment of a Circle
Polyhedra
C.5.1 Symbols
C.5.2 Box
C.5.3 Prism
C.5.4 Pyramid
Cylinder
Cone
Spheres
C.8.1 Segments
C.8.2 Sector
Torus 960
Geometric Tools for Computer Graphics
The Morgan Kaufmann Series in Computer Graphics and Geometric Modeling Series Editor: Brian A. Barsky, University of California, Berkeley Geometric Tools for Computer Graphics Philip Schneider and David Eberly Level of Detail for 3D Graphics David Luebke, Martin Reddy, Jonathan D. Cohen, Amitabh Varshney, Benjamin Watson, and Robert Huebner Texturing & Modeling: A Procedural Approach, Third Edition David S. Ebert, F. Kenton Musgrave, Darwyn Peachey, Ken Perlin, and Steven Worley Jim Blinn’s Corner: Notation, Notation, Notation Jim Blinn Understanding Virtual Reality William Sherman and Alan Craig Digital Video and HDTV Algorithms and Interfaces Charles Poynton Pyramid Algorithms: A Dynamic Programming Ap- proach to Curves and Surfaces for Geometric Modeling Ron Goldman Non-Photorealistic Computer Graphics: Modeling, Rendering, and Animation Thomas Strothotte and Stefan Schlechtweg Curves and Surfaces for CAGD: A Practical Guide, Fifth Edition Gerald Farin Subdivision Methods for Geometric Design: A Constructive Approach Joe Warren and Henrik Weimer Computer Animation: Algorithms and Techniques Rick Parent The Computer Animator’s Technical Handbook Lynn Pocock and Judson Rosebush Andrew Glassner’s Notebook: Recreational Computer Graphics Andrew S. Glassner Warping and Morphing of Graphical Objects Jonas Gomes, Lucia Darsa, Bruno Costa, and Luiz Velho Jim Blinn’s Corner: Dirty Pixels Jim Blinn Rendering with Radiance: The Art and Science of Lighting Visualization Greg Ward Larson and Rob Shakespeare Introduction to Implicit Surfaces Edited by Jules Bloomenthal Jim Blinn’s Corner: A Trip Down the Graphics Pipeline Jim Blinn Interactive Curves and Surfaces: A Multimedia Tutorial on CAGD Alyn Rockwood and Peter Chambers Wavelets for Computer Graphics: Theory and Applica- tions Eric J. Stollnitz, Tony D. DeRose, and David H. Salesin Principles of Digital Image Synthesis Andrew S. Glassner Radiosity & Global Illumination Fran¸cois X. Sillion and Claude Puech Knotty: A B-Spline Visualization Program Jonathan Yen User Interface Management Systems: Models and Algorithms Dan R. Olsen, Jr. Making Them Move: Mechanics, Control, and Animation of Articulated Figures Edited by Norman I. Badler, Brian A. Barsky, and David Zeltzer Advanced RenderMan: Creating CGI for Motion Pictures Anthony A. Apodaca and Larry Gritz Geometric and Solid Modeling: An Introduction Christoph M. Hoffmann Curves and Surfaces in Geometric Modeling: Theory and Algorithms Jean Gallier An Introduction to Splines for Use in Computer Graphics and Geometric Modeling Richard H. Bartels, John C. Beatty, and Brian A. Barsky
Geometric Tools for Computer Graphics Philip J. Schneider David H. Eberly
Publishing Director Diane Cerra Publishing Services Manager Edward Wade Senior Developmental Editor Belinda Breyer Project Management Elisabeth Beller Cover Design Ross Carron Design Cover Image Getty/Spencer Jones Text Design Rebecca Evans & Associates Composition Windfall Software, using ZzTEX Technical Illustration and Figure Revision Dartmouth Publishing, Inc. Copyeditor Ken DellaPenta Proofreader Indexer Printer The Maple-Vail Book Manufacturing Group Jennifer McClain Steve Rath Designations used by companies to distinguish their products are often claimed as trademarks or registered trademarks. In all instances in which Morgan Kaufmann Publishers is aware of a claim, the product names appear in initial capital or all capital letters. Readers, however, should contact the appropriate companies for more complete information regarding trademarks and registration. Morgan Kaufmann Publishers An imprint of Elsevier Science 340 Pine Street, Sixth Floor San Francisco, CA 94104-3205 www.mkp.com © 2003 by Elsevier Science (USA) All rights reserved Printed in the United States of America 07 06 05 04 03 5 4 3 2 1 No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means—electronic, mechanical, photocopying, recording, or otherwise— without the prior written permission of the publisher. Library of Congress Control Number: 2002107242 ISBN: 1-55860-594-0 This book is printed on acid-free paper.
To my wife, Suzanne, and my sons, Dakota and Jordan —PS To my wife, Shelly, for her patience through yet another book —DE
Foreword Eric Haines On my shelf is an old book called A Programmer’s Geometry, by Bowyer and Wood- wark. It was published in 1983, reprinted twice in 1984 and 1985, but then discontin- ued. Over the years I have guarded my copy, keeping careful track of who borrowed it. Checking on the Web today, I found six used copies ranging in price from $50 to $100. This is a high price range for a paperback book only 140 pages in length. The reason the book is worth this much is that it describes how to program various op- erations related to 2D geometry. It does not just present geometric formulae; it also describes efficient ways to accomplish tasks and gives code snippets (in FORTRAN). Now, almost two decades later, we have a worthy successor to that slim volume. The book before you distills a huge amount of literature on geometry into that which is most useful to programmers. The field of computer graphics has evolved consid- erably since 1983, and this volume reflects those advances. Due to the continuing improvement in computer processor performance, operations that once were only part of offline analysis packages are now commonly done in interactive programs. Polygon triangulation, collision detection and response, and surface modelling and modification are now possible at real-time rates. This book gives solid explanations and code to perform these and many other algorithms. Beyond providing a solid reference for a wide range of geometry-related tasks, this volume also presents the underpinnings of the theory behind the algorithms. Rather than employ a pure cookbook approach, which can leave the reader with runnable code and no comprehension of how it works, the authors explain key concepts. This approach makes each algorithm a tool that, further on, can be recombined with other tools. The dynamic nature of computer graphics makes it a particularly interesting area of study. Research and implementation of rendering methods respond to changes in the underlying hardware. For example, in the field of interactive rendering, the emerging programmable nature of the graphics accelerator has changed the relative costs of different techniques. On a broader scale, the evolution of the CPU has made memory access and caching rise in importance, compared to the older practice of minimizing the number of operations (e.g., counting multiplies and adds). However, the underlying theory and algorithms for, say, finding the convex hull of an object are considerably more long-lasting, less affected by changes. Of course, more efficient algorithms are found over time, and hardware influences which method currently is considered the fastest, but the basic principles remain the same. Years after you have vii
viii Foreword shed your books on DirectX 9 or Intel’s 64-bit Itanium architecture, you are likely to have some edition of this book on your shelf. Another reason this book will have increased staying power is the Internet. I am the archivist for the “Graphics Gems” series code repository. The code for this series of books, including code by Philip Schneider, was wisely made free for reuse when the series was published in the early 1990s. Over the years readers have sent in bug fixes and improvements to the code base, so benefiting all. Similarly, Dave Eberly has carefully maintained his “Magic Software” Web site (www.magic-software.com), which includes working versions of many of the algorithms presented in this volume. Called “a national treasure” by a leading researcher in computer graphics, this site allows addenda and corrigenda to be made available instantly whenever they are needed. Code does not rust; it improves with age when properly supported. This is particularly true for algorithms in this book as they are not tied to particular hardware, network protocols, or other transient objects. Over the years I and many others have used algorithms and code by the authors in products and research projects. An hour of a programmer’s time often costs more than the price of a book. By this measure, you hold a volume potentially worth thousands of dollars. That it can be purchased for a fraction of this cost I consider a modern miracle. The amount of information crammed into this book is incredible. The mathematics may be slow going at times, but the alternative would be to include wordier and less precise descriptions of fewer algorithms. If you are looking for a lightweight text you can read through and check off your list, keep searching. This book sometimes requires effort and struggle to fully comprehend but then, so do most of the worthwhile things in the world.
分享到:
收藏