《计算机图形学》答案,第七章

合集下载

计算机图形学智慧树知到答案章节测试2023年中国地质大学(武汉)

计算机图形学智慧树知到答案章节测试2023年中国地质大学(武汉)

第一章测试1.计算机图形学产生图形,计算机图像学产生图像。

()A:对B:错答案:B2.下列哪项不属于计算机图形学的应用领域?()A:虚拟现实B:游戏实时显示C:科学计算可视化D:计算机辅助设计E:数字电影制作F:识别图片中的动物答案:F3.本课程将讲不讲解以下哪个内容?()A:动画生成B:真实感图像生成C:曲线生成D:游戏制作答案:D4.使用OPENGL画带颜色的直线,需要调用不同的函数,分别指定颜色和起始点坐标。

()A:错B:对答案:B5.在OPENGL中定义的结点仅包含位置信息。

()A:对B:错答案:B第二章测试1.四面体的表面建模中,可用四个三角形来描述四面体的表面,每个三角形包含三个点,因此,四面体中点的总个数为()。

A:12B:6C:4D:9答案:C2.三次BEZIER曲线有几个控制点?()A:3B:5C:4D:6答案:C3.三次BEZIER曲线经过几个控制点?()A:3B:4C:2D:1答案:C4.不经过Y轴的斜线绕Y轴旋转得到的曲面是()A:半球面B:球面C:柱面D:圆台面答案:B5.BEZIER曲线上的所有点都是由控制点经过插值得到的。

()A:错B:对答案:A第三章测试1.通过变换可以将单位圆变成长半轴2短轴0.5的椭圆,具体实施步骤是()。

A:水平方向做平移变换,竖值方向做平移变换B:水平方向做拉伸变换,竖值方向做平移变换C:水平方向做收缩变换,竖值方向做拉伸变换D:水平方向做拉伸变换,竖值方向做收缩变换答案:B2.变换前后二线夹角保持不变的保角变换有()A:镜像B:旋转C:平移D:缩放答案:D3.水平方向的剪切变换,如果表达为x’=ax+by y’=c x+dy,则有()。

A:b=1,c=1,d=0B:a=0,b=1,c=1C:a=1,b=0,d=1D:a=1,c=0,d=1答案:D4.正交变换不包括()。

A:剪切B:镜像C:旋转D:平移答案:A5.变换的复合运算不满足交换律。

计算机图形学总复习

计算机图形学总复习

第一章:(蓝色字体为部分答案)●计算机图形学的定义?计算机图形学是研究通过计算机将数据转换为图形,并在专门显示设备上显示的原理、方法和技术的学科。

●计算机图形学常见的应用领域有哪些?(应用领域的标题)●计算机图形学的相关学科有哪些?和计算机图形学互逆的学科是?●CRT中为什么需要刷新?刷新频率是什么?由于荧光物质存在余晖时间,为了让荧光物质保持一个稳定的亮度值,电子束必须不断的重复描绘出原来的图形,这个过程叫做刷新刷新频率:每秒钟重绘屏幕的次数(次/秒、HZ)●彩色CRT和单色CRT的区别:⏹在荧光屏的内表面安装一个影孔板,用于精确定位像素的位置⏹CRT屏幕内部涂有很多组呈三角形的荧光粉,每一组由三个荧光点,三色荧光点由红、绿、蓝三基色组成(一组荧光点对应一个像素)⏹三支电子枪, 分别与三基色相对应●光栅扫描显示器中帧缓存是什么?位面是什么?⏹存储用于刷新的图像信息。

也就是存储屏幕上像素的颜色值。

⏹帧缓存的单位是位面。

⏹光栅扫描显示器屏幕上有多少个像素,该显示器的帧缓存的每个位面就有多少个一位存储器●1024×1024像素组成的24位真彩色光栅扫描显示器所需要的最小帧缓存是多少?第二章●什么是CDC?在微软基类库MFC中,CDC类是定义设备上下文对象的基类,所有绘图函数都在CDC基类中定义。

⏹简述CDC的4个派生类的名称,以及作用CClientDC类:显示器客户区设备上下文类CClientDC只能在窗口的客户区(不包括边框、标题栏、菜单栏以及状态栏的空白区域)进行绘图CMetaFileDCCMetaFileDC封装了在一个Windows图元文件中绘图的方法CPaintDC类该类一般用在响应WM_PAINT消息的成员函数OnPaint()中使用CWindowDC类整个窗口区域的显示器设备上下文类,包括客户区和非客户区(即窗口的边框、标题栏、菜单栏以及状态栏)⏹什么是映射模式?映射模式定义了Windows如何将绘图函数中指定的逻辑坐标映射为设备坐标输出到显示器或者打印机上。

《计算机图形学》练习题答案

《计算机图形学》练习题答案

《计算机图形学》练习题(答案)《计算机图形学》练习题1.直线扫描转换的Bresenham算法(1) 请写出生成其斜率介于0和1之间的直线的Bresenham算法步骤。

(2) 设一直线段的起点和终点坐标分别为(1,1)和(8,5),请用Bresenham算法生成此直线段,确定所有要绘制象素坐标。

(1)①输入线段的两个端点,并将左端点存储在(x0,y0)中②将(x0,y0)装入帧缓存,画出第一个点③计算常量∆x, ∆y, 2∆y, and 2∆y-2∆x,并得到决策参数的第一个值:p0 = 2∆y - ∆x④从k=0开始,在沿线路径的每个xk处,进行下列检测:如果pk < 0,下一个要绘制的点就是(xk +1,yk) ,并且pk+1 = pk + 2∆y否则下一个要绘制的点就是(xk +1, yk +1),并且 pk+1 = pk + 2∆y- 2∆x⑤重复步骤4,共∆x-1次(2)m=(5-1)/(8-1)=0.57∆x=7 ∆y=4P0=2∆y-∆x=12∆y=8 2∆y-2∆x=-6 k pk (xk+1,yk+1)0 1 (2,2)1 -5 (3,2)2 3 (4,3)3 -3 (5,3)4 5 (6,4)5 -1 (7,4)6 7 (8,5)2.已知一多边形如图1所示,其顶点为V1、V2、V3、V4、V5、V6,边为E1、E2、E3、E4、E5、E6。

用多边形的扫描填充算法对此多边形进行填充时(扫描线从下到上)要建立边分类表(sorted edge table)并不断更新活化边表(active edge list)。

(1)在表1中填写边分类表中每条扫描线上包含的边(标明边号即可);(2)在表2中写出边分类表中每条边结构中各成员变量的初始值(3) 指出位于扫描线y=6,7,8,9和10时活化边表中包含那些边,并写出这些边中的x值、ymax值、和斜率的倒数值1/m。

表1边分y1边 x y max 1/m 4 1 1 97 4 60 05 1 9 76 0 0 61 9 6 6 0 0Y 值(Scan Line Number ) 边(Edge Number ) 1 0 2 0 3 0 4 E1 5 E6,E2 6 E6 7 E3 8 E5,E3 9E4 10 01 2 3 4 5 6 7 8 9 1表 2 边的初7 1 18 7 790 1-18 2 7 9 9 1 -19 3 36 9 991-13. 二维变换(1) 记P(xf,yf)为固定点,sx、sy分别为沿x 轴和y轴方向的缩放系数,请用齐次坐标(Homogeneous Coordinate)表示写出二维固定点缩放变换的变换矩阵。

计算机图形学第7章曲线和曲面分析

计算机图形学第7章曲线和曲面分析

基矩阵: Ms
几何约束条件: G
基函数(blenging function),或称混合函数。
08:43
曲线和曲面
7.2 三次样条
给定n+1个点,可得到通过各个点的分段三次多项式曲线:
x(t) y(t)
axt ayt
3 3
bxt byt
2 2
cxt cyt
dx dyz(t)源自azt3bzt
6.参数变化对各因变量的影响可以明显地表示出来
08:43
曲线和曲面
7.1.4 插值和逼近样条
▪ 采用模线样板法表示和传递自由曲线曲 面的形状称为样条。
▪ 样条曲线是指由多项式曲线段连接而成 的曲线,在每段的边界处满足特定的连 续条件。
▪ 样条曲面则可以用两组正交样条曲线来 描述。
08:43
曲线和曲面
x(t) y(t)
ant n bnt n
a2t b2t
2 2
a1t1 b1t1
a0 b0
z(t)
cnt n
c2t
2
c1t1
c0
t [0,1]
08:43
曲线和曲面
x(t )
p(t)
y(t)
tn
z(t)
t
an
1 aa10
bn
b1 b0
cn
c1 c0
T C T M S G t[0,1]
特点: 只适用于型值点分布比较均匀的场合 不能“局部控制”
08:43
曲线和曲面
7.2.2 三次Hermite样条
定 义 : 假 定 型 值 点 Pk 和 Pk+1 之 间 的 曲 线 段 为 p(t),t∈[0,1],给定矢量Pk、Pk+1、Rk和Rk+1,则 满足下列条件的三次参数曲线为三次Hermite样条 曲线:

第七章-三维实体的表示

第七章-三维实体的表示
◦ 对于一个占据有限空间的正则点集,如果其表面 是二维流形,则该正则点集是实体(有效物体)。这 个描述中的条件在计算机中是可检测的。
5
正则集合运算
通过对简单实体做适当的运算来构造复杂实 体是一个有效的方法。
实体可看作点集,对实体进行的运算主要是 集合运算。
但是对两个实体做普通的集合运算并不能保 证其结果仍是实体。如下,两个二维实体A 、B求交:
20
实体表示方法——边界表示
◦ 简单多面体是指与球拓扑同构的的多面体,可连 续变换成一个球。它满足下面的欧拉公式:
v-e+f=2
其中v,e,f分别是多面体的顶点数、边数和面数。欧 拉公式是一个多面体为简单多面体的必要但非充 分条件。
v=8,e=12,f=6
v=4,e=6,f=4
21
实体表示方法——边界表示
◦ 正则运算即为先对物体取内点再取闭包的运算。 r•A为A的正则点集。但正则点集未必是实体。
4
实体的定义
下图是带悬挂边与孤立点、边的二维物体, 以此为例来说明正则运算的过程。
二维流形:
◦ 是指这样一些面,其上任一点都存在一个充分小 的邻域,该领域与平面上的圆盘是同构的,即在 该邻域与圆盘之间存在连续的一一映射。

Sb SiS
◦ 由实体的定义可知,bS是封闭的,它将整个三维 空间分成了三个区域(iS,bS,eS)。边界bS与实体S是 一一对应的,确定了边界,也就唯一确定了一个 实体。为了求实体A,B的正则运算结果Aop*B ,只 要求出其边界b(Aop*B)即可。我们有:
b ( b A i) A B ( b b A ) ( b B e A )B
2
实体的定义
实体造型中必须保证物体的有效性(客观存在 )。

【中南大学】计算机图形学习题及答案

【中南大学】计算机图形学习题及答案

计算机图形学作业答案第一章序论第二章图形系统1.什么是图像的分辨率?解答:在水平和垂直方向上每单位长度(如英寸)所包含的像素点的数目。

2.计算在240像素/英寸下640×480图像的大小。

解答:(640/240)×(480/240)或者(8/3)×2英寸。

3.计算有512×512像素的2×2英寸图像的分辨率。

解答:512/2或256像素/英寸。

第三章二维图形生成技术1.一条直线的两个端点是(0,0)和(6,18),计算x从0变到6时y所对应的值,并画出结果。

解答:由于直线的方程没有给出,所以必须找到直线的方程。

下面是寻找直线方程(y =mx+b)的过程。

首先寻找斜率:m =⊿y/⊿x =(y2-y1)/(x2-x1)=(18-0)/(6-0) = 3 接着b在y轴的截距可以代入方程y=3x+b求出 0=3(0)+b。

因此b=0,所以直线方程为y=3x。

2.使用斜截式方程画斜率介于0°和45°之间的直线的步骤是什么?解答:(1)计算dx:dx=x2-x1。

(2)计算dy:dy=y2-y1。

(3)计算m:m=dy/dx。

(4)计算b: b=y1-m×x1(5)设置左下方的端点坐标为(x,y),同时将x end设为x的最大值。

如果dx < 0,则x=x2、y=y2和x end=x1。

如果dx > 0,那么x=x1、y=y1和x end=x2。

(6)测试整条线是否已经画完,如果x > x end就停止。

(7)在当前的(x,y)坐标画一个点。

(8)增加x:x=x+1。

(9)根据方程y=mx+b计算下一个y值。

(10)转到步骤(6)。

3.请用伪代码程序描述使用斜截式方程画一条斜率介于45°和-45°(即|m|>1)之间的直线所需的步骤。

假设线段的两个端点为(x1,y1)和(x2,y2),且y1<y2int x = x1, y = y1;float x f, m = (y2-y1)/(x2-x1), b = y1-mx1;setPixel( x, y );/*画一个像素点*/while( y < y2 ) {y++;x f = ( y-b)/m;x = Floor( x f +0.5 );setPixel( x, y );}4.请用伪代码程序描述使用DDA算法扫描转换一条斜率介于-45°和45°(即|m| ≤1)之间的直线所需的步骤。

图形学复习资料 (含部分答案)

图形学复习资料 (含部分答案)

计算机图形学复习指导一、考试大纲要求掌握计算机图形学和图形系统所必须的基本原理,其主要内容包括:(一)计算机图形学和图形系统基本知识计算机图形学研究对象及应用领域;图形系统的硬软件及图形标推接口。

(二)二维基本图形生成算法直线和二次曲线生成的常用算法;字符和区域填充的实现方法。

(三)图形的剪裁和几何变换窗口视图变换;二维图形的裁剪的原理与方法;二维和三维图形的各种几何变换及其表示。

(四)三维物体的表示方法与输出显示处理各种不同类型曲面的参数表示;实体的定义、性质及各种几何表示方法;投影变换原理与实现;观察空间的定义和转换;三维裁剪。

(五)常用的光学模型及其算法实现(六)消隐显示和阴影生成等实现真实感图形的常用技术二、复习指南2(一)计算机图形学和图形系统基本知识1.计算机图形学研究对象及应用领域2.图形硬件设备3.图形软件系统4.图形标准接口(二)二维图形生成1.直线的生成算法(1)生成直线的常用算法---逐点比较法、数字微分(DDA)法和Bresenham 算法。

(2)直线属性——线型、线宽和线色。

2.曲线的生成算法(1)二次曲线的生成算法---圆弧的逐点比较插补法、圆/椭圆弧的角度数字微分(DDA)法、Bresenham 画圆算法和参数拟合法。

(2)自由曲线的设计---抛物线参数样条曲线、Hermite 曲线、三次参数样条曲线、Bezier 曲线和B 样条曲线。

3.字符(1)字符编码---ASCII 码和汉字国标码。

(2)矢量字符的存储与显示。

(3)点阵字符的存储与显示。

4.区域填充(1)种子填充算法。

(2)扫描转换填充算法。

(3)区域填充属性---式样、颜色和图案。

(三)图形的剪裁和几何变换1.窗口视图变换窗口区与视图区及其变换。

2.二维图形的裁剪(1)二维图形的裁剪的策略及原理。

(2)二维线段的裁剪方法---矢量裁剪法、编码裁剪法和中点分割裁剪法。

(3)字符的裁剪---矢量裁剪、字符裁剪和字符串裁剪法。

高级计算机图形学原理与实践智慧树知到课后章节答案2023年下西安科技大学

高级计算机图形学原理与实践智慧树知到课后章节答案2023年下西安科技大学

高级计算机图形学原理与实践智慧树知到课后章节答案2023年下西安科技大学第一章测试1.计算机图形学与计算几何之间的关系是( ) A:计算几何是计算机图形学的前身 B:两门毫不相干的学科 C:学术上的同义词 D:计算机图形学以计算几何为理论基础答案:计算机图形学以计算几何为理论基础2.Edwin Catmull首次提出了计算机图形学的概念。

()A:错 B:对答案:错3.计算机辅助设计与制造(CAD/CAM)的代表软件有哪些?()A:3D MaxB:Maya C:AutoCAD D:Unity 答案:3D Max;AutoCAD4.虚拟现实不属于计算机图形学的应用领域。

()A:错 B:对答案:错5.计算机图形显示器一般使用什么颜色模型?( ) A:RGB B:HLS C:CMY D:HSV 答案:RGB6.RGB三基色通过适当的混合能产生所有颜色。

()A:错 B:对答案:对第二章测试1.下面哪些方法可以减轻走样现象()。

A:非加权区域采样 B:降低空间分辨率 C:提高空间分辨率 D:加权区域采样答案:非加权区域采样 ;提高空间分辨率 ;加权区域采样2.利用数值微分算法进行直线的扫描转换不需要进行浮点数的加减法。

()A:对 B:错答案:错3.Brenham算法进行直线绘制, x为主方向,当中点误差项d>0时,y方向上应不走步。

()A:错 B:对答案:错4.走样是光栅扫描器的一种固有属性,不可避免,只能减轻。

()A:错 B:对答案:对5.有效边表算法中每一条扫描线交点的个数只能是偶数。

()A:错 B:对答案:对第三章测试1.n次B样条曲线中,更改一个控制顶点,最多影响()段曲线。

A:n+1 B:nC:1 D:所有答案:n+12.下面哪些性质是NURBS曲面不具备的()。

A:仿射变换不变性 B:局部修改性 C:凸包性 D:变差缩减小答案:变差缩减小3.曲线的插值拟合方法通过每个型值点。

()A:对 B:错答案:对4.B样条曲线曲面都可以精确的表示二次曲线弧或曲面。

计算机图形学-第7章-消除隐藏线和隐藏面

计算机图形学-第7章-消除隐藏线和隐藏面

可能的四种形体
隐藏线和隐藏面
不可见的线和面分别称为隐藏线和隐藏面。 隐藏线和面不仅仅有形体自身的,而且还 有形体之间互相遮挡的。消除它们即称为 消除隐藏线和消除隐藏面。
形体之间互相遮挡的隐藏线
当我们显示线条图或用笔式绘图仪或其 它线画设备绘制线条图形时,要解决的 主要是消除隐藏线的问题。而当用光栅 扫描显示器显示物体的明暗图形时,就 必须要解决消除隐藏面的问题。
设n={A,B,C},而
n
A ( y j )(zi z j ) i 1 n
B (zi z j )(xi x j ) i 1 n
C (xi x j )( yi y j ) i 1
式中若 i n,则j=i+1;否则i=n,j=1。 以上算法适合任何平面多边形。
非平面但接近平面的多边形的最佳逼近平面 的法矢量也可用此算法求出。为避免在程序 中出现两种计算平面外矢量的方法,建议凸 多边形也采用该算法计算外法矢量。多边形 所在平面的方程可写成
Ax By Cz D 0
其中 D ( Ax0 By0 Cz0 ,)
(x0 , y0 , z0 ) 为平面上任意一点。
7.2.2 深度检验
深度检验是比较位于同一条投射线的若干 个点的深度坐标(一般为z坐标),以确定 哪个点是可见的,将可见点表示出来。消 隐时必须进行深度检验。一般将需要比较 的各点的z坐标按递增或递减排序,也可从 中选出最大或最小的z坐标。至于选最大或 最小与所选的坐标系有关。
7.2.1 平面多边形的外法矢量
为了判别物体上各表面是朝前面还是朝后
面,需求出各表面(平面多边形)指向体外
的法矢量。设物体在右手坐标系中,多边
形顶点按逆时针排列。当多边形为凸多边
形时,则其法矢可取成多边形相邻两边矢

《计算机图形学》1-8章习题解答

《计算机图形学》1-8章习题解答
由于参数方程次数太低会导致控制曲线的灵活性降低,曲线不连续;而次数太高则会导致计算复杂,存储开销增大。因此,为了在计算速度和灵活性之间寻找一个合理的折衷方案,多采用三次参数方程来表示自由曲线。
3.请给出Hermite形式曲线的曲线段i与曲线段i-1及曲线段i+1实现C1连续的条件。
答:参见教材第133页。
(4)进行步骤(2)和(1)的逆变换,变换矩阵为 和 。
设向量 ,则有 ,所以变化矩阵为:
8.如何确定一个点P在观察点的内部还是外部?
答:一个平面将空间分成两部分。平面的一般方程是:
对于任意点 ,若定义一个标量函数 ,有:
如果 ,则说明P点和Q点在同一边(相对平面而言)。令 分别表示顶平面、底平面、右平面、左平面、前平面、后平面。
(a)相对于水平线y=2;
(b)相对于垂直线x=2;
(c)相对于直线y=x+2。
答:
(a)
(b)
(c)
4.请写出一个图例变换,将正方形A(0,0),B(1,0),C(1,1),D(0,1)一半大小的复本放到主图形的坐标系中,且正方形的中心在(-1,-1)点。
答:原正方形的中心在P(1/2,1/2),首先进行关于P点的缩放变换,变换矩阵为M;
对 到 直线上的任意点 ,要证明 在 和 连接的直线上,其中 是 的变换,且 ,(3)
即要证明: ,(4)
将公式(1)、(2)、(3)代入公式(4),经整理得:
因为 满足: ,
由此得到, 在 和 连接的直线上。
6.二次旋转变换定义为先绕x轴旋转再绕y轴旋转的变换:
(a)写出这个变换的矩阵;
(b)旋转的先后顺序对结果有影响吗?
A(0001)B(1000)、C(0000)D(1010)、E(0000)F(0000)、G(0100)H(0010)、I(1001)J(1000)

交互式计算机图形学1-7章课后题答案

交互式计算机图形学1-7章课后题答案

交互式计算机图形学(第五版)1-7章课后题答案(总13页)--本页仅作为文档封面,使用时请直接删除即可----内页可以根据需求调整合适字体及大小--Angel: Interactive Computer Graphics, Fifth Edition Chapter 1 SolutionsThe main advantage of the pipeline is that each primitive can be processed independently. Not only does this architecture lead to fast performance, it reduces memory requirements because we need not keep all objects available. The main disadvantage is that we cannot handle most global effects such as shadows, reflections, and blending in a physically correct manner.We derive this algorithm later in Chapter 6. First, we can form the tetrahedron by finding four equally spaced points on a unit sphere centered at the origin. One approach is to start with one point on the z axis(0, 0, 1). We then can place the other three points in a plane of constant z. One of these three points can be placed on the y axis. To satisfy the requirement that the points be equidistant, the point must be at(0, 2p2/3,−1/3). The other two can be found by symmetry to be at(−p6/3,−p2/3,−1/3) and (p6/3,−p2/3,−1/3).We can subdivide each face of the tetrahedron into four equilateral triangles by bisecting the sides and connecting the bisectors. However, the bisectors of the sides are not on the unit circle so we must push these points out to the unit circle by scaling the values. We can continue this process recursively on each of the triangles created by the bisection process. In Exercise , we saw that we could intersect the line of which theline segment is part independently against each of the sides of the window. We could do this process iteratively, each time shortening the line segment if it intersects one side of the window.In a one–point perspective, two faces of the cube is parallel to the projection plane, while in a two–point perspective only the edges of the cube in one direction are parallel to the projection. In the general case of a three–point perspective there are three vanishing points and none of the edges of the cube are parallel to the projection plane.Each frame for a 480 x 640 pixel video display contains only about300k pixels whereas the 2000 x 3000 pixel movie frame has 6M pixels, or about 18 times as many as the video display. Thus, it can take 18 times asmuch time to render each frame if there is a lot of pixel-level calculations. There are single beam CRTs. One scheme is to arrange the phosphorsin vertical stripes (red, green, blue, red, green, ....). The major difficulty is that the beam must change very rapidly, approximately three times as fast a each beam in a three beam system. The electronics in such a system the electronic components must also be much faster (and more expensive). Chapter 2 SolutionsWe can solve this problem separately in the x and y directions. The transformation is linear, that is xs = ax + b, ys = cy + d. We must maintain proportions, so that xs in the same relative position in the viewport as x is in the window, hencex − xminxmax − xmin=xs − uw,xs = u + wx − xminxmax − xmin.Likewiseys = v + hx − xminymax − ymin.Most practical tests work on a line by line basis. Usually we use scanlines, each of which corresponds to a row of pixels in the frame buffer. If we compute the intersections of the edges of the polygon with a line passing through it, these intersections can be ordered. The first intersection begins a set of points inside the polygon. The second intersection leaves the polygon, the third reenters and so on.There are two fundamental approaches: vertex lists and edge lists.With vertex lists we store the vertex locations in an array. The mesh is represented as a list of interior polygons (those polygons with no otherpolygons inside them). Each interior polygon is represented as an array of pointers into the vertex array. To draw the mesh, we traverse the list of interior polygons, drawing each polygon.One disadvantage of the vertex list is that if we wish to draw the edges in the mesh, by rendering each polygon shared edges are drawn twice. We can avoid this problem by forming an edge list or edge array, each element is a pair of pointers to vertices in the vertex array. Thus, we can draw each edge once by simply traversing the edge list. However, the simple edge list has no information on polygons and thus if we want to render the mesh in some other way such as by filling interior polygons we must add something to this data structure that gives information as to which edges form each polygon.A flexible mesh representation would consist of an edge list, a vertex list and a polygon list with pointers so we could know which edges belong to which polygons and which polygons share a given vertex.The Maxwell triangle corresponds to the triangle that connects thered, green, and blue vertices in the color cube.Consider the lines defined by the sides of the polygon. We can assigna direction for each of these lines by traversing the vertices in acounter-clockwise order. One very simple test is obtained by noting that any point inside the object is on the left of each of these lines. Thus, if we substitute the point into the equation for each of the lines (ax+by+c), we should always get the same sign.There are eight vertices and thus 256 = 28 possible black/white colorings. If we remove symmetries (black/white and rotational) there are 14 unique cases. See Angel, Interactive Computer Graphics (Third Edition) or the paper by Lorensen and Kline in the references.Chapter 3 SolutionsThe general problem is how to describe a set of characters that might have thickness, curvature, and holes (such as in the letters a and q). Suppose that we consider a simple example where each character can be approximated by a sequence of line segments. One possibility is to use a move/line system where 0 is a move and 1 a line. Then a character can be described by a sequence of the form (x0, y0, b0), (x1, y1, b1), (x2, y2, b2), .....where bi is a 0 or 1. This approach is used in the example in the OpenGL Programming Guide. A more elaborate font can be developed by using polygons instead of line segments.There are a couple of potential problems. One is that the application program can map different points in object coordinates to the same point in screen coordinates. Second, a given position on the screen when transformed back into object coordinates may lie outside the user’s window.Each scan is allocated 1/60 second. For a given scan we have to take 10% of the time for the vertical retrace which means that we start to draw scan line n at .9n/(60*1024) seconds from the beginning of the refresh. But allocating 10% of this time for the horizontal retrace we are at pixel m on this line at time .81nm/(60*1024).When the display is changing, primitives that move or are removedfrom the display will leave a trace or motion blur on the display as the phosphors persist. Long persistence phosphors have been used in text only displays where motion blur is less of a problem and the long persistence gives a very stable flicker-free image.Chapter 4 SolutionsIf the scaling matrix is uniform thenRS = RS(α, α, α) = αR = SRConsider R x(θ), if we multiply and use the standard trigonometric identities for the sine and cosine of the sum of two angles, we findR x(θ)R x(φ) = R x(θ + φ)By simply multiplying the matrices we findT(x1, y1, z1)T(x2, y2, z2) = T(x1 + x2, y1 + y2, z1 + z2)There are 12 degrees of freedom in the three–dimensional affine transformation. Consider a point p = [x, y, z, 1]T that is transformed top_ = [x_y_, z_, 1]T by the matrix M. Hence we have the relationshipp_ = Mp where M has 12 unknown coefficients but p and p_ are known. Thus we have 3 equations in 12 unknowns (the fourth equation is simply the identity 1=1). If we have 4 such pairs of points we will have 12 equations in 12 unknowns which could be solved for the elements of M.Thus if we know how a quadrilateral is transformed we can determine theaffine transformation.In two dimensions, there are 6 degrees of freedom in M but p and p_ haveonly x and y components. Hence if we know 3 points both before and after transformation, we will have 6 equations in 6 unknowns and thus in two dimensions if we know how a triangle is transformed we can determine theaffine transformation.It is easy to show by simply multiplying the matrices that theconcatenation of two rotations yields a rotation and that the concatenationof two translations yields a translation. If we look at the product of arotation and a translation, we find that the left three columns of RT arethe left three columns of R and the right column of RT is the rightcolumn of the translation matrix. If we now consider RTR_ where R_ is arotation matrix, the left three columns are exactly the same as the leftthree columns of RR_ and the and right column still has 1 as its bottom element. Thus, the form is the same as RT with an altered rotation (whichis the concatenation of the two rotations) and an altered translation. Inductively, we can see that any further concatenations with rotations and translations do not alter this form.If we do a translation by -h we convert the problem to reflection abouta line passing through the origin. From m we can find an angle by whichwe can rotate so the line is aligned with either the x or y axis. Now reflectabout the x or y axis. Finally we undo the rotation and translation so the sequence is of the form T−1R−1SRT.The most sensible place to put the shear is second so that the instance transformation becomes I = TRHS. We can see that this order makessense if we consider a cube centered at the origin whose sides are alignedwith the axes. The scale gives us the desired size and proportions. Theshear then converts the right parallelepiped to a general parallelepiped.Finally we can orient this parallelepiped with a rotation and place it wheredesired with a translation. Note that the order I = TRSH will work too.R = R z(θz)R y(θy)R x(θx) =⎡⎢⎢⎢⎣cos θy cos θz cos θz sin θx sin θy − cos θx sin θz cos θx cos θz sin θy + sin θx sin θz 0 cos θy sin θz cos θx cos θz + sin θx sin θy sin θz −cos θz sin θx + cos θx sin θy sin θz 0−sin θy cos θy sin θx cos θx cos θy 00 0 0 1⎤⎥⎥⎥⎦One test is to use the first three vertices to find the equation of the plane ax + by + cz + d = 0. Although there are four coefficients in the equation only three are independent so we can select one arbitrarily or normalize so that a2 + b2 + c2 = 1. Then we can successively evaluateax + bc + cz + d for the other vertices. A vertex will be on the plane if we evaluate to zero. An equivalent test is to form the matrix⎡⎢⎢⎢⎣1 1 1 1x1 x2 x3 x4y1 y2 y3 y4z1 z2 z3 z4⎤⎥⎥⎥⎦for each i = 4, ... If the determinant of this matrix is zero the ith vertex isin the plane determined by the first three.Although we will have the same number of degrees of freedom in the objects we produce, the class of objects will be very different. For example if we rotate a square before we apply a nonuniform scale, we will shear the square, something we cannot do if we scale then rotate.The vector a = u × v is orthogonal to u and v. The vector b = u × a is orthogonal to u and a. Hence, u, a and b form an orthogonal coordinate system.Using r = cos θ2+ sin θ2v, with θ = 90 and v = (1, 0, 0), we find forrotation about the x-axisr =√22(1, 1, 0, 0).Likewise, for rotation about the y axisr =√22(1, 0, 1, 0).Possible reasons include (1) object-oriented systems are slower, (2) users are often comfortable working in world coordinates with higher-level objects and do not need the flexibility offered by a coordinate-free approach, (3) even a system that provides scalars, vectors, and points would have to have an underlying frame to use for the implementation.Chapter 5 SolutionsEclipses (both solar and lunar) are good examples of the projection ofan object (the moon or the earth) onto a nonplanar surface. Any time a shadow is created on curved surface, there is a nonplanar projection. All the maps in an atlas are examples of the use of curved projectors. If the projectors were not curved we could not project the entire surface of a spherical object (the Earth) onto a rectangle.Suppose that we want the view of the Earth rotating about the sun. Before we draw the earth, we must rotate the Earth which is a rotation about the y axis. Next we translate the Earth away from the origin. Finally we do another rotation about the y axis to position the Earth in its desired location along its orbit. There are a number of interesting variants of this problem such as the view from the Earth of the rest of the solar system.Yes. Any sequence of rotations is equivalent to a single rotation abouta suitably chosen axis. One way to compute this rotation matrix is to form the matrix by sequence of simple rotations, such asR = RxRyRz.The desired axis is an eigenvector of this matrix.The result follows from the transformation being affine. We can also take a direct approach. Consider the line determined by the points(x1, y1, z1) and (x2, y2, z2). Any point along can be written parametrically as (_x1 + (1 − _)x2, _y1 + (1 − _)y2, _z1 + (1 − _)z2). Consider the simple projection of this point 1d(_z1+(1−_)z2) (_x1 + (1 − _)x2, _y1 + (1 − _)y2)w hich is of the form f(_)(_x1 + (1 − _)x2, _y1 + (1 − _)y2). This form describes a line because the slope is constant. Note that the function f(_) implies that we trace out the line at a nonlinear rate as _ increases from 0 to 1.The specification used in many graphics text is of the angles the projector makes with x,z and y, z planes, the angles defined by the projection of a projector by a top view and a side view.Another approach is to specify the foreshortening of one or two sides of acube aligned with the axes.The CORE system used this approach. Retained objects were kept in distorted form. Any transformation to any object that was defined with other than an orthographic view transformed the distorted object and the orthographic projection of the transformed distorted object was incorrect. If we use _ = _ = 45, we obtain the projection matrixP =266641 0 −1 00 1 −1 00 0 0 00 0 0 137775All the points on the projection of the point , z) in the directiondx, dy, dz) are of the form (x + _dx, y + _dy, z + _dz). Thus the shadow of the point (x, y, z) is found by determining the _ for which the line intersects the plane, that isaxs + bys + czs = dSubstituting and solving, we find_ =d − ax − by − czadx + bdy + cdz.However, what we want is a projection matrix, Using this value of _ we findxs = z + _dx =x(bdy + cdx) − dx(d − by − cz)adx + bdy + cdzwith similar equations for ys and zs. These results can be computed by multiplying the homogeneous coordinate point (x, y, z, 1) by the projection matrixM =26664bdy + cdz −bdx −cdx −ddx−ady adx + cdz −cdy −ddy−adz −bdz adx + bdy −ddz0 0 0 adx + bdy + cdz37775.Suppose that the average of the two eye positions is at (x, y, z) andthe viewer is looking at the origin. We could form the images using the LookAt function twice, that isgluLookAt(x-dx/2, y, z, 0, 0, 0, 0, 1, 0);/* draw scene here *//* swap buffers and clear */gluLookAt(x+dx/2, y, z, 0, 0, 0, 0, 1, 0);/* draw scene again *//* swap buffers and clear */Chapter 6 SolutionsPoint sources produce a very harsh lighting. Such images are characterized by abrupt transitions between light and dark. The ambient light in a real scene is dependent on both the lights on the scene and the reflectivity properties of the objects in the scene, something that cannot be computed correctly with OpenGL. The Phong reflection term is not physically correct; the reflection term in the modified Phong model is even further from being physically correct.If we were to take into account a light source being obscured by an object, we would have to have all polygons available so as to test for this condition. Such a global calculation is incompatible with the pipeline model that assumes we can shade each polygon independently of all other polygons as it flows through the pipeline.Materials absorb light from sources. Thus, a surface that appears red under white light appears so because the surface absorbs all wavelengths of light except in the red range—a subtractive process. To be compatible with such a model, we should use surface absorbtion constants that define the materials for cyan, magenta and yellow, rather than red, green and blue.Let ψ be the angle between the normal and the halfway vector, φ bethe angle between the viewer and the reflection angle, and θ be the angle between the normal and the light source. If all the vectors lie in the same plane, the angle between the light source and the viewer can be computer either as φ + 2θ or as 2(θ + ψ). Setting the two equal, we find φ = 2ψ. Ifthe vectors are not coplanar then φ < 2ψ.Without loss of generality, we can consider the problem in twodimensions. Suppose that the first material has a velocity of light of v1 and the second material has a light velocity of v2. Furthermore, assume that the axis y = 0 separates the two materials.Place a point light source at (0, h) where h > 0 and a viewer at (x, y) where y < 0. Light will travel in a straight line from the source to a point (t, 0) where it will leave the first material and enter the second. It will then travel from this point in a straight line to (x, y). We must find the t that minimizes the time travelled.Using some simple trigonometry, we find the line from the source to (t, 0) has length l1 = √h2 + t2 and the line from there to the viewer has length 1l2 = _y2 + (x − t)2. The total time light travels is thus l1v1 + l2v2 .Minimizing over t gives desired result when we note the two desired sines are sin θ1 = h√h2+t2 and sin θ2 = −y √(y2+(x−t)2 .Shading requires that when we transform normals and points, we maintain the angle between them or equivalently have the dot productp ·v = p_ ·v_ when p_ = Mp and n_ = Mp. If M T M is an identity matrix angles are preserved. Such a matrix (M−1 = M T ) is called orthogonal. Rotations and translations are orthogonal but scaling and shear are not.Probably the easiest approach to this problem is to rotate the given plane to plane z = 0 and rotate the light source and objects in the same way. Now we have the same problem we have solved and can rotate everything back at the end.A global rendering approach would generate all shadows correctly. Ina global renderer, as each point is shaded, a calculation is done to see which light sources shine on it. The projection approach assumes that we can project each polygon onto all other polygons. If the shadow of a given polygon projects onto multiple polygons, we could not compute these shadow polygons very easily. In addition, we have not accounted for the different shades we might see if there were intersecting shadows from multiple light sources.Chapter 7 SolutionsFirst, consider the problem in two dimensions. We are looking for an _ and _ such that both parametric equations yield the same point, that isx(_) = (1 − _)x1 + _x2 = (1 − _)x3 + _x4,y(_) = (1 − _)y1 + _y2 = (1 − _)y3 + _y4.These are two equations in the two unknowns _ and _ and, as long as the line segments are not parallel (a condition that will lead to a division by zero), we can solve for _ _. If both these values are between 0 and 1, the segments intersect.If the equations are in 3D, we can solve two of them for the _ and _ where x and y meet. If when we use these values of the parameters in the two equations for z, the segments intersect if we get the same z from both equations.If we clip a convex region against a convex region, we produce the intersection of the two regions, that is the set of all points in both regions, which is a convex set and describes a convex region. To see this, consider any two points in the intersection. The line segment connecting them must be in both sets and therefore the intersection is convex.See Problem . Nonuniform scaling will not preserve the anglebetween the normal and other vectors.Note that we could use OpenGL to, produce a hidden line removed image by using the z buffer and drawing polygons with edges and interiors the same color as the background. But of course, this method was not used in pre–raster systems.Hidden–line removal algorithms work in object space, usually with either polygons or polyhedra. Back–facing polygons can be eliminated. In general, edges are intersected with polygons to determine any visible parts. Good algorithms (see Foley or Rogers) use various coherence strategies to minimize the number of intersections.The O(k) was based upon computing the intersection of rays with the planes containing the k polygons. We did not consider the cost of filling the polygons, which can be a large part of the rendering time. If we consider a scene which is viewed from a given point there will be some percentage of 1the area of the screen that is filled with polygons. As we move the viewer closer to the objects, fewer polygons will appear on the screen but each will occupy a larger area on the screen, thus leaving the area of the screenthat is filled approximately the same. Thus the rendering time will be about the same even though there are fewer polygons displayed.There are a number of ways we can attempt to get O(k log k) performance. One is to use a better sorting algorithm for the depth sort. Other strategies are based on divide and conquer such a binary spatial partitioning.If we consider a ray tracer that only casts rays to the first intersectionand does not compute shadow rays, reflected or transmitted rays, then the image produced using a Phong model at the point of intersection will be the same image as produced by our pipeline renderer. This approach is sometimes called ray casting and is used in volume rendering and CSG. However, the data are processed in a different order from the pipeline renderer. The ray tracer works ray by ray while the pipeline renderer works object by object.Consider a circle centered at the origin: x2 + y2 = r2. If we know thata point (x, y) is on the curve than, we also know (−x, y), (x,−y),(−x,−y), (y, x), (−y, x), (y,−x), and (−y,−x) are also on the curve. This observation is known as the eight–fold symmetry of the circle. Consequently, we need only generate 1/8 of the circle, a 45 degree wedge, and can obtain the rest by copying this part using the symmetries. If we consider the 45 degree wedge starting at the bottom, the slope of this curve starts at 0 and goes to 1, precisely the conditions used for Bresenham’s line algorithm. The tests are a bit more complex and we have to account for the possibility the slope will be one but the approach is the same as for line generation.Flood fill should work with arbitrary closed areas. In practice, we canget into trouble at corners if the edges are not clearly defined. Such can be the case with scanned images.Note that if we fill by scan lines vertical edges are not a problem. Probably the best way to handle the problem is to avoid it completely by never allowing vertices to be on scan lines. OpenGL does this by having vertices placed halfway between scan lines. Other systems jitter the y value of any vertex where it is an integer.Although each pixel uses five rays, the total number of rays has only doubled, . consider a second grid that is offset one half pixel in both thex and y directions.A mathematical answer can be investigated using the notion ofreconstruction of a function from its samples (see Chapter 8). However, a very easy to see by simply drawing bitmap characters that small pixels lead to very unreadable characters. A readable character should have some overlap of the pixels.We want k levels between Imin and Imax that are distributed exponentially. Then I0 = Imin, I1 = Iminr,I2 = Iminr2, ..., Ik−1 = Imax = Iminrk−1. We can solve the last equation for the desired r = ( ImaxImin)1k−1If there are very few levels, we cannot display a gradual change in brightness. Instead the viewer will see steps of intensity. A simple rule of thumb is that we need enough gray levels so that a change of one step is not visible. We can mitigate the problem by adding one bit of random noise to the least significant bit of a pixel. Thus if we have 3 bits (8 levels), the third bit will be noise. The effect of the noise will be to break up regions of almost constant intensity so the user will not be able to see a step because it will be masked by the noise. In a statistical sense the jittered image is a noisy (degraded) version of the original but in a visual sense it appears better.。

计算机图形学第7章课后习题参考答案

计算机图形学第7章课后习题参考答案

第七章1.什么叫几何造型?几何造型是一种技术,它能将物体的形状及其属性(如颜色、纹理等)存储在计算机内,形成该物体的三维几何模型,利用这个模型对原物体进行确切的数学描述或是对原物体某种状态进行真实模拟。

几何造型是用计算机及其图形工具表示、描述物体的形状,设计几何形体,模拟物体动态过程的一门综合技术。

它是集成CAD/CAM的基础,主要包括曲面造型、实体造型和特征造型三个分支。

2.几何造型有哪3种模型?各有什么特点?(1)线框模型线框模型表示的主体,不能充分反映出与计算机内部关于线数据和形状特征数据的关系;采用线框模型,在计算体积、重量等质量参数时,就无法利用隐线消去法,此外,这种模型很难表示圆筒或球之类的曲面立体。

由于线框模型的数据结构简单,具有计算机处理速度快的优点,因此用途还是很广的,特别是当未使用高性能计算机时,就能充分发挥其处理速度快的优点。

主体的线框模型在计算机生成后,利用投影法就可很容易得到立体的三视图,在制图领域中有很广泛的应用。

(2) 表面模型表面模型是在线框模型的基础上,增加了有关生成立体各表面的数据而构成的模型。

表面的定义就是一些指定某表面由哪些棱线按何种顺序组成的信息。

这种模型通常用于构造复杂的曲面物体,构形时常常利用线框功能,先构造一线框图,然后用扫描或旋转等手段变成曲面,当然也可以用系统提供的许多曲面图素来建立各种曲面模型。

表面模型由于比线框模型更高级、更优越,以及更易于在微机上实现等特点,在工程领域中有广泛的应用,特别是进行类似汽车外形设计这种有复杂表面设计工作的领域。

(3) 实体模型实体模型是3种模型中最重要的,也是出现最晚的。

实体模型的优点可以概括为:完整定义了立体图形,能区分内外部;能提供清晰的剖面图;能准确计算质量特性和有限元网格;方便机械运动的模拟。

3.分析比较CSG法与B-rep法优缺点。

CSG法(1)边界表示法强调的是形体的外表细节,详细记录了形体的所有几何和拓扑信息。

《计算机图形学》答案,第七章

《计算机图形学》答案,第七章

7.6习题2.试证明下述几何变换的矩阵运算具有互换性:(1)两个连续的旋转变换;(2)两个连续的平移变换;(3)两个连续的变比例变换;(4)当比例系数相等时的旋转和比例变换;(1)证明:设第一次的旋转变换为:cos 0 1 sin 0 1 0Tl= - sinO 1 cos 0 1 00 0 1第二次的旋转变换为:Cos 0 2 sin 0 2 0T2= - sin 0 2 cos 0 2 00 0 1则因为cos 0 1 sin 0 2+ sin 0 1-sin 0 1 sin 0 1+ cos 0 1 0Cos (0 1+02) sin (0 1+02) 0二-sin ( 0 1+02) cos ( 0 1+0 2) 00 0 1T2*T1 二cos 9 1 0cos 0 2 sin 0 2 0 COS 0 1sin 0 1 -sin 0 2cos 0 2 0 -sin 0 10 0 1 0 0T1*T2 = cos 0 1 sin 0 1 0 sin 0 2 00 - sin 0 1 cos 0 110 0 1cos 0 2-sin 0 2cos 0 20 =cos 0 1cos 9 2 0-sin 0 1 cos 0 2 00 cos 0 2+sin O 1 sin 0 2 cos 0 2- cos 0 1 sin 0 21cos 0 1 cos 0 2+ sin 0 1 sin 0 2 sin 0 1 cos 0 2 0=- sin 0 2cos 0 1 - cos 0 2 sin 0 1 cos Q 1 cos 0 2 01Cos (0 1+02) sin ( 0 1+0 2) 0 =-sin ( 0 1+0 2) cos (01+02)0 0 0 1即T1*T2二T2*T1,两个连续的旋转变换具有互换性(2) 证明:设第一次的平移变换为:1 00 Tl=0 1TxlTyl1笫二次的平移变换为:1 0 0T2=0 1 0Tx2Ty21则因为T1*T2 =1 0 0 1 0 00 1 0 0 1 0TxlTyl1 Tx2Ty2110 0二1 0Txl+Tx2Tyl+Ty21而T2*T1 =1 0 0 1 0 0 0 1 0 0 1 0Tx2Ty21 TxlTyl110 0二1cos 0 1 sin 0 2+ -sinO 1 sin 0 1+Txl+Tx2Tyl+Ty2 1即T1*T2= T2*T1,两个连续的平移变换具有互换性(3) 证明:设第一次的变比例变换为:Sxl 0Tl=0 Syl0 0第二次的变比例变换为:Sx2 0 T2 =0 Sy2 0 0 则因为T1*T2 = Sxl 00 Syl 0 0Sxl*Sx2= 0而T2*T1 =Sx2 0 0 Sy2 0 0 Sxl*Sx2= 0即T1*T2二T2灯1,两个连续的变比例变换具有互换性(4) 证明:设第一次为比例系数相等时的比例变换:STl= 0Sx2 0 0 00 Sy2 0 11Syl*Sy2 01Sxl 0 0 0Syl0 11Syl*Sy2 01第二次的为旋转变换:T2*T1 =cos 0 sin 0 0SOO- sin 0 cos 0 0OSO0 0 10 0 1即T1*T2= T2*T1, “当比例系数相等时的旋转和比例“变换具有互换性3.证明二维点相对x 轴作对称,紧跟着相对y=-x 直线作对称变换完全等价于 该点相对坐标原点作旋转变换。

计算机图形学第二版(陆枫)课后习题答案部分

计算机图形学第二版(陆枫)课后习题答案部分

计算机图形学第二版(陆枫)课后习题集第一章绪论概念:计算机图形学、图形、图像、点阵法、参数法、图形的几何要素、非几何要素、数字图像处理;计算机图形学和计算机视觉的概念及三者之间的关系;计算机图形系统的功能、计算机图形系统的总体结构。

第二章图形设备图形输入设备:有哪些。

图形显示设备:CRT的结构、原理和工作方式。

彩色CRT:结构、原理。

随机扫描和光栅扫描的图形显示器的结构和工作原理。

图形显示子系统:分辨率、像素与帧缓存、颜色查找表等基本概念,分辨率的计算第三章交互式技术什么是输入模式的问题,有哪几种输入模式。

第四章图形的表示与数据结构自学,建议至少阅读一遍第五章基本图形生成算法概念:点阵字符和矢量字符;直线和圆的扫描转换算法;多边形的扫描转换:有效边表算法;区域填充:4/8连通的边界/泛填充算法;内外测试:奇偶规则,非零环绕数规则;反走样:反走样和走样的概念,过取样和区域取样。

5.1.2 中点 Bresenham 算法(P109)5.1.2 改进 Bresenham 算法(P112)习题解答习题5(P144)5.3 试用中点Bresenham算法画直线段的原理推导斜率为负且大于1的直线段绘制过程(要求写清原理、误差函数、递推公式及最终画图过程)。

(P111)解: k<=-1 |△y|/|△x|>=1 y为最大位移方向故有构造判别式:推导d各种情况的方法(设理想直线与y=yi+1的交点为Q):所以有: y Q-kx Q-b=0 且y M=y Qd=f(x M-kx M-b-(y Q-kx Q-b)=k(x Q-x M)所以,当k<0,d>0时,M点在Q点右侧(Q在M左),取左点 P l(x i-1,y i+1)。

d<0时,M点在Q点左侧(Q在M右),取右点 Pr(x i,y i+1)。

d=0时,M点与Q点重合(Q在M点),约定取右点 Pr(x i,y i+1) 。

所以有递推公式的推导:d2=f(x i-1.5,y i+2)当d>0时,d2=y i+2-k(x i-1.5)-b 增量为1+k=d1+1+k当d<0时,d2=y i+2-k(x i-0.5)-b 增量为1=d1+1当d=0时,5.7 利用中点 Bresenham 画圆算法的原理,推导第一象限y=0到y=x圆弧段的扫描转换算法(要求写清原理、误差函数、递推公式及最终画图过程)。

交互式计算机图形学1-7章课后题答案

交互式计算机图形学1-7章课后题答案

Angel: Interactive Computer Graphics, Fifth Edition Chapter 1 SolutionsThe main advantage of the pipeline is that each primitive can be processed independently. Not only does this architecture lead to fast performance, it reduces memory requirements because we need not keep all objects available. The main disadvantage is that we cannot handle most global effects such as shadows, reflections, and blending in a physically correct manner.We derive this algorithm later in Chapter 6. First, we can form the tetrahedron by finding four equally spaced points on a unit sphere centeredat the origin. One approach is to start with one point on the z axis (0, 0, 1). We then can place the other three points in a plane of constant z.One of these three points can be placed on the y axis. To satisfy the requirement that the points be equidistant, the point must be at(0, 2p2/3,−1/3). The other two can be found by symmetry to be at(−p6/3,−p2/3,−1/3) and (p6/3,−p2/3,−1/3).We can subdivide each face of the tetrahedron into four equilateral triangles by bisecting the sides and connecting the bisectors. However, thebisectors of the sides are not on the unit circle so we must push these points out to the unit circle by scaling the values. We can continue this process recursively on each of the triangles created by the bisection process.In Exercise , we saw that we could intersect the line of which the line segment is part independently against each of the sides of the window. We could do this process iteratively, each time shortening the line segmentif it intersects one side of the window.In a one–point perspective, two faces of the cube is parallel to the projection plane, while in a two–point perspective only the edges of the cube in one direction are parallel to the projection. In the general case of athree–point perspective there are three vanishing points and none of the edges of the cube are parallel to the projection plane.Each frame for a 480 x 640 pixel video display contains only about 300k pixels whereas the 2000 x 3000 pixel movie frame has 6M pixels, or about 18 times as many as the video display. Thus, it can take 18 times asmuch time to render each frame if there is a lot of pixel-level calculations.There are single beam CRTs. One scheme is to arrange the phosphorsin vertical stripes (red, green, blue, red, green, ....). The major difficulty isthat the beam must change very rapidly, approximately three times as fast a each beam in a three beam system. The electronics in such a system the electronic components must also be much faster (and more expensive).Chapter 2 SolutionsWe can solve this problem separately in the x and y directions. The transformation is linear, that is xs = ax + b, ys = cy + d. We must maintain proportions, so that xs in the same relative position in the viewport as x is in the window, hencex − xminxmax − xmin=xs − uw,xs = u + wx − xminxmax − xmin.Likewiseys = v + hx − xminymax − ymin.Most practical tests work on a line by line basis. Usually we usescanlines, each of which corresponds to a row of pixels in the frame buffer.If we compute the intersections of the edges of the polygon with a line passing through it, these intersections can be ordered. The first intersection begins a set of points inside the polygon. The second intersection leaves the polygon, the third reenters and so on.There are two fundamental approaches: vertex lists and edge lists. With vertex lists we store the vertex locations in an array. The mesh is represented as a list of interior polygons (those polygons with no other polygons inside them). Each interior polygon is represented as an array ofpointers into the vertex array. To draw the mesh, we traverse the list ofinterior polygons, drawing each polygon.One disadvantage of the vertex list is that if we wish to draw the edges inthe mesh, by rendering each polygon shared edges are drawn twice. We can avoid this problem by forming an edge list or edge array, each element is a pair of pointers to vertices in the vertex array. Thus, we can draw eachedge once by simply traversing the edge list. However, the simple edge listhas no information on polygons and thus if we want to render the mesh in some other way such as by filling interior polygons we must add something to this data structure that gives information as to which edges form each polygon.A flexible mesh representation would consist of an edge list, a vertex listand a polygon list with pointers so we could know which edges belong to which polygons and which polygons share a given vertex.The Maxwell triangle corresponds to the triangle that connects the red, green, and blue vertices in the color cube.Consider the lines defined by the sides of the polygon. We can assign a direction for each of these lines by traversing the vertices in a counter-clockwise order. One very simple test is obtained by noting that any point inside the object is on the left of each of these lines. Thus, if wesubstitute the point into the equation for each of the lines (ax+by+c), weshould always get the same sign.There are eight vertices and thus 256 = 28 possible black/white colorings. If we remove symmetries (black/white and rotational) there are 14 unique cases. See Angel, Interactive Computer Graphics (Third Edition) or the paper by Lorensen and Kline in the references.Chapter 3 SolutionsThe general problem is how to describe a set of characters that might have thickness, curvature, and holes (such as in the letters a and q). Suppose that we consider a simple example where each character can be approximated by a sequence of line segments. One possibility is to use amove/line system where 0 is a move and 1 a line. Then a character can be described by a sequence of the form (x0, y0, b0), (x1, y1, b1), (x2, y2, b2), .....where bi is a 0 or 1. This approach is used in the example in the OpenGL Programming Guide. A more elaborate font can be developed by using polygons instead of line segments.There are a couple of potential problems. One is that the application program can map different points in object coordinates to the same point in screen coordinates. Second, a given position on the screen when transformed back into object coordinates may lie outside the user’s window.Each scan is allocated 1/60 second. For a given scan we have to take 10% of the time for the vertical retrace which means that we start to draw scan line n at .9n/(60*1024) seconds from the beginning of the refresh. But allocating 10% of this time for the horizontal retrace we are at pixel mon this line at time .81nm/(60*1024).When the display is changing, primitives that move or are removed from the display will leave a trace or motion blur on the display as the phosphors persist. Long persistence phosphors have been used in text only displays where motion blur is less of a problem and the long persistence gives a very stable flicker-free image.Chapter 4 SolutionsIf the scaling matrix is uniform thenRS = RS(α, α, α) = αR = SRConsider R x(θ), if we multiply and use the standard trigonometric identities for the sine and cosine of the sum of two angles, we findR x(θ)R x(φ) = R x(θ + φ)By simply multiplying the matrices we findT(x1, y1, z1)T(x2, y2, z2) = T(x1 + x2, y1 + y2, z1 + z2)There are 12 degrees of freedom in the three–dimensional affine transformation. Consider a point p = [x, y, z, 1]T that is transformed top_ = [x_y_, z_, 1]T by the matrix M. Hence we have the relationshipp_ = Mp where M has 12 unknown coefficients but p and p_ are known. Thus we have 3 equations in 12 unknowns (the fourth equation is simply the identity 1=1). If we have 4 such pairs of points we will have 12 equations in 12 unknowns which could be solved for the elements of M. Thus if we know how a quadrilateral is transformed we can determine the affine transformation.In two dimensions, there are 6 degrees of freedom in M but p and p_ have only x and y components. Hence if we know 3 points both before and after transformation, we will have 6 equations in 6 unknowns and thus in two dimensions if we know how a triangle is transformed we can determine the affine transformation.It is easy to show by simply multiplying the matrices that the concatenation of two rotations yields a rotation and that the concatenationof two translations yields a translation. If we look at the product of arotation and a translation, we find that the left three columns of RT are the left three columns of R and the right column of RT is the right column of the translation matrix. If we now consider RTR_ where R_ is a rotation matrix, the left three columns are exactly the same as the left three columns of RR_ and the and right column still has 1 as its bottom element. Thus, the form is the same as RT with an altered rotation (which is the concatenation of the two rotations) and an altered translation. Inductively, we can see that any further concatenations with rotations andtranslations do not alter this form.If we do a translation by -h we convert the problem to reflection about a line passing through the origin. From m we can find an angle by which we can rotate so the line is aligned with either the x or y axis. Now reflect about the x or y axis. Finally we undo the rotation and translation so thesequence is of the form T−1R−1SRT.The most sensible place to put the shear is second so that the instance transformation becomes I = TRHS. We can see that this order makes sense if we consider a cube centered at the origin whose sides are aligned with the axes. The scale gives us the desired size and proportions. The shear then converts the right parallelepiped to a general parallelepiped. Finally we can orient this parallelepiped with a rotation and place it wheredesired with a translation. Note that the order I = TRSH will work too. R = R z(θz)R y(θy)R x(θx) =⎡⎡⎡⎡⎡cos θy cos θz cos θz sin θx sin θy −cos θx sin θz cos θx cos θz sin θy + sin θx sin θz 0cos θy sin θz cos θx cos θz + sin θx sin θy sin θz −cos θz sin θx + cos θx sin θy sin θz 0−sin θy cos θy sin θx cos θx cos θy 00 0 0 1⎡⎡⎡⎡⎡One test is to use the first three vertices to find the equation of the plane ax + by + cz + d = 0. Although there are four coefficients in the equation only three are independent so we can select one arbitrarily or normalize so that a2 + b2 + c2 = 1. Then we can successively evaluate ax + bc + cz + d for the other vertices. A vertex will be on the plane if weevaluate to zero. An equivalent test is to form the matrix⎡⎡⎡⎡⎡1 1 1 1x1 x2 x3 x4y1 y2 y3 y4z1 z2 z3 z4⎡⎡⎡⎡⎡for each i = 4, ... If the determinant of this matrix is zero the ith vertex isin the plane determined by the first three.Although we will have the same number of degrees of freedom in the objects we produce, the class of objects will be very different. For exampleif we rotate a square before we apply a nonuniform scale, we will shear thesquare, something we cannot do if we scale then rotate.The vector a = u × v is orthogonal to u and v. The vector b = u × a isorthogonal to u and a. Hence, u, a and b form an orthogonal coordinate system.Using r = cos θ2+ sin θ2v, with θ = 90 and v = (1, 0, 0), we find forrotation about the x-axisr =√22(1, 1, 0, 0).Likewise, for rotation about the y axisr =√22(1, 0, 1, 0).Possible reasons include (1) object-oriented systems are slower, (2) users are often comfortable working in world coordinates withhigher-levelobjects and do not need the flexibility offered by a coordinate-free approach, (3) even a system that provides scalars, vectors, and points would have to have an underlying frame to use for the implementation.Chapter 5 SolutionsEclipses (both solar and lunar) are good examples of the projection ofan object (the moon or the earth) onto a nonplanar surface. Any time a shadow is created on curved surface, there is a nonplanar projection. All the maps in an atlas are examples of the use of curved projectors. If the projectors were not curved we could not project the entire surface of a spherical object (the Earth) onto a rectangle.Suppose that we want the view of the Earth rotating about the sun. Before we draw the earth, we must rotate the Earth which is a rotation about the y axis. Next we translate the Earth away from the origin. Finally we do another rotation about the y axis to position the Earth in itsdesired location along its orbit. There are a number of interesting variantsof this problem such as the view from the Earth of the rest of the solar system.Yes. Any sequence of rotations is equivalent to a single rotation about a suitably chosen axis. One way to compute this rotation matrix is to form the matrix by sequence of simple rotations, such asR = RxRyRz.The desired axis is an eigenvector of this matrix.The result follows from the transformation being affine. We can also take a direct approach. Consider the line determined by the points(x1, y1, z1) and (x2, y2, z2). Any point along can be written parametricallyas (_x1 + (1 −_)x2, _y1 + (1 −_)y2, _z1 + (1 −_)z2). Consider the simple projection of this point 1d(_z1+(1−_)z2) (_x1 + (1 − _)x2, _y1 + (1 − _)y2)which is of the form f(_)(_x1 + (1 − _)x2, _y1 + (1 − _)y2). This form describes a line because the slope is constant. Note that the function f(_)implies that we trace out the line at a nonlinear rate as _ increases from 0to 1.The specification used in many graphics text is of the angles the projector makes with x,z and y, z planes, the angles defined by the projection of a projector by a top view and a side view.Another approach is to specify the foreshortening of one or two sides of acube aligned with the axes.The CORE system used this approach. Retained objects were kept indistorted form. Any transformation to any object that was defined with other than an orthographic view transformed the distorted object and the orthographic projection of the transformed distorted object was incorrect.If we use _ = _ = 45, we obtain the projection matrixP =266641 0 −1 00 1 −1 00 0 0 00 0 0 137775All the points on the projection of the point , z) in the direction dx, dy, dz) are of the form (x + _dx, y + _dy, z + _dz). Thus the shadow ofthe point (x, y, z) is found by determining the _ for which the line intersects the plane, that isaxs + bys + czs = dSubstituting and solving, we find_ =d − ax − by − czadx + bdy + cdz.However, what we want is a projection matrix, Using this value of _ we findxs = z + _dx =x(bdy + cdx) − dx(d − by − cz)adx + bdy + cdzwith similar equations for ys and zs. These results can be computed by multiplying the homogeneous coordinate point (x, y, z, 1) by the projectionmatrixM =26664bdy + cdz −bdx −cdx −ddx−ady adx + cdz −cdy −ddy−adz −bdz adx + bdy −ddz0 0 0 adx + bdy + cdz37775.Suppose that the average of the two eye positions is at (x, y, z) and the viewer is looking at the origin. We could form the images using the LookAt function twice, that isgluLookAt(x-dx/2, y, z, 0, 0, 0, 0, 1, 0);/* draw scene here *//* swap buffers and clear */gluLookAt(x+dx/2, y, z, 0, 0, 0, 0, 1, 0);/* draw scene again *//* swap buffers and clear */Chapter 6 SolutionsPoint sources produce a very harsh lighting. Such images are characterized by abrupt transitions between light and dark. The ambient light in a real scene is dependent on both the lights on the scene and thereflectivity properties of the objects in the scene, something that cannot becomputed correctly with OpenGL. The Phong reflection term is not physically correct; the reflection term in the modified Phong model is evenfurther from being physically correct.If we were to take into account a light source being obscured by an object, we would have to have all polygons available so as to test for thiscondition. Such a global calculation is incompatible with the pipeline model that assumes we can shade each polygon independently of all other polygons as it flows through the pipeline.Materials absorb light from sources. Thus, a surface that appears red under white light appears so because the surface absorbs all wavelengths oflight except in the red range—a subtractive process. To be compatible withsuch a model, we should use surface absorbtion constants that define the materials for cyan, magenta and yellow, rather than red, green and blue.Let ψ be the angle between the normal and the halfway vector, φ be the angle between the viewer and the reflection angle, and θ be the anglebetween the normal and the light source. If all the vectors lie in the sameplane, the angle between the light source and the viewer can be computer either as φ + 2θ or as 2(θ + ψ). Setting the two equal, we find φ = 2ψ. Ifthe vectors are not coplanar then φ < 2ψ.Without loss of generality, we can consider the problem in two dimensions. Suppose that the first material has a velocity of light of v1 andthe second material has a light velocity of v2. Furthermore, assume that the axis y = 0 separates the two materials.Place a point light source at (0, h) where h > 0 and a viewer at (x, y) where y < 0. Light will travel in a straight line from the source to a point(t, 0) where it will leave the first material and enter the second. It willthen travel from this point in a straight line to (x, y). We must find the tthat minimizes the time travelled.Using some simple trigonometry, we find the line from the source to (t, 0)has length l1 = √h2 + t2 and the line from there to the viewer has length 1l2 = _y2 + (x − t)2. The total time light travels is thus l1v1 + l2v2 .Minimizing over t gives desired result when we note the two desired sines are sin θ1 = h√h2+t2 and sin θ2 = −y √(y2+(x−t)2 .Shading requires that when we transform normals and points, we maintain the angle between them or equivalently have the dot productp ·v = p_ ·v_ when p_ = Mp and n_ = Mp. If M T M is an identity matrix angles are preserved. Such a matrix (M−1 = M T ) is called orthogonal. Rotations and translations are orthogonal but scaling and shear are not.Probably the easiest approach to this problem is to rotate the given plane to plane z = 0 and rotate the light source and objects in the same way. Now we have the same problem we have solved and can rotate everything back at the end.A global rendering approach would generate all shadows correctly. Ina global renderer, as each point is shaded, a calculation is done to see which light sources shine on it. The projection approach assumes that we can project each polygon onto all other polygons. If the shadow of a given polygon projects onto multiple polygons, we could not compute these shadow polygons very easily. In addition, we have not accounted for the different shades we might see if there were intersecting shadows from multiple light sources.Chapter 7 SolutionsFirst, consider the problem in two dimensions. We are looking for an _ and _ such that both parametric equations yield the same point, that is x(_) = (1 − _)x1 + _x2 = (1 − _)x3 + _x4,y(_) = (1 − _)y1 + _y2 = (1 − _)y3 + _y4.These are two equations in the two unknowns _ and _ and, as long as the line segments are not parallel (a condition that will lead to a division byzero), we can solve for _ _. If both these values are between 0 and 1, thesegments intersect.If the equations are in 3D, we can solve two of them for the _ and _ where x and y meet. If when we use these values of the parameters in the two equations for z, the segments intersect if we get the same z from both equations.If we clip a convex region against a convex region, we produce the intersection of the two regions, that is the set of all points in both regions,which is a convex set and describes a convex region. To see this, consider any two points in the intersection. The line segment connecting them must be in both sets and therefore the intersection is convex.See Problem . Nonuniform scaling will not preserve the anglebetween the normal and other vectors.Note that we could use OpenGL to, produce a hidden line removed image by using the z buffer and drawing polygons with edges and interiors the same color as the background. But of course, this method was not used in pre–raster systems.Hidden–line removal algorithms work in object space, usually with either polygons or polyhedra. Back–facing polygons can be eliminated. In general, edges are intersected with polygons to determine any visible parts.Good algorithms (see Foley or Rogers) use various coherence strategies tominimize the number of intersections.The O(k) was based upon computing the intersection of rays with the planes containing the k polygons. We did not consider the cost of filling thepolygons, which can be a large part of the rendering time. If we consider ascene which is viewed from a given point there will be some percentage of1the area of the screen that is filled with polygons. As we move the viewer closer to the objects, fewer polygons will appear on the screen but each will occupy a larger area on the screen, thus leaving the area of the screen that is filled approximately the same. Thus the rendering time will be about the same even though there are fewer polygons displayed.There are a number of ways we can attempt to get O(k log k) performance. One is to use a better sorting algorithm for the depth sort. Other strategies are based on divide and conquer such a binary spatial partitioning.If we consider a ray tracer that only casts rays to the first intersection and does not compute shadow rays, reflected or transmitted rays, then the image produced using a Phong model at the point of intersection will be the same image as produced by our pipeline renderer. This approach is sometimes called ray casting and is used in volume rendering and CSG. However, the data are processed in a different order from the pipeline renderer. The ray tracer works ray by ray while the pipeline renderer works object by object.Consider a circle centered at the origin: x2 + y2 = r2. If we know that a point (x, y) is on the curve than, we also know (−x, y), (x,−y), (−x,−y), (y, x), (−y, x), (y,−x), and (−y,−x) are also on the curve. This observation is known as the eight–fold symmetry of the circle. Consequently, we need only generate 1/8 of the circle, a 45 degree wedge, and can obtain the rest by copying this part using the symmetries. If we consider the 45 degree wedge starting at the bottom, the slope of thiscurve starts at 0 and goes to 1, precisely the conditions used for Bresenham’s line algorithm. The tests are a bit more complex and we have to account for the possibility the slope will be one but the approach is thesame as for line generation.Flood fill should work with arbitrary closed areas. In practice, we can get into trouble at corners if the edges are not clearly defined. Such can bethe case with scanned images.Note that if we fill by scan lines vertical edges are not a problem. Probably the best way to handle the problem is to avoid it completely by never allowing vertices to be on scan lines. OpenGL does this by having vertices placed halfway between scan lines. Other systems jitter the y value of any vertex where it is an integer.Although each pixel uses five rays, the total number of rays has only doubled, . consider a second grid that is offset one half pixel in both thex and y directions.A mathematical answer can be investigated using the notion of reconstruction of a function from its samples (see Chapter 8). However, avery easy to see by simply drawing bitmap characters that small pixels lead to very unreadable characters. A readable character should have some overlap of the pixels.We want k levels between Imin and Imax that are distributed exponentially. Then I0 = Imin, I1 = Iminr,I2 = Iminr2, ..., Ik−1 = Imax = Iminrk−1. We can solve the last equation forthe desired r = ( ImaxImin)1k−1If there are very few levels, we cannot display a gradual change in brightness. Instead the viewer will see steps of intensity. A simple rule ofthumb is that we need enough gray levels so that a change of one step is not visible. We can mitigate the problem by adding one bit of random noise to the least significant bit of a pixel. Thus if we have 3 bits (8 levels),the third bit will be noise. The effect of the noise will be to break up regions of almost constant intensity so the user will not be able to see astep because it will be masked by the noise. In a statistical sense the jittered image is a noisy (degraded) version of the original but in a visualsense it appears better.。

计算机图形学习题参考答案(完整版)

计算机图形学习题参考答案(完整版)

9、使用中点圆算法,绘制圆心为 (0, 0) ,半径 r 10 的圆在第一象限中的部分。 解:
k (x k, yk) (x k ', yk ') pk 0 (0,10) (10, 0) 1r 9 1 (1,10) (10,1) p0 2x 116 2 (2,10) (10, 2) p12x 2 11 3 (3,10) (10, 3) p2 2x 3 2x 4 12y 4 3 5 (5, 9) (9, 5) p4 2x 5 18 6 (6, 8) (8, 6) p5 2x 6 12y6 5 7 (7, 7)
1
度,可以沿着三个方向移动,也可以沿着三个方位旋转,同时还可以建立与其他三维空间的超链接。 因此 VRML 是超空间的。 7、图形的构成要素有哪些? 解: ① 刻画形状的点、线、面、体等几何要素; ② 反映物体表面属性和材质的灰度、颜色等非几何要素。 8、计算机图形学的最高奖以谁的名字命名,获得第一届和第二届该奖的分别是谁? 解: 计算机图形学的最高奖是以 Coons 的名字命名的, 获得第一届和第二届 Coons 奖的是 Ivan Sutherland 和 Pierre Bézier。
2
11、已知: A(0, 0) 、 B(1, 1) 、 C(2, 0) 、 D(1, 2) ,请判断多边形 ABCD 是否是凹多边形。 解: 多 边 形 的 边 向 量 为 AB (1,1, 0) , BC (1, 1, 0) , CD (1, 2, 0) , DA(1, 2, 0) 。 因 为
第 2 章 基本图元的显示
1、假设 RGB 光栅系统的设计采用 810 英寸的屏幕,每个方向的分辨率为每英寸 100 个像素。如果 每个像素 6 位,存放在帧缓冲器中,则帧缓冲器需要多大存储容量(字节数)? 解: 8100101006/8600000 (字节) 。 2、假设计算机字长为 32 位,传输速率为 1 MIP(每秒百万条指令) 。300 DPI(每英寸点数)的激光打 印机,页面大小为 8.511 英寸,要填满帧缓冲器需要多长时间。 解:
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

7.6 习题
2.试证明下述几何变换的矩阵运算具有互换性:
(1)两个连续的旋转变换;(2)两个连续的平移变换;
(3)两个连续的变比例变换;(4)当比例系数相等时的旋转和比例变换;(1)证明:设第一次的旋转变换为:
cosθ1 sinθ1 0
T1= - sinθ1 cosθ1 0
0 0 1
第二次的旋转变换为:
Cosθ2 sinθ20
T2= - sinθ2 cosθ2 0
0 0 1
则因为
T1*T2 = cosθ1 sinθ1 0 cosθ2
sinθ2 0
- sinθ1 cosθ1 0 - sinθ2 cosθ2 0
0 0 1 0 0
1
= cosθ1 cosθ2+sinθ1 sinθ2 cosθ1 sinθ2+ sinθ1 cosθ2
- sinθ1 cosθ2- cosθ1 sinθ2 -sinθ1 sinθ1+ cosθ1 cosθ2 0
0 0
1
Cos(θ1+θ2)sin(θ1+θ2)0
= - sin(θ1+θ2)cos(θ1+θ2)0
0 0 1
cosθ2 sinθ2 0 cosθ1 sinθ1 0
T2*T1 = - sinθ2 cosθ2 0 - sinθ1
cosθ1 0
0 0 1 0 0
1
cosθ1 cosθ2+ sinθ1 sinθ2 cosθ1 sinθ2+ sinθ1 cosθ2 0
= - sinθ2cosθ1- cosθ2 sinθ1 -sinθ1 sinθ1+ cosθ1 cosθ2 0
0 0 1
Cos(θ1+θ2)sin(θ1+θ2)0 = - sin(θ1+θ2)cos(θ1+θ2)0
0 0 1即T1*T2= T2*T1, 两个连续的旋转变换具有互换性
(2)证明:设第一次的平移变换为:
1 0 0
T1= 0 1 0
Tx1 Ty1 1
第二次的平移变换为:
1 0 0
T2= 0 1 0
Tx2 Ty2 1
则因为
T1*T2 = 1 0 0 1 0 0
0 1 0 0 1 0
Tx1 Ty1 1 Tx2 Ty2 1
1 0 0
= 0 1 0
Tx1+Tx2 Ty1+Ty2 1

T2*T1 = 1 0 0 1 0 0
0 1 0 0 1 0
Tx2 Ty2 1 Tx1 Ty1 1
1 0 0
= 0 1 0
Tx1+Tx2 Ty1+Ty2 1
即T1*T2= T2*T1, 两个连续的平移变换具有互换性
(3)证明:设第一次的变比例变换为:
Sx1 0 0
T1= 0 Sy1 0
0 0 1
第二次的变比例变换为:
Sx2 0 0
T2 = 0 Sy2 0
0 0 1
则因为
T1*T2 = Sx1 0 0 Sx2 0 0
0 Sy1 0 0 Sy2 0
0 0 1 0 0 1
Sx1*Sx2 0 0
= 0 Sy1*Sy2 0
0 0 1

T2*T1 = Sx2 0 0 Sx1 0 0
0 Sy2 0 0 Sy1 0
0 0 1 0 0 1
Sx1*Sx2 0 0
= 0 Sy1*Sy2 0
0 0 1
即T1*T2= T2*T1, 两个连续的变比例变换具有互换性
(4)证明:设第一次为比例系数相等时的比例变换:
S 0 0
T1= 0 S 0
0 0 1
第二次的为旋转变换:
cosθ sinθ 0
T2= - sinθ cosθ 0
0 0 1
则因为
T1*T2 = S 0 0 cosθ sinθ 0
0 S 0 - sinθ cosθ 0
0 0 1 0 0 1
S cosθ S sinθ 0
= - S sinθ S cosθ2 0
0 0 1

T2*T1 = cosθ sinθ 0 S 0 0
- sinθ cosθ 0 0 S 0
0 0 1 0 0 1
S cosθ S sinθ 0
= -S sinθ S cosθ 0
0 0 1
即T1*T2= T2*T1, “当比例系数相等时的旋转和比例“变换具有互换性
3、证明二维点相对x轴作对称,紧跟着相对y=-x直线作对称变换完全等价于该点相对坐标原点作旋转变换。

证明:
(1) 点相对x轴作对称的变换矩阵
1 0 0
T1= 0 -1 0
0 0 1
(2) 相对于y=-x直线作对称变换矩阵
0 -1 0
T2= -1 0 0
0 0 1
1 0 0 0 -1 0 0 -1 0
因为T1*T2= 0 -1 0 * -1 0 0 = 1 0 0
0 0 1 0 0 1 0 0 1
cos(-90º) sin(-90 º) 0
= - sin(-90 º) cos(-90º) 0
0 0 1
即该点相对坐标原点作顺时针方向转90 º的旋转变换
4、证明
1-t22t
1+ t 2 1+t2
T= 完全表示一个旋转变换。

-2t 1-t2
1+t2 1+t2
证明:令t=tg(θ/2)
则:(1-t2)/(1+ t 2)= cosθ
(2t)/(1+ t 2)= sinθ

cosθ sinθ
T=
- sinθ cosθ
将T扩充为一个三行齐次坐标的变换矩阵为:
cosθ sinθ 0
T= - sinθ cosθ 0
0 0 1
该矩阵表示为一个旋转变换
5、例:三角形ABC各顶点坐标为A(3,0)B(4,2)C(6,0),其绕原点逆时针旋转90°,再向X方向平移2,Y方向平移-1。

解:因为:θ=90°
变换矩阵为
COS90°SIN90°0 0 1 0 TR= - SIN90°COS90°0 = -1 0 0
2 -1 1 2 -1 -1

A 3 0 1 0 1 0 2 2 1 A‘
B 4 2 1 -1 0 0 = 0 3 1 B‘
C 6 0 1 2 -1 1 2 5 1 C‘
如果先进行平移变换,再进行旋转变换,
1 0 0 COS90°SIN90°0 0 1 0 Tr= 0 1 0 - SIN90°COS90°0 = -1 0 0
2 -1 1 0 0 1 1 2 1

A 3 0 1 0 1 0 1 5 1 A‘
B 4 2 1 -1 0 0 = -1 6 1 B‘
C 6 0 1 1 2 1 1 8 1 C‘结论:变换顺序不同,结果也不同。

相关文档
最新文档