没有合适的资源?快使用搜索试试~ 我知道了~
首页计算机图形学(第三版)Donald Hearn 蔡士杰译 课后习题答案 8
计算机图形学(第三版)Donald Hearn 蔡士杰译 课后习题答案 8
5星 · 超过95%的资源 需积分: 9 101 下载量 17 浏览量
更新于2023-06-28
评论 1
收藏 98KB PDF 举报
计算机图形学(第三版)Donald Hearn 蔡士杰译 课后习题答案 第8章 英文
资源详情
资源评论
资源推荐
Chapter 8
Three-Dimensional Object
Representations
This chapter examines the methods that have been devised to describe and visualize various
kinds of objects and data sets. In addition, programming projects explore the application of
OpenGL functions for different representations, as well as the implementation details involved
in the algorithms for generating displays of splines, fractals, and other objects.
Exercises
8-1. Input for this algorithm is the sphere radius, assuming that the sphere is centered at the
coordinate origin. A polygon-mesh representation can be constructed using longitude and
latitude lines to obtain vertex positions. Thus, two additional input parameters could
be provided to specify the number of latitude and longitude lines that are to be used in
subdividing the sphere surface.
The parametric equations for either a longitude line or a latitude line can be obtained
from Eqs. 8-2. Along each longitude line, angle θ has a constant value. Similarly, angle
φ is constant along any latitude line. For example, the coordinates along the longitude
line in the xz plane (θ = 0) are calculated with the equations
x = r cos φ, y =0,z= r sin φ
and the equations for computing coordinate positions along the latitude line in the xy
plane (φ = 0) are
x = r cos θ, y = r sin θ, z =0
If we denote the required number of latitude lines as n
lat
and the required number of
longitude lines as n
long
, the algorithm can obtain vertex coordinates by calculating n
long
positions along n
lat
latitude lines (or vice versa). Thus, angle θ is assigned n
long
values
over the range from −π to +π, and angle φ is assigned n
lat
values over the range from
−π/2to+π/2.
47
48 CHAPTER 8. THREE-DIMENSIONAL OBJECT REPRESENTATIONS
The algorithm should take sphere symmetries into account to reduce the number of
trigonometric calculations. Coordinate positions need to be computed from the paramet-
ric sphere equations only for the latitude lines in the northern (or southern) hemisphere.
Positions in the other hemisphere are obtained using a reflection about the xy plane.
Also, the algorithm need only calculate positions within one octant of each circular lat-
itude (or longitude) line. The remaining positions in the other octants for each circle
are obtained by symmetry (Fig. 3-18). Furthermore, the latitude “lines” at the top and
bottom of the sphere (the poles) are points.
At the top of the sphere, polygon edges are defined from the pole position radially down
to the coordinate positions on the first latitude line below the pole, and a polygon edge
is defined between each pair of adjacent positions along that latitude line. A similar set
of polygons is constructed at the bottom of the sphere. Thus, the top and bottom of the
spherical surface are each represented with a triangular mesh.
For all other latitude lines, adjacent pairs of coordinate positions are used to define a
horizontal edge of a quadrilateral, and adjacent positions along a longitude line joining
two latitude lines are used to define a vertical edge of a quadrilateral. To facilitate
processing and to ensure that the vertex positions for each surface facet are coplanar,
additional calculations can be performed to split each quadrilateral into two triangles.
The final step in the algorithm is to store the information for vertex coordinates, polygon
edges, and surface facets in polygon tables (Section 3-15).
8-2. A polygon-mesh representation for an ellipsoid can be constructed using Eqs. 8-4 and
the sphere algorithm from the preceding exercise. The primary differences between the
two algorithms are that the parametric equations involve a radius value for each axis and
input values are needed for r
x
, r
y
, and r
z
, with the ellipsoid centered at the coordinate
origin. Also, coordinate positions along an ellipse are symmetric between quadrants, but
not between octants.
8-3. Assuming that the cylinder parameters are specified relative to the coordinate origin,
input for this algorithm can be the cylinder radius r and the height h above the xy plane.
Thus, the cylinder axis is along the z axis, the center position for the bottom of the
cylinder is (0, 0, 0), and the center position for the top of the cylinder is (0, 0, h). If some
other position is to be given for the cylinder, calculations for the polygon-mesh vertex
coordinates can be carried out relative to the given cylinder reference position. Or, the
cylinder can be translated and rotated to place its base in the xy plane and its axis along
the z axis.
First, compute a set of equally spaced points around the perimeter of the cylinder top.
This can be accomplished using the midpoint circle algorithm (Section 3-9) or the para-
metric circle equations 3-28. In either case, we need only calculate coordinates for the
points in the first quadrant, and the remaining points are determined by symmetry (Fig.
3-18). These points provide the vertices for a convex polygon representation of the top of
the cylinder, and form the basis for obtaining the polygon representation for the cylinder
base. For every position (x, y, h) along the top of the cylinder, there is a corresponding
point (x, y, 0) at the base of the cylinder, which are the remaining vertex positions
49
needed for the polygon at the base and for the rectangles along the side of the cylinder.
The final step in the algorithm is to store the information for vertex coordinates, polygon
edges, and surface facets in polygon tables (Section 3-15).
The number of circle subdivisions can be an additional input parameter. Or a fixed
number of subdivisions, such as 8 or 10, can be used for all input cylinders.
To facilitate processing and to ensure that the vertex positions for each surface facet are
coplanar, additional calculations can be performed to convert the polygon representation
into a triangular mesh. This is accomplished for the top and bottom of the cylinder by
adding radial lines from the circle center to the vertex positions on the circle perimeter.
For each rectangular strip along the side of the cylinder, add a diagonal line. Also, the
size of the polygons along the side of the cylinder can be reduced by first dividing each
rectangle into a number of smaller rectangles, then splitting the reduced rectangles into
triangles. Thus, another option for this algorithm is the specification of the number of
horizontal slices to be used in creating the rectangles along the side of the cylinder.
8-4. A polygon-mesh representation for a superellipsoid can be constructed using Eqs. 8-12
and the ellipsoid algorithm (Exercise 8-2), along with the additional parameters s
1
and
s
2
.
8-5. An algorithm for generating a polygon-mesh representation for the surface of a meta-
ball object can be set up using techniques similar to those for the sphere and ellipsoid
algorithms (Exercises 8-1 and 8-2). Given values for parameters b, d, and the surface
constant for f(r), convert the object description to a parametric form involving surface
parameters u and v. Then, subdivide the surface into a number of subintervals in the
two orthogonal directions to obtain a set of polygon facets.
8-6. Input for this routine can be a data file that includes a value for the tension parameter
t, as well as a set of four control-point positions. An additional input can be either the
number of coordinate positions to plot along the curve or a step size ∆u for the parametric
parameter u.
The parametric representation 8-35 can be rewritten in standard polynomial form for
each of the x and y coordinates, and positions along the curve between the middle two
control points are calculated for parameter values u
j+1
= u
j
+∆u, where u
0
=0,u
n
=1,
and j =0, 1, 2,...,n. These coordinate positions could be connected with straight line
segments, or forward differences can be used to determine points along the cardinal-spline
path.
To display the curve section, the example program in Section 8-10 can be modified so
that the cardinal-spline routine replaces procedure bezier. As an option, a closed curve
as in Fig. 8-29 can be displayed using a cyclic permutation of the four control points.
Another option is to specify more that four control points so that multiple connected
cardinal-spline sections can be generated between all control points except the first point
and the last point.
8-7. The parametric equations for a Kochanek-Bartels spline can be derived from boundary
conditions 8-36 using the same procedures discussed for cardinal splines. And the curve
50 CHAPTER 8. THREE-DIMENSIONAL OBJECT REPRESENTATIONS
can be displayed using the cardinal-spline procedures in Exercise 8-6. For this program, an
input file can include values for the tension, bias, and continuity parameters, in addition
to the control-point positions and a value for the parametric step size ∆u.
8-8. As noted in Section 8-10, a B´ezier curve generated with three distinct, noncollinear control
points is a parabola. The three blending functions are
BEZ
0,2
=(1−u)
2
,BEZ
1,2
=2u(1 −u),BEZ
2,2
= u
2
Function BEZ
0,2
has a minimum value of 0 at u =1.0 and a maximum value of 1.0 at
u = 0. Function BEZ
1,2
has its minimum value of 0 at both u = 0 and u =1.0, and
BEZ
1,2
has a maximum value of 0.5 at u =0.5. Function BEZ
2,2
has a minimum value
of0atu = 0 and a maximum value of 1.0 at u =1.0.
8-9. The five B´ezier blending functions for n = 4 are
BEZ
0,4
=(1− u)
4
, min = 0 at u = 1; max = 1 at u =0
BEZ
1,4
=4u(1 − u)
3
, min = 0 at u =0, 1; max = 27/64 at u =1/4
BEZ
2,4
=6u
2
(1 − u)
2
, min = 0 at u =0, 1; max = 3/8 at u =1/2
BEZ
3,4
=4u
3
(1 − u), min = 0 at u =0, 1; max = 27/64 at u =3/4
BEZ
4,4
= u
4
, min = 0 at u = 0; max = 1 at u =1
8-10. For this exercise, replace the set of four control-point coordinates given in procedure
displayFcn with input from a data file. Other input values could also be included in
the data file, such as the curve width, the curve color, and details for displaying the
control points and control graph. For example, the control points could be displayed in
a specified size and color, with connecting dashed lines.
8-11. For this exercise, replace the fixed values for variable nCtrlPts and the control-point
coordinates given in procedure displayFcn with input from a data file that contains the
control-point positions and the number of positions. Various other data can be included
in the input, such as the number of points to be plotted along the curve path, the width
and color of the curve, and details for displaying the control points and control graph.
For example, the control points could be displayed in a specified size and color, with
connecting dashed lines. Other options include displaying the curve as set of straight-line
segments, or a set of points obtained with forward-difference calculations.
8-12. This programming exercise is a variation of the program for Exercise 8-10. Modify the
programming example in Section 8-10 so that the OpenGL routines from the example
in Section 8-18 are used to generate and display the B´ezier curve, instead of the explicit
calculations for the blending functions and curve coordinates.
8-13. Expand the program from the preceding exercise so that the control points are specified
in three-dimensional Cartesian coordinates and a three-dimensional B´ezier curve is gener-
ated. Viewing routines for displaying the curve can be taken from previous programming
剩余15页未读,继续阅读
cp_ebook
- 粉丝: 2
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论6