计算机图形学第6章交互技术

合集下载

图形学复习提纲

图形学复习提纲

图形学复习提纲图形学复习提纲2010.10.10第1章引言1.1 计算机图形学及其相关概念计算机图形学(Computer Graphics)计算机图形学是研究怎样利用计算机来显示、生成和处理图形的原理、方法和技术的一门学科。

IEEE定义:Computer graphics is the art or science of producing graphical images with the aid of computer.计算机图形学的研究对象——图形通常意义下的图形:能够在人的视觉系统中形成视觉印象的客观对象都称为图形。

两类图形要素:1.几何要素:点,线,面,体等;2.非几何要素:明暗,灰度,色彩等计算机图形学中所研究的图形:从客观世界物体中抽象出来的带有颜色及形状信息的图和形。

图形的两种表示方法:点阵法是用具有颜色信息的点阵来表示图形的一种方法,它强调图形由哪些点组成,并具有什么灰度或色彩。

参数法是以计算机中所记录图形的形状参数与属性参数来表示图形的一种方法。

通常把参数法描述的图形叫做图形(Graphics)把点阵法描述的图形叫做图象(Image)1.4 计算机图形系统1.4.2 计算机图形系统的结构课后作业:习题一(p19)1.1 名词解释:图形、图象、点阵法、参数法。

1.2 图形包括哪两方面的要素,在计算机中如何表示它们?1.3 什么叫计算机图形学?分析计算机图形学、数字图象处理和计算机视觉学科间的关系。

1.7 一个交互性计算机图形系统必须具有哪几种功能?其结构如何?第2章图形设备计算机图形系统包含哪些外部设备?图形输入设备:概念、特点图形显示设备:概念、结构原理、工作方式、特点图形绘制设备:概念、特点课后作业:习题二(p63)2.2. PC图形显示卡主要有哪几种?2.4. 试列举出你所知道的图形输入与输出设备。

2.5. 说明三维输入设备的种类以及应用范围。

2.6. 阴极射线管由哪几部分组成?它们的功能分别是什么?2.16. 什么是象素点?什么是显示器的分辨率?第3章交互式技术如何设计一个好的用户接口为什么要定义逻辑输入设备交互式绘图技术有哪些?设备的评价三个层次:⒈设备层: 硬件性能最优化⒉任务层:单任务:选择最佳的交互设备⒊对话层:多任务:比较优劣3.2.2 输入模式1. 请求方式(request mode)输入设备在应用程序的控制下工作:2. 取样方式(sample mode)应用程序和输入设备同时工作:输入设备不断地产生数据,并送入数据缓冲区;当程序遇到采样语句要求输入时,从数据缓冲区中读取数据。

计算机图形学课后答案第6章

计算机图形学课后答案第6章

习题参考答案6.1交互式绘图系统基本的交互任务有哪些?答:1定位,2笔画,3定值,4选择,5拾取,6字符串,7三维交互。

6.2编写程序实现橡皮筋技术画直线和圆。

答:思想:首先将绘图模式设定为异或。

画直线时,点击鼠标左键,光标所在位置即为直线的起点,用鼠标牵引光标移动,当前光标所在位置即认为是直线的终点。

光标从原位置移动到新位置时,首先在起点与原位置之间画一条直线,因为是异或模式,原有直线变为不可见,然后再在起点与新位置之间画一条直线,作为当前直线。

画圆时,点击鼠标左键,光标所在位置即为圆的圆心,用鼠标牵引光标移动,当前光标所在位置与圆心的距离即被认为是圆的半径。

当鼠标牵引光标从原位置移动到新位置时,首先在以圆心与原位置的距离为半径画圆,因为是异或模式,原有的圆变为不可见,然后再以圆点与新位置的距离为半径画圆,作为当前圆。

6.3引力场是人机交互中的常见的辅助技术,它能给用户带来什么便利?设计人员在设计引力场的时候需要注意什么问题?答:用户用光标进行选图操作时,引力场的使用可使光标较容易地定位在选择区域小的图形上。

设计人员在设计引力场时,引力场的大小要适中,外形应与其所含图形的外形一致。

6.4图形模式和图像模式下,拖拽的处理方法有什么不同?答:图形模式下的拖拽是在异或的绘图模式下进行的。

首先在原位置再次绘制要拖拽图形,由于自身异或的结果为空,原位置处的图形变为不可见,然后在新位置处绘制图形,实现了图形的拖拽。

而图像模式下的拖拽,则是进行了图像的整体移动,即首先在要经过位置处按拖动图像大小保存原有屏幕图像,然后将拖动的图像整体移动到该位置,当图像离开该位置而移动到下一个新位置时,再恢复该位置保存的屏幕图像。

图形模式不需要保存屏幕图像,只需在原位置重绘图形。

图像模式需要保存图像经过处的屏幕图像,并在移开后重新显示保存的屏幕图像。

6.5请叙述三种输入控制模式的流程。

答:请求模式下,用户在接收到应用程序请求后才输入数据;应用程序等待用户输入数据,输入结束,才进行处理。

计算机图形学基础(第2版)课后习题答案__陆枫__何云峰

计算机图形学基础(第2版)课后习题答案__陆枫__何云峰

计算机图形学基础(第2版)课后习题答案__陆枫__何云峰第⼀章绪论概念:计算机图形学、图形、图像、点阵法、参数法、图形的⼏何要素、⾮⼏何要素、数字图像处理;计算机图形学和计算机视觉的概念及三者之间的关系;计算机图形系统的功能、计算机图形系统的总体结构。

第⼆章图形设备图形输⼊设备:有哪些。

图形显⽰设备: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) 。

计算机图形学第6章-人机交互绘图技术

计算机图形学第6章-人机交互绘图技术
意义
人机交互绘图技术提高了图形绘制的 效率和精度,降低了图形设计的难度 和成本,促进了计算机图形学及相关 领域的发展。
相关术语解析
人机交互
指人与计算机之间的信息交换和通信 过程,涉及输入、输出设备以及相应 的软件和技术。
图形用户界面(GUI)
一种基于图形的用户界面,通过窗口、 图标、菜单、指针等图形元素来实现 用户与计算机的交互。
语音交互技术
利用自然语言处理技术,使用户能够通过语音命令进行图形操作,提高交互的自然性和便捷性。
手势识别技术
通过计算机视觉技术识别用户手势,实现手势控制图形操作,提供更加直观自然的交互方式。
智能化、个性化发展趋势
智能化绘图技术
利用机器学习和深度学习技术,使计算机能够自动理解用户需求, 提供智能化的绘图建议和帮助。
THANKS
感谢您的观看
智能手表
通过手表上的触控屏幕和语音识 别技术,实现对手机的远程控制 和信息查看。
语音识别与手势识别
语音识别
通过麦克风接收用户语音输入,经过语音识别算法处理,将语音转换为计算机 可识别的文本或命令。
手势识别
通过摄像头捕捉用户手部动作和手势,经过图像处理和计算机视觉算法处理, 识别出用户的手势意图并转换为相应的计算机操作。
消隐处理
消除被遮挡的线和面,确保绘制的三维图形 具有真实感。
投影变换
采用正交投影或透视投影,将三维模型从世 界坐标系投影到二维屏幕坐标系。
光照和材质处理
模拟光线照射在物体表面的效果,增强三维 图形的立体感和真实感。
05
人机交互绘图技术
应用案例
CAD/CAM系统中的应用
机械设计
CAD系统允许设计师通过交互式绘图工具进行复杂机械零件的设计,如齿轮、轴承等,实现高精度、高效率的设计流 程。

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

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

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

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

图形显示设备: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 Solutions1.1 The 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.1.3 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 thesepoints 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.1.5 In Exercise 1.4, 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.1.7 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.1.9 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.1.11 There are single beam CRTs. One scheme is to arrange the phosphors in 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 Solutions2.9 We 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.2.11 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.2.13 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 inthe mesh, by rendering each polygon shared edges are drawn twice. Wecan avoid this problem by forming an edge list or edge array, each elementis 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 somethingto 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.2.15 The Maxwell triangle corresponds to the triangle that connects thered, green, and blue vertices in the color cube.2.19 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 thatany 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.2.23 There are eight vertices and thus 256 = 28 possible black/white colorings. If we remove symmetries (black/white and rotational) there are14 unique cases. See Angel, Interactive Computer Graphics (Third Edition) or the paper by Lorensen and Kline in the references.Chapter 3 Solutions3.1 The 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.3.11 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.3.19 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).3.25 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 Solutions4.1 If 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)4.5 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 simplythe identity 1=1). If we have 4 such pairs of points we will have 12equations 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.4.7 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 bottomelement. 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.4.9 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.4.11 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.4.13R = 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⎤⎥⎥⎥⎦4.17 One test is to use the first three vertices to find the equation of theplane ax + by + cz + d = 0. Although there are four coefficients in theequation only three are independent so we can select one arbitrarily ornormalize 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 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.4.19 Although we will have the same number of degrees of freedom in theobjects 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 the square, something we cannot do if we scale then rotate.4.21 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 coordinatesystem.4.23 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).4.27 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 Solutions5.1 Eclipses (both solar and lunar) are good examples of the projection of an 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.5.3 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.5.5 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.5.7 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)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 0 to 1.5.9 The specification used in many graphics text is of the angles the projector makes with x,z and y, z planes, i.e 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 a cube aligned with the axes.5.11 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.5.15 If we use _ = _ = 45, we obtain the projection matrixP =266641 0 −1 00 1 −1 00 0 0 00 0 0 1377755.17 All the points on the projection of the point (x.y, z) in the direction dx, 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.5.21 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 Solutions6.1 Point 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.6.3 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.6.5 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. 6.7 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 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ψ.6.13 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 thatthe 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 length1l2 = _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 sinesare sin θ1 = h√h2+t2 and sin θ2 = −y √(y2+(x−t)2 .6.19 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.6.21 Probably the easiest approach to this problem is to rotate the givenplane to plane z = 0 and rotate the light source and objects in the sameway. Now we have the same problem we have solved and can rotate everything back at the end.6.23 A global rendering approach would generate all shadows correctly. Ina global renderer, as each point is shaded, a calculation is done to seewhich light sources shine on it. The projection approach assumes that wecan 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 thedifferent shades we might see if there were intersecting shadows from multiple light sources.Chapter 7 Solutions7.1 First, 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.7.3 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.7.5 See Problem 6.22. Nonuniform scaling will not preserve the angle between the normal and other vectors.7.7 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.7.9 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 eachwill 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.7.11 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.7.13 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.7.15 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.7.17 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 be the case with scanned images.7.19 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 havingvertices placed halfway between scan lines. Other systems jitter the y value of any vertex where it is an integer.7.21 Although each pixel uses five rays, the total number of rays has only doubled, i.e. consider a second grid that is offset one half pixel in both the x and y directions.7.23 A mathematical answer can be investigated using the notion of reconstruction 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.7.25 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−17.27 If 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.。

第6章交互式技术与用户接口

第6章交互式技术与用户接口
❖ (6)用户界面的设计:包括窗口设计、菜单设计、对话 框、列表框等交互界面。
用子程序库设计用户接口,使用方便、 便于扩充,便于在用户自己编写的程序代 码中加入子程序库中的函数,可以充分利 用高级程序设计语言本身具有的功能,实 现用户希望产生的图形和交互处理。但是, 这种方式实现用户界面需要不断地编写、 调试和修改源程序,不形象直观。子程序 库函数的调用格式要随所用主语言而定, 对子程序库的使用应遵循相应主语言对子 程序或函数的调用约定。
6.2.2 基本交互任务和交互技术
交互技术是用户用交互设备把信息输入进计算 机的不同方式,而交互任务是用户输入到计算机的 一个单元信息。最基本的交互任务有四种,即:定 位、字串、选择、取数。对于一个给定的交互任务, 可用多种不同的交互技术来实现,如一个选择任务 可通过鼠标在菜单中选一项,也可用键盘输入选择 项的名字,还可以通过按一个功能键实现选择。类 似的情况是一种交互设备可用于不同的交互任务, 如鼠标既可以用于定位,也可以用于选择。因此, 交互任务是图形系统所要完成的目标,而交互技术 则是完成交互任务的手段,并且交互技术的实现在 很大程度上依赖于交互设备及其支撑环境。
{polyline1,polyline2,polygon,cycle}
中,用户希望选择对象polygon。当输入p时,反馈 显示3个元素polyline1,polyline2,polygon。直到键 入polyg后,只显示唯一的元素polygon,这时用户 就无需再继续输入剩下的字符了,确认后就唯一地 选择了polygon对象。
定量输入任务是指在某个最小值和最大值之间 指定一个数值,例如温度、时间、透明度等数值量 的输入。典型的交互式定量技术有:① 键盘输入数 值;② 调节电位器的阻值产生相应的数值;③ 用 上下翻转数字的计数器选择数值;④ 用光标移动屏 幕上的标度盘或刻度尺上的指针来确定数值。图6.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. 俯视图 H
y 轴方向投影
1
0
0
0
0
00
0
0
0
1
0
0
0
0
1
4 阶三维变换矩阵
10
0
0
00
-1
0
00
0
0
0 0 -z0 1
z 轴方向投影
绕 x 轴旋转 -90 度
1
00
0
1
0
0
0
0
1
0
0
0 cos(- 90°) sin( - 90°) 0
0
0
0
0
0
0
0
1
0 -sin(- 90°) cos( - 90°)0
第三章 交互式技术 什么是输入模式的问题,有哪几种输入模式。
第四章 图形的表示与数据结构 自学,建议至少阅读一遍
第五章 基本图形生成算法 概念:点阵字符和矢量字符; 直线和圆的扫描转换算法; 多边形的扫描转换:有效边表算法;
1 / 21
区域填充: 4/ 8 连通的边界/泛填充算法; 内外测试:奇偶规则,非零环绕数规则; 反走样:反走样和走样的概念,过取样和区域取样。
1) 平移:将点 P(5,4) 平移至原点 (0,0) , 2) 旋转:图形绕原点( 0 点)旋转 45 度, 3) 反平移:将 P 点移回原处 (5,4) , 4) 变换矩阵:平移—旋转—反平移
8 / 21
5) 变换过程:四边形 ABCD 的规范化齐次坐标 (x,y,1) * 3 阶二维变换矩阵
计算机图形学第二版(陆枫)课后习题集 第一章 绪论 概念:计算机图形学、图形、图像、点阵法、参数法、 图形的几何要素、非几何要素、数字图像处理; 计算机图形学和计算机视觉的概念及三者之间的关系; 计算机图形系统的功能、计算机图形系统的总体结构。

计算机图形学 第六章 计算机动画(2)

计算机图形学 第六章 计算机动画(2)

应用实例

《史酷比2:怪兽偷跑》
整体和局部变形方法
由Alan Barr于1984年提出,是最早的变形方法
。包括渐细变形(Tapering)、螺旋形变形 (Twisting)等。
(a)变形前的茶壶
(b) 渐细变形
(c) 螺旋形变形
Alan Barr的变形类别
应用例子
自由变形方法FFD

1986年,Sederderg等提出了一种非常适合于柔 性物体动画的一般化的变形方法,该方法不直 接操作物体,而是将物体嵌入一空间,当所嵌 的空间变形时,物体也随之变形。
群组层次

群 —— Crowd behaviors
组 —— Group behaviors 个体 —— Individual behavior


为什么需要群组动画?

得到大场面的视觉震撼效果

动漫设计和影视特技中,不可避免地会遇到各种大 规模群体动作场面的制作。例如,两军对垒中的数 十万大军冲锋的效果、兽群、鸟群等。
茶壶的FFD变形 (a) 变形前 (b) 变形后
FFD的数学原理
Q (u, v, w) Pijk Bi (u ) B j (v) Bk ( w)
i 0 j 0 k 0 3 3 3
轴变形方法

轴变形是一种通过参数曲线来控制物体自由变 形的方法。该方法把物体嵌入轴线的局部参数 空间中来实施变形,当轴线变形时,嵌入其参 数空间中的各点的位置随之发生变化。

两个元球靠近时的形变过程
动画演示
过程动画技术

过程动画是指采用一个过程来描述物体的运动 或变形。 最简单的过程动画是设立一个数学模型去控制 物体的几何形状和运动,如旗帜迎风招展、水 波随风荡漾等。

《计算机图形学》学习资料

《计算机图形学》学习资料

《计算机图行学》学习包本课程为有关专业的必修课程(或选修课程)。

通过本课程的教学,学生可以学习、了解和掌握计算机图形学中有关的基本原理、概念、方法和技术,培养和提高交互式图形设计的能力。

计算机图形学与图象处理,计算机图形学的研究内容,计算机图形学的发展简史,计算机图形学的发展方向,本课程教学要求与学习方法。

本章无习题计算机图形系统的组成、功能与分类,计算机图形显示器,图形输入设备,图形输出设备,图形软件系统,图形软件标准。

课后习题1. 某光栅系统中,显示器的分辨率为1280×768,其中每个象素点的颜色深度为12 bit,则该系统需要多大的帧缓存(即多少KB)?2. 有甲乙两台光栅图形显示器,它们的产品说明书介绍均称可以显示4096种颜色,但甲机在显示一幅画面时却只有256种颜色,问其中究竟是什么原因?参考答案1.1280×768×12 / (8×1024) = 1440(KB)2.(1) 甲机:8个位平面,采用一张有256个单元,每个单元有12 bit的彩色查找表。

(2) 乙机:12个位平面,没有采用查找表。

1点的生成,生成直线的DDA算法和Bresenham 算法,二次曲线,区域的简单种子填充算法和扫描线种子填充算法,多边形的扫描转换,字符的生成,反走样技术。

课后习题1. 用对称DDA算法画出A(0,0)到B(5,3)连线的各象素点的位置,并在表内填出相应的中间数据。

rx=5, ry=3,x=0,y=0,steps=5,dx=1,dy=0.6;2. 用Bresenham算法画出A(0,0)到B(5,3)连线的各象素点的位置,并在表内填出相应的中间数据。

dx=5, dy=3, d=2dy-dx=1, x=0, y=0, 2dy-2dx=-4, 3dy=6;23. 用Bresenham算法画出圆心为(0,0),半径为8的顺时针90至45的1/8圆弧上各象素点的位置。

计算机图形学复习

计算机图形学复习

第二章图形系统:1、图形系统的基本功能是什么?(1)计算功能:应能实现设计中所需要的计算、变换、分析等功能;(2)存储功能:在计算机的内外存中能存放图形数据,特别是要存放形体几何元素之间的连线关系以及各种属性信息,并且可基于设计人员的要求对有关信息进行实时检索、变化、增加、删除等操作。

(3)对话功能:通过图形显示器直接进行人机通讯。

(4)输入功能:把图形设计和绘制过程中的有关定位、定形尺寸及必要的参数和命令输入到计算机中去,包括约束条件和属性参数。

(5)输出功能:系统具有文字、图形、图像信息的输出功能,对输出的结果有精度、形式和时间的要求。

2、选择图形系统应考虑哪些原则?3、CRT中偏转系统最重要的特性是什么?为什么在图形系统中多采用磁偏转系统?(1)偏转系统最重要的特性是灵敏度,它反映了偏转信号所能产生的偏转角度的大小。

(2)磁偏转系统方法允许用较高速的电子束,因而能产生亮度较高的图像。

另外,磁偏转系统可以使电子书汇聚成更小的光点,且具有结构简单及所需电功率较小等优点,所以大多数CRT都用磁偏转系统。

4、图形系统有哪些硬拷贝设备?1.点阵式打印机;2.绘图仪:(1)滚筒式绘图仪;(2)平板式绘图仪;(3)静电绘图仪;3.激光打印机;4.喷墨打印机。

5、根据工作原理分类,绘图仪可分为哪两类?各有什么优缺点?(1)可分为笔式绘图仪和静电绘图仪;(2)笔式绘图仪是矢量型设备,绘图笔相对于纸做随机移动,其绘图速度取决于绘图笔移动的加速度和速率。

笔式绘图仪一般都有一个微处理机,把输出图素分解成横平竖直及对角线等八个任意方向的运动增量,位置传感器和伺服电机反馈系统执行该命令,同时利用电磁原理抬笔或落笔。

笔式绘图仪中的滚筒式绘图仪结构比较简单,价格相对便宜一些,但是精确度和速度不可能太高;机械转动的平板式绘图仪速度低,精度低,寿命短,价格相对便宜;具有平面电机的平板式绘图仪精度较高,维修方便,但价格较昂贵静电绘图仪是打印机与笔式绘图仪的结合,静电绘图仪能输出具有明暗度的面图形,分辨率较高,可达每毫米4-8个点,其速度比笔式绘图仪的速度高,是高性能打印机速度的两倍。

交互式计算机图形学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.。

计算机图形学第6章-人机交互绘图技术

计算机图形学第6章-人机交互绘图技术

整理ppt
3
1. 定位设备(Locator)
用于指定用户空间的一个位置(如指定一个圆的圆心等) 输入方式包括直接或间接在屏幕上输入,设置数值坐标等
触摸板
整理ppt
键盘
4
2. 笔画设备(Stroke)
用于指定用户空间中一组有序点的位置(如指定一条折 线的顶点组、指定一条自由曲线的控制点等) 输入方式与定位设备的输入方式一致。 物理设备
整理ppt
8
6.字符串设备(String)
用于向应用程序输入字符串(如为某对象确定名字、 为某图纸输入加注文字等) 输入方式:
➢ 键盘输入 ➢ 手写输入 ➢ 声音输入 ➢ 菜单输入
物理设备
➢ 字母键盘、数字化仪、光笔、声音 识别仪、触压板等
整理ppt
9
基本交互任务
1. 定位 2. 笔画 3. 定值 4. 选择 5. 拾取 6. 字符串
➢语音输入需要使用语音识别技术。
手写板 语音输入
整理ppt
18
基本交互模式
现在最常用的三种基本交互模式
•请求模式(request mode) •样本模式(sample mode) •事件模式(event mode)
现代的计算机图形输入系统往往不是单一地使用一种输入 方式,而是多种输入方式的混合使用,即一个应用程序可以 使用多种控制方式,使用几种不同的输入设备。
物理设备
➢包括光笔、触摸屏、数字化仪、鼠标、操纵杆、跟踪球,
字符串输入设备、编程功整能理pp键t 、声音识别仪等。
7
5.拾取设备(Pick)
用于在处理的模型中选取一个对象,从而为应用型操作确 定目标
输入方式:
➢ 直接在屏幕上选取 ➢ 时间扫描 ➢ 字符串选取

计算机图形学第6章交互式绘图技术

计算机图形学第6章交互式绘图技术

(b)非对称式
屏幕划分
15
2、字型选取:中文或英文、字体 3、颜色选取 4、窗口:屏幕上可划分大小不同窗口,方便交互式对话 5、菜单:用菜单表示程序中各种功能
16
6.5.2 交互式工作方式
1、固定输入/输出方式
2、问答方式 3、表处理方式
第六章 交互式绘图技术
4、命令语言
5、菜单方式
6、图标方式 6.5.3 交互式用户接口的实现
4、橡皮筋法:在起点确定后,光标移出去定终点时, 在屏幕上始终显示一条连结起点和光标中心的直线
5、拖动法:用光标将形体在空间移动至任一位置
+
+
+
按动按钮 选中物体
移动光标 也移动物体
当物体正确定 位时按钮停止
11
6.3.2 拾取技术
当屏幕上有几个图形显示时,要处理某一图形,此 时我们只需点取此图形,表示现在要处理该图形。如点 取图形上一点、划长方形框处理框内图形。
第六章 交互式绘图技术
6.1 概述
一、计算机绘图方式
第六章 交互式绘图技术
1、被动式绘图
依靠程序运行自动产生图形
6.1 概述 6.2 交互式绘图系统
的绘图方式;
6.3 交互式绘图的交互技术
图形在生成过程中,操作者
6.4 输入控制方式 6.5 交互式绘图系统构造方法
无法对图形进行操作和控制。
如C语言绘图
第六章 交互式绘图技术 6.5 交互式绘图系统构造方法 6.5.1 界面布置 6.5.2 交互式工作方式 6.5.3 交互式用户接口的实现
14
6.5.1 界面布置
界面布置包括屏幕划分、显示内容、颜色搭配等
1、屏幕划分:如图
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

7、图象扫描仪(Image Scanner) 图象扫描仪是一种直接把图形(如工程图纸)或图象(如照片)扫描 输入到计算机中,并以象素形式存储表示的图形输入设备。 按所支持的颜色来分类,可以分为单色扫描仪和彩色扫描仪; 按所采用的固态器件来分类,可以分为电荷耦合器件(CCD: Charge Coupled Device)扫描仪、金属氧化物半导体(MOS:Metal Oxide Semiconductor)电路扫描仪等; 按扫描图件的宽度和操作方式来分类,又可分为大型扫描仪、台式扫 描仪、手持式扫描仪等。 扫描仪的分辨率是指在原稿的单位长度上的取样点数,单位是dpi (dot per inch),目前常用的分辨率为300~1000dpi。 扫描仪的另一个重要指标是它支持的颜色、灰度等级。当然,分辨率 越高、颜色、灰度等级越多,保存图象所需要的存储空间就越大。
5.1 物理输入设备
有多种设备用于图形系统的数据输入。多数系统有一个键盘和其它种为 交互输入而设计的设备。这些设备包括:鼠标、跟踪球、操纵杆、数字化仪、 光笔等。 适合特殊应用的其它输入设备有:数据手套、触摸板、扫描仪和声音系 统。 1、键盘(Keyboard) 键盘除了输入文本串外,也能用来进行屏幕坐标的输入、菜单选择及图 形功能的选择。因此,作为图形输入设备的键盘,除通常的以ASCII编码的 数字键和字母键外,还附有一些命令键和功能键,以完成图形操作时的某一 特定功能。
六、拾取设备(Pick Device) 拾取设备用来拾取屏幕上的一些图形对象,以便对它们进行进一步的 操作。 在使用随机扫描显示器时,光笔是最方便的拾取设备。先用光笔对准 屏幕上需要拾取的图形,由于显示处理器反复执行显示文件以刷新屏幕, 因而光笔可以立即检测到画图产生的荧光,并产生中断让显示处理器暂停 执行,此时显示文件暂停的位置就是拾取到的图形,接着显示处理器继续 往下执行。 一般情况下,可以先用定位设备将光标移动到想要拾取的图形对象的 附近(对于非封闭图形)或内部(对于封闭图形),再按拾取键,这时系 统会根据一定的拾取算法在存储所有图形对象的内部数据结构中找出被拾 取的图形对象,并将该区域内拾取到的所有图形对象顺序醒目显示,用户 认可后即可对该对象作进一步的操作,如复制、删除、修改等。
5.3 输入方式
用六种逻辑输入设备设计一个交互系统时,应用程序必须指定用于输 入数据的物理设备类型及其逻辑分类,其它参数取决于输入数据。 在应用程序和输入设备之间,输入方式是多样的,常用的输入方式为: 一、请求(Request)方式 请求方式下,程序发出从某设备输入数据的请求,接着便等待用户输 入数据,得到“允许从该设备输入”的回答后再将数据读入。 这完全类似在高级语言中用读(read/scanf)命令从键盘上获得数据。 在这种方式中,应用程序和数据输入是交替工作的,如果要求进行数 据输入时,用户不进行输入,则整个程序被挂起。所以在要求输入时应对 用户显示提示信息。字符或数据输入时往往采用这种方式。 如希望用请求方式从定位设备中获得位置坐标,可用下面的请求函数: requestLocator(ws,deviceCode,&x,&y) 在函数中,每一种逻辑设备所包括的参数是和输入数据类型有关的。 如在请求方式下的笔划输入函数是: requestStroke(ws,deviceCode,n,xa,ya) 这里输入的n个点的坐标存放在数组xa和ya中。
三、字符串设备(String Device) 字符串设备用来输入一串字符。最常用的字符串设备是键盘,还有手写 体识别输入及语音识别输入字符串的输入方法。 后两种方法涉及到模式识别技术。首先需要有各种字符特征的字典或通 过用户说一段话建立用户的语音字典,然后进行书写或朗读,利用模式识别 提取字符或语音的特征,再到相应的字典中找出字符来。 四、定值设备(Valuator Device) 定值设备向图形系统输入数值。这些数值有些用于设置图形参数,如旋 转角度、缩放因子,有些用于设置与特定应用相关的物理参数,如温度、压 力、电压等。键盘上的数字键可以用来作为定值输入,用户只要按照指定的 格式键入数值即可,但是键盘方法输入数值较慢。 通过在图形显示器上显示出标尺、刻度盘、滑杆、按钮等辅助工具,数 字化仪、鼠标、操纵杆等定位设备也可以被用来实现定值设备的功能。 五、选择设备(Choice Device) 利用选择设备可以从一个选择集中挑选出一个元素。在图形系统中,操 作命令、属性值、物体种类、物体等都是可能的被选集。 常用的选择设备有功能键、定位设备。键盘上的每个键都可以被应用程 序定义为功能键,按下某个键即执行相应的功能。通过键盘或鼠标可以对菜 单进行选择。 当用定位设备实现选择功能时,首先需要判断当前光标位置落在屏幕上 的哪个菜单区域中,然后再判断选择了该菜单的哪一项。
2、直接或间接 (1)直接定位设备。如触摸屏,用户可以直接用手指或其它物体指 点屏幕来进行定位。 (2)间接定位设备。如数字化仪、鼠标和操纵杆,用户通过移动屏 幕上的光标来进行定位。人们已经习惯于间接定位的工作方式,而直接定 位常常会导致手臂疲劳。 3、连续或离散 (1)连续定位设备将手的平滑移动变成光标的平滑移动,数字化仪、 鼠标和操纵杆等都是连续定位设备。 (2)键盘上的光标控制键则是离散定位设备。 连续定位设备比离散定位设备移动光标更自然、更容易、更快捷。 二、笔划设备(Stroke Device) 笔划设备用于输入一系列坐标位置,可以看成是对定位设备的连续调 用。 许多用来定位的图形输入设备都可以作为笔划设备,如鼠标、跟踪球、 操纵杆的连续移动都可以输入一系列坐标位置。 数字化仪是一种最典型的笔划设备,选择流工作方式后并按下游标上 的输入键,数字化仪进入连续工作模式,当游标在数字化板上移动时,可 以产生一连串的坐标值。这种功能在画不规则图形时特别有用。
8、触摸板(Touch Panel) 触摸板是一种可以通过手指触摸显示的物体或屏幕位置来实现定位和 选择的设备。有些系统像等离子显示板直接设计成具有触摸屏功能,另一 些系统则通过在显示屏上贴一个透明的有触感的设备来进行触摸输入。 根据工作原理,触摸屏可以分为电阻式、电容式、红外线式和声表面 波式等几种。 如红外线式触摸板,在沿框的垂直边和水平边各使用一行红外发光二 极管(LED),而相对的垂直边和水平边安装光检测器。触摸时手指或其 它东西会挡住部分光线,通过光检测器便可测知光线被挡住的位置。 9、光笔(Light Pen) 光笔是一种能检测出计算机荧光屏发出荧光的笔式装置,它对电子束 打到特定象素点时荧光涂层瞬时发射的突发光敏感。 光笔的笔尖处有一个小孔,使得荧光屏上的光可以进入笔内,进入笔 内的光脉冲经光导纤维传导、放大,在开关控制下向计算机发出中断信号 来实现对图形的拾取或定位。 虽然光笔并未消失,但由于其精度低、操作容易疲劳、不能检测屏幕 黑暗区域,因此它不再像一度兴旺那样普及。
2、鼠标(Mouse) 鼠标是一种用来定位屏幕光标的图形输入设备,当鼠标被移动时,它能 将移动的方向和距离转换成数字信号传送给计算机,从而达到定位的目的。 鼠标通常可以用按键数目及检测移动的方式来分类。 鼠标的顶部常常会有1~3个按键,不同的软件系统可以自行定义这些 按键的操作方式及其功能含义。 机械鼠标利用底部滚轮的运动来检测移动的方向和距离; 光电鼠标通常必须在一块印有相同间隔的网格板上移动,利用鼠标底部 的发光二极管(LED)和光敏传感器,检测移动的方向和距离。 由于鼠标检测到的是相对当前位置的运动方向和距离,因此它是一种相 对坐标定位设备。 鼠标上附加一些其它装置可以增加鼠标的功能。如下图的Z鼠标包含: 三个按键、侧边的拇指轮、顶部的跟踪球以及底部的标准鼠标球。用Z鼠标, 可以拾取一个对象,使其按六个自由度进行旋转并按任意方向移动。Z鼠标 可用在虚拟现实系统、CAD和动画领域。
5.2 逻辑输入设备
尽管图形输入设备的种类繁多,用法各不相同,并且有各自的特点, 但是按逻辑功能划分,可以分为六种逻辑输入设备,即定位设备、笔划设 备、字符串设备、定值设备、选择设备、拾取设备。图形系统使用逻辑输 入设备的概念来减少系统对物理设备的依赖性,提高系统的独立性和灵活 性。 虽然每种逻辑输入设备的功能都可以用多种图形输入设备来实现,但 是有些输入设备却比其它设备更加方便地完成特定的逻辑输入功能。比如 说,鼠标和数字化仪擅长于定位,键盘可以方便地输入字符串,光笔适合 在屏幕上拾取图形。 一、定位设备(Locator Device) 定位设备用来输入一个位置坐标(x,y)。根据三个相互独立的特征 对定位设备进行分类,可分成: 1、绝对或相对 (1)绝对定位设备。如数字化仪和触摸屏,都有绝对坐标原点,输 入给计算机的是相对于坐标原点的位置坐标。 (2)相对定位设备,如鼠标、跟踪球、操纵杆等,没有绝对坐标原 点,输入给计算机和空间球(Spaceball) 跟踪球(Trackball)是一个装在支架上的可以自由转动的球,人的手 掌摸着球转动时,带动着两个互相垂直的电位器,电位器的输出送给系统, 控制屏幕光标的移动。
4、操纵杆(Joystick) 操纵杆由手杆安装在一个底座上构成,它用来对屏幕光标进行操纵, 它只不过用一根杆控制两个方向的电位器。当操纵杆左右摆动时,改变着 代表X方向的电位器;当操纵杆前后摆动时,改变着代表Y方向的电位器。 5、数据手套(Data Glove) 数据手套可用来抓住"虚拟" 对象。手套由一系列检测手和手指运动的 传感器构成。发送天线和接收天线之间的电磁耦合,用来提供关于手的位 置和方向的信息。发送和接收天线分别由一组三个相互垂直的线圈构成, 形成三维笛卡儿坐标系统。来自手套的输入,可用来给虚拟场景中的对象 定位或操纵该场景的对象。可在显示器上观察或用头套观察三维投影。
6、数字化仪(Digitizer) 数字化仪也叫图形输入板(graphics tablet),是一种能够方便地将 用户的原始图件转换成坐标并输入计算机的常用图形设备。 数字化仪因制作原理不同,有四种结构形式:电磁感应式、静电感应 式、超声波式、磁致伸缩式。通常使用的是电磁感应式结构形式。在一块 布满金属网格的绝缘平板上放置一个可移动的定位设备,该设备可以是手 持游标或者是指示笔。手持游标上的十字叉丝用于定位,游标上通常还有 2个、4个或16个按键,每个按键都可以赋予特定的功能。指示笔上面通常 也有按键。 数字化仪是一种绝对坐标定位设备,它将手持游标或指示笔位于数字 化仪平板上的坐标位置输入到计算机。工作时用户将原始图样平贴在数字 化仪平板上,用游标将原始图样的几何数据精确地输入到计算机里。
相关文档
最新文档