文档库 最新最全的文档下载
当前位置:文档库 › 交互式计算机图形学1-7章课后题答案

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

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

Angel: Interactive Computer Graphics, Fifth Edition Chapter 1 Solutions

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.

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 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 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 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 as

much 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 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 Solutions

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, hence

x ? xmin

xmax ? xmin

=

xs ? u

w

,

xs = u + w

x ? xmin

xmax ? xmin

.

Likewise

ys = v + h

x ? xmin

ymax ? 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 other polygons 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 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 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 Solutions

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.

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 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 Solutions

If the scaling matrix is uniform then

RS = RS(α, α, α) = αR = SR

Consider R x(θ), if we multiply and use the standard trigonometric identities for the sine and cosine of the sum of two angles, we find

R x(θ)R x(φ) = R x(θ + φ)

By simply multiplying the matrices we find

T(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 to

p_ = [x_y_, z_, 1]T by the matrix M. Hence we have the relationship

p_ = 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 concatenation

of two translations yields a translation. If we look at the product of a

rotation 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 and

translations 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 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 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 where

desired 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 0

0 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 we

evaluate to zero. An equivalent test is to form the matrix

?????

1 1 1 1

x1 x2 x3 x4

y1 y2 y3 y4

z1 z2 z3 z4

?????

for each i = 4, ... If the determinant of this matrix is zero the ith vertex is

in 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 θ2

v, with θ = 90 and v = (1, 0, 0), we find for

rotation about the x-axis

r =

√2

2

(1, 1, 0, 0).

Likewise, for rotation about the y axis

r =

√2

2

(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 Solutions

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.

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 about a suitably chosen axis. One way to compute this rotation matrix is to form the matrix by sequence of simple rotations, such as

R = 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 1

d(_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.

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 a

cube 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 matrix

P =

26664

1 0 ?1 0

0 1 ?1 0

0 0 0 0

0 0 0 1

37775

All 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 of

the point (x, y, z) is found by determining the _ for which the line intersects the plane, that is

axs + bys + czs = d

Substituting and solving, we find

_ =

d ? ax ? by ? cz

adx + bdy + cdz

.

However, what we want is a projection matrix, Using this value of _ we find

xs = z + _dx =

x(bdy + cdx) ? dx(d ? by ? cz)

adx + bdy + cdz

with similar equations for ys and zs. These results can be computed by multiplying the homogeneous coordinate point (x, y, z, 1) by the projection

matrix

M =

26664

bdy + cdz ?bdx ?cdx ?ddx

?ady adx + cdz ?cdy ?ddy

?adz ?bdz adx + bdy ?ddz

0 0 0 adx + bdy + cdz

37775

.

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 is

gluLookAt(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 Solutions

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.

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, φ be the 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ψ. If

the 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 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 1

l2 = _y2 + (x ? t)2. The total time light travels is thus l1

v1 + l2

v2 .

Minimizing over t gives desired result when we note the two desired sines are sin θ1 = h

√h

2+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 product

p ·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. In

a 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 Solutions

First, 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 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 angle

between 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

1

the 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 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 can get 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 the

x and y directions.

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.

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 = ( Imax

Imin

)

1

k?1

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.

计算机图形学习题分析

第一章绪论 1、计算机图形学、图形处理与模式识别本质区别是什么?请各举一例说明。 解:计算机图形学是研究根据给定的描述,用计算机生成相应的图形、图像所生成的图形、图像可以显示屏幕上、硬拷贝输出或作为数据集存在计算机中的学科。计算机图形学研究的是从数据描述到图形生成的过程。例如计算机动画。 图形处理是利用计算机对原来存在物体的映像进行分析处理,然后再现图像。例如工业中射线探伤。 模式识别是指计算机对图形信息进行识别和分析描述,是从图形(图像)到描述的表达过程。例如邮件分捡设备扫描信件上手写的邮政编码,并将编码用图像复原成数字。 2、举3个例子说明计算机图形学的应用。 解:①事务管理中的交互绘图 应用图形学最多的领域之一是绘制事务管理中的各种图形。通过从简明的形式呈现出数据的模型和趋势以增加对复杂现象的理解,并促使决策的制定。 ②地理信息系统 地理信息系统是建立在地理图形基础上的信息管理系统。利用计算机图形生成技术可以绘制地理的、地质的以及其他自然现象的高精度勘探、测量图形。 ③计算机动画 用图形学的方法产生动画片,其形象逼真、生动,轻而易举地解决了人工绘图时难以解决的问题,大大提高了工作效率。 3、计算机生成图形的方法有哪些? 解:计算机生成图形的方法有两种:矢量法和描点法。 ①矢量法:在显示屏上先给定一系列坐标点,然后控制电子束在屏幕上按一定的顺序扫描,逐个“点亮”临近两点间的短失线,从而得到一条近似的曲线。尽管显示器产生的只是一些短直线的线段,但当直线段很短时,连成的曲线看起来还是光滑的。 (2)描点法 4.什么叫虚拟现实技术和可视化? 解:虚拟现实技术: 利用计算机生成一种模拟环境,通过多种传感器和设备使用户“投入”到该环境中 ,实现用户和该环境直接进行交互的技术。例如模拟飞机驾驶舱。 可视化技术: 通过对空间数据场构造中间几何因素,或用图形绘制技术在屏幕上产生二维图象。例如分子模型构造。 5.对于分辨绿为1024*1024的光栅系统,若每一像素咏8位和12位二进制来表示存储信息,各需多大光栅存储容量?每一屏幕最多能显示多少颜色?若R,G,B灰度都占8位,其显示颜色的总数是多少? 解: 1) 每一像素用8位二进制来表示存储信息,所需容量为1024*1024*1=220(byte)=1MB

计算机图形学试题附答案完整版

名词解释 将图形描述转换成用像素矩阵表示的过程称为扫描转换。 1.图形 2.像素图 3.参数图 4.扫描线 5.构造实体几何表示法 6.投影 7.参数向量方程 8.自由曲线 9.曲线拟合 10.曲线插值 11.区域填充 12.扫描转换 三、填空 1.图形软件的建立方法包括提供图形程序包、和采用专用高级语言。 2.直线的属性包括线型、和颜色。 3.颜色通常用红、绿和蓝三原色的含量来表示。对于不具有彩色功能的显示系统,颜色显示为。 4.平面图形在内存中有两种表示方法,即和矢量表示法。 5.字符作为图形有和矢量字符之分。 6.区域的表示有和边界表示两种形式。 7.区域的内点表示法枚举区域内的所有像素,通过来实现内点表示。 8.区域的边界表示法枚举区域边界上的所有像素,通过给赋予同一属性值来实现边界表示。 9.区域填充有和扫描转换填充。 10.区域填充属性包括填充式样、和填充图案。 11.对于图形,通常是以点变换为基础,把图形的一系列顶点作几何变换后,

连接新的顶点序列即可产生新的变换后的图形。 12.裁剪的基本目的是判断图形元素是否部分或全部落在之内。 13.字符裁剪方法包括、单个字符裁剪和字符串裁剪。 14.图形变换是指将图形的几何信息经过产生新的图形。 15.从平面上点的齐次坐标,经齐次坐标变换,最后转换为平面上点的坐标,这一变换过程称为。 16.实体的表面具有、有界性、非自交性和闭合性。 17.集合的内点是集合中的点,在该点的内的所有点都是集合中的元素。 18.空间一点的任意邻域内既有集合中的点,又有集合外的点,则称该点为集合的。 19.内点组成的集合称为集合的。 20.边界点组成的集合称为集合的。 21.任意一个实体可以表示为的并集。 22.集合与它的边界的并集称集合的。 23.取集合的内部,再取内部的闭包,所得的集合称为原集合的。 24.如果曲面上任意一点都存在一个充分小的邻域,该邻域与平面上的(开)圆盘同构,即邻域与圆盘之间存在连续的1-1映射,则称该曲面为。 25.对于一个占据有限空间的正则(点)集,如果其表面是,则该正则集为一个实体(有效物体)。 26.通过实体的边界来表示一个实体的方法称为。 27.表面由平面多边形构成的空间三维体称为。 28.扫描表示法的两个关键要素是和扫描轨迹。 29.标量:一个标量表示。 30.向量:一个向量是由若干个标量组成的,其中每个标量称为向量的一个分量。 四、简答题 1. 什么是图像的分辨率?

(完整版)计算机图形学发展综述

计算机图形学发展综述 报告 专业 班级 学生 学号

计算机图形学发展综述 一、计算机图形学历史 1950年,第一台图形显示器作为美国麻省理工学院(MIT)旋风I(Whirlwind I)计算机的附件诞生了。该显示器用一个类似于示波器的阴极射线管(CRT)来显示一些简单的图形。1958年美国Calcomp公司由联机的数字记录仪发展成滚筒式绘图仪,GerBer公司把数控机床发展成为平板式绘图仪。在整个50年代,只有电子管计算机,用机器语言编程,主要应用于科学计算,为这些计算机配置的图形设备仅具有输出功能。计算机图形学处于准备和酝酿时期,并称之为:“被动式”图形学。到50年代末期,MIT的林肯实验室在“旋风”计算机上开发SAGE空中防御体系,第一次使用了具有指挥和控制功能的CRT显示器,操作者可以用笔在屏幕上指出被确定的目标。与此同时,类似的技术在设计和生产过程中也陆续得到了应用,它预示着交互式计算机图形学的诞生。 1962年,MIT林肯实验室的Ivan E.Sutherland 发表了一篇题“Sketchpad:一个人机交互通信的图形系统”的博士论文,他在论文中首次使用了计算机图形学Computer Graphics”这个术语,证明了交互计算机图形学是一个可行的、有用的研究领域,从而确定了计算机图形学作为一个崭新的科学分支的独立地位。他在论文中所提出的一些基本概念和技术,如交互技术、分层存储符号的数据结构等至今还在广为应用。1964年MIT的教授Steven A. Coons提出了被后人称为超限插值的新思想,通过插值四条任意的边界曲线来构造曲面。同在60年代早期,法国雷诺汽车公司的工程师Pierre Bézier发展了一套被后人称为Bézier曲线、曲面的理论,成功地用于几何外形设计,并开发了用于汽车外形设计的

计算机图形学复习题及答案

计算机图形学复习题及答 案 This manuscript was revised on November 28, 2020

中南大学现代远程教育课程考试模拟复习试题.及参考答案 计算机图形学 一、名词解释 1.图形 2.像素图 3.参数图 4.扫描线 5.构造实体几何表示法 6.投影 7.参数向量方程 8.自由曲线 9.曲线拟合 10.曲线插值 11.区域填充 12.扫描转换 二、判断正误(正确写T,错误写F) 1.存储颜色和亮度信息的相应存储器称为帧缓冲存储器,所存储的信息被称为位 图。() 2.光栅扫描显示器的屏幕分为m行扫描线,每行n个点,整个屏幕分为m╳n个点,其中每个点称为一个像 素。―――――――――――――――――――――() 3.点阵字符用一个位图来表示,位图中的0对应点亮的像素,用前景色绘制;位图中的1对应未点亮的像素,用背景色绘 制。――――――――――――――――-() 4.矢量字符表示法用(曲)线段记录字形的边缘轮廓线。―――――――――――() 5.将矢量字符旋转或放大时,显示的结果通常会变得粗糙难看,同样的变换不会改变点阵字符的显示效 果。―――――――――――――――――――――――――()

6.在光栅图形中,区域是由相连的像素组成的集合,这些像素具有相同的属性值或者它们位于某边界线的内 部。―――――――――――――――――――――――() 7.多边形的扫描变换算法不需要预先定义区域内部或边界的像素值。――――――() 8.齐次坐标表示法用n维向量表示一个n+1维向 量。―――――――――――――() 9.实体的边界由平面多边形或空间曲面片组成。―――――――――――――――() 10.平面多面体表面的平面多边形的边最多属于两个多边形,即它的表面具有二维流形的性 质。―――――――――――――――――――――――――――――――() 11.实体几何性质包括位置、长度和大小 等。―――――――――――――――――() 12.实体的拓扑关系表示实体之间的相邻、相离、方位、相交和包含等关系。―――() 13.实体的扫描表示法也称为推移表示法,该表示法用一个物体和该物体的一条移动轨迹来描述一个新的物 体。――――――――――――――――――――――――() 14.如果投影空间为平面,投影线为直线,则称该投影为平面几何投影。――――-() 15.平面几何投影分为两大类:透视投影和平行投影。――――――――――――- () 16.当投影中心到投影面的距离为有限值时,相应的投影为平行投 影。――――――() 17.当投影中心到投影面的距离为无穷大时,相应的投影即为透视投影。―――――()

计算机图形学教程课后习题参考答案.

第一章 1、试述计算机图形学研究的基本内容? 答:见课本P5-6页的1.1.4节。 2、计算机图形学、图形处理与模式识别本质区别是什么?请各举一例说明。 答:计算机图形学是研究根据给定的描述,用计算机生成相应的图形、图像,且所生成的图形、图像可以显示屏幕上、硬拷贝输出或作为数据集存在计算机中的学科。计算机图形学研究的是从数据描述到图形生成的过程。例如计算机动画制作。 图形处理是利用计算机对原来存在物体的映像进行分析处理,然后再现图像。例如工业中的射线探伤。 模式识别是指计算机对图形信息进行识别和分析描述,是从图形(图像)到描述的表达过程。例如邮件分捡设备扫描信件上手写的邮政编码,并将编码用图像复原成数字。 3、计算机图形学与CAD、CAM技术关系如何? 答:见课本P4-5页的1.1.3节。 4、举3个例子说明计算机图形学的应用。 答:①事务管理中的交互绘图 应用图形学最多的领域之一是绘制事务管理中的各种图形。通过从简明的形式呈现出数据的模型和趋势以增加对复杂现象的理解,并促使决策的制定。 ②地理信息系统 地理信息系统是建立在地理图形基础上的信息管理系统。利用计算机图形生成技术可以绘制地理的、地质的以及其它自然现象的高精度勘探、测量图形。 ③计算机动画 用图形学的方法产生动画片,其形象逼真、生动,轻而易举地解决了人工绘图时难以解决的问题,大大提高了工作效率。 5、计算机绘图有哪些特点? 答:见课本P8页的1.3.1节。 6、计算机生成图形的方法有哪些? 答:计算机生成图形的方法有两种:矢量法和描点法。 ①矢量法:在显示屏上先给定一系列坐标点,然后控制电子束在屏幕上按一定的顺序扫描,逐个“点亮”临近两点间的短矢量,从而得到一条近似的曲线。尽管显示器产生的只是一些短直线的线段,但当直线段很短时,连成的曲线看起来还是光滑的。 ②描点法:把显示屏幕分成有限个可发亮的离散点,每个离散点叫做一个像素,屏幕上由像素点组成的阵列称为光栅,曲线的绘制过程就是将该曲线在光栅上经过的那些像素点串接起来,使它们发亮,所显示的每一曲线都是由一定大小的像素点组成的。当像素点具有多种颜色或多种灰度等级时,就可以显示彩色图形或具有不同灰度的图形。 7、当前计算机图形学研究的课题有哪些? 答:见课本P10-11页的1.4节。

计算机图形学5套模拟题

组卷规则:每套模拟题5个问答或者计算或者证明题,每题20分。 《计算机图形学基础》模拟试题(1) 1、简述Cohen-Sutherland 裁剪方法的思想,并指出与之相比,中点裁剪方法的改进之处,及这种改进的理由。 答:Cohen-Sutherland 裁剪算法的思想是:对于每条线段分为三种情况处理。(1)若完全在窗口内,则显示该线段简称“取”之。(2)若明显在窗口外,则丢弃该 线段,简称“弃”之。(3)若线段既不满足“取”的条件,也不满足“弃”的条件,则求线段与窗口交点,在交点处把线段分为两段。其中一段完全在窗口外,可弃之。然后对另一段重复上述处理。中点分割算法的大意是,与Cohen-Sutherland 算法一样首先对线段端点进行编码,并把线段与窗口的关系分为三种情况: 全在、完全不在和线段和窗口有交。对前两种情况, 进行同样的处理。对于第三种情况,用中点分割的方法求出线段与窗口的交点。即从点出发找出距最近的可见点A和从点出发找出距最近的可见点B,两个可见点之间的连线即为线段的可见部分。从出发找最近可见点采用中点分割方法:先求出的中点,若不是显然不可见的,并且在窗口中有可见部分,则距最近的可见点一定落在上,所以用代替;否则取代替。再对新的求中点。重复上述过程,直到长度小于给定的控制常数为止,此时收敛于交点。 改进之处在于,对第三种情况,不直接解方程组求交,而是采用二分法收搜索交点。这种改进的理由是:计算机屏幕的象素通常为1024×1024,最多十次二分搜索即可倒象素级,必然找到交点。而且中点法的主要计算过程只用到加法和除2运算,效率高,也适合硬件实现。 2、在Phong 模型 中,三项分别表示何含义?公式中的各个符号的含义指什么? 答:三项分别代表环境光、漫反射光和镜面反射光。为环境光的反射光强,为理想漫反射光强,为物体对环境光的反射系数,为漫反射系数,为镜面反射系数,为高光指数,L 为光线方向,N 为法线方向,V 为视线方向,R 为光线的反射方向。

计算机图形学第三章答案

1. voidLine_Midpoint(int x1, int y1, int x2, int y2, int color) { int x = x1, y = y1; int a = y1 - y2, b = x2 - x1; int cx = (b >= 0 ? 1 : (b = -b, -1)); int cy = (a <= 0 ? 1 : (a = -a, -1)); putpixel(x, y, color); int d, d1, d2; if (-a <= b) // 斜率绝对值 <= 1 { d = 2 * a + b; d1 = 2 * a; d2 = 2 * (a + b); while(x != x2) { if (d < 0) y += cy, d += d2; else d += d1; x += cx; putpixel(x, y, color); } } else // 斜率绝对值 > 1 { d = 2 * b + a; d1 = 2 * b; d2 = 2 * (a + b); while(y != y2) { if(d < 0) d += d1; else x += cx, d += d2; y += cy; putpixel(x, y, color); } } } 7 void Line_Midpoint(int x1, int y1, int x2, int y2, int color, int flag) { intx,y; if(flag==0) { x0=point.x; y0=point.y; flag=1; } else { flag=0; x1=point.x; y1=point.y; a=y0-y1;

图形学模拟试题 (含答案)

计算机图形学课程模拟试卷(参考答案含评分标准) 2010—2011学年第二学期 年级专业学号姓名得分 一、简要回答题(每题7分,共7题,共49分) 1.被誉为“图形学之父”的伊万?萨瑟兰(Ivan Sutherland)对计算机图形学理论和 应用的主要贡献有哪些? 答:(1)(3分)萨瑟兰在MIT攻读博士学位时,在著名的林肯实验室完成基于光笔的交互式图形系统:Sketchpad。这一系统中许多交互式图形设计的创意是革命性的,它的影响一直延续到今天。 (2)(4分)用于显示立体和彩色图像的“Lorgnette”技术和一系列图形图像算法,如分区编码的直线段裁剪算法、多边形裁剪算法、曲面的表示和消除隐藏线算法等等。 2.有人认为图形学算法主要依赖于点和向量的数学运算,你是否认同这一观点?给出 同意或反对的理由,并举例说明。 答:这一观点是正确的(2分),主要理由和举例如下(5分): (1)图形学的很多算法属于几何算法,点(从三维、二维到一维)是最基本的几何要素,也是统一基本几何的计算机表示形式。例如,在观察流水线上的主要图形学算法,无 论是表示和生成(显示)、建模(造型)、变换(包括投影、观察、消隐)都可以统 一到建立基于点的几何模型;(可以以典型的光栅图形学的算法如基本图形的生成和 变换、三维观察、Z-Buffer算法为例说明) (2)向量几何是图形学的重要数学基础、建立了以“方向性”概念的基本理论、思想方法、几何结构、几何算法与复杂性分析的几何计算理论体系。例如,借助向量几何可以将 二维布尔运算降为一维向量计算、将三维布尔运算下降为二维布尔运算、将三维消隐 算法最终归结为一维交集算法等等,从而使几何计算的复杂性大为简化。(可以以比 较典型的Liang-Barsky裁剪算法、三维实体造型CSG树生成,隐藏线消除算法等为例 说明)。 『评分说明』若认为这一观点是错误的或持有含糊的态度,且给出的例子是片面的、主观的,则本题不得分。其他错误情况者,如未举例说明,酌情扣2分左右。 3.针对多面体模型,直接用简单光照模型绘制会有什么问题?简述两种增量式光照明 模型(多边形绘制)的基本思想,并指出两个算法的主要区别。 答: (1)(3分)针对多面体模型,使用简单光照模型绘制会在多边形与多边形之交界处产生明暗的不连续变化,影响了曲面的显示效果,即马赫带效应。如果增加多边形个数,减小每个多边形的

计算机图形学作业-Display-答案

计算机图形学作业 I 一.判断题 1.齐次坐标提供了坐标系变换的有效方法,但仍然无法表示无穷远的点;(×) 2.若要对某点进行比例、旋转变换,首先需要将坐标原点平移至该点,在新的坐标系下做比例或旋转变换,然后在将原点平移回去;(√) 3. 相似变换是刚体变换加上等比缩放变换;(√) 4. 保距变换是刚体变换加上镜面反射;(√) 5. 射影变换保持直线性,但不保持平行性。(√) 二、填空题 1.透视投影的视见体为截头四棱锥形状;平行投影的视见体为长方体形状。 2.字符的图形表示可以分为矢量表示和点阵表示两种形式。 3.仿射变换保持直线的平行性 4.刚体变换保持长度 5.保角变换保持向量的角度 三、单项选择题 1. 分辨率为1024×1024的显示器各需要多少字节位平面数为24的帧缓存?( D) A. 512KB; B. 1MB; C. 2MB; D. 3MB ; 2. 在透视投影中,主灭点的最多个数是( C ) A 1; B 2; C 3; D 4 3. 以下关于图形变换的论述不正确的是( B ) A. 平移变换不改变图形大小和形状,只改变图形位置; B. 拓扑关系不变的几何变换不改变图形的连接关系和平行关系; C.旋转变换后各图形部分间的线性关系和角度关系不变,变换后直线的长度不变 D.错切变换虽然可引起图形角度的改变,但不会发生图形畸变; 4. 使用下列二维图形变换矩阵:将产生变换的结果为( D ) A. 图形放大2倍; B. 图形放大2倍,同时沿X、Y1个绘图单位; C.沿X坐标轴方向各移动2个绘图单位; D.沿X坐标轴方向放大2倍,同时沿X、Y坐标轴方向各平移1个绘图单位。 5. 下列有关投影的叙述语句中,正确的论述为(B ) A. 透视投影具有近小远大的特点; B. 平行投影的投影中心到投影面距离是无限的; C. 透视投影变换中,一组平行于投影面的线的投影产生一个灭点; T =

计算机图形学_陆枫_模拟试题1

一、填空(1×20=20分) 1. 一个交互性的计算机图形系统应具 有、、、、输入等五方面的功能。 2. 阴极射线管从结构上可以分 为、和。 3. 常用的图形绘制设备 有和,其中支持矢量格式。 5. 通常可以采用和处理线宽。 6. 齐次坐标表示就是用维向量表示n维向量。 7. 平行投影根据可以分 为和投影。 二、名词解释(3×5=15分) 1. 图像 2. 走样 3. 段 4. 4连通区域 5. 主灭点

三、简答与计算(6×5=30分) 1.图形包括哪两个方面的要素在计算机中如何表示它们 2.简述荫罩式彩色阴极射线管的结构和工作原理 3.在交互输入过程中,常用的管理设备的方式有哪些试分别说明。 4.举例说明奇偶规则和非零环绕树规则进行内外测试时有何不同 5.什么是观察坐标系为什么要建立观察坐标系 四、推导与计算题 (要 1. 试用中点Bresenham算法原理推导斜率大于1的直线段的扫描转换算法。求写清原理、误差函数和递推公式,并进行优化)(15分) 2. 已知直线,求相对于该直线作对称变换的变换矩阵。(10分) 3.试作出下图中三维形体ABCDE的三视图(平移矢量均为1)。要求写清变换过程,并画出生成的三视图。(10分) 一、填空

1. 计算;存储;交互(对话);输入。 2. 电子枪;偏转系统;荧光屏。 3. 打印机;绘图仪;笔式绘图仪。 4. 数值设备;字符串设备;选择设备;拾取设备。 5. 线刷子;方刷子。 6. n+1。 7. 投影方向与投影面是否垂直;正;斜。 二、名词解释 1. 图像:在计算机中用点阵法描述的图形叫做图像。 2. 走样:用离散量表示连续量引起的失真。 3. 段:段是指具有逻辑意义的有限个图素(或体素)及其附加属性的集合,也称为图段(二维空间中)、结构和对象。 4. 4连通区域:从区域上的一点出发,通过访问已知点的4-邻接点,在不越出区域的前提下,遍历区域内的所有像素点。 5. 主灭点:透视投影中,与坐标轴方向平行的平行线的投影会汇聚到一点,这个点称为主灭点。 三、简答与计算 1. 答:构成图形的要素可以分为刻画形状的点、线、面、体等的几何要素和反映物体表面属性或材质的明暗、灰度、色彩(颜色信息)等的非几何要素。

计算机图形学必考知识点

Phong Lighting 该模型计算效率高、与物理事实足够接近。Phong模型利用4个向量计算表面任一点的颜色值,考虑了光线和材质之间的三种相互作用:环境光反射、漫反射和镜面反射。Phong模型使用公式:I s=K s L s cosαΦα:高光系数。计算方面的优势:把r和v归一化为单位向量,利用点积计算镜面反射分量:I s=K s L s max((r,v)α,0),还可增加距离衰减因子。 在Gouraud着色这种明暗绘制方法中,对公用一个顶点的多边形的法向量取平均值,把归一化的平均值定义为该顶点的法向量,Gouraud着色对顶点的明暗值进行插值。Phong着色是在多边形内对法向量进行插值。Phong着色要求把光照模型应用到每个片元上,也被称为片元的着色。 颜色模型RGB XYZ HSV RGB:RGB颜色模式已经成为现代图形系统的标准,使用RGB加色模型的RGB三原色系统中,红绿蓝图像在概念上有各自的缓存,每个像素都分别有三个分量。任意色光F都可表示为F=r [ R ] + g [ G ] + b [ B ]。RGB颜色立方体中沿着一个坐标轴方向的距离代表了颜色中相应原色的分量,原点(黑)到体对角线顶点(白)为不同亮度的灰色 XYZ:在RGB 系统基础上,改用三个假想的原色X、Y、Z建立了一个新的色度系统, 将它匹配等能光谱的三刺激值,该系统称为视场XYZ色度系统,在XYZ空间中不能直观地评价颜色。 HSV是一种将RGB中的点在圆柱坐标系中的表示法,H色相S饱和度V明度,中心轴为灰色底黑顶白,绕轴角度为H,到该轴距离为S,沿轴高度为S。 RGB优点:笛卡尔坐标系,线性,基于硬件(易转换),基于三刺激值,缺点:难以指定命名颜色,不能覆盖所有颜色范围,不一致。 HSV优点:易于转换成RGB,直观指定颜色,’缺点:非线性,不能覆盖所有颜色范围,不一致 XYZ:覆盖所有颜色范围,基于人眼的三刺激值,线性,包含所有空间,缺点:不一致 交互式计算机程序员模型 (应用模型<->应用程序<->图形库)->(图形系统<->显示屏).应用程序和图形系统之间的接口可以通过图形库的一组函数来指定,这和接口的规范称为应用程序编程人员接口(API),软件驱动程序负责解释API的输出并把这些数据转换为能被特定硬件识别的形式。API提供的功能应该同程序员用来确定图像的概念模型相匹配。建立复杂的交互式模型,首先要从基本对象开始。良好的交互式程序需包含下述特性:平滑的显示效果。使用交互设备控制屏幕上图像的显示。能使用各种方法输入信息和显示信息。界面友好易于使用和学习。对用户的操作具有反馈功能。对用户的误操作具有容忍性。Opengl并不直接支持交互,窗口和输入函数并没有包含在API中。 简单光线跟踪、迭代光线跟踪 光线跟踪是一种真实感地显示物体的方法,该方法由Appel在1968年提出。光线跟踪方法沿着到达视点的光线的相反方向跟踪,经过屏幕上每一象素,找出与视线所交的物体表面点P0,并继续跟踪,找出影响P0点光强的所有的光源,从而算出P0点上精确的光照强度。光线跟踪器最适合于绘制具有高反射属性表面的场景。优缺点:原理简单,便于实现,能生成各种逼真的视觉效果,但计算量开销大,终止条件:光线与光源相交光线超出视线范围,达到最大递归层次。一般有三种:1)相交表面为理想漫射面,跟踪结束。2)相交表面为理想镜面,光线沿镜面反射方向继续跟踪。3)相交表面为规则透射面,光线沿规则透射方向继续跟踪。 描述光线跟踪简单方法是递归,即通过一个递归函数跟踪一条光线,其反射光想和折射光线再调用此函数本身,递归函数用来跟踪一条光线,该光线由一个点和一个方向确定,函数返回与光线相交的第一个对象表面的明暗值。递归函数会调用函数计算指定的光线与最近对象表面的交点位置。 图形学算法加速技术BVH, GRID, BSP, OCTree 加速技术:判定光线与场景中景物表面的相对位置关系,避免光线与实际不相交的景物表面的求交运算。加速器技术分为以下两种:Bounding Volume Hierarchy 简写BVH,即包围盒层次技术,是一种基于“物体”的场景管理技术,广泛应用于碰撞检测、射线相交测试之类的场合。BVH的数据结构其实就是一棵二叉树(Binary Tree)。它有两种节点(Node)类型:Interior Node 和Leaf Node。前者也是非叶子节点,即如果一个Node不是Leaf Node,它必定是Interior Node。Leaf Node 是最终存放物体/们的地方,而Interior Node存放着代表该划分(Partition)的包围盒信息,下面还有两个子树有待遍历。使用BVH需要考虑两个阶段的工作:构建(Build)和遍历(Traversal)。另一种是景物空间分割技术,包括BSP tree,KD tree Octree Grid BSP:二叉空间区分树 OCTree:划分二维平面空间无限四等分 Z-buffer算法 算法描述:1、帧缓冲器中的颜色设置为背景颜色2、z缓冲器中的z值设置成最小值(离视点最远)3、以任意顺序扫描各多边形a) 对于多边形中的每一个采样点,计算其深度值z(x,y) b) 比较z(x, y)与z缓冲器中已有的值zbuffer(x,y)如果z(x, y) >zbuffer(x, y),那么计算该像素(x, y)的光亮值属性并写入帧缓冲器更新z缓冲器zbuffer(x, y)=z(x, y) Z-buffer算法是使用广泛的隐藏面消除算法思想为保留每条投影线从COP到已绘制最近点距离,在投影后绘制多边形时更新这个信息。存储必要的深度信息放在Z缓存中,深度大于Z缓存中已有的深度值,对应投影线上已绘制的多边形距离观察者更近,故忽略该当前多边形颜色,深度小于Z缓存中的已有深度值,用这个多边形的颜色替换缓存中的颜色,并更新Z缓存的深度值。 void zBuffer() {int x, y; for (y = 0; y < YMAX; y++) for (x = 0; x < XMAX; x++) { WritePixel (x, y, BACKGROUND_VALUE); WriteZ (x, y, 1);} for each polygon { for each pixel in polygon’s projection { //plane equation doubl pz = Z-value at pixel (x, y); if (pz < ReadZ (x, y)) { // New point is closer to front of view WritePixel (x, y, color at pixel (x, y)) WriteZ (x, y, pz);}}}} 优点:算法复杂度只会随着场景的复杂度线性增加、无须排序、适合于并行实现 缺点:z缓冲器需要占用大量存储单元、深度采样与量化带来走样现象、难以处理透明物体 着色器编程方法vert. frag 着色器初始化:1、将着色器读入内存2、创建一个程序对象3、创建着色器对象4、把着色器对象绑定到程序对象5、编译着色器6、将所有的程序连接起来7、选择当前的程序对象8、把应用程序和着色器之间的uniform变量及attribute变量关联起来。 Vertex Shader:实现了一种通用的可编程方法操作顶点,输入主要有:1、属性、2、使用的常量数据3、被Uniforms使用的特殊类型4、顶点着色器编程源码。输入叫做varying变量。被使用在传统的基于顶点的操作,例如位移矩阵、计算光照方程、产生贴图坐标等。Fragment shader:计算每个像素的颜色和其他属性,实现了一种作用于片段的通用可编程方法,对光栅化阶段产生的每个片段进行操作。输入:Varying 变量、Uniforms-用于片元着色器的常量,Samples-用于呈现纹理、编程代码。输出:内建变量。 观察变换 建模变换是把对象从对象标架变换到世界标架 观察变换把世界坐标变换成照相机坐标。VC是与物理设备无关的,用于设置观察窗口观察和描述用户感兴趣的区域内部分对象,观察坐标系采用左手直角坐标系,可在用户坐标系中的任何位置、任何方向定义。其中有一坐标轴与观察方向重合同向并与观察平面垂直。观察变换是指将对象描述从世界坐标系变换到观察坐标系的过程。(1):平移观察坐标系的坐标原点,与世界坐标系的原点重合,(2):将x e,y e轴分别旋转(-θ)角与x w、y w轴重合。 规范化设备坐标系 规范化设备坐标系是与具体的物理设备无关的一种坐标系,用于定义视区,描述来自世界坐标系窗口内对象的图形。 光线与隐式表面求交 将一个对象表面定义为f(x,y,z)=f(p)=0,来自P0,方向为d的光线用参数的形式表示为P(t)=P0+td. 交点位置处参数t的值满足:f(P0+td)=0,若f是一个代数曲面,则f是形式为X i Y j Z k的多项式之和,求交就转化为寻求多项式所有根的问题,满足的情况一:二次曲面,情况二:品面求交,将光线方程带入平面方程:p*n+c=0可得到一个只需做一次除法的标量方程p=p0+td。可通过计算得到交点的参数t的值:t=(p0*n+c)/(n*d). 几何变换T R S矩阵表示 三维平移T 三维缩放S旋转绕z轴Rz( ) 100dx 010dy 001dz 0001 Sx000 0Sy00 00Sz0 0001 cos-sin00 sin cos00 0010 0001 θθ θθ 旋转绕x轴Rx(θ) 旋转绕y轴Ry(θ) 1000 0cos-sin0 0sin cos0 0001 θθ θθ cos0sin0 0100 -sin0cos0 0001 θθ θθ 曲线曲面 Bezier曲线性质:Bezier曲线的起点和终点分别是特征多边形的第一个顶点和最后一个顶点。曲线在起点和终点处的切线分别是特征多边形的第一条边和最后一条边,且切矢的模长分别为相应边长的n倍;(2)凸包性;(3)几何不变性(4)变差缩减性。端点插值。 均匀B样条曲线的性质包括:凸包性、局部性、B样条混合函数的权性、连续性、B样条多项式的次数不取决于控制函数。 G连续C连续 C0连续满足:C1连续满足: (1)(0) p(1)=(1)(0)(0) (1)(0) px qx py q qy pz qz == ???? ???? ???? ???? (1)(0) p'(1)=(1)'(0)(0) (1)(0) p x q x p y q q y p z q z == ???? ???? ???? ???? C0(G0)连续:曲线的三个分量在连接点必须对应相等 C1连续:参数方程和一阶导数都对应相等 G1连续:两曲线的切线向量成比例 三维空间中,曲线上某点的导数即是该点的切线,只要求两个曲线段连接点的导数成比例,不需要导 数相等,即p’(1)=aq’(0) 称为G1几何连续性。将该思想推广到高阶导数,就可得到C n和G n连续性。

西安交通大学18年9月课程考试《计算机图形学》作业考核试题

(单选题) 1: 计算机图形学中的光栅算法主要用于( )。 A: 三维图形的输入 B: 三维图形的输出 C: 二维图形输入 D: 二维图形输出 正确答案: (单选题) 2: 在光亮度插值算法中,下列论述哪个是错误的( ) A: Gouraud明暗模型计算中,多边形与扫描平面相交区段上每一采样点的光亮度值是由扫描平面与多边形边界交点的光亮度插值得到的 B: Phong明暗处理模型中,采用了双线性插值和构造法向量函数的方法模拟高光 C: Gouraud明暗模型和Phong明暗处理模型主要是为了处理由多个平面片近似表示曲面物体的绘制问题 D: Phong明暗模型处理的物体表面光亮度呈现不连续跃变 正确答案: (单选题) 3: 种子填充算法中,正确的叙述是() A: 它是按扫描线的顺序进行像素点的填充 B: 四连接算法可以填充八连接区域 C: 四连接区域内的每一个像素可以通过上下左右四个方向组合到达 D: 八连接算法不能填充四连接区域 正确答案: (单选题) 4: 选择下面哪一个命令,可以在工作时获得最好的视觉效果( ) A: “View-Simple Wireframe” B: “View-Wireframe” C: “View-Draft” D: “View-Enhanced” 正确答案: (单选题) 5: 在下列叙述语句中,错误的论述为( ) A: 在图形文件系统中,点、线、圆等图形元素通常都用其几何特征参数来描述 B: 在图形系统中,图形处理运算的精度不取决于显示器的分辨率 C: 在光栅扫描图形显示器中,所有图形都按矢量直接描绘显示,不存在任何处理 D: 在彩色图形显示器中,使用RGB颜色模型 正确答案: (单选题) 6: 下列哪个对象不可以使用“Effect-Add Perspective”命令添加透视效果( ) A: 未转换成为曲线路径的美术字文本 B: 具有使用“交互阴影”工具创建的阴影的矢量对象 C: 位图 D: 具有使用“交互透明”工具创建的局部透明效果的矢量对象 正确答案: (单选题) 7: 编辑3D文字时,怎样得到能够在三维空间内旋转3D文字的角度控制框( ) A: 利用“选择”工具单击3D文字 B: 利用“交互立体”工具单击3D文字 C: 利用“交互立体”工具双击3D文字 D: 利用“交互立体”工具先选中3D文字,然后再单击 正确答案: (单选题) 8: 分别用编码裁剪算法和中点分割裁剪算法对一条等长的直线段裁剪,下面那一个说法是正确的( ) A: 编码裁剪算法的速度快于中点分割裁剪算法的裁剪速度 B: 编码裁剪算法的速度慢于中点分割裁剪算法的裁剪速度 C: 编码裁剪算法的速度和中点分割裁剪算法的裁剪速度一样 D: 编码裁剪算法的速度和中点分割裁剪算法的裁剪速度哪一个快,无法确定 正确答案: (单选题) 9: 下列关于Bezier曲线的性质,哪个是错误的( ) A: 在起点和终点处的切线方向和控制多边形第一条边和最后一条边的方向一致 B: 在端点处的R阶导数,仅与R个相邻个控制顶点有关

计算机图形学第二版课后习题答案

第一章绪论 概念:计算机图形学、图形、图像、点阵法、参数法、 图形的几何要素、非几何要素、数字图像处理; 计算机图形学和计算机视觉的概念及三者之间的关系; 计算机图形系统的功能、计算机图形系统的总体结构。 第二章图形设备 图形输入设备:有哪些。 图形显示设备: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 Q d=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

《计算机图形学》练习试题及参考答案(二)

《计算机图形学》练习试题及参考答案 二、选择题(每题2分) B 1、计算机图形学与计算几何之间的关系是( )。 A)学术上的同义词B)计算机图形学以计算几何为理论基础 C)计算几何是计算机图形学的前身D).两门毫不相干的学科 B 2、计算机图形学与计算机图象学的关系是( )。 A)计算机图形学是基础,计算机图象学是其发展 B)不同的学科,研究对象和数学基础都不同,但它们之间也有可转换部分 C)同一学科在不同场合的不同称呼而已 D)完全不同的学科,两者毫不相干 C 3、触摸屏是( )设备。 A)输入B)输出C)输入输出D)既不是输入也不是输出 B 4.计算机绘图设备一般使用什么颜色模型?( ) A)RGB;B)CMY;C)HSV ;D)HLS A 5. 计算机图形显示器一般使用什么颜色模型?( ) A)RGB;B)CMY;C)HSV ;D)HLS C 6.分辨率为1024×1024的显示器各需要多少字节位平面数为24的帧缓存?( ) A)512KB;B)1MB;C)2MB ;D)3MB

D 7.哪一个不是国际标准化组织(ISO)批准的图形标准?( ) A)GKS;B)PHIGS;C)CGM ;D)DXF C8.下述绕坐标原点逆时针方向旋转a角的坐标变换矩阵中哪一项是错误的? ( ) | A B | | C D | A) cos a; B) sin a; C) sin a; D) cos a A 9、在多边形的逐边裁剪法中,对于某条多边形的边(方向为从端点S 到端点P)与某条裁剪线(窗口的某一边)的比较结果共有以下四种情况,分别需输出一些顶点.请问哪种情况下输出的顶点是错误的? ( ) A)S和P均在可见的一侧,则输出S和P. B)S和P均在不可见的一侧,则输出0个顶点. C)S在可见一侧,P在不可见一侧,则输出线段SP与裁剪线的交点. D)S在不可见的一侧,P在可见的一侧,则输出线段SP与裁剪线的交点和P. C 10、在物体的定义中对边的哪条限制不存在? ( ) A) 边的长度可度量且是有限的 B) 一条边有且只有两个相邻的面

计算机图形学作业题

计算机图形学作业题 1. 计算机中由图形的形状参数(方程或分析表达式的系数,线段的端点坐标等)加属性参数(颜色、线型等)来表示图形称图形的参数表示;枚举出图形中所有的点称图形的点阵表示,简称为图像(数字图像) 2. 什么是计算机图形学?计算机图形学有哪些研究内容? 3. 计算机图形学有哪些应用领域? 4. 计算机图形学有哪些相关学科分支?它们的相互关系是怎样的? 5. 图形系统的软件系统由哪些软件组成?举例说明。 6. 了解计算机图形系统的硬件。 7. 什么是显示器的分辨率、纵横比、刷新率? 8. 什么是像素、分辨率、颜色数?分辨率、颜色数与显存的关系? 分辨率M ?N 、颜色个数K 与显存大小V 的关系: 例:分辨率为1024像素/行?768行/ 帧,每像素24位(bit )颜色(224种颜色)的显示器,所需的显存为:1024?768?24位(bit )=1024?768?24/8=2359296字节(byte )。或:每像素16777216种颜色(24位真彩色),1024?768的分辨率,所需显存为:1024?768?log 216777216位显存=2359296字节显存。 9. 什么是图元的生成?分别列举两种直线和圆扫描转换算法。 10. OpenGL 由核心库GL(Graphics Library)和实用函数库GLU(Graphics Library Utilities)两个库组成。 11. 区域填充算法要求区域是连通的,因为只有在连通区域中,才可能将种子点的颜色扩展到区域内的其它点。 区域可分为 向连通区域和 向连通区域。区域填充算法有 填充算法和 填充算法。 12. 字符生成有哪两种方式? 点阵式(bitmap fonts 点阵字——raster 光栅方法):采用逐位映射的方式得到字符的点阵和编码——字模位点阵。 笔画式(outline fonts 笔画字——stroke 方法):将字符笔画分解为线段,以线段端点坐标为字符字模的编码。 13. 图形信息包含图形的 和 。 14. 什么是图形变换?图形变换只改变图形的 不改变图形的 。图形变换包括 和 ( )。 15. 熟练掌握二维图形的齐次坐标表示、平移、比例、旋转、对称变换以及复合变换的方法和原则。 16. 图形的几何变换包括 、 、 、 、 ;图形连续作一次以上的几何变换称 变换。 17. 试写出图示多边形绕点A(xo,yo)旋转的变换矩阵。要求写出求解过程及结果。 18. 试写出针对固定参考点、任意方向的比例变换矩阵。 19. 试写出对任意直线y=mx+b 的对称变换矩阵。 20. 什么是窗口?什么是视区?什么是观察变换? 21. 简述二维观察变换的流程。 22. 试述窗口到视区的变换步骤,并推出变换矩阵。 ??—(位) —K N M V 2log ??≥

相关文档
相关文档 最新文档