首页 齐次坐标HomogeneousCoordinates

齐次坐标HomogeneousCoordinates

举报
开通vip

齐次坐标HomogeneousCoordinates Homogeneous Coordinates They work, but where do they come from? Jonathan Senning jonathan.senning@gordon.edu Outline Two-dimensional computer graphics Translation – necessary but nonlinear Homogeneous coordinates Affine geometry and spaces F...

齐次坐标HomogeneousCoordinates
Homogeneous Coordinates They work, but where do they come from? Jonathan Senning jonathan.senning@gordon.edu Outline Two-dimensional computer graphics Translation – necessary but nonlinear Homogeneous coordinates Affine geometry and spaces Frames Homogeneous coordinates again Perspective projections Two-dimensional computer graphics Provides an interesting motivational example  Illustrates linear transformations Early exposure to idea of isomorphisms Three key operations: scaling rotation translation Scaling To scale the x coordinate by α and the y coordinate by β we can use the scaling matrix defined by Applying the transformation scales the vector S  ,=[ 00 ] [ 00 ][ xy ]=[ x y ] Rotation The matrix that implements a counterclockwise rotation about the origin by the angle θ is Applying this gives R =[cos −sin sin  cos ] [cos  −sin sin  cos  ][ xy ]=[ x cos − y sin x sin  y cos ] Shearing Shearing can also be easily implemented with a matrix Notice that x is increased by a factor of y; shearing, like rotation, is relative to the origin [1  1 ][ xy ]=[ x yy x ] H  ,=[1  1 ] Translation Unfortunately translation cannot be implemented with matrix-vector multiplication. Here comes the magic... Homogeneous Coordinates This magic is called “homogeneous coordinates” and (from a student's perspective) consists of appending a 1 to the x and y coordinates. [ xy ] [ xy1 ] Homogeneous Coordinates The magic of homogeneous coordinates is twofold: 1. The matrices of existing linear transformations can easily be extended to work with homogeneous coordinates [  ] [  0  00 0 1] Homogeneous Coordinates 2. Translation can be implemented as matrix-vector multiplication Little justification is offered for where homogeneous coordinates come from; the justification is usually “they just work.” [1 0 h0 1 k0 0 1 ][ x y 1 ]=[ xh yk 1 ] Affine Spaces Definition: An affine space consists of a vector space V and a set of points P such that 1. the difference of any two points from P is a vector in V, 2. given any point p from P and vector v from V, the sum p + v is a point in P. Affine Spaces Suppose p and q are points from P. Then 1. α(p – q) is a vector in V, and 2. q + α(p – q) is a point in P that lies along the line between q and p. q p q + α(p – q) Affine Combinations This last expression, q + α(p – q), yields a point according to the axioms for affine spaces. If we formally rearrange this we can obtain αp + (1 – α)q or αp + βq where α + β = 1. This is defined to be an affine combination; an affine combination of points yields a point. Frames A frame for an affine space A=(V,P) is analogous to a basis for a vector space. A frame consists of two things: - a basis B for the vector space V and - a point o from P. Every vector in V is a linear combination of vectors in B. Every point in P can be obtained by adding a vector from V to o. Frames A frame for an affine space with an n-dimensional vector space contains n+1 elements. A frame allows us to locate and orient an n- dimensional vector space relative to another n- dimensional vector space. Coordinate Axiom To make use of a frame for an affine space we need one additional axiom. The coordinate axiom is quite simple and states: For every point p in an affine space A - 0p is defined to be the zero vector 0 in A, and - 1p is defined to be the point p. Frames and the Coordinate Axiom Suppose the frame for an affine space A is given by a basis for V and a point o from P. Because of the coordinate axiom, any vector v in A can be written as for suitable choice of constants . v=1u12u2⋯nun0 o {u1 ,u2 ,u3 , ,un} i Frames and the Coordinate Axiom Similarly, any point p in A can be written as for suitable . Once a frame is defined, we can describe coordinates of elements in an affine space relative to the frame. As in the case of bases for vector spaces, we assume that elements of the frame are ordered and we require that the point o appears last. p=1u12u2⋯nun1 o i Frame Coordinate Vectors The coordinate vectors of the vector v and the point p are Notice that the coordinate vector of a vector ends with 0 while the coordinate vector of a point ends with 1. [v ]=[ 1 2 ⋮ n 0 ] [p ]=[ 1 2 ⋮ n 1 ] Homogeneous Coordinates Again The frame coordinate vectors are exactly the same as the homogeneous coordinates we've already seen! An interesting project at this point would be to have students derive the transformation matrices for scaling, rotation, and translation by finding suitable frames and the corresponding change-of-frames matrices. Another View of Homogeneous Coordinates The set of vectors given by can be viewed as points on a plane parallel to the xy-plane but translated away from the origin by 1 unit along the z axis. We can extend the definition of homogeneous coordinates so that is equivalent to all vectors when x = x'/z' and y = y'/z'. [ x y 1]T [ x y 1]T [ x ' y ' z ' ]T Another View of Homogeneous Coordinates This means that homogeneous coordinates define an surjection of onto an n-dimensional subspace of . Most computer graphics hardware implements the nonlinear scaling operation that normalizes the last coordinate as part of the pipeline that all points pass through. This is called perspective division. From now on we'll be using 3-dimensions... Rn1 Rn1 Perspective Projection Cross section of perspective projection: xy-plane eye at z = 0 viewing plane at z = d object at (x,y,z) image at (x',y',d) field of view z-axis Perspective Projection From similar triangles we know y'/y = z/d which gives y' = y/(z/d). Repeating these steps we can also find x' = x/(z/d). z y y' d Perspective Projection We need to perform the mapping This nonlinear operation can (almost) be done with a single matrix-vector multiplication. [ xyz1 ] [ x z /d y z /d d 1 ] Perspective Projection Consider the following operation If perspective division is automatically performed by the graphics system, we obtain the desired vector for the image point. [1 0 0 00 1 0 00 0 1 00 0 1 /d 0 ][ x y z 1 ]=[ x y z z /d ] Summary Frames provide a useful tool for modern computer graphics. Students easily pick up these concepts once they are comfortable with vector spaces and bases. Homogeneous coordinates arise naturally when affine spaces and frames are used, combating the “they just work” rationale for their use. Homogeneous coordinates make other important operations easy to implement in a modern graphics system.
本文档为【齐次坐标HomogeneousCoordinates】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_036607
暂无简介~
格式:pdf
大小:160KB
软件:PDF阅读器
页数:27
分类:工学
上传时间:2011-10-26
浏览量:27