# 《计算机图形学基础（OpenGL版）》勘误表

38

9

(1MB)

(128KB)

41

16

k=Δx/Δyk=\Delta x/\Delta yk=Δx/Δy

k=Δy/Δxk=\Delta y/\Delta xk=Δy/Δx

43

9

d≤0d \leq 0d≤0

d≥0d \geq 0d≥0

46

6

s−t=sΔxΔy(xi+1)+2b+2yi−1 s-t = s \frac{\Delta x}{\Delta y}(x_i+1)+2b+2y_i-1s−t=sΔyΔx​(xi​+1)+2b+2yi​−1

s−t=sΔxΔy(xi+1)+2b−2yi−1 s-t = s \frac{\Delta x}{\Delta y}(x_i+1)+2b -2y_i-1s−t=sΔyΔx​(xi​+1)+2b−2yi​−1

46

−1≤1≤0-1\leq1\leq0−1≤1≤0

0≤k≤10\leq k\leq 10≤k≤1

47

26

int curx = x1;

int curx = x1 + 1;

48

12

b=x0−x1b=x_0-x_1b=x0​−x1​

b=x1−x0b=x_1-x_0b=x1​−x0​

51

19

52

Cirpot(x0, y0, x, y)

Cirpot(x0, y0, x, y, color)

53

9

Cirpot(x0, y0, x, y)

Cirpot(x0, y0, x, y, color)

57

7

FloodFill

FloodFill4

57

13-16

FloodFill4(…, newcolor)

FloodFill4(…, newcolor, boundaryColor)

58-59

58页倒数第2行~59页第11行

59

60

65

65

yi+m/2y_i+m/2yi​+m/2

yi−int(yi)+m/2y_i-int(y_i)+m/2yi​−int(yi​)+m/2

73

6

y′=rsin(ϕ+θ)=rcosϕsinθ−rsinϕcosθ y&#x27;=rsin(\phi+\theta)=rcos \phi sin \theta - rsin \phi cos \theta y′=rsin(ϕ+θ)=rcosϕsinθ−rsinϕcosθ

y′=rsin(ϕ+θ)=rcosϕsinθ+rsinϕcosθ y&#x27;=rsin(\phi+\theta)=rcos \phi sin \theta + rsin \phi cos \theta y′=rsin(ϕ+θ)=rcosϕsinθ+rsinϕcosθ

75

8

117

2

T=R(θ)T(−x0,−y0)=[cosθsinθ0−sinθcosθ0001][10−x001−y0001]T=R(\theta)T(-x_0, -y_0) =\begin{bmatrix} cos\theta &amp; sin\theta &amp; 0 \\ -sin\theta &amp; cos\theta &amp; 0 \\ 0 &amp; 0 &amp; 1 \\ \end{bmatrix} \begin{bmatrix} 1 &amp; 0 &amp; -x_0 \\0 &amp; 1 &amp; -y_0 \\0 &amp; 0 &amp; 1 \end{bmatrix}T=R(θ)T(−x0​,−y0​)=⎣⎡​cosθ−sinθ0​sinθcosθ0​001​⎦⎤​⎣⎡​100​010​−x0​−y0​1​⎦⎤​

T=R(θ)T(−x0,−y0)=[cosθ−sinθ0sinθcosθ0001][10−x001−y0001]T=R(\theta)T(-x_0, -y_0) = \begin{bmatrix} cos\theta &amp; -sin\theta &amp; 0 \\sin\theta &amp; cos\theta &amp; 0 \\ 0 &amp; 0 &amp; 1 \end{bmatrix} \begin{bmatrix} 1 &amp; 0 &amp; -x_0 \\0 &amp; 1 &amp; -y_0 \\0 &amp; 0 &amp; 1 \end{bmatrix} T=R(θ)T(−x0​,−y0​)=⎣⎡​cosθsinθ0​−sinθcosθ0​001​⎦⎤​⎣⎡​100​010​−x0​−y0​1​⎦⎤​

122

15

t1′′=(xR−x1)/dxt_1^{&#x27;&#x27;}=(x_R-x_1)/dxt1′′​=(xR​−x1​)/dx

t1′′=(yb−y1)/dyt_1^{&#x27;&#x27;}=(y_b-y_1)/dyt1′′​=(yb​−y1​)/dy

130

24

131

1

131

135

(6.2)

u=V×n∣N∣=(ux,uy,uz)u=\frac{V \times n}{\mid N \mid} = (u_x, u_y, u_z)u=∣N∣V×n​=(ux​,uy​,uz​)

u=V×n∣V×n∣=(ux,uy,uz)u=\frac{V \times n}{\mid V \times n \mid} = (u_x, u_y, u_z)u=∣V×n∣V×n​=(ux​,uy​,uz​)

151

(6.29)

[xpyp01]=[1000010000000001][100001000010001d1][xsyszs1]=[xsys01+zsd] \begin{bmatrix}x_p \\ y_p \\ 0 \\ 1 \end{bmatrix} =\begin{bmatrix}1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 0 &amp; 1\end{bmatrix} \begin{bmatrix} 1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 0 &amp; 0 &amp; \frac{1}{d} &amp; \LARGE{ 1} \end{bmatrix} \begin{bmatrix} x_s \\ y_s \\ z_s \\ 1 \end{bmatrix} = \begin{bmatrix} x_s \\ y_s \\ 0 \\ \LARGE{1+ \frac{z_s}{d}} \end{bmatrix}⎣⎢⎢⎡​xp​yp​01​⎦⎥⎥⎤​=⎣⎢⎢⎡​1000​0100​0000​0001​⎦⎥⎥⎤​⎣⎢⎢⎡​1000​0100​001d1​​0001​⎦⎥⎥⎤​⎣⎢⎢⎡​xs​ys​zs​1​⎦⎥⎥⎤​=⎣⎢⎢⎢⎡​xs​ys​01+dzs​​​⎦⎥⎥⎥⎤​

[xpyp01]=[1000010000000001][100001000010001d0][xsyszs1]=[xsys0zsd] \begin{bmatrix} x_p \\ y_p \\ 0 \\ 1 \end{bmatrix} =\begin{bmatrix}1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\0 &amp; 0 &amp; 0 &amp; 0 \\0 &amp; 0 &amp; 0 &amp; 1\end{bmatrix} \begin{bmatrix} 1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 0 &amp; 0 &amp; \frac{1}{d} &amp; \LARGE{0}\end{bmatrix} \begin{bmatrix} x_s \\ y_s \\ z_s \\ 1 \end{bmatrix} = \begin{bmatrix} x_s \\ y_s \\ 0 \\ \LARGE{ \frac{z_s}{d} } \end{bmatrix}⎣⎢⎢⎡​xp​yp​01​⎦⎥⎥⎤​=⎣⎢⎢⎡​1000​0100​0000​0001​⎦⎥⎥⎤​⎣⎢⎢⎡​1000​0100​001d1​​0000​⎦⎥⎥⎤​⎣⎢⎢⎡​xs​ys​zs​1​⎦⎥⎥⎤​=⎣⎢⎢⎢⎡​xs​ys​0dzs​​​⎦⎥⎥⎥⎤​

151

(6.31)

[10000100001000r1] \begin{bmatrix}1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 0 &amp; 0 &amp; r &amp; 1\end{bmatrix} ⎣⎢⎢⎡​1000​0100​001r​0001​⎦⎥⎥⎤​

[10000100001000r0] \begin{bmatrix} 1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 0 &amp; 0 &amp; r &amp; 0\end{bmatrix} ⎣⎢⎢⎡​1000​0100​001r​0000​⎦⎥⎥⎤​

151

(6.33)

[100001000010p001] \begin{bmatrix}1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\0 &amp; 0 &amp; 1 &amp; 0 \\ p &amp; 0 &amp; 0 &amp; 1\end{bmatrix} ⎣⎢⎢⎡​100p​0100​0010​0001​⎦⎥⎥⎤​

[100001000010p000] \begin{bmatrix}1 &amp; 0 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ p &amp; 0 &amp; 0 &amp; 0 \end{bmatrix} ⎣⎢⎢⎡​100p​0100​0010​0000​⎦⎥⎥⎤​

151

(6.34)

[1000010000100q01] \begin{bmatrix} 1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 0 &amp; q &amp; 0 &amp; 1\end{bmatrix} ⎣⎢⎢⎡​1000​010q​0010​0001​⎦⎥⎥⎤​

[1000010000100q00] \begin{bmatrix} 1 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 0 &amp; q &amp; 0 &amp; 0\end{bmatrix} ⎣⎢⎢⎡​1000​010q​0010​0000​⎦⎥⎥⎤​

152

(6.35)

152

(6.35)

152

12

152

(6.37)

a=−(zfar+znear)znearzfar−znear a=\frac{-(z_{far}+z_{near})z_{near}}{z_{far}-z_{near}}a=zfar​−znear​−(zfar​+znear​)znear​​

a=zfar+znearznear(zfar−znear) a=\frac{z_{far}+z_{near}}{z_{near}(z_{far}-z_{near})}a=znear​(zfar​−znear​)zfar​+znear​​

224

2

8

11

20

ZB(x,y)单元置为最小值

ZB(x,y)单元置为最大值

26

if(z(x,y) > ZB(x,y))

if(z(x,y) < ZB(x,y))

### 附录B 模拟试题及答案

337

340

T=[200010111]T= \left[ \begin{matrix} 2 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 0 \\ 1 &amp; 1 &amp; 1 \end{matrix} \right] T=⎣⎡​201​011​001​⎦⎤​

P′=PT=[xy1][200010111]P^{&#x27;}= PT =\left[ \begin{matrix} x &amp; y &amp; 1 \end{matrix} \right] \left[ \begin{matrix} 2 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 0 \\ 1 &amp; 1 &amp; 1 \end{matrix} \right] P′=PT=[x​y​1​]⎣⎡​201​011​001​⎦⎤​

345

347

349

ABC

ABCD

350

B

C

350

B

C

350

C

D

350

ACD

ABCD

350

CD

BCD

352

D

B

352

BCE

352

BD

B

352

BD

BCD

354

[00011/271/91/308/274/91/301111]\begin{bmatrix} 0 &amp; 0 &amp; 0 &amp; 1 \\ 1/27 &amp; 1/9 &amp; 1/3 &amp; 0 \\ 8/27 &amp; 4/9 &amp; 1/3 &amp; 0 \\ 1 &amp; 1 &amp; 1 &amp; 1 \end{bmatrix}⎣⎢⎢⎡​01/278/271​01/94/91​01/31/31​1001​⎦⎥⎥⎤​

[00011/271/91/318/274/92/311111]\begin{bmatrix} 0 &amp; 0 &amp; 0 &amp; 1 \\ 1/27 &amp; 1/9 &amp; 1/3 &amp; 1 \\ 8/27 &amp; 4/9 &amp; 2/3 &amp; 1 \\ 1 &amp; 1 &amp; 1 &amp; 1 \end{bmatrix}⎣⎢⎢⎡​01/278/271​01/94/91​01/32/31​1111​⎦⎥⎥⎤​

• P349, 模拟试题1，第四大题第3小题答案： T1=[100010−2−41]T_1= \left[ \begin{matrix} 1 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 0 \\ -2 &amp; -4 &amp; 1 \end{matrix} \right] T1​=⎣⎡​10−2​01−4​001​⎦⎤​

T2=[cos600∘sin600∘0−sin600∘cos600∘0001]=[−1/2−3/203/2−1/20001]T_2= \left[ \begin{matrix} cos600^\circ &amp; sin600^\circ &amp; 0 \\ -sin600^\circ &amp; cos600^\circ &amp; 0 \\ 0 &amp; 0 &amp; 1 \end{matrix} \right] =\left[ \begin{matrix} -1/2 &amp; -\sqrt{3}/2 &amp; 0 \\ \sqrt{3}/2 &amp; -1/2 &amp; 0 \\ 0 &amp; 0 &amp; 1 \end{matrix} \right]T2​=⎣⎡​cos600∘−sin600∘0​sin600∘cos600∘0​001​⎦⎤​=⎣⎡​−1/23​/20​−3​/2−1/20​001​⎦⎤​

T3=[100010241]T_3= \left[ \begin{matrix} 1 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 0 \\ 2 &amp; 4 &amp; 1 \end{matrix} \right] T3​=⎣⎡​102​014​001​⎦⎤​

T=T1T2T3=[−1/2−3/203/2−1/203−236+31]T= T_1T_2T_3= \left[ \begin{matrix} -1/2 &amp; -\sqrt{3}/2 &amp; 0\\ \sqrt{3}/2 &amp; -1/2 &amp; 0 \\ 3-2 \sqrt{3} &amp; 6+ \sqrt{3} &amp; 1 \end{matrix} \right] T=T1​T2​T3​=⎣⎡​−1/23​/23−23​​−3​/2−1/26+3​​001​⎦⎤​ 由 $P^{’}= PT$ 可得：[A′B′C′]=[ABC]T=[241441411]T=[24114−311−33/211/2−31] \left[ \begin{matrix} A^{&#x27;} \\ B^{&#x27;} \\ C^{&#x27;} \end{matrix} \right] =\left[ \begin{matrix} A \\ B \\ C \end{matrix} \right] T = \left[ \begin{matrix} 2 &amp; 4 &amp; 1 \\ 4 &amp; 4 &amp; 1 \\ 4 &amp; 1 &amp; 1 \end{matrix} \right] T= \left[ \begin{matrix} 2 &amp; 4 &amp; 1 \\ 1 &amp; 4-\sqrt{3} &amp; 1 \\ 1-3\sqrt{3}/2 &amp; 11/2-\sqrt{3} &amp; 1 \end{matrix} \right]⎣⎡​A′B′C′​⎦⎤​=⎣⎡​ABC​⎦⎤​T=⎣⎡​244​441​111​⎦⎤​T=⎣⎡​211−33​/2​44−3​11/2−3​​111​⎦⎤​

• P350, 模拟试题1，第四大题第4小题答案： 由相似三角形关系可得x′x=dd−z \frac{x^{&#x27;}} {x} = \frac{d} {d-z} xx′​=d−zd​于是 x′=xdd−z=x1−zdx^{&#x27;} = \frac{xd} {d-z}= \frac{x} {1-\frac{z}{d}}x′=d−zxd​=1−dz​x​ 同理有：y′=y1−zdy^{&#x27;} = \frac{y} {1-\frac{z}{d}}y′=1−dz​y​ 另外，z′=0z^{&#x27;}=0z′=0. 于是有： P′=[x′y′z′1]=[x1−zdy1−zd01]≡[xy01−zd]=[10000100000000−1d1][xyz1]＝TP P^{&#x27;} = \left[ \begin{matrix} x^{&#x27;} \\ y^{&#x27;} \\ z^{&#x27;} \\ 1 \end{matrix} \right] =\left[ \begin{matrix} \frac{x} {1-\frac{z}{d}} \\ \frac{y} {1-\frac{z}{d}} \\ 0 \\ 1 \end{matrix} \right] \equiv \left[ \begin{matrix} x \\ y \\ 0 \\ 1-\frac{z}{d} \end{matrix} \right] = \left[ \begin{matrix} 1 &amp; 0 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; -\frac{1}{d} &amp; 1 \\ \end{matrix} \right] \left[ \begin{matrix} x \\ y \\ z \\ 1 \end{matrix} \right] ＝ TP P′=⎣⎢⎢⎡​x′y′z′1​⎦⎥⎥⎤​=⎣⎢⎢⎡​1−dz​x​1−dz​y​01​⎦⎥⎥⎤​≡⎣⎢⎢⎡​xy01−dz​​⎦⎥⎥⎤​=⎣⎢⎢⎡​1000​0100​000−d1​​0001​⎦⎥⎥⎤​⎣⎢⎢⎡​xyz1​⎦⎥⎥⎤​＝TP 上式中TTT即为透视变换矩阵，其中$\equiv$表示齐次坐标转化。 顶点坐标计算：以G点为例，G点齐次坐标为(1,1,-1,1)，则由透视变换可知： G′=TG=T[11−11]=[10000100000000−1d1][11−11]＝[1101+1d]≡[dd+1dd+101] G^{&#x27;} = TG =T \left[ \begin{matrix} 1 \\ 1 \\ -1 \\ 1 \end{matrix} \right] = \left[ \begin{matrix} 1 &amp; 0 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; -\frac{1}{d} &amp; 1 \\ \end{matrix} \right] \left[ \begin{matrix} 1 \\ 1 \\ -1 \\ 1 \end{matrix} \right] ＝ \left[ \begin{matrix} 1 \\ 1 \\ 0 \\ 1+\frac{1}{d} \end{matrix} \right] \equiv \left[ \begin{matrix} \frac{d}{d+1} \\ \frac{d}{d+1} \\ 0 \\ 1 \end{matrix} \right] G′=TG=T⎣⎢⎢⎡​11−11​⎦⎥⎥⎤​=⎣⎢⎢⎡​1000​0100​000−d1​​0001​⎦⎥⎥⎤​⎣⎢⎢⎡​11−11​⎦⎥⎥⎤​＝⎣⎢⎢⎡​1101+d1​​⎦⎥⎥⎤​≡⎣⎢⎢⎡​d+1d​d+1d​01​⎦⎥⎥⎤​ 故透视变换后G点变为G′=(dd+1,dd+1,0)G^{&#x27;}=( \frac{d}{d+1}, \frac{d}{d+1}, 0)G′=(d+1d​,d+1d​,0).
• P351, 模拟试题2，第五大题第2小题答案： cosi=L⃗⋅N⃗=0.5,R⃗=2cosiN⃗−L⃗=(−1/2,1/2,−2/2). cosi=\vec{L} \cdot \vec{N}=0.5, \vec{R} = 2cosi\vec{N}-\vec{L}=(-1/2,1/2,-\sqrt{2}/2).cosi=L⋅N=0.5,R=2cosiN−L=(−1/2,1/2,−2​/2). cosθ=R⃗⋅V⃗=−2/2&lt;0,R⃗与V⃗夹角大于90度，因此V⃗方向上无镜面反射光，所以cosθ取0.cos\theta= \vec{R} \cdot \vec{V} = -\sqrt{2}/2&lt;0, \vec{R}与\vec{V}夹角大于90度，因此\vec{V}方向上无镜面反射光，所以 cos\theta取0. cosθ=R⋅V=−2​/2<0,R与V夹角大于90度，因此V方向上无镜面反射光，所以cosθ取0. ∴I=Ipaka+Ip(kdcosi+kscosnθ)=160∗0.5+175(0.2∗0.5+0)=97.5\therefore I=I_{pa}k_a+I_p(k_dcosi+k_scos^n\theta)=160*0.5+175(0.2*0.5+0)=97.5∴I=Ipa​ka​+Ip​(kd​cosi+ks​cosnθ)=160∗0.5+175(0.2∗0.5+0)=97.5

x

y

did_idi​

Next Point

2

1

0

E

3

1

0-4=-4

NE

4

2

-4+4=0

E

5

2

0-4=-4

NE

6

3

-4+4=0

E

7

3

0-4=-4

NE

8

4

-4+4=0

E

9

4

0-4=-4

NE

10

5

0 条评论

• ### 模拟试题A

版权声明：本文为博主原创文章，未经博主允许不得转载。 https://blog.csdn.net/wpxu08/article/detail...

• ### 翻车！Spring Boot 2.2.3 不兼容 Spring Cloud Hoxton.SR1

Spring Boot 2.2.3 修复了 Spring Boot 2.2的大量问题，当升级至 2.2.3 以后，直接翻车 pigx-gateway 网关应用直...

• ### 翻车！Spring Boot 2.2.3 不兼容 Spring Cloud Hoxton.SR1

Spring Boot 2.2.3 修复了 Spring Boot 2.2的大量问题，当升级至 2.2.3 以后，直接翻车 pigx-gateway 网关应用直...

• ### 软件性能调优：看数据，还是谈概念？

上周写了「想让服务器跑得快，并不是换个编程语言那么简单」，很多朋友的留言歪了楼：论性能，C语言甩Python数倍到数十倍，你说和编程语言没关？拜托，程序君只是说...

• ### 最强读心术！脑波直接转语音，你的秘密已无处藏身 | Nature子刊

有，用万能的AI啊。最近，Nature子刊Scientific Reports上报道了一项新技术进展：监测一下脑电波，AI就能还原你听到的声音。

• ### 达观数据中国电信分享实录：推荐技术介绍

导读：3月下旬，中国电信大数据技术团队邀请达观数据技术团队前去进行技术交流和互相学习。达观数据联合创始人文辉就“视频推荐技术”进行了详细的讲解，主要从达观推荐系...

• ### 你的APP与“抖音”，只差一个SDK

短视频因为其自身文化局限性低、时效性高、社交属性强等特点，实力碾压图文信息，具备了与生俱来的国际化传播特性。海外市场作为短视频领域急待挖掘的一片净土，各大平台也...

• ### 谈抽象接口的重要性

.pdf 抽象是架构师最基础最重要的能力之一。一名程序员要成长为架构师，首先要理解接口的重要性。但是对一个没有经验的人来说，他心中可能无法体会“接口”这两个字...