http://blog.hjenglish.com/fjren/articles/143735.html
Mathematics for Computer Graphics
Greg Turk, August 1997
"What math should I learn in order to study computer graphics?" This is
perhaps the most common general question that students ask me about computer
graphics. The answer depends on how deeply you wish to go into the field. If you
wish to begin to use off-the-shelf graphics programs then the answer is that you
probably do not need to know very much math at all. If you wish to take an
introductory course in computer graphics, then you should read the first two
sections below for my recommendations (algebra, trigonometry and linear
algebra). If you want some day to be a researcher in graphics then I believe
that you should consider your mathematics education to be an ongoing process
throughout your career.
If you do not particularly care for mathematics, is there still a chance of
working in the field? Yes, a few areas within computer graphics are not much
concerned with mathematical ideas. You should not give up on graphics just
because you are not a math wizard. It is likely, however, that you will have
more freedom in choosing research topics if you have a willingness to learn
about new mathematical ideas.
There is no absolute answer to what mathematics is important in computer
graphics. Different areas within the field require different mathematical
techniques, and your own interests will likely lead you towards some topics and
may never touch others. Below are descriptions of a number of areas in
mathematics that I believe are useful in computer graphics. Do not feel that you
need to be an expert in each of these areas to become a graphics researcher! I
deliberately included many areas below to give a fairly broad view of the
mathematical ideas used in graphics. Many researchers, however, will never find
the need to look at some of the topics that I mention below.
Finally, although it should be clear from reading this, the opinions given
within this document are entirely my own. It is likely that you would get a
different list of topics or at least different emphases from other people who
work in computer graphics. Now on to the list of topics.
Algebra and Trigonometry
High-school level algebra and trigonometry are
probably the most important areas to know in order to begin to learn about
computer graphics. Just about every day I need to determine one or more unknowns
from a simple set of equations. Almost as often I need to perform simple
trigonometry such as finding the length of the edge of some geometric figure
based on other lengths and angles. Algebra and trigonometry are the subjects
that will solve such day-to-day tasks in computer graphics.
What about the geometry that we learn in high school? It may come as a
surprise, but our high school geometry is not very often needed for most tasks
in computer graphics. The reason for this is that geometry as it is taught in
many schools actually is a course in how to construct mathematical proofs. While
proof construction is definitely a valuable intellectual tool, the actual
theorems and proofs from your geometry class are not often used in computer
graphics. If you go to graduate school in a mathematics related field (including
computer graphics) then you may well find yourself proving theorems, but this is
not necessary in order to start out in graphics.
If you have a good understanding of algebra and trigonometry then you are
quite prepared to begin reading an introductory book in computer graphics. Most
such books contain at least an abbreviated introduction to the next important
area of mathematics for computer graphics, namely linear algebra.
Book recommendation:
- Computer Graphics: Principles and Practice
- James Foley, Andries van Dam, Steven Feiner, John Hughes
- Addison-Wesley
- [a huge book, but still my favorite]
Linear Algebra
The ideas of linear algebra are used throughout computer
graphics. In fact, any area that concerns itself with numerical representations
of geometry often will collect together numbers such as x,y,z positions into
mathematical objects called vectors. Vectors and a related mathematical object
called a matrix are used all the time in graphics. The language of vectors and
matrices is an elegant way to describe (among other things) the way in which an
object may be rotated, shifted (translated), or made larger or smaller (scaled).
Linear algebra is usually offered either in an advanced high school class or in
college. Anyone who wishes to work in computer graphics should eventually get a
solid grounding in this subject. As I mentioned before, however, many textbooks
in graphics give a reasonable introduction to this topic-- often enough to get
you through a first course in graphics.
Book recommendation:
- Linear Algebra and Its Applications
- Gilbert Strang
- Academic Press
Calculus
Knowledge of calculus is an important part of advanced computer
graphics. If you plan to do research in graphics, I strongly recommend getting a
basic grounding in calculus. This is true not just because it is a collection of
tools that are often used in the field, but also because many researchers
describe their problems and solutions in the language of calculus. In addition,
a number of important mathematical areas require calculus as a prerequisite.
This is the one area in mathematics in addition to basic algebra that can open
the most doors for you in computer graphics in terms of your future mathematical
understanding.
Calculus is the last of the topics that I will mention that is often
introduced in high school. The topics to follow are almost always found in
college courses.
Differential Geometry
This area of mathematics studies equations that
govern the geometry of smooth curves and surfaces. If you are trying to figure
out what direction is perpendicular to (points directly away from) a smooth
surface (the "normal vector") then you are using differential geometry. Making a
vehicle travel at a particular speed along a curved path is also differential
geometry. There is a common technique in graphics for making a smooth surface
appear rough known as "bump mapping", and this method draws on differential
geometry. If you plan to do work with curves and surfaces for shape creation
(called "modeling" in the graphics field) then you should learn at least the
basics of differential geometry. Multivariable calculus is the prerequisite for
this area.
Book recommendation:
- Elementary Differential Geometry
- Barrett O'Neill
- Academic Press
Numerical Methods
Almost every time we represent and manipulate numbers
in the computer we use approximate instead of exact values, and because of this
there is always the possibility for errors to creep in. Moreover, there are
often many different approaches to solving a given numerical problem, and some
methods will be faster, more accurate or require less memory than others. The
study of these issues goes by a number of names including "numerical methods"
and "scientific computing". This is a very broad area, and several of the other
areas of mathematics that I will mention can be considered sub-areas underneath
this umbrella. These sub-areas include sampling theory, matrix equations,
numerical solution of differential equations, and optimization.
Book recommendation:
- Numerical Recipes in C: The Art of Scientific Computing
- William Press, Saul Teukolsky, William Vetterling and Brian Flannery
- Cambridge University Press
- [this is a very valuable reference but is not normally used as a textbook]
Sampling Theory and Signal Processing
Over and over in computer graphics
we represent some object such as an image or a surface as a collection of
numbers that are stored in a regular two-dimensional array. Whenever we do this
we are creating a "sampled" representation of the object. A good understanding
of sampling theory is important if we are to use and to control the quality of
such representations. A common issue in sampling as it applies to graphics is
the jagged edges that can appear on the silhouette of an object when it is drawn
on a computer screen. The appearance of such jagged edges (one form of a
phenomenon known as "aliasing") is very distracting, and this can be minimized
by using well-understood techniques from sampling theory. At the heart of
sampling theory are concepts such as convolution, the Fourier transform, and
spatial and frequency representations of functions. These ideas are also
important in the fields of image and audio processing.
Book recommendation:
- The Fourier Transform and Its Applications
- Ronald N. Bracewell
- McGraw Hill
Matrix Equations
There are a wide variety of problems that come up in
computer graphics that require the numerical solution of matrix equations. Some
problems that need matrix techniques include: finding the best position and
orientation to match one object to another (one example of a "least squares"
problem), creating a surface that drapes over a given collection of points with
minimal creases (thin-plate splines), and simulation of materials such as water
or cloth. Matrix formulations of problems come up often enough in graphics that
I rank this area very high on my list of topics to know.
Book recommendation:
- Matrix Computations
- Gene Golub and Charles Van Loan
- Johns Hopkins University Press
Physics
Physics is obviously a field of study in its own right and not a
sub-category of mathematics. Nevertheless, physics and mathematics are closely
tied to one another in several areas within computer graphics. Examples of
graphics problems that involve physics include how light interacts with the
surfaces of objects, how light bounces around in a complex environment, the way
people and animals move, and the motion of water and wind. Knowledge of physics
is important for simulating all of these phenomena. This is closely tied to
solving differential equations, which I shall discuss next.
Numerical Solutions of Differential Equations
It is my belief that
techniques for solving differential equations are extremely important to
computer graphics. As we just discussed, much of computer graphics is devoted to
simulating physical systems from the real world. How waves form in water and how
an animal walks across the ground are two examples of physical simulation.
Simulation of physical systems very often leads to numerical solutions of
differential equations. Note that this is actually very different than symbolic
solutions to differential equations. Symbolic solutions are exact answers, and
usually can be found only for extremely simple sets of equations. Sometimes a
college course called "Differential Equations" will only examine symbolic
solutions, and this will not help much for most computer graphics problems.
In physical simulation, one breaks the world down into little pieces that are
represented as large vectors. Then the relations between the parts of the world
are captured in the entries in matrices. Solving the matrix equations that arise
is not usually done exactly, but is instead performed by carrying out a long
series of calculations that yields an approximate solution as a list of numbers.
This is what numerical solutions of differential equations are about. Note that
the solution of matrix equations is an intimate part of numerical solutions to
differential equations.
Optimization
Quite often in computer graphics we are looking for a
description of an object or a collection of objects that satisfies some desired
goal. Examples include looking for the positions of lights that give a certain
"feeling" to how a room is lit, figuring out how an animated character can move
its limbs to carry out a particular action, and positioning shapes and text on a
page so that the result does not look cluttered. Each of these examples can be
stated as an optimization problem. Ten years ago there was little in the
graphics literature that made use of optimization techniques, but the field is
using optimization more and more in recent work. I think that optimization will
continue to play an increasingly important role in computer graphics.
Probability and Statistics
There are a number of areas within computer
graphics that make use of probability and/or statistics. Certainly when
researchers carry out studies using human subject, they require statistical
methods in order to perform the analysis of the data. Graphics related areas
that often make use of human subjects include Virtual Reality and Human-Computer
Interaction (HCI). In addition, many computer descriptions of the real world
involve using various probabilities that a given action will occur. The
probability that a tree limb will branch during growth or that a synthetic
animal will decide to walk in a particular direction are two examples of this.
Finally, some techniques for solving difficult equations make use of random
numbers to estimate their solutions. An important example of this is a class of
techniques known as Monte Carlo methods that are often used to determine how
light propagates in an environment. These are just a few of the ways that
probability and statistics are used in computer graphics.
Computational Geometry
Computational geometry is the study of efficient
ways to represent and manipulate geometry within the computer. Typical problems
include testing whether two objects collide, deciding how to break up a polygon
into triangles, and finding the nearest point in a group to a given location.
This area is a blend of algorithms, data structures and mathematics. Researchers
in graphics who work on creating shapes (modeling) draw heavily upon this area.
Book recommendations:
- Computational Geometry in C
- Joseph O'Rourke
- Cambridge University Press
- [undergraduate text]
- Computational Geometry: An Introduction
- Franco Preparata and Michael Shamos
- Springer-Verlag
- [the classic text, somewhat dated]
Concluding Words: Applied and Pure Mathematics
One common thread to many
of the mathematical topics that are associate with graphics is that they are
from the applied side instead of the theoretical side of mathematics. This
should not come as a surprise. Many of the problems in computer graphics are
closely tied to problems that physicists and engineers have studied, and the
mathematical tools of the physicist and of the engineer are overwhelmingly the
tools that graphics researchers use. Most of the topics that make up theoretical
("pure") mathematics are seldom put to use in computer graphics. This should not
be taken as an absolute truth, however. We should pay attention to examples from
other fields: molecular biology is now drawing upon knot theory for the study of
DNA dynamics, and subatomic physics makes use of abstract group theory. Who can
tell when a "pure" mathematics topic will be put to use in computer graphics?
There are a few areas of mathematics that seem as though they ought to be
important and yet never really play a large part in computer graphics. Perhaps
the most interesting of these areas is topology. The usual one-sentence
description of topology is the study of why a doughnut and a coffee cup are the
same. The answer is that they are both surfaces with one hole. Here we are
talking about ideas from topology. Aren't surfaces a big part of computer
graphics? Yes, but it turns out that most of the ideas in topology that are
useful to graphics can be learned in a first course in differential geometry.
Differential geometry studies the *shapes* of surfaces, whereas topology studies
things such as which parts of a surface are next to which other parts. I have
seen very little topology that is put to use in graphics, and I believe that
this is because much of topology is concerned with rather abstract sets, and
that much of topology is far removed from the concepts in three dimensional
Euclidean space that is so central to most of graphics. There are times when the
formalism of topology (the symbolic notation) is a convenient way to express
ideas in graphics, but the actual tools from abstract topology so seldom play a
role in graphics. Study this beautiful subject for its own sake, but don't
expect an immediate payoff for graphics!
I have been asked a few times whether either abstract algebra (group theory,
rings, etc.) or number theory play a role in computer graphics. Not much that I
have seen. These subjects, like topology, are areas that are full of beautiful
ideas. Unfortunately these ideas seldom find their way into computer graphics.
Mathematics for Computer Graphics
数学在计算机图形学中的应用
Greg Turk, August 1997
“学习计算机图形学需要多少的数学?”这是初学者最经常问的问题。答案取决于你想在计算机图形学领域钻研多深。如果仅仅使用周围唾手可得的图形软件,你不需要知道多少数学知识。如果想学习计算机图形学的入门知识,我建议你读一读下面所写的前两章(代数,三角学和线性代数)。如果想成为一名图形学的研究者,那么对数学的学习将是活到老,学到老。
如果你并不特别喜欢数学,是否仍有在计算机图形学领域工作的机会?是的,计算机图形学的确有一些方面不需要考虑太多的数学问题。你不应该因为数学成绩不好而放弃它。不过,如果学习了更多的数学知识,似乎你将在研究课题上有更多的选择余地。
对于在计算机图形学中哪些数学才是重要的还没有明确的答案。这领域里不同的方面要求掌握不同的数学知识,也许兴趣将会决定了你的方向。以下介绍我认为对于计算机图形学有用的数学。别以为想成为一名图形学的研究者就必须精通各门数学!为了对用于图形学的数学有一个全面的看法,我特地列出了很多方面。但是许多研究者从不需要考虑下面提到的数学。
最后,虽然读了这篇文章后,你应该会对数学在计算机图形学中的应用有所了解,不过这些观点完全是我自己的。也许你应该阅读更多的此类文章,或者至少从其他从事计算机图形学工作的人那里了解不同的学习重点。现在开始切入正题。
代数和三角学
对于计算机图形学的初学者来说,高中的代数和三角学可能是最重要的数学。日复一日,我从简单的方程解出一个或更多的根。我时常还要解决类似求一些几何图形边长的简单三角学问题。代数和三角学是计算机图形学的最基础的知识。
那么高中的几何学怎么样呢?可能让人惊讶,不过在多数计算机图形学里,高中的几何学并不经常被用到。原因是许多学校教的几何学实际上是如何建立数学证明的课程。虽然证明题对提高智力显然是有效的,但对于计算机图形学来说,那些与几何课有关的定理和证明并不常被用到。如果你毕业于数学相关领域(包括计算机图形学),就会发现虽然你在证明定理,不过这对开始学习图形学不是必要的。
如果精通代数和三角学,就可以开始读一本计算机图形学的入门书了。下一个重要的用于计算机图形学的数学——线性代数,多数此类书籍至少包含了一个对线性代数的简要介绍。
推荐的参考书:
Computer Graphics: Principles and Practice
James Foley, Andries van Dam, Steven Feiner, John Hughes
Addison-Wesley
[虽然厚重,可是我很喜欢]
线性代数
线性代数的思想贯穿于计算机图形学。事实上,只要牵涉到几何数值表示法,就常常抽象出例如x,y,z坐标之类的数值,我们称之为矢量。图形学自始至终离不开矢量和矩阵。用矢量和矩阵来描述旋转,平移,或者缩放是再好不过了。高中和大学都有线性代数的课程。只要想在计算机图形学领域工作,就应该打下坚实的线性代数基础。我刚才提到,许多图形学的书都有关于线性代数的简要介绍——足够教给你图形学的第一门课。
推荐的参考书:
Linear Algebra and Its Applications
Gilbert Strang
Academic Press
微积分学
微积分学是高级计算机图形学的重要成分。如果打算研究图形学,我强烈建议你应该对微积分学有初步认识。理由不仅仅是微积分学是一种很有用的工具,还有许多研究者用微积分学的术语来描述他们的问题和解决办法。另外,在许多重要的数学领域,微积分学被作为进一步学习的前提。学习了基本代数之后,微积分学又是一种能为你打开多数计算机图形学与后继的数学学习之门的课程。
微积分学是我介绍的最后一个中学课程,以下提及的科目几乎全部是大学的课程。
微分几何学
微分几何学研究支配光滑曲线,曲面的方程组。如果你要计算出经过某个远离曲面的点并垂直于曲面的矢量(法向矢量)就会用到微分几何学。让一辆汽车以特定速度在曲线上行驶也牵涉到微分几何学。有一种通用的绘制光滑曲面的图形学技术,叫做“凹凸帖图”,这个技术用到了微分几何学。如果要着手于用曲线和曲面来创造形体(在图形学里称之为建模)你至少应该学习微分几何学的基础。
推荐的参考书:
Elementary Differential Geometry
Barrett O'Neill
Academic Press
数值方法
几乎任何时候,我们在计算机里用近似值代替精确值来表示和操作数值,所以计算过程总是会有误差。而且对于给定的数值问题,常常有多种解决的方法,一些方法会更块,更精确或者对内存的需求更少。数值方法研究的对象包括“计算方法”和“科学计算”等等。这是一个很广阔的领域,而且我将提及的其他几门数学其实是数值方法的一些分支。这些分支包括抽样法理论,矩阵方程组,数值微分方程组和最优化。
推荐的参考书:
Numerical Recipes in C: The Art of Scientific Computing
William Press, Saul Teukolsky, William Vetterling and Brian Flannery
Cambridge University Press
[这本参考书很有价值可是很少作为教材使用]
抽样法理论和信号处理
在计算机图形学里我们反复使用储存在正规二维数组里的数字集合来表示一些对象,例如图片和曲面。这时,我们就要用抽样法来表示这些对象。如果要控制这些对象的品质,抽样法理论就变得尤为重要。抽样法应用于图形学的常见例子是当物体被绘制在屏幕上时,它的轮廓呈现锯齿状的边缘。这锯齿状的边缘(被认为是“混淆”现象)是非常让人分散注意力的,用抽样法中著名的技术例如回旋,傅立叶变换,空间和频率的函数表示就能把这个现象减少到最小。这些思想在图像和音频处理领域是同样重要的。
推荐的参考书:
The Fourier Transform and Its Applications
Ronald N. Bracewell
McGraw Hill
矩阵方程组
计算机图形学的许多问题要用到矩阵方程组的数值解法。一些涉及矩阵的问题包括:找出最好的位置与方向以使对象们互相匹配(最小二乘法),创建一个覆盖所给点集的曲面,并使皱折程度最小(薄板样条算法),还有材质模拟,例如水和衣服等。在图形学里矩阵表述相当流行,因此在用于图形学的数学中我对矩阵方程组的评价是很高的。
推荐的参考书:
Matrix Computations
Gene Golub and Charles Van Loan
Johns Hopkins University Press
物理学
物理学显然不是数学的分支,它是自成一家的学科。但是在计算机图形学的某些领域,物理学和数学是紧密联系的。在图形学里,牵涉物理学的问题包括光与物体的表面是怎样互相影响的,人与动物的移动方式,水与空气的流动。为了模拟这些自然现象,物理学的知识是必不可少的。这和解微分方程紧密联系,我将会在下一节提到微分方程。
微分方程的数值解法
我相信对于计算机图形学来说,解微分方程的技巧是非常重要的。像我们刚才讨论的,计算机图形学致力于模拟源于真实世界的物理系统。波浪是怎样在水里形成的,动物是怎样在地面上行走的,这就是两个模拟物理系统的例子。模拟物理系统的问题经常就是怎样解微分方程的数值解。请注意,微分方程的数值解法与微分方程的符号解法是有很大差异的。符号解法求出没有误差的解,而且时常只用于一些非常简单的方程。有时大学课程里的“微分方程”只教符号解法,不过这并不会对多数计算机图形学的问题有帮助。
在对物理系统的模拟中,我们把世界细分为许多表示成矢量的小元素。然后这些元素之间的关系就可以用矩阵来描述。虽然要处理的矩阵方程组往往没有很精确的解,但是取而代之的是执行了一系列的计算,这些计算产生一个表示成数列的近似解。这就是微分方程的数值解法。请注意,矩阵方程的解法与微分方程数值解法的关系是很密切的。
最优化
在计算机图形学里,我们常常为了期望的目标寻求一种合适的描述对象或者对象集的方法。例如安排灯的位置使得房间的照明看起来有种特殊的“感觉”,动画里的人物要怎样活动四肢才能实现一个特殊的动作,怎样排版才不会使页面混乱。以上这些例子可以归结为最优化问题。十年前的计算机图形学几乎没有最优化技术的文献,不过最近这个领域越来越重视最优化理论。我认为在计算机图形学里,最优化的重要性将会日益增加。
概率论与统计学
计算机图形学的许多领域都要用到概率论与统计学。当研究者涉足人类学科时,他们当然需要统计学来分析数据。图形学相关领域涉及人类学科,例如虚拟现实和人机交互(HCI)。另外,许多用计算机描绘真实世界的问题牵涉到各种未知事件的概率。两个例子:一棵成长期的树,它的树枝分杈的概率;虚拟的动物如何决定它的行走路线。最后,一些解高难度方程组的技巧用了随机数来估计方程组的解。重要的例子:蒙特卡罗方法经常用于光如何传播的问题。以上仅是一部分在计算机图形学里使用概率论和统计学的方法。
计算几何学
计算几何学研究如何用计算机高效地表示与操作几何体。典型问题如,碰撞检测,把多边形分解为三角形,找出最靠近某个位置的点,这个学科包括了运算法则,数据结构和数学。图形学的研究者,只要涉足创建形体(建模),就要大量用到计算几何学。
推荐的参考书:
Computational Geometry in C
Joseph O'Rourke
Cambridge University Press
[大学教材]
Computational Geometry: An Introduction
Franco Preparata and Michael Shamos
Springer-Verlag
[很经典,不过有点旧了]
总结:数学应用和数学理论
对于图形学来说,以上提到的许多数学学科都有个共同点:比起这些数学的理论价值,我们更倾向于发掘它们的应用价值。不要惊讶。图形学的许多问题和物理学者与工程师们研究的问题是紧密联系的,并且物理学者与工程师们使用的数学工具正是图形学研究者们使用的。多数研究纯数学理论的学科从不被用于计算机图形学。不过这不是绝对的。请注意这些特例:分子生物学正利用节理论来研究DNA分子动力学,亚原子物理学用到了抽象群论。也许有一天,纯数学理论也能推动计算机图形学的发展,谁知道呢?
有些看来重要的数学实际上在计算机图形学里不常被用到。可能拓扑学是此类数学中最有意思的。用一句话来形容拓扑学,它研究油炸圈饼与咖啡杯为什么在本质上是相同的。答案是他们都是只有一个洞的曲面。我们来讨论一下拓扑学的思想。虽然曲面是计算机图形学的重要成分,不过微分几何学的课程已经涵盖了多数对图形学有用的拓扑学知识。微分几何学研究曲面的造型,可是拓扑学研究曲面的相邻关系。我觉得拓扑学对于图形学来说几乎没用,这是由于拓扑学关心抽象的事物,而且拓扑学远离了多数图形学的核心——三维欧氏空间的概念。对于图形学来说,拓扑学的形式(符号表示法)是表达思想的简便方法,不过图形学很少用到抽象拓扑学的实际工具。对图形学来说,拓扑学像一个好看的花瓶,不过别指望它能立即带给你回报。
有人曾经这么问我,计算机图形学是否用到了抽象代数(群论,环,等等….)或者数论。我没怎么遇到过。和拓扑学一样,这些学科有很多美好的思想。可是很不幸,这些思想很少用于计算机图形学。
--The End--
[小鹏翻译 email: rggg_clp@163.com]
posted on 2008-08-31 04:22
bneliao 阅读(217)
评论(0) 编辑 收藏 引用 所属分类:
graph/game