Mathematics for
3D Game Programming
and Computer Graphics
Third Edition
Eric Lengyel
Course Technology PTR
A part of Cengage Learning
Australia • Brazil • Japan • Korea • Mexico • Singapore • Spain • United Kingdom • United States
Mathematics for 3D Game Programming
and Computer Graphics, Third Edition
By Eric Lengyel
Publisher and General Manager,
Course Technology PTR:
Stacy L. Hiquet
Associate Director of Marketing:
Sarah Panella
Manager of Editorial Services:
Heather Talbot
Marketing Manager:
Jordan Castellani
Senior Acquisitions Editor:
Emi Smith
Cover Designer:
Mike Tanamachi
Proofreader:
Mike Beady
© 2012 Course Technology, a part of Cengage Learning.
ALL RIGHTS RESERVED. No part of this work covered by the copyright
herein may be reproduced, transmitted, stored, or used in any form or by
any means graphic, electronic, or mechanical, including but not limited to
photocopying, recording, scanning, digitizing, taping, Web distribution,
information networks, or information storage and retrieval systems, except
as permitted under Section 107 or 108 of the 1976 United States Copyright
Act, without the prior written permission of the publisher.
For product information and technology assistance, contact us at
Cengage Learning Customer & Sales Support, 1-800-354-9706
For permission to use material from this text or product,
submit all requests online at cengage.com/permissions
Further permissions questions can be emailed to
permissionrequest@cengage.com
All trademarks are the property of their respective owners.
All images © Cengage Learning unless otherwise noted.
Library of Congress Control Number: 2011924487
ISBN-13: 978-1-4354-5886-4
ISBN-10: 1-4354-5886-9
Course Technology, a part of Cengage Learning
20 Channel Center Street
Boston, MA 02210
USA
Cengage Learning is a leading provider of customized learning solutions
with office locations around the globe, including Singapore, the United
Kingdom, Australia, Mexico, Brazil, and Japan. Locate your local office at:
international.cengage.com/region
Cengage Learning products are represented in Canada by Nelson
Education, Ltd.
For your lifelong learning solutions, visit courseptr.com
Visit our corporate website at cengage.com
Printed in China
1 2 3 4 5 6 7 13 12 11
eISBN-10: 1-4354-5887-7
iii
Contents
Preface xiii
What’s New in the Third Edition xiii
Contents Overview xiv
Website and Code Listings xvii
Notational Conventions xvii
Chapter 1 The Rendering Pipeline 1
1.1 Graphics Processors 1
1.2 Vertex Transformation 4
1.3 Rasterization and Fragment Operations 6
Chapter 2 Vectors 11
2.1 Vector Properties 11
2.2 The Dot Product 15
2.3 The Cross Product 19
2.4 Vector Spaces 26
Chapter 2 Summary 29
Exercises for Chapter 2 30
Chapter 3 Matrices 31
3.1 Matrix Properties 31
3.2 Linear Systems 34
3.3 Matrix Inverses 40
3.4 Determinants 47
3.5 Eigenvalues and Eigenvectors 54
3.6 Diagonalization 58
iv Contents
Chapter 3 Summary 62
Exercises for Chapter 3 64
Chapter 4 Transforms 67
4.1 Linear Transformations 67
4.1.1 Orthogonal Matrices 68
4.1.2 Handedness 70
4.2 Scaling Transforms 70
4.3 Rotation Transforms 71
4.3.1 Rotation About an Arbitrary Axis 74
4.4 Homogeneous Coordinates 75
4.4.1 Four-Dimensional Transforms 76
4.4.2 Points and Directions 77
4.4.3 Geometrical Interpretation of the w Coordinate 78
4.5 Transforming Normal Vectors 78
4.6 Quaternions 80
4.6.1 Quaternion Mathematics 80
4.6.2 Rotations with Quaternions 82
4.6.3 Spherical Linear Interpolation 86
Chapter 4 Summary 89
Exercises for Chapter 4 91
Chapter 5 Geometry for 3D Engines 93
5.1 Lines in 3D Space 93
5.1.1 Distance Between a Point and a Line 93
5.1.2 Distance Between Two Lines 94
5.2 Planes in 3D Space 97
5.2.1 Intersection of a Line and a Plane 98
5.2.2 Intersection of Three Planes 99
5.2.3 Transforming Planes 101
5.3 The View Frustum 102
5.3.1 Field of View 103
5.3.2 Frustum Planes 106
5.4 Perspective-Correct Interpolation 107
5.4.1 Depth Interpolation 108
5.4.2 Vertex Attribute Interpolation 110
5.5 Projections 111
5.5.1 Perspective Projections 112
5.5.2 Orthographic Projections 116
- 1
- 2
- 3
- 4
- 5
前往页