L4 - Curves and Surfaces
L4 - Curves and Surfaces
4
IMPLICIT CURVES/SURFACES
F(x, y) = 0 2D-Planar curve
http://www.robots.ox.ac.uk/~ian/Teaching/CompGeom/lec3.pdf 5
IMPLICIT CURVES/SURFACES
x2 + y2 − r 2 = 0
6
SIMPLE IMPLICIT SURFACES
• Spheres
• Planes
• Cylinders
• Cones
• Torus
7
IMPLICIT CURVES/SURFACES
• Advantages
• Easy to determine inside/outside
• Easy to determine if a point is on the surface
• Disadvantages
• Hard to generate points on the surface
8
EXPLICIT FORM
http://www.robots.ox.ac.uk/~ian/Teaching/CompGeom/lec3.pdf
9
PRINCIPAL OF COMPUTER GRAPHICS
The points are used to form geometries.
Large increment of t ➔discontinuous look
➢Line ➔
x = 𝑥1 + 𝑥2 − 𝑥1 𝑡 0≤𝑡≤1
y = 𝑦1 + 𝑦2 − 𝑦1 𝑡
Symmetric digital differential analyzer (DDA)
10
PARAMETRIC CURVES/SURFACES
P(t) = (x(t), y(t), z(t))
P(s,t) = (x(s,t), y(s,t), z(s,t))
11
CIRCLE
• Cartesian equation: x2 + y2 = r2
• Parametrical equation:
x = r cos(t), y = r sin(t)
x(s,t) = 1+s2s2 +t 2
y(s,t) = 1+s2t2 +t 2
z(s,t) = 1−s2 −t 2
1+s2 +t 2
13
PARAMETRIC CURVES/SURFACES
• Advantages
• Easy to generate points on the curve/surface
• Separates x/y/z components
• Disadvantages
• Hard to determine inside/outside
• Hard to determine if a point is on the curve/surface
15
SYNTHETIC CURVES
1. Parametric Cubic Spline (Hermite Cubic Spline)
2. Bezier curves
3. B-spline curves
4. Rational B-splines
5. Nonuniform rational B-splines
17
APPROXIMATION VS INTERPOLATION
• Instead of fitting exact curves to points, approximated
curve is found.
• Used in airplane fuselage, ship hull, car body where
smooth surfaces are needed.
18
PARAMETRIC CUBIC (HERMITE)
where 𝑃(𝑡) is a point on the curve.
• 𝑃 0 = 𝑎0
• 𝑃 1 = 𝑎3 + 𝑎2 + 𝑎1 + 𝑎0 𝑃(0)′ 𝑷(𝒕)
• 𝑃′ 0 = 𝑎1
𝑃(1)
• 𝑃′ 1 = 3𝑎3 + 2𝑎2 + 𝑎1 𝑃(0)
𝑃(1)′
Geometric
coefficients
19
PARAMETRIC CUBIC
• Unknowns are found:
- 𝑎0 =𝑃 0
- 𝑎1 = 𝑃′ 0
- 𝑎2 = −3𝑃 0 + 3𝑃 1 − 2𝑃′(0) − 𝑃′(1)
- 𝑎3 = 2𝑃 0 − 2𝑃 1 + 𝑃 ′ 0 + 𝑃′(1)
• 𝑃 𝑡 = 2𝑡 3 − 3𝑡 2 + 1 𝑃 0 + −2𝑡3 + 3𝑡2 𝑃 1 + 𝑡 3 − 2𝑡 2 + 𝑡 𝑃′ 0
+ 𝑡 3 − 𝑡 2 𝑃′(1)
20
PARAMETRIC CUBIC
• Matrix form:
𝑎3
𝑎2
- 𝑃 𝑡 = 𝑡3 𝑡2 𝑡 1 𝑎1
𝑎0
2 −2 1 1 𝑃(0)
- 𝑃 𝑡 = 𝑡3 −3 3 −2 −1 𝑃(1)
𝑡2 𝑡 1 0 0 1 0 𝑃′(0)
1 0 0 0 𝑃′(1)
21
EXAMPLE
Find geometric coefficients of parametric cubic curve using following
information:
for 𝑡 = 0 ⇒ 2,20,2 is a point on the curve and 𝑃′ 0 = (𝑥1 , 0, 4𝑥1 )
for 𝑡 = 1 𝑖ç𝑖𝑛 ⇒ 10,20,2 is a point on the curve and 𝑃′ 1 = (𝑥2 , 0, −2𝑥2 )
for 𝑡 = 0.5𝑖ç𝑖𝑛 ⇒ 6, 20, 6 is a point on the curve
22
CONT.
2 −2 1 1 2 20 2
−3 3 −2 −1 10 20 2
6 20 6 = 0.53 0.52 0.5 1 𝑥1 0 4𝑥1
0 0 1 0
1 0 0 0 𝑥2 0 −2𝑥2
6 = 6 + 0.125𝑥1 − 0.125𝑥2
6 = 2 + 0.5𝑥1 + 0.25𝑥2
16
𝑥1 = 𝑥2 =
3
2 20 2
Geometric Coefficients 10 20 2
16/3 0 64/3
16/3 0 −32/3
23
CONTINUITIES
• Smoothness of the connection of two curves or surfaces
at the connection points or edges.
• 𝐶0 continuity: simply connecting two curves.
• 𝐶1 continuity: gradients (tangent) at the point of joining
are same.
• 𝐶2 continuity: curvature continuity at the point of joining
is same.
24
BEZIER CURVES
• Employing control points (ordered set of points (𝑉0, … ,𝑉𝑛)).
• A Bezier curve of degree 𝑛, specified by 𝑛 + 1 control
vertices.
• Parametric form is as follows:
𝐵𝑖,𝑛 𝑡 = 1 0≤𝑡≤1
𝑖=0
25
BEZIER CURVES
• Previous page conditions force the curve to lie entirely within
the convex hull of the curve.
• 𝑡 = 0 → 𝑄 0 = 𝑉0.
• 𝑡 = 1 → 𝑄 1 = 𝑉3. 𝑄′ 0 = ?
26
BEZIER CURVES
• Plot of blending functions for a cubic Bezier curve.
𝐵3,3
𝐵0,3
𝐵1,3 𝐵2,3
−1 3 −3 1 𝑉0
3 −6 3 0 𝑉1
- 𝑄 𝑡 = 𝑡3 𝑡2 𝑡 1
−3 3 0 0 𝑉2
1 0 0 0 𝑉3
28
EXAMPLE
Bezier curve
29
BEZIER CURVES
• Closed curves can be obtained by making the first and
last control points coincide.
30
BEZIER CURVES
• 𝐶1 continuity is usually applied to piecewise Bezier
curves.
31
BEZIER CURVES
• Changes on a Bezier curve caused by
repositioning of control points.
32
Example
𝑄1′ 1 = 𝑄2′ 0
34
B-SPLINE CURVES
• Exhibiting local control.
• The curvature continuity 𝐶 2 is guaranteed by cubic B- splines.
35
GENERAL B-SPLINE REPRESENTATION
• General form:
• For example;
-𝑘= 4
- Degree = 𝑘 − 1 = 3
- Second degree continuity is satisfied.
36
GENERAL B-SPLINE REPRESENTATION
• The i th blending function 𝑁𝑖,𝑘(𝑡) is:
37
UNIFORM CUBIC B-SPLINE CURVES
• The uniform cubic B-spline blending function 𝑁𝑖(𝑡) is a cubic 𝐶 2 basis function.
• The parametric intervals (or knots) 𝑡, within which the basis function is defined,
are equal.
[𝑡𝑖, 𝑡𝑖+4].
38
UNIFORM CUBIC B-SPLINE CURVES
• Uniform cubic B-spline curve with six control points:
- 𝑉0, 𝑉1, 𝑉2, 𝑉3, 𝑉4, 𝑉5
• Three curve segments:
- Seg1 → 𝑉0, 𝑉1, 𝑉2,𝑉3
- Seg2 → 𝑉1, 𝑉2, 𝑉3,𝑉4
- Seg3 → 𝑉2, 𝑉3, 𝑉4,𝑉5 Seg1
Seg2
Seg3
41
UNIFORM CUBIC B-SPLINE CURVES
1
• 𝑁0,3 𝑡 = 𝑡 3 0≤𝑡≤ 1
6
42
UNIFORM CUBIC B-SPLINE CURVES
• Matrix form:
−1 3 −3 1 𝑉𝑖 −1
1
1 3 −6 3 0 𝑉𝑖
-𝑃 𝑡 = 𝑡3 𝑡2 𝑡
6 −3 0 3 0 𝑉𝑖 +1
1 4 1 0 𝑉𝑖 +2
43
UNIFORM QUADRATIC B-SPLINE CURVES
• Matrix form:
1 −2 1 𝑉𝑖 −1
1
- 𝑃 𝑡 = 𝑡2 𝑡 1 −2 2 0 𝑉𝑖
2
1 1 0 𝑉𝑖 +1
44
UNIFORM QUADRATIC B-SPLINE CURVE
• Closed quadratic B-spline curve produced by six control
points with six segments.
45
EXAMPLE
Find starting and ending
locations of uniform quadratic
B-spline curve
46
EXAMPLE
47
CONVERSION BETWEEN REPRESENTATIONS
• [𝑀] 𝑓𝑟𝑜𝑚 [𝑉] 𝑓𝑟𝑜𝑚 = [𝑀]𝑡𝑜 [𝑉]𝑡𝑜
48
EXAMPLE
49
CONT.
(a)
(b) −6 0 0 1
6 0 0 1
𝑉 𝐻 =
9 12 0 0
9 12 0 0
50
UNIFORM/PERIODIC B-SPLINES
• Equispaced knot values; [ 𝑡𝑖 − 𝑡𝑖−1 = 𝑎].
• For example;
- 0 1 2 3 4 with 𝑎 = 1.
- [−0.5 0.0 0.5 1.0 1.5] with 𝑎 = 0.5.
51
NONUNIFORM B-SPLINES
• Multiplicity of knot values occurred at the ends and the internal knots
were equispaced.
• For example;
- [0 1 2 3 3 4]
- [0.0 0.20 0.55 0.75 1.0]
52
NONPERIODIC B-SPLINES
53
EFFECT OF MULTIPLICITY OF CONTROL POINTS
54
NON UNIFORM RATIONAL B-SPLINES (NURBS)
• Rational curves with varying weight at 𝑉4.
where
- 𝐵𝑖𝑛(𝑡)=standard Bezier blending function
- 𝑤𝑖=weights at each control point.
Bezier B-Spline
𝑛 𝑛
𝑄 𝑡 = 𝐵𝑖𝑛 𝑡 𝑉𝑖 𝑃 𝑡 = 𝑁𝑖𝑘 𝑡 𝑉𝑖
Nonrational 𝑖=0
𝑖=0
55
NON UNIFORM RATIONAL B-SPLINES (NURBS)
57
SUMMARY
• (i-1) for t=0
• (i-1) for t=1
• (i) for t=0
𝑃𝑖−1 (𝑖 − 1) segment
𝑃′𝑖−1
• (i) for t=1
𝑃𝑖 (𝑖) segment
𝑃′𝑖
𝑃𝑖+1
𝑃′𝑖+1
𝑃𝑖−1 (𝑖 − 1) segman
𝑃′𝑖−1
𝑃′′𝑖 −1
𝑃𝑖 (𝑖) segman
𝑃′𝑖
𝑃′′𝑖 𝑃𝑖+1
𝑃′𝑖+1
Cubic b-splines 𝑃′′𝑖 +1
58
SUMMARY Q,V,P→ all points Geometric coefficients
59
SURFACES
60
SURFACE MODELING
61
USE OF SURFACE MODELS
•Checking for interference
•Between mating parts
•Generating cross-section views
•Generating finite elements meshes
•Generating NC tool paths for machining
•Etc.
62
IMPLICIT AND EXPLICIT SURFACES
• There are two types of surfaces that are commonly used in
modeling systems, parametric and implicit.
63
CURVES VS SURFACES
64
SURFACES OF REVOLUTION
➢Rotating a plane curve around an axis.
65
SURFACES OF REVOLUTION R(θ)
67
SURFACES OF REVOLUTION
➢ A simple torus can be generated by rotating a circle contained
in the xz plane around the z axis.
➢ Parametric form of circle: [𝑎 + 𝑟 cos 𝜙 , 0, 𝑎 sin𝜙] .
➢ Parametric form of a torus:
68
EXAMPLE
result
Cubic Bezier Curve
Requesed Point's Revolution
parameters
69
SWEEPING
➢Surface is generated through the movement of a
line/curve/polygon/etc. along or around a path.
70
SWEEPING
• The swept surface is represented in parametric form as:
- 𝑃 𝑡,s = 𝑄 𝑡 [𝑇(𝑠)]
* 𝑄(𝑡) is the parametric equation of the line or curve.
* [𝑇(𝑠)] is the sweep transformation based on the path.
72
CONT. 1 0 0 0
−5 0 0 1
0 0.964 0.268 0
𝑃 0.25,15.52° = 0 5 0 1
0 −0.268 0.964 0
5 0 0 1
0 −0.293 2.0 1
73
FREEFORM SURFACES
➢Some surfaces cannot be totally described by
the analytical representations.
➢For example: automobile bodies, ship hulls,
etc…
➢Series of “patches” are used to represent
models.
74
PARAMETRIC CUBIC SURFACES
➢ Hermite curve formulation:
2 −2 1 1 𝑃(0)
1] −3 3 −2 1 𝑃(1)
- 𝑃 𝑡 = [𝑡3 𝑡2 𝑡
0 0 1 0 𝑃′(0)
1 0 0 0 𝑃′(1)
-𝑃 𝑡 = 𝑡 𝑀 𝐻 𝐺 𝐻
75
PARAMETRIC CUBIC SURFACES
• [𝐺]𝐻 matrix represents the following:
[𝐺]𝐻 parameters
𝑃(0,0) 𝑃(0,1) 𝑃𝑡 (0,0) 𝑃𝑡(0,1)
𝑃(1,0) 𝑃(1,1) 𝑃𝑡 (1,0) 𝑃𝑡(1,1)
- [𝐺]𝐻 =
𝑃𝑠 (0,0) 𝑃𝑠(0,1) 𝑃𝑠𝑡(0,0) 𝑃𝑠𝑡(0,1)
𝑃𝑠 (1,0) 𝑃𝑠(1,1) 𝑃𝑠𝑡(1,0) 𝑃𝑠𝑡(1,1)
𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝑤𝑖𝑡ℎ
𝑃𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑜𝑓
𝑟𝑒𝑠𝑝𝑒𝑐𝑡 𝑡𝑜 𝑡 𝑎𝑡
𝑐𝑜𝑟𝑛𝑒𝑟 𝑝𝑜𝑖𝑛𝑡𝑠
𝑐𝑜𝑟𝑛𝑒𝑟 𝑝𝑜𝑖𝑛𝑡𝑠
- [𝐺]𝐻 = 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝑤𝑖𝑡ℎ
𝐶𝑟𝑜𝑠𝑠 𝑑𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒
𝑟𝑒𝑠𝑝𝑒𝑐𝑡 𝑡𝑜 𝑠 𝑎𝑡
𝑎𝑡 𝑐𝑜𝑟𝑛𝑒𝑟 𝑝𝑜𝑖𝑛𝑡𝑠
𝑐𝑜𝑟𝑛𝑒𝑟 𝑝𝑜𝑖𝑛𝑡𝑠
76
PARAMETRIC CUBIC SURFACES
Variation of twist vectors Variation of tangent vectors
changing the shape. changing the shape.
77
PARAMETRIC CUBIC SURFACES
Normal vector at a point on the surface is computed as follows:
- 𝑛 = 𝑃′𝑠 × 𝑃′𝑡
78
EXAMPLE
79
CONT. t = 1 ve s = ½
80
BEZIER SURFACES
81
BEZIER SURFACES
➢The surface takes the general shape of the control points.
➢The surface is contained within the convex hull of the CPs.
➢The surface corners and corner CPs are coincident.
82
BEZIER SURFACES
➢𝐶1 continuity are enforced along the common edge between two
patches.
➢Force the polygon control sides meeting at the common edge to
be collinear.
83
B-SPLINE SURFACES
• Parametric equation:
84
B-SPLINE SURFACES
Local control
85
B-SPLINE SURFACES
For 𝐶2 continuity, 16 control points are needed for each patch,
twelve are shared with the next segment in developing the surface.
86
B-SPLINE SURFACES
➢Cylindrical surface ➢Closed curve
87
B-SPLINE SURFACES
88
EXAMPLE
89
EXAMPLE
90
CONVERSION BETWEEN CUBIC SURFACE REPRESENTATIONS
• 𝑉𝑡𝑜 = [𝑀𝑡𝑜−1𝑀𝑓𝑟𝑜𝑚]𝑉𝑓𝑟𝑜𝑚[𝑀𝑡𝑜−1𝑀𝑓𝑟𝑜𝑚]𝑇
91
RATIONAL SURFACES
• 𝑉𝑖,𝑗 are the control points.
• 𝑁𝑖,𝑘(𝑠), 𝑁𝑗,𝑙 (𝑡)are the B−spline blending
functions.
• 𝑤𝑖,𝑗 are the weights at each control point.
Bezier B-Spline
𝑛 𝑚 𝑛 𝑚
σ𝑛𝑖=0 σ𝑚
𝑗=0 𝑤𝑖,𝑗 𝐵𝑖,𝑛 𝑠 𝐵𝑗,𝑚 (𝑡)𝑉𝑖,𝑗 σ𝑛𝑖=0 σ𝑚
𝑗=0 𝑤𝑖,𝑗 𝑁𝑖,𝑘 (𝑠) 𝑁𝑗,𝑙 𝑡 𝑉𝑖,𝑗
Rational 𝑄 𝑠, 𝑡 = 𝑛 𝑃 𝑠, 𝑡 =
σ𝑛𝑖=0 σ𝑚
σ𝑖=0 σ𝑚𝑗=0 𝑤𝑖,𝑗 𝐵𝑖,𝑛 𝑠 𝐵𝑗,𝑚 (𝑡) 𝑗=0 𝑤𝑖,𝑗 𝑁𝑖,𝑘 (𝑠) 𝑁𝑗,𝑙 𝑡
92
NURBS
Non-uniform Rational B-spline Surfaces
93
Additional Surface Entities
94
PLANE SURFACE
• Three noncoincident points can define a plane surface.
95
RULED SURFACE
• Linear interpolation between two curves.
v u constant
0
v G ( U ) − P( u , v)
=
1 G(U ) − Q(U )
P(u, v) = (1− v)G(u) + vQ(u)
0 u 1 0 v 1
96
TABULATED CYLINDER
• Sweeping a planar curve in space in a certain direction at a certain distance.
0 u umax
P(u, v) = G(u) + vn
0 v vmax
97
REFERENCES
This presention is a compilation of following sources:
98