查看“︁三维投影”︁的源代码
←
三维投影
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{NoteTA |T=zh-cn:三维投影; zh-tw:3D投影; |1=zh-cn:三维; zh-tw:3D; |2=zh-cn:二维; zh-tw:2D; }} '''三维投影'''是将三维空间中的点映射到二维平面上的方法。由于目前绝大多数图形数据的显示方式仍是二维的,因此三维投影的应用相当广泛,尤其是在计算机图形学,工程学和[[技术制图|工程制图]]中。 ==分类== *'''三维图形平面投影''' **'''平行投影''':投影中心与投影平面的距离是无限的,投影线相互平行 ***'''正投影(正交投影)''':投影线垂直于投影平面 ****'''多视图投影''':物体的坐标面与投影面平行,正视图、侧视图、俯视图 ****'''轴测投影''':物体的三个坐标面或坐标轴与投影面均不平行 *****'''正等轴测投影(正等测)''':投影时三个坐标轴等比例缩放,投影面坐标轴夹角120° *****'''正二轴测投影(正二测)''':投影时两个坐标轴等比例缩放,第三个坐标轴缩放比例不同 *****'''正三轴测投影(正三测)''':投影时三个坐标轴缩放比例均不相等 ***'''斜投影''':投影线不垂直于投影平面 ****'''斜等轴测投影(斜等测)''' ****'''斜二轴测投影(斜二测)''' ****'''斜三轴测投影(斜三测)''' **'''透视投影''':投影中心与投影平面的距离是有限的 ***一点透视 ***两点透视 ***三点透视 ==平行投影== 平行投影是投影线相互平行的投影。若投影线垂直于投影面则称正投影,若投影面倾斜于投影面则称斜投影。 ===正交投影=== 正交投影是一系列用于显示三维物体的轮廓、细节或精确测量结果的变换方法。通常又称作截面图、鸟瞰图或立面图。 当视平面的法向(即摄像机的朝向)平行于[[笛卡尔坐标]]系三根坐标轴中的一根,数学变换定义如下: 若使用一个平行于y轴(侧视图)的正交投影将三维点<math>a_x</math>, <math>a_y</math>, <math>a_z</math>投影到二维平面上得到二维点<math>b_x</math>, <math>b_y</math>,可以使用如下公式 :<math> b_x = s_x a_x + c_x </math> :<math> b_y = s_z a_z + c_z </math> 其中向量'''s'''是一个任意的缩放因子,而'''c'''是一个任意的偏移量。这些常量可自由选择,通常用于将[[视口]]调整到一个合适的位置。该投影变换同样可以使用矩阵表示(为清晰起见引入临时向量'''d''') :<math> \begin{bmatrix} {d_x } \\ {d_y } \\ \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}\begin{bmatrix} {a_x } \\ {a_y } \\ {a_z } \\ \end{bmatrix} </math> :<math> \begin{bmatrix} {b_x } \\ {b_y } \\ \end{bmatrix} = \begin{bmatrix} {s_x } & 0 \\ 0 & {s_z } \\ \end{bmatrix}\begin{bmatrix} {d_x } \\ {d_y } \\ \end{bmatrix} + \begin{bmatrix} {c_x } \\ {c_z } \\ \end{bmatrix}. </math> 虽然正交投影产生的图像在一定程度上反映了物体的三维特性,但此类投影图像和实际观测到的并不相同。特别是对于相同长度的平行线段,无论离虚拟观察者(摄像机)远近与否,它们都会在正交投影中显示为相同长度。这会导致较近的线段看起来被缩短了。 ===斜投影=== 斜投影不像正交投影一样投影线垂直于投影面,而是投影线与投影面成非90度的斜角。 ==透视投影== {{主条目|变换矩阵}} [[透视投影]]的定义更为复杂。可以将其理解为透过摄像机取景器对于被投影物体进行观察。摄像机的位置、朝向和[[视野]]都将影响投影变换的结果。我们定义以下变量来对这一变换进行描述: * <math>\mathbf{a}_{x,y,z}</math>:将被投影的三维空间中的点。 * <math>\mathbf{c}_{x,y,z}</math>:摄像机的位置。 * <math>\mathbf{\theta}_{x,y,z}</math>:摄像机的旋转角度。当 <math>\mathbf{c}_{x,y,z}</math>=<0,0,0>且 <math>\mathbf{\theta}_{x,y,z}</math>=<0,0,0>, 三维向量<1,2,0>将被投影到二维向量<1,2>。 * <math>\mathbf{e}_{x,y,z}</math>:观测者相对显示平面的位置。<ref>{{citation |author=Ingrid Carlbom, Joseph Paciorek |title=Planar Geometric Projections and Viewing Transformations |journal=[[ACM Computing Surveys]] |volume=10 |issue=4 |pages=465–502 |year=1978 |doi=10.1145/356744.356750 }}.</ref> 最终结果为: * <math>\mathbf{b}_{x,y}</math>:<math>\mathbf{a}</math>所产生的二维投影。 首先我们定义点<math>\mathbf{d}_{x,y,z}</math>作为点<math>\mathbf{a}</math>向摄像机[[坐标系]]所作的[[变换]],其中摄像机[[坐标系]]由摄像机的位置<math>\mathbf{c}</math>和旋转<math>\mathbf{\theta}_{x,y,z}</math>所决定。该过程为:先用<math>\mathbf{a}</math>[[矩阵加法|减去]]<math>\mathbf{c}</math>,然后使用由<math>-\mathbf{\theta}</math>产生的[[旋转矩阵]]乘上该结果。该变换通常称为摄像机变换(注意该计算过程假设使用[[笛卡尔坐标系#取向|左手法则]]): <!--Orthogonal transformation (pg 931) and Matrix and Adaptation for n-dimensional arbitrary rotation (pg 942):--><ref>{{cite book | last = Riley | first = K F | title = Mathematical Methods for Physics and Engineering | url = https://archive.org/details/mathematicalmeth00rile | year = 2006 | publisher = [[Cambridge University Press]] | pages = [https://archive.org/details/mathematicalmeth00rile/page/931 931],942 | doi = 10.2277/0521679710 | isbn = 0521679710 }} </ref> <!--Related form, using rotation around intermediate axes--><ref>{{cite book | last = Goldstein| first = Herbert | title = Classical Mechanics 2nd Edn. | url = https://archive.org/details/classicalmechani00gold_639| year = 1980 | pages = [https://archive.org/details/classicalmechani00gold_639/page/146 146]–148 | isbn = 0201029189 | publisher = Addison-Wesley Pub. Co. | location = Reading, Mass. }} </ref> :<math> \begin{bmatrix} \mathbf{d}_x \\ \mathbf{d}_y \\ \mathbf{d}_z \\ \end{bmatrix}=\begin{bmatrix} 1 & 0 & 0 \\ 0 & {\cos ( \mathbf{- \theta}_x ) } & { - \sin ( \mathbf{- \theta}_x ) } \\ 0 & { \sin ( \mathbf{- \theta}_x ) } & { \cos ( \mathbf{- \theta}_x ) } \\ \end{bmatrix}\begin{bmatrix} { \cos ( \mathbf{- \theta}_y ) } & 0 & { \sin ( \mathbf{- \theta}_y ) } \\ 0 & 1 & 0 \\ { - \sin ( \mathbf{- \theta}_y ) } & 0 & { \cos ( \mathbf{- \theta}_y ) } \\ \end{bmatrix}\begin{bmatrix} { \cos ( \mathbf{- \theta}_z ) } & { - \sin ( \mathbf{- \theta}_z ) } & 0 \\ { \sin ( \mathbf{- \theta}_z ) } & { \cos ( \mathbf{- \theta}_z ) } & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}\left( {\begin{bmatrix} \mathbf{a}_x \\ \mathbf{a}_y \\ \mathbf{a}_z \\ \end{bmatrix} - \begin{bmatrix} \mathbf{c}_x \\ \mathbf{c}_y \\ \mathbf{c}_z \\ \end{bmatrix}} \right) </math><ref>[http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html Rotation About an Arbitrary Axis in 3 Dimensions] {{Wayback|url=http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html |date=20140413201510 }} Glenn Murray 2013-6-6 [2014-4-23]</ref> 或者使用以下这种非矩阵表示的形式,其中角度的正负号与矩阵表示形式不同: :<math> \begin{array}{lcl} d_x &= &\cos \theta_y\cdot(\sin \theta_z\cdot(a_y-c_y)+\cos \theta_z\cdot(a_x-c_x))-\sin \theta_y\cdot(a_z-c_z) \\ d_y &= &\sin \theta_x\cdot(\cos \theta_y\cdot(a_z-c_z)+\sin \theta_y\cdot(\sin \theta_z\cdot(a_y-c_y)+\cos \theta_z\cdot(a_x-c_x)))+\cos \theta_x\cdot(\cos \theta_z\cdot(a_y-c_y)-\sin \theta_z\cdot(a_x-c_x)) \\ d_z &= &\cos \theta_x\cdot(\cos \theta_y\cdot(a_z-c_z)+\sin \theta_y\cdot(\sin \theta_z\cdot(a_y-c_y)+\cos \theta_z\cdot(a_x-c_x)))-\sin \theta_x\cdot(\cos \theta_z\cdot(a_y-c_y)-\sin \theta_z\cdot(a_x-c_x)) \\ \end{array} </math> 然后将变换后的该点通过以下方程投影到二维平面(此处投影平面为''x/y''平面,有时也使用''x/z''):<ref> {{Citation | last1 = Sonka | first1 = M | last2 = Hlavac | first2 = V | last3 = Boyle | first3 = R | title = Image Processing, Analysis & Machine Vision 2nd Edn. | publisher = Chapman and Hall | year = 1995 | pages = 14 | isbn = 0412455706 }} </ref> :<math> \begin{array}{lcl} \mathbf{b}_x &= &(\mathbf{d}_x - \mathbf{e}_x) (\mathbf{e}_z / \mathbf{d}_z) \\ \mathbf{b}_y &= &(\mathbf{d}_y - \mathbf{e}_y) (\mathbf{e}_z / \mathbf{d}_z) \\ \end{array} </math> 或在[[齐次坐标系]]下可以表示为: :<math> \begin{bmatrix} \mathbf{f}_x \\ \mathbf{f}_y \\ \mathbf{f}_z \\ \mathbf{f}_w \\ \end{bmatrix}=\begin{bmatrix} 1 & 0 & 0 & -\mathbf{e}_x \\ 0 & 1 & 0 & -\mathbf{e}_y \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 1/\mathbf{e}_z & 0 \\ \end{bmatrix}\begin{bmatrix} \mathbf{d}_x \\ \mathbf{d}_y \\ \mathbf{d}_z \\ 1 \\ \end{bmatrix} </math> 和 :<math> \begin{array}{lcl} \mathbf{b}_x &= &\mathbf{f}_x / \mathbf{f}_w \\ \mathbf{b}_y &= &\mathbf{f}_y / \mathbf{f}_w \\ \end{array} </math> 观测者到显示平面的距离,<math>\mathbf{e}_z</math>,直接关系到视野的大小。<math>\alpha=2 \cdot \tan^{-1}(1/\mathbf{e}_z)</math>为可视角度。(这里假设屏幕的两角为(-1,-1)和(1,1)) 如果要在一些特定的显示设备上显示该二维平面,之后还要进行一些必要的剪裁和缩放操作。 ==图示== [[Image:Projective_Transform.svg]] 计算三维空间中位于Ax,Az的点在屏幕坐标x轴的位置: <math>screen\ x\ coordinate\ (Bx)\ =\ model\ x\ coordinate\ (Ax) \times \frac{distance\ from\ eye\ to\ screen\ (Bz)}{distance\ from\ eye\ to\ point\ (Az)}</math> 对于y轴同样有: <math>screen\ y\ coordinate\ (By)\ =\ model\ y\ coordinate\ (Ay) \times \frac{distance\ from\ eye\ to\ screen\ (Bz)}{distance\ from\ eye\ to\ point\ (Az)}</math> (其中Ax和Ay是透视转换前物体在空间中的坐标) ==参看== *[[计算机图形学]] **[[三维计算机图形]] *[[透视]] *[[单应性]] *三维投影的数学理论:[[投影]] == 参考文献 == {{reflist}} == 延伸阅读 == {{Commonscat|3D projection}} *{{Citebook|title=3D Game Programming All in One|author=Kenneth C. Finney|year=2004|publisher=Thomson Course|id=ISBN 159200136X|pages=93|url=http://books.google.com/books?id=cknGqaHwPFkC&pg=PA93&dq=%223D+projection%22&ie=ISO-8859-1&output=html&sig=1ClwdV95eKLGbEgkcxb1PW1YjUk|access-date=2009-12-23|archive-date=2012-11-12|archive-url=https://web.archive.org/web/20121112125615/http://books.google.com/books?id=cknGqaHwPFkC&pg=PA93&dq=%223D+projection%22&ie=ISO-8859-1&output=html&sig=1ClwdV95eKLGbEgkcxb1PW1YjUk|dead-url=no}} {{计算机图形学}} {{DEFAULTSORT:投影}} [[Category:线性代数]] [[Category:立体几何]] [[Category:射影几何]] [[Category:三维计算机图形学]] [[Category:三维成像]] [[Category:投影圖]] [[Category:函数]]
该页面使用的模板:
Template:Citation
(
查看源代码
)
Template:Cite book
(
查看源代码
)
Template:Citebook
(
查看源代码
)
Template:Commonscat
(
查看源代码
)
Template:NoteTA
(
查看源代码
)
Template:Reflist
(
查看源代码
)
Template:Wayback
(
查看源代码
)
Template:主条目
(
查看源代码
)
Template:计算机图形学
(
查看源代码
)
返回
三维投影
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息