Table Of ContentUndergraduate Topics in Computer Science
John Vince
Mathematics
for Computer
Graphics
Fifth Edition
Undergraduate Topics in Computer Science
Series editor
Ian Mackie
Advisory Board
Samson Abramsky, University of Oxford, Oxford, UK
Karin Breitman, Pontifical Catholic University of Rio de Janeiro, Rio de Janeiro,
Brazil
Chris Hankin, Imperial College London, London, UK
Dexter C. Kozen, Cornell University, Ithaca, USA
Andrew Pitts, University of Cambridge, Cambridge, UK
HanneRiisNielson,TechnicalUniversityofDenmark,KongensLyngby,Denmark
Steven S. Skiena, Stony Brook University, Stony Brook, USA
Iain Stewart, University of Durham, Durham, UK
Undergraduate Topics in Computer Science (UTiCS) delivers high-quality
instructional content for undergraduates studying in all areas of computing and
information science. From core foundational and theoretical material to final-year
topics and applications, UTiCS books take a fresh, concise, and modern approach
and are ideal for self-study or for a one- or two-semester course. The texts are all
authoredbyestablishedexpertsintheirfields,reviewedbyaninternationaladvisory
board, and contain numerous examples and problems. Many include fully worked
solutions.
More information about this series at http://www.springer.com/series/7592
John Vince
Mathematics for Computer
Graphics
Fifth Edition
123
JohnVince
Breinton
UK
ISSN 1863-7310 ISSN 2197-1781 (electronic)
Undergraduate Topics inComputer Science
ISBN978-1-4471-7334-2 ISBN978-1-4471-7336-6 (eBook)
DOI 10.1007/978-1-4471-7336-6
LibraryofCongressControlNumber:2017943836
©Springer-VerlagLondonLtd.2001,2006,2010,2014,2017
Thisworkissubjecttocopyright.AllrightsarereservedbythePublisher,whetherthewholeorpart
of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission
orinformationstorageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilar
methodologynowknownorhereafterdeveloped.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this
publicationdoesnotimply,evenintheabsenceofaspecificstatement,thatsuchnamesareexemptfrom
therelevantprotectivelawsandregulationsandthereforefreeforgeneraluse.
The publisher, the authors and the editors are safe to assume that the advice and information in this
book are believed to be true and accurate at the date of publication. Neither the publisher nor the
authorsortheeditorsgiveawarranty,expressorimplied,withrespecttothematerialcontainedhereinor
for any errors or omissions that may have been made. The publisher remains neutral with regard to
jurisdictionalclaimsinpublishedmapsandinstitutionalaffiliations.
Printedonacid-freepaper
ThisSpringerimprintispublishedbySpringerNature
TheregisteredcompanyisSpringer-VerlagLondonLtd.
Theregisteredcompanyaddressis:236Gray’sInnRoad,LondonWC1X8HB,UnitedKingdom
This book is dedicated to my best friend
and wife Heidi.
Preface
Thisbookoriginallyappeared aspartofSpringer’sexcellent‘Essential’seriesand
wasrevisedtoincludechaptersonanalyticalgeometry,barycentriccoordinates,and
worked examples. The third edition included a new chapter on geometric algebra,
whichIhavewrittenaboutinmybooksGeometricAlgebraforComputerGraphics
andGeometricAlgebra:AnAlgebraicSystemforComputerGamesandAnimation.
In the fourth edition, I reviewed the entire book and included chapters on differ-
ential and integral calculus, which I have written about in Calculus for Computer
Graphics. This fifth edition includes some revisions and new content published in
my recent book Foundation Mathematics for Computer Science. I have also
redrawnallthefiguresincolourusingApple’sPagesandGrapher,whichimprove
the book’s visual appearance.
Whilst writing this book, I have borne in mind what it was like for me when
I was studying different areas of mathematics for the first time. In spite of reading
and rereading an explanation several times, it could take days before ‘the penny
dropped’ and a concept became apparent. Hopefully, the reader will find the fol-
lowingexplanationsusefulindevelopingtheirunderstandingofthesespecificareas
of mathematics and enjoy the sound of various pennies dropping!
IwouldliketothankBeverleyFord,GeneralManager,SpringerUK,andHelen
Desmond,EditorforComputerScience,forpersuadingmetogiveupholidaysand
hobbies in order to complete this fifth edition!
Breinton, UK John Vince
vii
Contents
1 Introduction .... .... .... ..... .... .... .... .... .... ..... .. 1
1.1 Mathematics for Computer Graphics . .... .... .... ..... .. 1
1.2 Understanding Mathematics.... .... .... .... .... ..... .. 1
1.3 What Makes Mathematics Difficult?.. .... .... .... ..... .. 2
1.4 Does Mathematics Exist Outside Our Brains? .. .... ..... .. 2
1.5 Symbols and Notation .... .... .... .... .... .... ..... .. 3
2 Numbers ... .... .... .... ..... .... .... .... .... .... ..... .. 5
2.1 Introduction ... .... ..... .... .... .... .... .... ..... .. 5
2.2 Background ... .... ..... .... .... .... .... .... ..... .. 5
2.3 Counting . .... .... ..... .... .... .... .... .... ..... .. 5
2.4 Sets of Numbers.... ..... .... .... .... .... .... ..... .. 6
2.5 Zero. .... .... .... ..... .... .... .... .... .... ..... .. 7
2.6 Negative Numbers .. ..... .... .... .... .... .... ..... .. 8
2.6.1 The Arithmetic of Positive and Negative
Numbers.. ..... .... .... .... .... .... ..... .. 9
2.7 Observations and Axioms.. .... .... .... .... .... ..... .. 10
2.7.1 Commutative Law.... .... .... .... .... ..... .. 10
2.7.2 Associative Law . .... .... .... .... .... ..... .. 10
2.7.3 Distributive Law. .... .... .... .... .... ..... .. 11
2.8 The Base of a Number System.. .... .... .... .... ..... .. 11
2.8.1 Background..... .... .... .... .... .... ..... .. 11
2.8.2 Octal Numbers .. .... .... .... .... .... ..... .. 12
2.8.3 Binary Numbers . .... .... .... .... .... ..... .. 13
2.8.4 Hexadecimal Numbers .... .... .... .... ..... .. 14
2.8.5 Adding Binary Numbers... .... .... .... ..... .. 17
2.8.6 Subtracting Binary Numbers.... .... .... ..... .. 18
2.9 Types of Numbers .. ..... .... .... .... .... .... ..... .. 19
2.9.1 Natural Numbers. .... .... .... .... .... ..... .. 19
2.9.2 Integers... ..... .... .... .... .... .... ..... .. 19
2.9.3 Rational Numbers.... .... .... .... .... ..... .. 20
ix
x Contents
2.9.4 Irrational Numbers ... .... .... .... .... ..... .. 20
2.9.5 Real Numbers... .... .... .... .... .... ..... .. 20
2.9.6 Algebraic and Transcendental Numbers ... ..... .. 20
2.9.7 Imaginary Numbers... .... .... .... .... ..... .. 21
2.9.8 Complex Numbers ... .... .... .... .... ..... .. 25
2.9.9 Transcendental and Algebraic Numbers ... ..... .. 27
2.9.10 Infinity ... ..... .... .... .... .... .... ..... .. 27
2.10 Summary . .... .... ..... .... .... .... .... .... ..... .. 28
2.11 Worked Examples .. ..... .... .... .... .... .... ..... .. 29
2.11.1 Algebraic Expansion.. .... .... .... .... ..... .. 29
2.11.2 Binary Subtraction ... .... .... .... .... ..... .. 29
2.11.3 Complex Numbers ... .... .... .... .... ..... .. 29
2.11.4 Complex Rotation.... .... .... .... .... ..... .. 30
3 Algebra .... .... .... .... ..... .... .... .... .... .... ..... .. 31
3.1 Introduction ... .... ..... .... .... .... .... .... ..... .. 31
3.2 Background ... .... ..... .... .... .... .... .... ..... .. 32
3.2.1 Solving the Roots of a Quadratic Equation. ..... .. 33
3.3 Indices... .... .... ..... .... .... .... .... .... ..... .. 37
3.3.1 Laws of Indices.. .... .... .... .... .... ..... .. 37
3.4 Logarithms.... .... ..... .... .... .... .... .... ..... .. 38
3.5 Further Notation.... ..... .... .... .... .... .... ..... .. 40
3.6 Functions. .... .... ..... .... .... .... .... .... ..... .. 40
3.6.1 Explicit and Implicit Equations.. .... .... ..... .. 40
3.6.2 Function Notation.... .... .... .... .... ..... .. 41
3.6.3 Intervals .. ..... .... .... .... .... .... ..... .. 42
3.6.4 Function Domains and Ranges .. .... .... ..... .. 43
3.6.5 Odd and Even Functions... .... .... .... ..... .. 44
3.6.6 Power Functions. .... .... .... .... .... ..... .. 45
3.7 Summary . .... .... ..... .... .... .... .... .... ..... .. 46
3.8 Worked Examples .. ..... .... .... .... .... .... ..... .. 46
3.8.1 Algebraic Manipulation.... .... .... .... ..... .. 46
3.8.2 Solving a Quadratic Equation... .... .... ..... .. 47
3.8.3 Factorising ..... .... .... .... .... .... ..... .. 49
4 Trigonometry ... .... .... ..... .... .... .... .... .... ..... .. 51
4.1 Introduction ... .... ..... .... .... .... .... .... ..... .. 51
4.2 Background ... .... ..... .... .... .... .... .... ..... .. 51
4.3 Units of Angular Measurement . .... .... .... .... ..... .. 51
4.4 The Trigonometric Ratios.. .... .... .... .... .... ..... .. 52
4.4.1 Domains and Ranges . .... .... .... .... ..... .. 55
4.5 Inverse Trigonometric Ratios... .... .... .... .... ..... .. 55
4.6 Trigonometric Identities... .... .... .... .... .... ..... .. 57
4.7 The Sine Rule . .... ..... .... .... .... .... .... ..... .. 58
4.8 The Cosine Rule ... ..... .... .... .... .... .... ..... .. 58
Contents xi
4.9 Compound-Angle Identities .... .... .... .... .... ..... .. 59
4.9.1 Double-Angle Identities ... .... .... .... ..... .. 60
4.9.2 Multiple-Angle Identities... .... .... .... ..... .. 61
4.9.3 Half-Angle Identities.. .... .... .... .... ..... .. 62
4.10 Perimeter Relationships ... .... .... .... .... .... ..... .. 62
4.11 Summary . .... .... ..... .... .... .... .... .... ..... .. 63
5 Coordinate Systems .. .... ..... .... .... .... .... .... ..... .. 65
5.1 Introduction ... .... ..... .... .... .... .... .... ..... .. 65
5.2 Background ... .... ..... .... .... .... .... .... ..... .. 65
5.3 The Cartesian Plane. ..... .... .... .... .... .... ..... .. 66
5.4 Function Graphs.... ..... .... .... .... .... .... ..... .. 66
5.5 Shape Representation..... .... .... .... .... .... ..... .. 67
5.5.1 2D Polygons.... .... .... .... .... .... ..... .. 67
5.5.2 Area of a Shape . .... .... .... .... .... ..... .. 68
5.6 Theorem of Pythagoras in 2D .. .... .... .... .... ..... .. 69
5.7 3D Cartesian Coordinates.. .... .... .... .... .... ..... .. 69
5.7.1 Theorem of Pythagoras in 3D... .... .... ..... .. 70
5.8 Polar Coordinates... ..... .... .... .... .... .... ..... .. 70
5.9 Spherical Polar Coordinates.... .... .... .... .... ..... .. 71
5.10 Cylindrical Coordinates ... .... .... .... .... .... ..... .. 72
5.11 Summary . .... .... ..... .... .... .... .... .... ..... .. 73
5.12 Worked Examples .. ..... .... .... .... .... .... ..... .. 73
5.12.1 Area of a Shape . .... .... .... .... .... ..... .. 73
5.12.2 Distance Between Two Points... .... .... ..... .. 74
5.12.3 Polar Coordinates .... .... .... .... .... ..... .. 74
5.12.4 Spherical Polar Coordinates .... .... .... ..... .. 75
5.12.5 Cylindrical Coordinates.... .... .... .... ..... .. 75
6 Determinants.... .... .... ..... .... .... .... .... .... ..... .. 77
6.1 Introduction ... .... ..... .... .... .... .... .... ..... .. 77
6.2 Linear Equations with Two Variables .... .... .... ..... .. 78
6.3 Linear Equations with Three Variables.... .... .... ..... .. 81
6.3.1 Sarrus’s Rule.... .... .... .... .... .... ..... .. 87
6.4 Mathematical Notation.... .... .... .... .... .... ..... .. 88
6.4.1 Matrix.... ..... .... .... .... .... .... ..... .. 88
6.4.2 Order of a Determinant.... .... .... .... ..... .. 89
6.4.3 Value of a Determinant.... .... .... .... ..... .. 89
6.4.4 Properties of Determinants . .... .... .... ..... .. 90
6.5 Summary . .... .... ..... .... .... .... .... .... ..... .. 91
6.6 Worked Examples .. ..... .... .... .... .... .... ..... .. 91
6.6.1 Determinant Expansion.... .... .... .... ..... .. 91
6.6.2 Complex Determinant. .... .... .... .... ..... .. 92
6.6.3 Simple Expansion.... .... .... .... .... ..... .. 92
6.6.4 Simultaneous Equations ... .... .... .... ..... .. 93
Description:John Vince explains a wide range of mathematical techniques and problem-solving strategies associated with computer games, computer animation, virtual reality, CAD and other areas of computer graphics in this completely revised and expanded fifth edition. The first five chapters cover a general intr