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 閱讀(224)
評論(0) 編輯 收藏 引用 所屬分類:
graph/game