Mathematics for Computer Graphics 1 1.1 a = (a x, a, a z ), b = (b x, b, b z ) c = (c x, c, c z ) a, b a, b a, b, c x,, z ( ) c a, b (vector product) (outer product) a b c = ( a b a z b z, a z b z a x b x, a x b x a b ) c (1) a x a a z (a b, c) = b x b b z (1) c x c c z 1. (1) U U t U = E (orthogonal matrix) () U a, b (Ua, Ub) = (a, b) (3) U U 1 = t U. (4) U = (u 1, u, u 3 ) {u 1, u, u 3 } ((u i, u j ) = δ ij ) (5) U det(u) = ±1 det(u) = 1 (rotation matrix) det(u) = 1 (reflection) (6) ±1 0 0 T (θ) ± = 0 cos θ sin θ 0 sin θ cos θ + det(u) = 1 1 det(u) = 1 1 1
(7) u 1 θ A {u 1, u, u 3 } U = (u 1, u, u 3 ) A = UT (θ) + tu t UAU = T (θ) + () θ x z 1 0 0 cos θ 0 sin θ cos θ sin θ 0 X(θ) = 0 cos θ sin θ, Y (θ) = 0 1 0, Z(θ) = sin θ cos θ 0 0 sin θ cos θ sin θ 0 cos θ 0 0 1 {a 1, a,..., a n,... } {a 1, a,..., a n } {u 1, u,..., u n (u i, u j ) = δ ij } u 1 = a 1 / (a 1, a 1 ), k t k = a k k 1 i=1 (a i, u i )u i, u k = t k / (t k, t k ) 1. u 1 = a 1 / (a 1, a 1 ), (u 1, u 1 ) = 1. t = a tu 1 u 1 0 = (t, u 1 ) = (a, u 1 ) t(u 1, u 1 ) = (a, u 1 ) t t = (a, u 1 ). u = t / (t, t ) {u 1, u } 3. t 3 = a 3 su 1 tu {u 1, u } 0 = (t 3, u 1 ) = (a 3, u 1 ) s s = (a 3, u 1 ), 0 = (t 3, u ) = (a 3, u ) t t = (a 3, u ). u 3 = t 3 / (t 3, t 3 ) {u 1, u, u 3 } 4. 3DCG 3DCG () 1 x 1 x- 3 1 () 1.3 (congruent transformation) (translation) (rotation) (reflection)
1.4 1.4.1 (scale transformation) (similar transformation) a 0 0 S(a, b, c) = 0 b 0 ( abc 0) (3) 0 0 c 1.4. 1 (shear or skew transformation) z z t (α, β, 1) 1 0 α H = 0 1 β 1 1 0 α = 0 1 β 0 0 1 0 0 1 1 0 α 1 0 0 1 0 0 1 0 α 1 0 α 0 1 0 0 1 β = 0 1 β 0 1 0 = 0 1 β 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 x z z x θ φ t (0, 0, 1) t (α, β, 1) α = tan θ β = tan φ H(θ, φ) 1 1 0 tan θ 1 0 tan θ H(θ, φ) = 0 1 tan φ = 0 1 tan φ (4) 0 0 1 0 0 1 3
z x x, π θ, tan(π θ) = tan( θ),. z x (4) tan θ, tan φ cot θ, cot φ,. θ > 0 θ < 0 x x z z θ x x θ x x z tan θ z tan θ z tan θ z tan θ z z z z z z tan ϕ z tan ϕ z tan ϕ ϕ ϕ < 0 z z z ϕ > 0 z z tan ϕ z ϕ Hamilton.1 3 3 3. 3 0 e ( ) A R 1 4
a A A L a : A A x ax A A L a 1 λ v 0 av = λv (a λe)v = 0. A v 0 a = λe, a Re. A = Re. Hamilton 4 H 3 Gauss computer graphics 4 R 4 e 0 = (1, 0, 0, 0), e 1 = (0, 1, 0, 0), e = (0, 0, 1, 0), e 3 = (0, 0, 0, 1) e 0 e 1 e 1 = e e = e 3 e 3 = e 1 e e 3 = e 0 e 1 e = e e 1 = e 3, e e 3 = e 3 e = e 1, e 3 e 1 = e 1 e 3 = e e 0 = 1, e 1 = i, e = j, e 3 = k α = a + ib + jc + dk (a, b, c, d R) i = j = k = ijk = 1 ij = ji = k, jk = kj = i, ki = ik = j i, j, k ( ) (a + ib + jc + kd)(r + ix + j + kz) = (ar bx c dz) + i(ax + br + cz d) + j(a bz + cr + dx) + k(az + b cx + dr). Hamilton R 4 a b c d F : H M(4, R) α = a + ib + jc + kd b a d c c d a b d c b a ( ) a + ib c id G : H M(, C) α = a + ib + jc + kd c id a ib 5
.3 Hamilton Hamilton (1) α = a + ib + jc + dk = a + q ( q = ib + jc + kd) a ( ) q ( ) a q = a ib jc kd α α ImH = {ib + jc + kd b, c, d R} Hamilton () α = a + ib + jc + kd αα = a + b + c + d. αα = α α α (3) α 0 α 1 = α. Hamilton α (4) α ( α = 1) α = cos 1 ω + sin 1 ωβ β ImH, β = 1, 0 < ω < π α = a + q ( q ImH) b = q, β = q/b β = 1, α = a + bβ. αα = (a + bβ)(a bβ) = a + (bβ) = a + b = 1 a = cos 1 ω, b = sin 1 ω 0 < ω < π (Euler from) i, j, k.4 3 α = a + ib + jc + kd ( α = 1) ζ = w + ix + j + kz αζα = w + i{(a + b c d )x + (bc ad) + (ac + bd)z} + j{(bc + ad)x + (a b + c d ) + (cd ab)z} + k{(bd ac)x + (ab + cd) + (a b c + d )z} αζα = w + ix + j + kz x a + b c d (bc ad) (ac + bd) 0 x z = (bc + ad) a b + c d (cd ab) 0 (bd ac) (ab + cd) a b c + d 0 z w 0 0 0 1 w (1) 6
α α = cos 1 ω + sin 1 ω β, β = ip + jq + kr, p + q + r = 1 3 3 T ω = ω cos ω + (p 1) sin ω r cos ω sin ω + pq sin ω q cos ω sin ω + pr sin ω T = r cos ω sin ω + pq sin ω cos ω + (q 1) sin ω p cos ω sin ω + qr sin ω q cos ω sin ω + pr sin ω p cos ω sin ω + qr sin ω cos ω + (r 1) sin ω T () t T T = E (3) t (p, q, r) 1 (4) Tr(T ) = 3 cos ω sin ω = 1 + cos ω T t (p, q, r) ω T Tr(T ) = 1 + e iω + e iω.5 CG p 1 θ 1 0 0 P = ( p 1, p, p 3 ), S = 0 cos θ sin θ P SP 1. 0 sin θ cos θ p 1, p, p 3 p, p 3 p 1 (1) () p p 1, p p 3 (3) p 1 α = a + ib + jc + kd β = ib + jc + kd α = a + β, cos θ/ = a/ α, sin θ/ = β / α θ t (b, c, d) T smoothness 7
.6 CG Interactive Computer Graphics, E. Angel αβα α = i cos θ + j sin θ t (cos θ, sin θ, 0) π α = cos ω/ + i sin ω/ cos θ + j sin ω/ sin θ α = cos ω/ + (ip + jq + kr) sin ω/ ( p + q + r = 1 ) 3 3.1 CG CG 3. V A a V p A p + a A A V (standard vector space) (affine space) (1) (p + a) + b = p + (a + b) (p A, a, b V) () p, q A q = p + a a V (i) (ii) n + 1 W n V A = {p + a 0 p V, a V} A V o A p A p = o + a a o (initial point) p (position vector) op 8
V A r + 1 p i (0 i r) r p 0 p i (1 i r) V n n + 1 V n e 1,..., e n V o A p A p = o + n x i e i i=1 F = (o ; e 1,..., e n ) A (affine frame) (homogeneous coordinate) x 1. x n 1 A, B V, W ϕ : A B (affine mapping) ϕ ψ : V W ϕ(p + x) = ϕ(p) + ψ(x) p A, x V A = B ϕ ϕ (affine transformation) ( ) M t 0 1 (1) P ( ) P t 0 0 1 () t = (α, β, γ) ( ) E t t 0 1 0 = (0, 0, 0) E 3.3 A V (o ; e 1,..., e n ), (o ; f 1,..., f n ) 9
p A n p = o + x i e i = o + o = o + f j = i=1 n j f j j=1 n a i e i i=1 n t ji e i (j = 1,..., n) i=1 ( ) ( n n n ) p = o + a i e i + j t ji e i = o + x i = a i + i=1 n a i + i=1 j=1 n j t ji e i j=1 n j t ji (i = 1,..., n) j=1 i=1 x 1 t 11... t n1 a 1 1. x n =....... t 1n... t nn a n n 1 0... 0 1 1 1 t 11... t n1 a 1. n =...... t 1n... t nn a n 1 0... 0 1 1 x 1. x n 1 (5) 3.4 3DCG 3DCG CG x z 10
z 3DCG VRP(View Reference Point), VUP(View Up Vector), VPN(View Plane Normal) VUP VPN z VPN x VRP (e x, e, e z ) VUP (u x, u.u z ) VPN (n x, n, n z ) (α, β, γ) = (u x, u, u z ) ( n x, n n ) T α u x n x e x T = β u n e γ u z n z e z 0 0 0 1 (w x, w, w z ) (c x, c, c z ) c x w x T c c z = w w z 1 1 c x w x c c z = T 1 w w z 1 1 OpenGL glulookat(eex ee, eez, atx, at, atz, upz, up, upz) (eex, ee, eez) (COP) (atx, at, atz) (upx, up, upz) VRP = (eex, ee, eez), VUP = (upx, up, upz), VPN = (atx eex, at ee, atz eez) VUP VPN (α, β, γ) α upx eex atx eex T = β up ee at ee γ upz eez atz eez 0 0 0 1 11
3.5 OpenGL 3.5.1 OpenGL, OpenGL. postmultiplication (CTM = current transformation matrix) CTM x = Mx (M : CTM) a T( a) R(θ) T(x) x = T(a)R(θ)T( a)x glmatrixmode(gl_modelview); glloadidentit(); gltranslatef(ax, a, az); glrotatef(t, rx, r, rz); gltranslatef(-ax, -a, -az); /* define objects here */ glutswapbuffer(); 3.5. OpenGL 4 4 API 1 1 1 ( ) 0 4 8 1 1 5 9 13 6 10 14 3 7 11 15 1 0 0 M = 0 1 3 0 0 0 1 0 0 0 0 1 1
GLfloat m[16]; for(i=0;i<15;i++) m[i]=0.0; m[0]=m[5]=m[10]=m[15]=1.0; m[4]=.0; m[9]=3.0; CTM glloadmatrixf(marra) CTM glmultmatrixf(marra) CTM glpushmatrix(); gltranslatef(...); glrotatef(...); glscalef(...); /* draw objects */ glpopmatrix(); 4 CG (Projection) 4.1 CG (COP = center of projection) COP (projector) (view volume) (clipping) CG 4. CG 13
4..1 (parallel projection) COP COP DOP(Direction Of Projection) (orthogonal or orthographic projection) DOP (oblique projection) DOP (bellows) 4.. (perspective projection) COP,, 3, 3 1 1 1 1 3 1 1 ( ) CG 5 5.1 OpenGL (tranform) (projection) glmatricmode(gl_modelview) glmatrixmode(gl_projection) ( ) 14
5. 5..1 COP DOP 1. orthogonal projection orthographic projection ( ) DOP z z = 0 x p x 1 0 0 0 x p z p = P orth z = 0 1 0 0 0 0 0 0 z (z p = 0) 1 1 0 0 0 1 1. DOP 3 z x CG x, z OpenGL z DOP DOP xz z θ z z φ,., DOP x (x,, z) (x p, p, z p ) ( z p = 0) x p x z p z = tan θ x p = x z tan θ p z p z = tan φ p = z tan φ (4) 1 0 tan θ 0 H = H(θ, φ) = 0 1 tan φ 0 0 0 1 0 0 0 0 1 15
DOP z DOP x tan θ, tan φ cot θ, cot φ P = P orth H matrixh H. glmatrixmode(gl_projection); glloadidentit(); glortho(-4.0,6.0,-4.0,6.0,-0.0,0.0); glmatrixmode(gl_modelview); glloadidentir(); glulookat(0.0,0.0,6.0,0.0,0.0,0.0,0.0,1.0,0.0); glmultmatrixf(matrixh); /* define view objects */ glortho. z skew oblique skew oblique ortho ortho θ x z ϕ θ > 0 ϕ < 0 DOP z DOP 5.. COP COP ( ) COP z = d (d < 0) view volume COP (frustum) (x,, z) (x p, p, z p ) z p = d (x,, z) (x p, p, z p ) x p x = p = z p z 16
x p = x z/d p = z/d z = d x p p z p = x z/d z/d d x 1 0 0 0 x x z/d 0 1 0 0 0 0 1 0 z = z 4 z/d d 0 0 1/d 0 1 z/d 1 z OpenGL glfrustum(left,right,bottom,top,near,far) gluperspective(fov,aspect,near,far) gluperspective fov field of view angle of view clipping COP aspect clippping w/h near, far glfrustum 5.3 Normalization 5.3.1 OpenGL glmatrixmode(gl_projection); glloadidentit(); glortho(left,right,bottom,top,near,far); near far 0 < near < far clipping left x right, bottom top, near z far default clipping 1 x 1, 1 1, 1 z 1 17
clipping ( ) x = ±1, = ±1, z = ±1 (normalization) clipping ( (x max + x min )/, ( max + min )/, (z max + z min )/) clipping x = ±1, = ±1, z = ±1 x /(x max x min ) /( max min ) z /(z max z min ) P = P orth ST x max x min 0 0 0 1 0 0 xmax xmin = P orth 0 max min 0 0 0 1 0 max min 0 0 z max z min 0 0 0 1 z max z min 0 0 0 1 0 0 0 1 x max x min 0 0 x max+x min x max x min = P orth 0 max min 0 max+min max min 0 0 z max z min zmax+zmin z max z min 0 0 0 1 z z 1 z max = near, z min = far z 1 right left 0 0 right+left right left P = P orth 0 top bottom 0 top+bottom top bottom far+near 0 0 far near far near 0 0 0 1 5.3. Perspective gluperspective(fov,aspect,near,far) fov = 90 view volume 45 view volume x = ±z, = ±z z near, far z z = ±1 z = 1 d = 1 1 0 0 0 M = 0 1 0 0 0 0 1 0 0 0 1 0 18
1 0 0 0 N = 0 1 0 0 0 0 α β 0 0 1 0 αβ 0 N M orth 1 0 0 0 M orth N = 0 1 0 0 0 0 0 0 0 0 1 0 x x x z = M orthn z = 0 w z w 4 (perspective division) x p = x z p = z x x z = N z w w x = x, =, z = αz + β, w = z perspective division x = x z, = z, z = ( α + β z max ) ( = 1 α + β z min α = z max + z min z max z min β = z maxz min z max z min ( α + β ) z ) = 1 19
z = ±1 N z = ( α + β ) z z max, z min z = 0 β > 0 z 1 < z = z 1 < z z z = 1 z = β α M orth 5.3.3 Frustum glfrustum x = ±z, = ±z, 1 z 1 glfrustum(left,right,bottom,top,near,far) z z ( xmin + x max, ) min + max, z max t ((x max + x min )/z max, ( max + min )/z max, 1) (4) x 1 0 max +x min z max 0 H = 0 1 max+ min z max 0 0 0 1 0 0 0 0 1 θ, φ 1 1 0 x max+x min z max 0 = 0 1 max+min z max 0 0 0 1 0 0 0 0 1 cot θ = x min + x max z max, cot φ = min + max z max 1 0 cot θ 0 H = H(θ, φ) = 0 1 cot φ 0 0 0 1 0 0 0 0 1 0
view volume COP H(θ, φ) frustum x min min z max 1 = x min x max min max z max 1 x max H(θ, φ) max z max = 1 x max x min max min z max 1 x = ± x max x min z max z = ± max min z max z z min z z max x = ±z = ±z z max z max S(,, 1) x max x min x max x min z = ±1 N P API z max x max x min 0 xmax+xmin x max x min 0 z P = NSH = 0 max max min max+ min max min 0 0 0 z max+z min z max z min 0 0 1 0 OpenGL z max = near, z min = far z max z min z max z min OpenGL z 3 1 z max x max x min 0 xmax+xmin z P = 0 max max min max+ min max min 0 0 0 far+near far near 0 0 1 0 x max x min 0 far near far near 1
6 6.1 (p, q, r) lx + m + nz + c = 0 P = (x,, z) P = (x s, s, z s ) P lx s + m s + nz s + c = 0 P P x s x p = s q = z s z r k lx + m + nz + c k = K K = lp + mq + nr x s = (K lp)x mp npz cp K s = lqx + (K mq) nqz cq K z s = lrx mr + (K nr)z cr K x K lp mp np cp x M oshd z = lq K mq nq cq lr mr K nr cr z 1 0 0 0 K 1 p 0 0 0 1 1 1 1 l 0 0 0 M oshd = K E 4 0 q 0 0 1 1 1 1 0 m 0 0 0 0 r 0 1 1 1 1 0 0 n 0 0 0 0 1 0 0 0 0 0 0 0 c (6) (7) OpenGL (6) (7) + c = 0 l = n = p = r = 0, m = 1, q = 1
x 1 0 0 0 x x M oshd z = 0 0 0 c 0 0 1 0 z = c z 1 0 0 0 1 1 1 + c = 0 (p, q, r) l = n = 0, m = 1 x q p 0 cp x M z = 0 0 0 cq 0 r q cr z 1 0 0 0 q 1. 6. L = (p, q, r) lx + m + nz + c = 0 P = (x,, z) P = (x s, s, z s ) P lx s + m x + nz s + c = 0 L, P, P 1 (x s p, s q, z s r) = k(x p, q, z r) K k = lx + m + nz + c K K = lp + mq + nz + c x s = s = z s = (K lp)x mp npz cp K (lx + m + nz + c) lqx + (K mq) nqz cq K (lx + m + nz + c) lrx mr + (K nr)z cr K = (lx + m + nz + c) 3
x K lp mp np cp x M pshd z = lq K mq nq cq lr mr K nr cr z 1 l m n K c 1 p 0 0 0 1 1 1 1 l 0 0 0 M pshd = KE 4 0 q 0 0 1 1 1 1 0 m 0 0 0 0 r 0 1 1 1 1 0 0 n 0 0 0 0 1 1 1 1 1 0 0 0 c (8) OpenGL 1 0 0 p p 0 0 0 1 1 1 1 l 0 0 0 1 0 0 p 0 1 0 q 0 q 0 0 1 1 1 1 0 m 0 0 0 1 0 q 0 0 1 r 0 0 r 0 1 1 1 1 0 0 n 0 0 0 1 r = 0 0 0 1 0 0 0 1 1 1 1 1 0 0 0 c 0 0 0 1 p 0 0 p 1 1 1 1 l 0 0 lp 0 q 0 q 1 1 1 1 0 m 0 mq 0 0 r r 1 1 1 1 0 0 n nr = 0 0 0 1 1 1 1 1 0 0 0 c 0 0 0 0 l 0 0 lp 0 0 0 0 0 0 0 0 0 m 0 mq 0 0 0 0 0 0 n nr = 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 c l m n K 1 0 0 p 1 0 0 p K 0 0 0 0 1 0 q 0 0 1 r M 0 1 0 q pshd 0 0 1 r = 0 K 0 0 0 0 K 0 0 0 0 1 0 0 0 1 l m n 0 1 0 0 p K 0 0 0 1 0 0 p M pshd = 0 1 0 q 0 K 0 0 0 1 0 q 0 0 1 r 0 0 K 0 0 0 1 r 0 0 0 1 l m n 0 0 0 0 1 (9) OpenGL (9) 4
+ c = 0 l = n = 0, m = 1 (9) 1 0 0 p 1 0 0 0 1 0 0 p M pshd = 0 1 0 q 0 1 0 0 0 1 0 q 0 0 1 r 0 0 1 0 0 0 1 r 0 0 0 1 0 1 q+c 0 0 0 0 0 1 (10) 6.3 (7) (8) 4 (9) (8) 1 (10) transform object() shdm[] main() void o_shadow() { GLfloat shdm[16]; for(i=0;i<15;i++) shdm[i]=0; shdm[0]=shdmm[5]=shdm[10]=1; shdm[7]=-1/(q+c); } gldisable(gl_light0); glpushmatrix(); gltranslatef(p,q,r); glmultmatrix(shdm); gltranslatef(-p,-q,-r); object(); glpopmatrix(); glenable(gl_light0); gldisable(gl_light0) object() displa() 5
, 7 7.1 1 1 3 f(x) = x (x < 0), x (0 x) x = 0 0 f (x) = x (x < 0), x (0 < x) x = 0 0 f (x) = (x < 0), (0 < x) x = 0 3 x = 0 CG 7. n + 1 (x 0, 0 ), (x 1, 1 ),..., (x n, n ) n x 0, x 1,..., x n f(x, ) = 0 1 (f(t), g(t)) (f(t), g(t), h(t)) (f(s, t), g(s, t), h(s, t)) CG 6
7.3 (x i,0 + x i,1 t + + x i,m t m, i,0 + i,1 t + + i,m t m, z i,0 + z i,1 t + + z i,m t m ) 1 1 1 3 1 3 1 ( 0, 1,..., n ) [ i, i+1 ] f i (t) = a i + b i t + c i t + d i t 3 (0 t 1) (11) 1,,..., n 1 1 f i 1 (1) = i f i (0) = i (1), 3 f i 1(1) = f i(0) f i 1(1) = f i (0) (13) i = 1,,..., n 1 0, n f 0 (0) = 0 f n 1 (1) = n (14) 4n 4(n 1) + = 4n f 0 (0) = 0 f n 1(1) = f n(0) = 0 (15) i 1 4n (1),(13) i (Bartels et al., 1998) f i (0) f i (0) 1 f i (0) = a i = i f i (1) = a i + b i + c i + d i = i+1 (16) 7
, 3 f i(0) = b i = D i f i(1) = b i + c i + 3d i = D i+1 (17) 4 c i = 3( i+1 i ) D i D i+1 (18) d i = ( i i+1 ) + D i + D i+1 (19) f 0 (0) = c 0 = 0 D 0 + D 1 = 3( 1 0 ) f 0 (1) = f 1 (0) c 1 = 3d 0 D 0 + 4D 1 + D = 3( 0 ) 1 1 4 1 1 4 1.......... 1 4 1 1 D 0 D 1 D. D n 1 D n 3( 1 0 ) 3( 0 ) 3( 3 1 ) =. 3( n n ) 3( n n 1 ) (0) ( ) ( ) ( ) 1 4 1 D n 1 3( n n ) = 1 1 4 3( 0 n 1 ) D n (1) D i D i a i, b i, c i, d i 4 f 0 (0) = f n(0) = 0 3 3 (cubic spline) (natural spline) 7.4 (1961 ) P(t) = P 0 + t(p 1 P 0 ) = (1 t)p 0 + tp 1 (0 t 1) P i i ( ) 3 P 0, P 1, P (de Castljou) 8
P 10 (t) = (1 t)p 0 + tp 1 (P 0, P 1 ) P 11 (t) = (1 t)p 1 + tp (P 1, P ) P(t) = (1 t)p 10 + tp 11 (P 10, P 11 ) P(t) = (1 t) P 0 + t(1 t)p 1 + t P (0 t 1) 4 P 0, P 1, P, P 3 P 0 (t) = (1 t) P 0 + t(1 t)p 1 + t P P 1 (t) = (1 t) P 1 + t(1 t)p + t P 3 P(t) = (1 t)p 0 (t) + tp 1 (t) = (1 t) 3 P 0 + 3t(1 t) P 1 + 3t (1 t)p + t 3 P 3 (0 t 1) n + 1 P 0, P 1,..., P n ( ) n n P(t) = B k,n (t)p k B k,n (t) = t k (1 t) n k () k k=0 P 0, P 1,..., P n (control points) n (Bézier curve) (Bernstein Bézier curve) B k,n (t) ( ) n 1 = ((1 t) + t) n n n = t k (1 t) n k = B k,n (t) k k=0 k=0 1 P k (1) () P(0) = P 0, P(1) = P 1 (3) P (t) = n(1 t) n 1 P 0 + (n(1 t) n 1 n(n 1)t(1 t) n )P 1 +t(1 t)(c P + + c n P n ) +(n(n 1)(1 t) nt n 1 )P n 1 + nt n 1 P n P (0) = n(p 1 P 0 ), vp (1) = n(p n P n 1 ), 9
(4) 0 < t < 1 (5) (6) 7.5 P 0, P 1,..., P n w 0, w 1,..., w n R(t) = n k=0 B k,n(t)w k P k n k=0 B k,n(t)wi B k,n (t) (rational Bézier curve) (1) () (3) (4) 7.6 B- 1 B- 1 [0, 1] [0, 1] 0 1 1 (C ) 30
3 f(x) = x 3 (x < 0), x 3 (0 x) f (x) = 3x (x < 0), 3x (0 x), f (x) = 6x (x < 0) 6x (0 x) x = 0 1 ( ) Cox de Boor B P 0, P 1,..., P n p (1) U = {u 0, u 1,..., u m 0 u 0 u 1 u m 1} (knot vector), u j (knot), [u j, u j+1 ) j (j th knot span) () u j = u j+1 = = u j+k 1 (k > 1) k (multiple knot of multiplicit k) u j (k) (simple knot) (3) 0 < u j < 1 (inner knot) (4) (u 1 u 0 = u u 1 = = u m u m 1 ) (uniform) (non uniform) 1 B (basis function) N i,0 (t) = 1 (u i t < u i+1 ) 0 (otherwise) N i,p (t) = t u i N i,p 1 (t) + u i+p+1 t N i+1,p 1 (t) u i+p u i u i+p+1 u i+1 N i,0 1 0 N i,1 (t) 0 0 B 0 (1) N i,p (t) p () N i,p (t) 0 (3) N i,p (t) > 0 (u i t < u i+p+1 ) (4) [u i, u i+1 ) N i p,p (t), N i p+1,p (t),..., N i,p (t) 0 (5) i k=i p N k,p(t) = 1 (u i t < u i+1 ). [u i, u i+1 ) 1 31
(6) m + 1, p, n + 1, m = n + p + 1 n + 1 B p (7) k N i,p (t) C p k p k B B (B spline) n C(t) = N i,p (t)p i i=0 (3) [0, 1] 1 B 0,n (0) = 1, B n,n (1) = 1 P 0, P n B N 0,p (0) = 0, N n,p (1) = 0, (1) B (open) B () B (clamped) B (3) B (closed) B (1) p B [u p, u n p ] 1 () p B p + 1 u 0 = u 1 = = u p = 0, u m p = u m p+1 = = u m = 1 (3) (u 0 = = u p = 0, u p+1 = = u p+1 = 1) B (4) t, t = u k, C(u k ) (knot point) B (5) n + 1, B p, m + 1 m = n + p + 1 (6) B u i t < u i+1 p C(t) P i p, P i p+1,..., P i 3
(7) P i C(u i ) C(u i+p+1 ) (8) B 3 B B B B NURBS(non-uniform rational B spline) 7.7 n m S(s, t) = B i,n (s)b j,m (t)p i,j (0 s, t 1) i=0 j=0 P i,j ( ), B i,n (tensor product) n m n m S(s, t) = B i,n (s) B j,m (t)p i,j = B i,n (s)p i (s) P i (s) = B j,m (t)p i,j i=0 j=0 i=0 j=0 P i (s) s (sweep) 3DCG NURBS 7.8 P(t) = (x(t), (t), z(t)) P(t) (tangent vector) P (t) = (x (t), (t), z (t)) (u(t) v(t)) = u (t) v(t) + u(t) v (t) u(t) = v(t) = P (t) 0 P (t) P (t) P (t) 0 N(t) P(t) (normal vector) (binormal vector) 33
P(t) Q, R 3 Q, R P(t) N(t) B(t) N(t) = P (t) P (t) B(t) = P (t) P (t) P P (t) P(t) Q, R 3 Q, R P(t) (circle of curvature) r K(t) = 1 r (curvature) K(t) = P (t) P (t) P (t) 3 = (t) (t) z (t) z (t) x (t) x (t) z + (t)) z (t) x + (t)) x (t) ( x ) 3 (t) + (t) + z (t) (t) (t)) P(t) = (x(t), (t)) K(t) = x (t) (t) x (t) (t) ( x (t) + (t) ) 3 = f(x) K(x) = ( 1 + ) 3 34