Grafika Komputerowa
Krzywe B-sklejane
Alexander Denisjuk
denisjuk@pjwstk.edu.pl
Polsko-Japo ´nska Wy˙zsza Szkoła Technik Komputerowych
zamiejscowy o´srodek dydaktyczny w Gda ´nsku
ul. Brzegi 55
80-045 Gda ´nsk
Krzywe B-sklejane
Najnowsza wersja tego dokumentu dost ˛epna jest pod
adresem
Krzywa B-sklejana (B-spline)
p 0 p 1 p 2 p 3 p 4 p 5 p 6 p 7 p 8 (a) Degreetwo B-spline urve.p 0 p 1 p 2 p 3 p 4 p 5 p 6 p 7 p 8 (b) Degree three B-spline urve.
Figure VIII.1: Degree two and degree three B-spline urves with uniformly spa ed knots and nine ontrol points. The degree three urve is smoother than the degree two urve, whereas, the degree two urve approa hes the ontrol points a little more losely. Compare with the degree eight Bezier urve of gure VII.9( ) onpage 167.
Krzywa B-sklejana trzeciego stopnia
p 0 p 1 p 2 p 3 p 4 p 5 p 6 q 3 q 4 q 5 q 6FigureVIII.2: A degreethreeuniformB-spline urvewithseven ontrolpoints.
q(u) =
n
X
i
=0
N
i
(u)p
i
,
3 ≤ u ≤ n + 1
Funkcje wagowe
N 0 N 1 N 2 N 3 N 4 N 5 N 6 1 0 1 2 3 4 5 6 7 8 9 10 y uFigure VIII.3: The blending fun tions for a uniform, degree three B-spline. Ea h fun tion N
i
has support (i;i+4).
N
i
(u) = N
0
(u − i)
Obci ˛ete wielomiany stopnia 3
N
i
∈
C
2
P
i
N
i
(u) = 1
dla
u ∈ [3, n + 1]
N
i
(u) ≥ 0
Funkcje wagowe
R
0
(u) = N
0
(u),
R
1
(u) = N
0
(u + 1),
R
2
(u) = N
0
(u + 2),
R
3
(u) = N
0
(u + 3) u ∈ [0, 1]
⇓
R
0
(u) =
1
6
u
3
R
1
(u) =
1
6
(−3u
3
+ 3u
2
+ 3u + 1)
R
2
(u) =
1
6
(3u
3
−
6u
2
+ 4)
R
3
(u) =
1
6
(1 − u)
3
Funkcje wagowe
R
0
(0) = 0,
R
′
0
(0) = 0,
R
′′
0
(0) = 0,
R
0
(1) =
1
6
= R
1
(0),
R
0
′
(1) =
1
2
= R
′
1
(0),
R
′′
0
(1) = 1 = R
′′
1
(0),
R
1
(1) =
2
3
= R
2
(0),
R
′
1
(1) = 0 = R
′
2
(0),
R
′′
1
(1) = −2 = R
′′
2
(0),
R
2
(1) =
1
6
= R
3
(0),
R
′
2
(1) = −
1
2
= R
′
3
(0),
R
′′
2
(1) = 1 = R
′′
3
(0),
R
3
(1) = 0,
R
′
3
(1) = 0,
R
3
′′
(0) = 0.
Krzywa B-sklejana niejednorodna
0 1 2 3 4 5 6 7 8 9 10 11 12 u 1 Doubledknot Tripledknot N 0;4 N 1;4 N 2;4 N 3;4 N 4;4 N 5;4 N 6;4 N 7;4 N 8;4 N 9;4 N 10;4 N 11;4Figure VIII.4: Example of orderfour (degree three) blendingfun tions with repeatedknots. Theknot ve toris [0;1;2;3;4;4;5;6;7;8;8;8;9;10;11;12℄ so thattheknot 4hasmultipli itytwoandtheknot8hasmultipli itythree.
w ˛ezły
u
0
≤
u
1
≤ · · · ≤
u
l−1
≤
u
l
w ˛ezły wielokrotne
u
i−1
≤
u
i
= u
i
+1
≤
u
i
+2
p 0 p 1 p 2 p 3 p 4 p 5 p 6 p 7 p 8 p 9 p 10 p 11
FigureVIII.5: ExampleofanorderfourB-spline reatedwith repeatedknots. This urve is reated with the knot ve tor and blending fun tions shown in gureVIII.4. Ithasdomain [3;9℄.
Krzywa B-sklejana stopnia
m − 1
(Cox de Boor)
Dane s ˛
a w ˛ezły
u
0
≤
u
1
≤ · · · ≤
u
l−1
≤
u
l
.
Dla
i = 0, 1, . . . , l − 1
wagi
N
i,
1
=
1 u
i
≤
u < u
i
+1
0
N
i,k
+1
(u) =
u
i+k
u−u
i
−u
i
N
i,k
(u) +
u
i+k+1
−u
u
i+k+1
−u
i+1
N
i
+1,k
(u)
0/0 = 0
,
(a/0) · 0 = 0
N
i,m
jest obci ˛etym (w w ˛ezłach) wielomianem
stopnia
m − 1
supp N
i,m
= [u
i
, u
i+m
]
jest obci ˛etym (w w ˛ezłach)
wielomianem stopnia
m − 1
Przykład. W˛ezły jednorodne,
m = 2
N 0;2 N 1;2 N 2;2 N 3;2 N 4;2 N 5;2 N 6;2 N 7;2 N 8;2 1 0 1 2 3 4 5 6 7 8 9 10 y uFigure VIII.6: The order two (pie ewise degree one) blending fun tions with uniformly spa ed knots, u
i
= i. Here ` = 10, and there are `+1 knots and ` 1 blending fun tions. The asso iated B-spline urve of equation (VIII.2) is dened for 1u ` 1.
N
0,2
=
u
0 ≤ u ≤ 1,
2 − u
1 ≤ u ≤ 2,
0
Przykład. W˛ezły jednorodne,
m = 3
N 0;3 N 1;3 N 2;3 N 3;3 N 4;3 N 5;3 N 6;3 N 7;3 1 0 1 2 3 4 5 6 7 8 9 10 y uFigure VIII.7: The order three (pie ewise degree two) blending fun tions with uniform knot positions u
i
=i. We still have `=10;there are `+1 knots and ` 2 blending fun tions. The asso iatedB-spline urve of equation (VIII.3) is dened for 2u ` 2.
N
0,3
=
1
2
u
2
0 ≤ u < 1,
1
2
u(2 − u) +
1
2
(3 − u(u − 1)
1 ≤ u < 2,
1
2
(3 − u)
2
2 ≤ u < 3,
0
Przykład. W˛ezły jednorodne,
m = 4
N 0 N 1 N 2 N 3 N 4 N 5 N 6 1 0 1 2 3 4 5 6 7 8 9 10 y uFigure VIII.3: The blending fun tions for a uniform, degree three B-spline. Ea h fun tion N
i
Przykład. Krzywe Béziera
w ˛ezły:
0, 0, 0, 0, 1, 1, 1, 1
N
3,1
(u) =
1, 0 ≤ u ≤ 1
0
N
i,
1
= 0
dla
i 6= 3
N
2,2
(u) = 1 − u
,
N
3,2
(u) = u
N
1,3
(u) = (1 − u)
2
,
N
2,3
(u) = 2u(1 − u)
,
N
3,3
(u) = u
2
N
0,4
(u) = (1 − u)
3
,
N
1,4
(u) = 3u(1 − u)
2
,
Niejednorodne wielokrotne w ˛ezły
w ˛ezły:
0, 0, 0, 0, 1, 2, 2
4
5
, 3
1
5
, 4, 5, 6, 7, 7, 8, 9, 10, 10, 10, 10
1 2 2:83:2 4 5 6 7 8 9 10 u 1 Doubledknot N 2;2 N 3;2 N 4;2 N 5;2 N 6;2 N 7;2 N 8;2 N 9;2 N 10;2 N 11;2 N 12;2 N 13;2 N 14;2(a)Degreeoneblendingfun tions.
1 2 2:83:2 4 5 6 7 8 9 10 u 1 Doubledknot N 1;3 N 2;3 N 3;3 N 4;3 N 5;3 N 6;3 N 7;3 N 8;3 N 9;3 N 10;3 N 11;3 N 12;3 N 13;3 N 14;3
(b)Degreetwoblendingfun tions.
1 2 2:83:2 4 5 6 7 8 9 10 u 1 Doubledknot N 0;4 N 1;4 N 2;4 N 3;4 N 4;4 N 5;4 N 6;4 N 7;4 N 8;4 N 9;4 N 10;4 N 11;4 N 12;4 N 13;4 N 14;4
( )Degreethreeblendingfun tions.
FigureVIII.8:Degreeone,two,andthreeblendingfun tionsforanon-uniform