文本描述
3DMathPrimerfor
GraphicsandGame
Development
FletcherDunn
andIanParberry
WordwarePublishing,Inc.
LibraryofCongressCataloging-in-PublicationData
Dunn,Fletcher.
3Dmathprimerforgraphicsandgamedevelopment/byFletcherDunnandIanParberry.
p.cm.
ISBN1-55622-911-9
1putergraphics.2putergames--Programming.3puterscience--Mathematics.
I.Parberry,Ian.II.Title.
T385.D8752002
006.6--dc212002004615
CIP
2002,WordwarePublishing,Inc.
AllRightsReserved
2320LosRiosBoulevard
Plano,Texas75074
Nopartofthisbookmaybereproducedinanyformorby
anymeanswithoutpermissioninwritingfrom
WordwarePublishing,Inc.
PrintedintheUnitedStatesofAmerica
ISBN1-55622-911-9
10987654321
0205
Productnamesmentionedareusedforidentificationpurposesonlyandmaybetrademarksoftheirrespectivecompanies.
AllinquiriesforvolumepurchasesofthisbookshouldbeaddressedtoWordwarePublishing,Inc.,attheabove
address.Telephoneinquiriesmaybemadebycalling:
(972)423-0090
Contents
Acknowledgments...........xi
Chapter1
Introduction...........1
1.1Whatis3DMath........1
1.2WhyYouShouldReadThisBook1
1.3WhatYouShouldKnowBeforeReadingThisBook..3
1.4Overview.3
Chapter2
TheCartesianCoordinateSystem5
2.11DMathematics.........6
2.22DCartesianMathematics....9
2.2.1AnExample:TheHypotheticalCityofCartesia..9
2.2.2Arbitrary2DCoordinateSpaces..........10
2.2.3SpecifyingLocationsin2DUsingCartesianCoordinates........13
2.3From2Dto3D.........14
2.3.1ExtraDimension,ExtraAxis...........15
2.3.2SpecifyingLocationsin3D15
2.3.3Left-handedvs.Right-handedCoordinateSpaces16
2.3.4SomeImportantConventionsUsedinThisBook.19
2.4Exercises.20
Chapter3
MultipleCoordinateSpaces..23
3.1WhyMultipleCoordinateSpaces...........24
3.2SomeUsefulCoordinateSpaces25
3.2.1WorldSpace........25
3.2.2ObjectSpace........26
3.2.3CameraSpace.......27
3.2.4InertialSpace........28
3.3NestedCoordinateSpaces....30
3.4SpecifyingCoordinateSpaces.31
3.5CoordinateSpaceTransformations...........31
3.6Exercises.34
Chapter4
Vectors.35
4.1Vector—AMathematicalDefinition.........36
4.1.1Vectorsvs.Scalars.....36
4.1.2VectorDimension.....36
4.1.3Notation..........36
4.2Vector—AGeometricDefinition...........37
iii
4.2.1WhatDoesaVectorLookLike..........37
4.2.2Positionvs.Displacement.38
4.2.3SpecifyingVectors.....38
4.2.4VectorsasaSequenceofDisplacements.....39
4.3Vectorsvs.Points........40
4.3.1RelativePosition......41
4.3.2TheRelationshipBetweenPointsandVectors..41
4.4Exercises.42
Chapter5
OperationsonVectors.....45
5.1LinearAlgebravs.WhatWeNeed...........46
5.2TypefaceConventions......46
5.3TheZeroVector.........47
5.4NegatingaVector........48
5.4.1OfficialLinearAlgebraRules...........48
5.4.2GeometricInterpretation..48
5.5VectorMagnitude(Length)...49
5.5.1OfficialLinearAlgebraRules...........49
5.5.2GeometricInterpretation..50
5.6VectorMultiplicationbyaScalar51
5.6.1OfficialLinearAlgebraRules...........51
5.6.2GeometricInterpretation..52
5.7NormalizedVectors.......53
5.7.1OfficialLinearAlgebraRules...........53
5.7.2GeometricInterpretation..53
5.8VectorAdditionandSubtraction54
5.8.1OfficialLinearAlgebraRules...........54
5.8.2GeometricInterpretation..55
5.8.3VectorfromOnePointtoAnother.........57
5.9TheDistanceFormula......57
5.10VectorDotProduct.......58
5.10.1OfficialLinearAlgebraRules..........58
5.10.2GeometricInterpretation.59
5.10.3ProjectingOneVectorontoAnother.......61
5.11VectorCrossProduct......62
5.11.1OfficialLinearAlgebraRules..........62
5.11.2GeometricInterpretation.62
5.12LinearAlgebraIdentities...65
5.13Exercises67
Chapter6
ASimple3DVectorClass....69
6.1ClassInterface..........69
6.2ClassVector3Definition....70
6.3DesignDecisions........73
6.3.1Floatsvs.Doubles.....73
6.3.2OperatorOverloading...73
iv
Contents。