Uniform/Periodic B-splines : The spacing is unform and the knots (control points) are equispaced e.g. [0,1,2,3,4,5] These have satisfactory smoothness but lack local control and the sta[r]
(1)(c) SE/FIT/HUT 2002
Đường cong không gian
3D CURVE
(c) SE/FIT/HUT 2002
Đường cong - Curve
Why use curves? Quỹđạo chuyển động của điểm không gian
Đườngcong biểu diễnĐiểm-curve represents points:
ĐiểmBiểu diễnvà kiểm soát đường cong -Points represent-and control-the curve.
Cách tiếp cận sởcủa lĩnh vực Computer Aided Geometric Design (CAGD)
(c) SE/FIT/HUT 2002
Phân loại
Trên sởràng buộc điểm đường ứng dụng khoa học thiết kếta co thểphân làm loại:
Xấp xỉ-Approximation
-Được ứng dụng mơ hình hố hình học Nội suy-Interpolation
Trong thiết kếnôi suy cần thiết với đối tượng không phù hợp với đối tượng có hình dáng bất kỳ"free form“
(c) SE/FIT/HUT 2002
Biểu diễn Đường cong
Tường minh y=f(x) y = f(x), z = g(x)
impossible to get multiple values for a single x
• break curves like circles and ellipses into segments
not invariant with rotation
• rotation might require further segment breaking
problem with curves with vertical tangents • infinite slope is difficult to represent Khơng tường minh f(x,y)=0 - Implicit equations:
f(x,y,z) = 0
equation may have more solutions than we want
• circle: x² + y² = 1, half circle: ? problem to join curve segments together
• difficult to determine if their tangent directions agree at their joint point
Đường cong tham biến
Biểu diễn đường cong tham biến Parametric representation: x = x(t), y = y(t), z = z(t)
overcomes problems with explicit and implicit forms no geometric slopes (which may be infinite) parametric tangent vectors instead (never infinite) a curve is approximated by a piecewise polynomial curve
Define a parameter space
1D for curves 2D for surfaces
Define a mapping from parameter space to 3D points
A function that takes parameter values and gives back 3D points
The result is a parametric curve or surface
0 t
Mapping F :t →(x, y, z)
Parametric Curves
We have seen the parametric form for a line:
Note that x, y and z are each given by an equation that involves:
The parameter t
Some user specified control points, x0and x1
This is an example of a parametric curve
1
1
1
) 1 (
) 1 (
) 1 (
z t t z z
y t t y y
x t t x x
− + =
− + =
(2)(c) SE/FIT/HUT 2002
Đường cong đa thức bậc ba
Phảiđảm bảo làđường cong không gian với3 trục toạ độx, y, z tránhđược tính tốn phức tạp phần nhấp nhơ ngồi ý muốn xuất hiệnởnhữngđườngđa thức bậc cao
Why cubic?
(c) SE/FIT/HUT 2002
P0
P1 p2
p3
P0
P '0 P 1
P'1
Đường cong bậc 3
x= a1+ b1u+ c1u2+ d1u3
y= a2+ b2u+ c2u2+ d2u3
z= a3+ b3u+ c3u2+ d3u3
Với3 điểmP0, P1, P2, P3 phương trình xácđịnh
(c) SE/FIT/HUT 2002
Hermite Spline
A splineis a parametric curve defined by control points
The term spline dates from engineering drawing, where a spline was a piece of flexible wood used to draw smooth curves
The control points are adjusted by the userto control the shape of the curve
Phương pháp Hermite dựa sởcủa cách biểu diễn Ferguson hay Coons năm 60
AHermite splineis a curve for which the user provides: The endpoints of the curve
The parametric derivatives of the curve at the endpoints • The parametric derivatives are dx/dt, dy/dt, dz/dt
That is enough to define a cubic Hermite spline, more derivatives are required for higher order curves
(c) SE/FIT/HUT 2002 10
Đường cong Hermite
p = p(u) = k0+ k1u + k2u2+ k 3u3
p(u) = ∑kiui i∈n
p0 và p1ta có hai độdốc p0’ p1’ với u = u = tại hai điểm đầu cuối của đoạn [0,1].
We have constraints:
The curve must pass through p0when u=0 The derivative must be p’0when u=0 The curve must pass through p1when u=1 The derivative must be p’1when u=1
Basis Functions
A point on a Hermite curve is obtained by multiplying each control point by some function and summing
The functions are called basis functions Thay vào:
p= p(u) = p0(1-3u2+2u3) + p1(3u2-2u3)
+ p0’(u-2u2+u3) + p1’(-u2+u3)
(3)(c) SE/FIT/HUT 2002 13
Đường cong Bezier
Sửdụngđiểm vector kiểm soátđượcđộdốc củađường cong tại nhưngđiểm mà nóđi qua.(Hermit)
khơngđược thuận lợi cho việc thiết kếtương tác, không tiếp cận vào cácđộdốc củađường cong bằng giá trịsố(Hermite).
Paul Bezier,RENAULT, 1970 đường bềmặt UNISURF
(c) SE/FIT/HUT 2002 14
po, p3 tương đương với p0, p1 đường Hermite diểm trung gian p1, p2được xác định bằng 1/3 theo độdài của vector tiếp tuyến tại điểm po p3
p0’ = 3(p1– p0) p3’ = 3(p3– p2)
p = p(u) = p0(1-3u2+2u3) + p1(3u2-2u3) + p0’(u-2u2+u3) + p 1 ’(-u2+ u3)
p = p(u) = p0(1 - 3u + 3u2- u3) + p
1(3u-6u2-3u3)
+ p2(3u2- 3u3) + p 3u3
(c) SE/FIT/HUT 2002 15
Biểu diễn Ma trận
p = p(u) = [ u u2u3]
− −
− −
3
1 3 3 1
0 3 6 3
0 0 3 3
0 0 0 1
p p p p
0 0.2 0.4 0.6 0.8 1.2
B0 B1 B2 B3
(c) SE/FIT/HUT 2002 16
Ưu điểm
dễdàng kiểm soát hi`nh dạng của đường cong hơn vector tiếp tuyến tại p0’ p1’ của Hermite
Nằm đa giác kiểm soát với sốđiểm trung gian tuỳý( số
bậc tuỳ ý)
đi qua điểm đầu điểm cuối của đa giác kiểm soát, tiếp xúc với cặp hai vector của đầu cuối đó
Example Bezier Curves
[UW]
Sub-Dividing Bezier Curves
P0
P1 P2
P3 M01
M12
M23
M012 M
(4)(c) SE/FIT/HUT 2002 19
Sub-Dividing Bezier Curves
P0
P1 P2
P3
(c) SE/FIT/HUT 2002 20
Sub-Dividing Bezier Curves
Step 1: Find the midpoints of the lines joining the original control vertices Call them M01, M12, M23
Step 2: Find the midpoints of the lines joining M01, M12and M12, M23 Call
them M012, M123
Step 3: Find the midpoint of the line joining M012, M123 Call it M0123
The curve with control points P0, M01, M012and M0123exactly follows the
original curve from the point with t=0 to the point with t=0.5
The curve with control points M0123 , M123 , M23and P3exactly follows the
original curve from the point with t=0.5 to the point with t=1
(c) SE/FIT/HUT 2002 21
de Casteljau’s Algorithm
You can find the point on a Bezier curve for any parameter valuetwith a similar algorithm
Say you want t=0.25, instead of taking midpoints take points 0.25 of the way
P0
P1 P2
P3 M01
M12
M23 t=0.25
(c) SE/FIT/HUT 2002 22
Biểu thức Bezier-Bernstain
Tổng quát hoá với n+1 điểm kiểm soát
p0 pn: vector vịtrí củađa giác n+1 đỉnh ) )( ( )
(
) ( ) (
1 ,
,
i i n
i in i n
i n i
P p u B n u p
p u B u p
− =
′ =
+ = − =
∑ ∑
i n i n
i u C ni u u
B, ( )= ( , ) (1− ) −
)! i n ( ! i
! n ) i , n ( C
− =
Tính chất
P0 Pn nằm đường cong
Đường cong liên tục có đạo hàm liên tục tất cảcác bậc Tiếp tuyến của đường cong tại điểm P0 đường P0P1 tại Pn đường Pn-1Pn
Đường cong nằm đường bao lồi convex hull của
điểm kiểm soát.
This is because each successive Pi(j) is a convex combination of the points Pi(j-1) and Pi-1(j-1) P1 ,P2 , … ,Pn-1 nằm đường cong chỉ
Review:
Bézier Curve Prop’s [1/6] We looked at some properties of Bézier curves Generally “Good” Properties
Endpoint Interpolation Smooth Joining Affine Invariance Convex-Hull Property
Generally “Bad” Properties
(5)(c) SE/FIT/HUT 2002 25
Problem with Bezier Curves
To make a long continuous curve with Bezier segments requires using many segments
Maintaining continuity requires constraints on the control point positions
The user cannot arbitrarily move control vertices and automatically maintain continuity
The constraints must be explicitly maintained It is not intuitive to have control points that are not free
(c) SE/FIT/HUT 2002 26
Invariance
Translational invariancemeans that translating the control points and then evaluating the curve is the same as evaluating and then translating the curve
Rotational invariancemeans that rotating the control points and then evaluating the curve is the same as evaluating and then rotating the curve
These properties are essential for parametric curves used in graphics It is easy to prove that Bezier curves, Hermite curves and everything else we will study are translation and rotation invariant
Some forms of curves, rational splines, are also perspective invariant
Can perspective transform of control points and thenevaluate the curve
(c) SE/FIT/HUT 2002 27
Longer Curves
A single cubic Bezier or Hermite curve can only capture a small class of curves At most inflection points
One solution is to raise the degree
Allows more control, at the expense of more control points and higher degree polynomials
Control is not local, one control point influences entire curve
Alternate, most common solution is to join pieces of cubic curve together into
piecewise cubic curves
Total curve can be broken into pieces, each of which is cubic
Local control: Each control point only influences a limited part of the curve Interaction and design is much easier
(c) SE/FIT/HUT 2002 28
Piecewise Bezier Curve “knot” P0,0
P0,1 P0,2
P0,3 P1,0
P1,1
P1,2 P1,3
Continuity
When two curves are joined, we typically want some degree of continuity across the boundary (the knot)
C0, “C-zero”, point-wise continuous, curves share the same point where they
join
C1, “C-one”, continuous derivatives, curves share the same parametric
derivatives where they join
C2, “C-two”, continuous second derivatives, curves share the same parametric
second derivatives where they join Higher orders possible
Question: How we ensure that two Hermite curves are C1across a
knot?
Question: How we ensure that two Bezier curves are C0, or C1, or C2
across a knot?
Đường bậc ba Spline
Spline đi qua n điểm cho trước mà mỗi đoạn đường bậc ba
độc lập có độdốc độcong liên tục tại mỗi điểm kiểm soát hay điểm nút
Với n điểm:n-1 đoạn với mỗi đoạn vector hệsố 4(n-1) cho n-1 đoạn, 2(n-1) điều kiện biên n-2 điều kiện vềđộdốc cùng n-2 vềđộcong
(6)(c) SE/FIT/HUT 2002 31
Đường cong bậc ba
Spline u0= với: (u0 un-1) uj+1> uj
ui+1= ui+ di+1
C0đểkhông cósựgiánđoạn giữahaiđoạncong
C1tính liêntục bậc nhấthayđạohàmbậc tạiđiểm nối
C2đạohàmbậchai liêntục củađườngcongtạiđiểm nối
(c) SE/FIT/HUT 2002 32
Achieving Continuity
For Hermite curves, the user specifies the derivatives, so C1is achieved
simply by sharing points and derivatives across the knot For Bezier curves:
They interpolate their endpoints, so C0is achieved by sharing control points
The parametric derivative is a constant multiple of the vector joining the first/last control points
So C1is achieved by settingP
0,3=P1,0=J, and making P0,2and Jand P1,1
collinear, with J-P0,2=P1,1-J
C2comes from further constraints on P 0,1and P1,2
(c) SE/FIT/HUT 2002 33
Bezier Continuity
P0,0
P0,1 P0,2
J
P1,1
P1,2 P1,3
Disclaimer: PowerPoint curves are not Bezier curves, they are interpolating piecewise quadratic curves! This diagram is an approximation
(c) SE/FIT/HUT 2002 34
B-splines
B-splines automatically take care of continuity, with exactly one control vertex per curve segment
Many types of B-splines: degree may be different (linear, quadratic, cubic,…) and they may be uniform or non-uniform
We will only look closely at uniform B-splines
With uniform B-splines, continuity is always one degree lower than the degree of each curve piece
Linear B-splines have C0continuity, cubic have C2, etc
Đường cong B-spline
Đường cong B-spline đường cong được sinh từđa giác kiểm soát mà bậc của khơng phụthuộc vào sốđỉnh của đa giác kiểm soát.
B-Splines: The Idea [1/2]
The repeated-lirping idea that produced the Bézier curves has the drawbacks that is produces polynomials with high degree that are nonzero almost everywhere
Using functions defined in pieces, we can fix these two
Start: An order-1 B-Spline has blending functions that are always either or When a function is 1, all the rest are zero
So an order-1 B-spline is just a sequence of points Any number of control points may be used
Now we make higher-order B-splines using a repeated-lirping procedure
(7)(c) SE/FIT/HUT 2002 37
B-Splines: The Idea [2/2]
We form an order-2 B-Spline by lirping between the order-1 blending functions
As discussed, we get functions that start at 0, ramp up to and back down, then stay at zero Each function is most of the time
So each blending function is defined in pieces Each piece is a polynomial of degree (graph is a line)
So an order-2 B-spline is just the control polygon Again, any number of control points may be used
We form an order-3 B-Spline by lirping between the order-2 blending functions
Now blending functions are smooth They start at 0, curve up to then back down Again, each function is most of the time
Again, each blending function is defined in pieces Each piece is a polynomial of degree
We continue this repeated-lirping procedure to define B-splines of higher order
See the blue book for details and graphs
(c) SE/FIT/HUT 2002 38
Types of B-Splines Approximation Curves Used
B-Spline approximations can be classified based on the spacing of the knot vector and the use of weights
1 Uniform/Periodic B-splines: The spacing is unform and the knots (control points) are equispaced e.g [0,1,2,3,4,5] These have satisfactory smoothness but lack local control and the starting and ending poits are ill defined as above
2 Non-periodic:The knots are repeated at the ends m times and the interior is equispaced e.g [0 0 3 ] These can be used to force the control point to start and finish at a control point
3 Non-uniform B-Splines: The spacing is non-uniform and or repeated knots e.g [0 1 6 ] These can be used to obtain local control
B-Splines
(c) SE/FIT/HUT 2002 39
Ví dụ: Uniform Cubic B-spline on
[0,1]
Four control points are required to define the curve for 0≤t<1(tis the parameter)
Not surprising for a cubic curve with degrees of freedom
The equation looks just like a Bezier curve, but with different basis functions
Also called blending functions- they describe how to blend the control points to make the curve
( ) ( ) ( ) ( )3
3 2 3 61 3 6 61 3
61 t t t P t t P t t t P t
P t B P t P
i i i
+ − + + + + − + − + − = =∑ = ) ( ) ( ,
(c) SE/FIT/HUT 2002 40
Basis Functions on [0,1]
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
t
Does the curve interpolate its endpoints? Does it lie inside its convex hull?
B0,4
B1,4 B
2,4
B3,4
( )
( )
( )
( )3 3 2 1 61 3 3 3 1 6 1 3 6 4 6 1 3 3 1 6 1 t P t t t P t t P t t t P t P + − + + + + − + − + − = ) (
Uniform Cubic B-spline on [0,1) The blending functions sum to one, and are positive everywhere
The curve lies inside its convex hull
The curve does not interpolate its endpoints
Requires hacks or non-uniform B-splines
There is also a matrix form for the curve:
[ ] − − − − = 1 0 0 0 1 1 3 3 3 4 0 6
31 3 3 1
6 1 3 t t t P P P P t P()
Uniform - B-spline
Ni,k(u) đa thức B-Spline cơ bản Với n+ sô điểm kiểm soát Piđiểm kiểm soát thứi k bậc của đường cong 1<k<n+2
Ui vector nút của đường cong U=[U1,U2 Un+k+1] i
n i ik
P u N u P ∑ = = , ). ( ) ( ) ( ) ( ) ( ) ( ) ( )
( ,
2 1 , 1
, N u
U U u U u N U U U u u
N ik