加色模型
从黑色加起来
例子:
CRTs
Projection systems 投影仪
Positive film 正片
减色模型
互补色 Complementary colors
Some objects might be translucent 半透明
Physical Approaches:
Ray tracing 光线跟踪 无法处理复杂场景
Radiosity 辐射度: Energy based approach
函数组成:库前缀+根命令+可选的参数个数+可选的参数类型
Devices can be described either by
Physical properties物理属性
mouse
trackball
light pen
data tablet
joy stick
space ball
The code provides logical input 逻辑输入
The X Window System introduced a client-server model for a network of workstations
Client: OpenGL program
Graphics Server: bitmap display位图显示设备 with a pointing device and a keyboard
Programming interface程序界面 for event-driven input
Define a callback function for each type of event the graphics system recognizes
Many events may invoke the display callback function许多事件都会导致调用显示回调函数
Can lead to multiple executions of the display callback on a single pass through the event loop这会导致遍历一次事件循环的过程中多次执行显示回调函数
Many events may invoke the display callback function许多事件都会导致调用显示回调函数
Can lead to multiple executions of the display callback on a single pass through the event loop这会导致遍历一次事件循环的过程中多次执行显示回调函数
For unchanged contents静止图象 of the buffer, We refresh the frame buffer at 60 to 85 Hz rate
For animation动画, instead of one color buffer, we use two Buffers
Three Approaches
Two-dimensional forms二维形式
Explicit显式: y = mx +h
Implicit隐式: ax + by +c =0
Parametric参数形式:
x(a) = ax0 + (1-a)x1
y(a) = ay0 + (1-a)y1
Consider the “sum” 考虑“和”式
P=a1P1+a2P2+……+anPn
Can show by induction that this sum makes sense iff a1+a2+……an=1 in which case we have the affine sum of the points P1,P2,……Pn 当且仅当α1+ α2+…+ αn =1时上述和式有意义,此时结果就称为点P1, P2 ,…, Pn 的仿射和
An object is convex iff for any two points in the object all points on the line segment between these points are also in the object一个对象为凸的当且仅当在对象中任何两点的连接线段也在该对象内
A plane can be defined by a point and two vectors or by three points平面是由一个点与两个向量或者三个点确定的
Existing graphics hardware and software fit well with the 3-D objects现有图形硬件软件非常适合这些三维对象
Described by their surface and can be thought of as being hollow用对象的面来描述它,并认为是中空的
Specified through a set of vertices of 3D用三维空间的一系列顶点来确定
Composed of or approximated by flat, convex polygons由凸多边形组成,或者用凸多边形来逼近
A set of vectors v1, v2, …, vn is linearly independent if一组向量v1, v2 ,…, vn称为线性无关的,是指
a1v1+a2v2+… anvn=0 iff a1=a2=…=0
If a set of vectors is linearly independent, we cannot represent one in terms of the others如果一组向量是线性无关的,则不能把其中一个向量表示成其它向量的线性组合
If a set of vectors is linearly dependent, as least one can be written in terms of the others如果一组向量是线性相关的,那么其中至少有一个向量可以表示为其它向量的线性组合
In a vector space, the maximum number of linearly independent vectors is fixed and is called the dimension of the space在向量空间中,最大线性无关向量组的元素个数是固定的,这个数称为空间的维数(如2D、3D等)
In an n-dimensional space, any set of n linearly independent vectors form a basis for the space在n维空间中,任意n个线性无关的向量构成空间的基(如XYZ、RGB等)
到现在为止我们只是讨论几何对象,而没有使用任何参考标架,例如坐标系
If we define 0•P = 0 and 1•P =P then we can write
v=a1v1+ a2v2 +a3v3 = [a1 a2 a3 0 ] [v1 v2 v3 P0] T
P = P0 + b1v1+ b2v2 +b3v3= [b1 b2 b3 1 ] [v1 v2 v3 P0] T
Thus we obtain the four-dimensional homogeneous coordinate representation从而得到n+1维齐次坐标表示
If w=0, the representation is that of a vector当w = 0时,表示对应的是一个向量
If w=1, the representation of a point is [x y z 1]
齐次坐标是所有计算机图形系统的关键
Each of the basis vectors, u1,u2, u3, are vectors that can be represented in terms of the first basis u1,u2,u3中每个向量都可以用第一组表示出来
u1 = r11v1+r12v2+r13v3
u2 = r21v1+r22v2+r23v3
u3 = r31v1+r32v2+r33v3
Extending what we did with change of bases把基的改变方法推广可有
如何用标架v来表示标架u
defining a 4 x 4 matrix由此定义了4×4阶矩阵
一个仿射变换只具有12个自由度,因为所有仿射变换只是由4×4阶矩阵定义的线性变换的子集,而矩阵的16个元素中有四个元素是固定的
A transformation maps points to other points and/or vectors to other vectors所谓变换就是把点映射到其它点,把向量映射到其它向量
线性变换条件:f(αp+βq)=αf§+βf(q)
可以表示为矩阵相乘的形式:v=ATu
线性变换:标架的变换;顶点在同一个标架里的变换;
仿射变换是具有线性不变性的变换
p=[ x y z 1]T
p’=[x’ y’ z’ 1]T
d=[dx dy dz 0]T
Hence p’ = p + d or
x’=x+dx
y’=y+dy
z’=z+dz
p’=Tp
Expand or contract along each axis (fixed point of origin)
沿每个坐标轴伸展或收缩(原点为不动点)
Although we could compute inverse matrices by general formulas, we can use simple geometric observations虽然可以直接计算矩阵的逆,但根据几何意义可以给出各种变换的逆
Translation平移: T-1(dx, dy, dz) = T(-dx, -dy, -dz)
Rotation旋转: R -1(q) = R(-q)
Holds for any rotation matrix对任一旋转矩阵成立
Note that since cos(-q) = cos(q) and sin(-q)=-sin(q)
R -1(q) = R T(q)
Scaling放缩: S-1(sx, sy, sz) = S(1/sx, 1/sy, 1/sz)
Helpful to add one more basic transformation另外一种实用的基本变换
Equivalent to pulling faces in opposite directions等价于把面向相反方向倾斜
Consider simple shear along x axis考虑沿x轴的错切
x’ = x + y cot q
y’ = y
z’ = z
Order of Transformations变换的顺序
Note that matrix on the right is the first applied注意在右边的矩阵是首先被应用的矩阵
Mathematically, the following are equivalent从数学的角度来说,下述表示是等价的
p’ = ABCp = A(B(Cp))
变换的顺序是不可交换的(仅特殊情况下不影响结果)
Note many references use column matrices to represent points. In terms of column matrices列矩阵
p’T = pTCTBTAT
A rotation by q about an arbitrary axis can be decomposed into the concatenation of rotations about the x, y, and z axes绕过原点任一轴旋转θ角可以分解为绕x, y, z 轴旋转的复合
V + F - E = 2
顶点数:V
面数:F
边数:E
拓展的:
V+ F -E = 2+ H -2G
Viewing requires three basic elements视图中需要三个基本要素
One or more objects一个或多个对象
A viewer with a projection surface观察者,带有一个投影面
Projectors that go from the object(s) to the projection surface从对象到投影平面的投影变换
平面几何投影的分类图
Perspective Projection透视投影
Parallel Projection平行投影
Projection plane parallel to principal face投影面平行于基准面
Usually form front, top, side views通常从前面、顶部和侧面进行投影(三视图)
Allow projection plane to move relative to object投影面相对于对象基准面有一定的夹角
classify by how many angles of
a corner of a projected cube are
the same根据对立方体进行投影时一个角点处有多少个角相等进行分类
none没有: trimetric三度(正三测)
two两个: dimetric四边(正二测)
three三个: isometric等角(等轴测)
Arbitrary relationship between projectors and projection plane投影线与投影面之间的关系任意