计算机图形学数学基础_第1页
计算机图形学数学基础_第2页
计算机图形学数学基础_第3页
计算机图形学数学基础_第4页
计算机图形学数学基础_第5页
已阅读5页,还剩35页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 A P P E N D I XA Mathematics for Computer Graphics A variety of mathematical concepts and techniques are employed in computer graphics algorithms Here we provide a brief refer ence for the methods from analytic geometry linear algebra vector analysis tensor analysis complex numbers quaternions calculus numerical analysis and other areas that are referred to in the dis cussions throughout this book A 1COORDINATE REFERENCE FRAMES Both Cartesian and non Cartesian reference frames are often useful in computer graphics applications We typically specify coordinates in a graphics program using a Cartesian reference system but the initial specifi cation of a scene could be given in a non Cartesian frame of reference Spherical cylindrical or other symmetries often can be exploited to simplify expressions involving object descriptions or manipulations Two Dimensional Cartesian Screen Coordinates For the device independent commands within a graphics package screen coordinatepositionsarereferencedwithinthefi rstquadrantofatwo dimensional Cartesian frame in standard position as shown in Fig A 1 a The coordinate ori gin for this reference frame is at the lower left screen corner Scan lines however are numbered from 0 at the top of the screen so that screen positions are repre sented internally with respect to the upper left corner of the screen Therefore device dependent commands such as those for interactive input and display window manipulations often reference screen coordinates using the inverted Cartesian frame shown in Fig A 1 b Horizontal coordinate values in the two systems are the same and an inverted y value is converted to a y value measured from the bottom of the screen with the calculation y ymax yinvert A 1 787 hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 788APPENDIX AMathematics for Computer Graphics FIGURE A 1Cartesian screen coordinate positions are referenced with respect to the lower left screen corner a or the upper left screen corner b x y a x yinvert ymax b ymax r u FIGURE A 2A polar coordinate reference frame formed with concentric circles and radial lines y y axis xx axis r P u FIGURE A 3Relationship between polar and Cartesian coordinates In some application packages the screen coordinate origin can be placed at an arbitrary position such as the center of the screen Standard Two Dimensional Cartesian Reference Frames We use Cartesian systems in standard position for world coordinate specifi ca tions viewing coordinates and other references within the two dimensional viewing pipeline Coordinates in these frames can be positive or negative with any range of values To display a view of a two dimensional picture we desig nate a clipping window and a viewport to map a section of the picture to screen coordinates P r x y u FIGURE A 4Right triangle with hypotenuse r sides x and y and an interior angle Polar Coordinates in the xy Plane A frequently used two dimensional non Cartesian system is a polar coordinate reference frame Fig A 2 where a coordinate position is specifi ed with a radial distance r from the coordinate origin and an angular displacement from the horizontal Positive angular displacements are counterclockwise and negative angular displacements are clockwise The relation between Cartesian and polar coordinates is shown in Fig A 3 Considering the right triangle in Fig A 4 and using the defi nition of the trigonometric functions we transform from polar hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 A 1Coordinate Reference Frames789 coordinates to Cartesian coordinates with the expressions x r cos y r sin A 2 The inverse transformation from Cartesian to polar coordinates is r x2 y2 tan 1 y x A 3 Angular values can be measured either in degrees or in dimensionless units radians One radian is defi ned as a measure for an angle that is subtended by a circulararcthathasalengthequaltothecircleradius Thisdefi nitionisillustrated in Fig A 5 which shows two intersecting lines in a plane and a circle centered on the intersection point P For any circle centered on P the value of angle in radians is given by the ratio s r radians A 4 where s is the length of the circular arc subtending and r is the radius of the circle Total angular distance around point P is the length of the circle perimeter 2 r divided by r or 2 radians In terms of degrees a circle circumference is dividedinto360arcsofequallength sothateacharcsubtendsanangleof1degree Therefore 360 2 radians s r P u FIGURE A 5An angle subtended by a circular arc of length s and radius r Other conics besides circles can be used to specify coordinate positions For example using concentric ellipses instead of circles we can give coordinate positions in elliptical coordinates Similarly other types of symmetries can be exploited with hyperbolic or parabolic plane coordinates Standard Three Dimensional Cartesian Reference Frames Figure A 6 a shows the conventional orientation for the coordinate axes in a three dimensional Cartesian reference system This is called a right handed sys tem because the right hand thumb points in the positive z direction when we imagine grasping the z axis with the fi ngers curling from the positive x axis to the positive y axis through 90 as illustrated in Fig A 6 b In most computer graphics programs we specify object descriptions and other coordinate parame ters in right handed Cartesian coordinates For discussions throughout this book includingtheappendix weassumethatallCartesianreferenceframesareright handed unless specifi cally stated otherwise y axis y z x axisz axis P a y axis x axisz axis b x FIGURE A 6Coordinate representation for a point P at position x y z in a standard right handed Cartesian reference system hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 790APPENDIX AMathematics for Computer Graphics FIGURE A 7Left handed Cartesian coordinate system superimposed on the surface of a video monitor y z x a y z x b Cartesian reference frames are orthogonal coordinate systems which just means that the coordinate axes are perpendicular to each other Also in Cartesian frames the axes are straight lines But coordinate systems with curved axes are usefulinmanyapplications Mostofthesesystemsarealsoorthogonalinthesense that the axial directions at any point in the space are mutually perpendicular Three Dimensional Cartesian Screen Coordinates When a view of a three dimensional scene is displayed on a video monitor depth information is stored for each screen position The three dimensional position corresponding to each screen point is often referenced with the left handed sys tem shown in Fig A 7 In this case the left hand thumb points in the positive z direction when we imagine grasping the z axis so that the fi ngers of the left hand curl from the positive x axis to the positive y axis through 90 Positive z values indicate positions behind the screen for each point in the xy plane and larger values along the positive z axis are interpreted as being farther from the viewer Three Dimensional Curvilinear Coordinate Systems Any non Cartesian reference frame is referred to as a curvilinear coordinate system The choice of coordinate system for a particular graphics application depends on a number of factors such as symmetry ease of computation and visualization advantages Figure A 8 shows a general curvilinear coordinate ref erence frame formed with three coordinate surfaces where each surface has one co ordinate held constant For instance the x1x2 surface is defi ned with x3 const3 Coordinateaxesinanyreferenceframearetheintersectioncurvesofthecoordinate surfaces If the coordinate surfaces intersect everywhere at right angles we have an orthogonal curvilinear coordinate system Nonorthogonal curvilinear refer ence frames are useful for some applications such as visualizations of motions governed by the laws of general relativity but they are used less frequently in computer graphics than orthogonal systems A cylindrical coordinate specifi cation of a spatial position is shown in Fig A 9 in relation to a Cartesian reference frame The surface of constant is a vertical cylinder the surface of constant is a vertical plane containing the z axis and the surface of constant z is a horizontal plane parallel to the Cartesian xy plane We transform from a cylindrical coordinate specifi cation to a Cartesian reference frame with the calculations x cos y sin z z A 5 hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 A 1Coordinate Reference Frames791 x2 axis x3 const3 x2 const2 x1 axis x3 axis x1 const1 FIGURE A 8A general curvilinear coordinate reference frame x axis y axis z axis z P r u z u r FIGURE A 9Cylindrical coordinates and z x y z P r u f r f u FIGURE A 10Spherical coordinates r and r A P v FIGURE A 11A solid angle subtended by a spherical surface patch with area Aand radius r Another commonly used curvilinear coordinate specifi cation is the spherical coordinate system in Fig A 10 Spherical coordinates are sometimes referred to as polar coordinates in three dimensional space The surface of constant r is a sphere the surface of constant is again a vertical plane containing the z axis and the surface of constant is a cone with apex at the coordinate origin If 90 theconeisbelowthe xyplane Wetransform from a spherical coordinate specifi cation to a Cartesian reference frame with the calculations x r cos sin y r sin sin z r cos A 6 Solid Angle The defi nition for a solid angle is formulated by analogy with the defi nition for a two dimensional radian angle between two intersecting lines Eq A 4 For a three dimensional angle however we consider a cone with apex at a point P and a sphere centered at P as shown in Fig A 11 The solid angle within the hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 792APPENDIX AMathematics for Computer Graphics cone shaped region with apex at P is defi ned as A r2 A 7 where A is the area of the spherical surface intersected by the cone and r is the radius of the sphere Also in analogy with two dimensional polar coordinates the dimensionless unit for solid angles is called the steradian The total solid angle about point P is the total area of the spherical surface 4 r2 divided by r2 or 4 steradians A 2POINTS AND VECTORS There is a fundamental difference between the concept of a geometric point and that of a vector A point is a position specifi ed with coordinate values in some reference frame where the coordinates and other properties for the point depend onourchoicefortheframeofreference Avector ontheotherhand hasproperties that are independent of any particular coordinate system Point Properties Figure A 12 illustrates the coordinate specifi cation for a two dimensional point position P in two reference frames In frame A the point has coordinates that are given by the ordered pair x y and its distance from the origin is x2 y2 In frame B the same point has coordinates 0 0 and the distance to the coordinate origin of frame B is 0 Vector Properties In a chosen coordinate system we can defi ne a vector as the difference between two point positions Thus for the two dimensional points P1and P2in Fig A 13 we can specify a vector as V P2 P1 x2 x1 y2 y1 A 8 Vx Vy y OA OB x P frame B frame A FIGURE A 12Coordinates for a point position P with respect to two different Cartesian reference frames y1 y2 x2x1 P2 V P1 FIGURE A 13A two dimensional vector V defi ned in a Cartesian reference frame as the difference of two point positions hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 A 2Points and Vectors793 where the Cartesian components or Cartesian elements Vxand Vyare the projec tions of V onto the x and y axes We could also obtain these same vector com ponents using two other point positions in this coordinate reference frame In fact there are an infi nite number of point pairs that will produce the same vector components and a vector is often defi ned with a single point position relative to the current frame of reference Therefore a vector has no fi xed position within a coordinate system Also if we transform the representation for V to another reference frame the coordinates for the positions P1and P2change but the basic properties of the vector remain unchanged We can describe a vector as a directed line segment that has two fundamental properties magnitudeanddirection Forthetwo dimensionalvectorinFig A 13 we calculate the vector magnitude using the Pythagorean theorem which gives us the distance along the vector direction between its two endpoint positions V V2 x V2 y A 9 We can specify the vector direction in various ways For example we can give the direction in terms of the angular displacement from the horizontal as tan 1 Vy Vx A 10 A vector has the same magnitude and direction no matter where we position the vector within a single coordinate system And the vector magnitude is inde pendent of the coordinate representation However if we transform the vector to another reference frame the values for its components and direction within that reference frame may change For example we could transform the vector to a rotated Cartesian frame so that the vector direction is along the new y direction For a three dimensional Cartesian vector representation V Vx Vy Vz the vector magnitude is V V2 x V2 y V2 z A 11 And we can give the vector direction in terms of the direction angles and thatthevectormakeswitheachofthecoordinateaxes Fig A 14 Directionangles are the positive angles that the vector makes with each of the positive coordinate axes We calculate these angles as cos Vx V cos Vy V cos Vz V A 12 The values cos cos and cos are called the direction cosines of the vector Actually we need specify only two of the direction cosines to give the direction of V since cos2 cos2 cos2 1 A 13 z x y Vg b a FIGURE A 14Direction angles and Fsun earth v FIGURE A 15A gravitational force vector F and a velocity vector v Vectors are used to represent any quantities that have the properties of mag nitude and direction Two common examples are force and velocity Fig A 15 A forcecanbethoughtofasanamountofpushorpullalongaparticulardirection A velocity vector specifi es how fast speed an object is moving in a certain direction hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 794APPENDIX AMathematics for Computer Graphics FIGURE A 16Two vectors a can be added geometrically by positioning the two vectors end to end b and drawing the resultant vector from the start of the fi rst vector to the tip of the second vector y x V2 V1 a y x V1 V2V2 b V1 Vector Addition and Scalar Multiplication By defi nition the sum of two vectors is obtained by adding corresponding components V1 V2 V1x V2x V1y V2y V1z V2z A 14 Two dimensional vector addition is illustrated geometrically in Fig A 16 We obtain the vector sum by placing the start position of one vector at the tip of the other vector and drawing the representation for the vector sum from the start of the fi rst vector to the tip of the second Addition of a vector with a scalar is undefi ned since a scalar has only one numerical value while a vector has n numerical components in an n dimensional space Multiplication of a vector by a scalar value s is defi ned as sV sVx sVy sVz A 15 For example if the scalar parameter s has the value 2 each component of V is doubled and its magnitude is doubled We can also combine vectors using multiplicative processes in various ways One highly useful method is to multiply the magnitudes of two vectors so that this product is used to form either another vector or a scalar quantity Scalar Product of Two Vectors We obtain a scalar value from two vectors with the calculation V1 V2 V1 V2 cos 0 A 16 where is the smaller of the two angles between the vector directions Fig A 17 This multiplication scheme is called the scalar product or dot product of two vectors It is also referred to as the inner product particularly in discussing scalar products in tensor analysis Equation A 16 is valid in any coordinate representa tion and can be interpreted as the product of the parallel components of the two vectors where V2 cos is the projection of vector V2in the direction of V1 V2 V1 V2 cos u u FIGURE A 17The dot product of two vectors is obtained by multiplying parallel components In addition to the coordinate independent form of the scalar product we can express this calculation in specifi c coordinate representations For a Cartesian reference frame the scalar product is calculated as V1 V2 V1xV2x V1yV2y V1zV2z A 17 The scalar product is a generalization of the Pythagorean theorem and the scalarproductofavectorwithitselfproducesthesquareofthevectormagnitude hearn 50265 ISBN 0 13 015390 7bookAugust 4 200314 49 A 2Points and Vectors795 Also the scalar product of two vectors is zero if and only if the two vectors are perpendicular orthogonal Dot products are commutative V1 V2 V2 V1 A 18 because this operation produces a scalar And dot products are distributive with respect to vector addition V1 V2 V3 V1 V2 V1 V3 A 19 Vector Product of Two Vectors We use the following calculation to combine two vectors to produce another vector V1 V2 u V1 V2 sin 0 A 20 Parameteruinthisexpressionisaunitvector magnitude1 thatisperpendicular to both V1and V2 Fig A 18 The direction for u is determined by the right hand rule We grasp an axis that is perpendicular to the plane containing V1and V2so thatthefi ngersoftherighthandcurlfromV1toV2 Vectoruistheninthedirection of the right thumb This calculation is called the vector product or cross product of two vectors and Equation A 20 is valid in any coordinate representation The cross product of two vectors is a vector that is perpendicular to the plane of the two vectors and the magnitude of the cross product vector is equal to the area of the parallelogram formed by the two vectors V1 V2 V1 V2 u u FIGURE A 18The cross product of two vectors is a vector in a direction perpendicular to the two original vectors and with a magnitude

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论