TEAMFLY3DMathPrimerforGraphicsandGameDevelopmentFletcherDunnandIanParberryWordwarePublishing,Inc.LibraryofCongressCataloging-in-PublicationDataDunn,Fletcher.3Dmathprimerforgraphicsandgamedevelopment/byFletcherDunnandIanParberry.p.cm.ISBN1-55622-911-91.Computergraphics.2.Computergames--Programming.3.Computerscience--Mathematics.I.Parberry,Ian.II.Title.T385.D8752002006.6--dc212002004615CIP©2002,WordwarePublishing,Inc.AllRightsReserved2320LosRiosBoulevardPlano,Texas75074NopartofthisbookmaybereproducedinanyformorbyanymeanswithoutpermissioninwritingfromWordwarePublishing,Inc.PrintedintheUnitedStatesofAmericaISBN1-55622-911-9109876543210205Productnamesmentionedareusedforidentificationpurposesonlyandmaybetrademarksoftheirrespectivecompanies.AllinquiriesforvolumepurchasesofthisbookshouldbeaddressedtoWordwarePublishing,Inc.,attheaboveaddress.Telephoneinquiriesmaybemadebycalling:(972)423-0090ContentsAcknowledgments...................................xiChapter1Introduction.......................11.1Whatis3DMath?................................11.2WhyYouShouldReadThisBook........................11.3WhatYouShouldKnowBeforeReadingThisBook..............31.4Overview.....................................3Chapter2TheCartesianCoordinateSystem............52.11DMathematics.................................62.22DCartesianMathematics............................92.2.1AnExample:TheHypotheticalCityofCartesia..............92.2.2Arbitrary2DCoordinateSpaces......................102.2.3SpecifyingLocationsin2DUsingCartesianCoordinates........132.3From2Dto3D.................................142.3.1ExtraDimension,ExtraAxis.......................152.3.2SpecifyingLocationsin3D........................152.3.3Left-handedvs.Right-handedCoordinateSpaces............162.3.4SomeImportantConventionsUsedinThisBook.............192.4Exercises.....................................20Chapter3MultipleCoordinateSpaces..............233.1WhyMultipleCoordinateSpaces?.......................243.2SomeUsefulCoordinateSpaces....