View
221
Download
1
Category
Preview:
Citation preview
Geometric Modeling
Page
Computer GraphicsComputer Graphics
Copyright Gotsman, Elber, Barequet, Karni, Sheffer
Computer Science - Technion
Geometric Geometric ModelingModeling
2
An Example
3 4
5
Outline
� Objective: Develop methods and algorithms to mathematically model shape of real world objects
� Categories:
Wire-frame representations
Boundary representations
Volumetric representations
6
Wire-Frame Representation
� Object is represented as as a set of points and edges (a graph) containing topological information.
� Used for fast display in interactive systems.� Can be ambiguous:
Geometric Modeling
Page
Computer GraphicsComputer Graphics
Copyright Gotsman, Elber, Barequet, Karni, Sheffer
Computer Science - Technion
7
Volumetric Representation
� Voxel based� Advantages: simple and robust Boolean operations,
in/out tests, can represent and model the interior of the object.
� Disadvantages: memory consuming, non-smooth, difficult to manipulate.
8
Constructive Solid Geometry
� Use set of volumetric primitivesBox, sphere, cylinder, cone, etc…
� For constructing complex objectsuse Boolean operations
UnionIntersectionSubtractionComplement
9
CSG Trees
� Operations performed recursively
� Final object stored as sequence (tree) of operations on primitives
� Common in CAD packages –
mechanical parts fit well into primitive based framework
� Can be extended with free-form primitives
C2
B2
S S C3 2 2= −
S S B2 1 2= −
C1
B1
S B C1 1 1= +
10
Freeform Representation
� Explicit form: z = z(x, y)
� Implicit form: f(x, y, z) = 0
� Parametric form: S(u, v) = [x(u, v), y(u, v), z(u, v)]
� Example – origin centered sphere of radius R:
],[],2,0[),sin,cossin,coscos(),,(
0
:
:
22
2222
222222
ππψπθψψθψθ −∈∈=
=−++
−−−=∪−−+=
RRRzyx
Rzyx
yxRzyxRz
:Parametric
Implicit
Explicit
Explicit is a special case of implicit and parametric form
11
Parametric Curves
� Analogous to trajectory of particle in space.
� Single parameter t∈ [T1,T2] – like “time”.� position = p(t) = (x(t),y(t)),
velocity = v(t) = (x’(t),y’(t))
� Circle:x(t) = cos(t), y(t) = sin(t) t ∈ [0,2π) ||v(t)|| ≡ 1x(t) = cos(2t), y(t) = sin(2t) t ∈ [0,π) ||v(t)|| ≡ 2x(t) = (1-t2)/(1+t2), y(t) = 2t/(1+t2) t ∈ (-∞,+∞)
(x(t),y(t))(x(t),y(t))
v(t) = (xv(t) = (x’’(t),y(t),y’’(t))(t))
(x(t),y(t))(x(t),y(t))
r(t)r(t)
k(t) = 1/r(t)k(t) = 1/r(t)
12
Mathematical Continuity� C1(t) & C2(t), t ∈ [0,1] - parametric curves� Level of continuity of the curves at C1(1) and C2(0) is:
C-1:C1(1) ≠ C2(0) (discontinuous)C0: C1(1) = C2(0) (positional continuity)Ck, k > 0 : continuous up to kth derivative
� Continuity of single curve inside its parameter domain is similarly defined - for polynomial bases it is C∞
kjCC jj ≤≤= 0),0()1( )(2
)(1
Geometric Modeling
Page
Computer GraphicsComputer Graphics
Copyright Gotsman, Elber, Barequet, Karni, Sheffer
Computer Science - Technion
13
Geometric Continuity� Mathematical continuity is sometimes too strong� May be relaxed to geometric continuity
(so curves would look the same, but need to change their parameterization) Gk, k ≤ 0 : Same as Ck
Gk, k =1 : C'1(1) =α C'2(0)Gk, k≥ 0 : There is a reparameterization of C1(t) & C2(t), where the two are Ck
� E.g.C1(t)=[cos(t),sin(t)], t∈[−π/2,0]C2(t)=[cos(t),sin(t)], t∈[0,π/2]C3(t)=[cos(2t),sin(2t)], t∈[0,π/4]C1(t) & C2(t) are C1 (& G1) continuous C1(t) & C3(t) are G1 continuous (not C1)
C1
C2, C3
14
Polynomial Bases
� Monomial basis {1 , x, x2, x3, …}Coefficients are geometrically meaninglessManipulation is not robust
� Number of coefficients =polynomial rank
� We seek coefficients with geometrically intuitive meanings� Polynomials are easy to analyze, derivatives remain polynomial,
etc.� Other polynomial bases (with better geometric intuition):
Lagrange (Interpolation scheme)Hermite (Interpolation scheme)Bezier (Approximation scheme)B-Spline (Approximation scheme)
15
Cubic Hermite Basis
�Set of polynomials of degree k is linear vector space of degree k+1
�The canonical, monomial basis for polynomials is
{1 , x, x2, x3,…}
�Define geometrically-oriented basis for cubic polynomials
hi,j(t): i, j = 0,1, t∈[0,1]
�Has to
satisfy:
16
Physical Splines
17
Hermite Cubic Basis � The four cubics which satisfy these conditions are
� Obtained by solving four linear equations in four unknowns for each basis function
� Prove: Hermite cubic polynomials are linearly
independent and form a
basis for cubics
)1()()1()(
)32()(1)32()(2
112
10
201
200
−=−=
−−=+−=
ttthttth
ttthttth
18
Hermite Cubic Basis (cont’d)
� Lets solve for h00(t) as an example.� h00(t) = a t3 + b t2 + c t + d
must satisfy the following four
constraints:
� Four linear equations in four unknowns.
.230)1('
,0)0('
,0)1(
,1)0(
00
00
00
00
cbah
ch
dcbah
dh
++====
+++====
Geometric Modeling
Page
Computer GraphicsComputer Graphics
Copyright Gotsman, Elber, Barequet, Karni, Sheffer
Computer Science - Technion
19
Hermite Cubic Basis (cont’d)
� Let C(t) be a cubic polynomial defined as the linear combination:
i
)()()()()( 111100011000 thTthTthPthPtC +++=
� Then C(0) = P0, C(1) = P1, C’(0) = T0, C’(1) = T1
� To generate a curve through P0 & P1 with slopes T0 &
T1, use
)()()()()( 111100011000 thTthTthPthPtC +++=
20
Parametric Splines
Fit spline independently for x(t) and y(t) to obtain C(t)
21
Cubic Splines
� Standard spline input – set of points { Pi} i= 0, n
No derivatives’ specified as input
� Interpolate by n cubic segments (4n DOF):Derive { Ti} i= 0,..,n from C2 continuity constraintsSolve 4n linear equations in 4n unknowns
Interpolation (2 equations):
C continuity constraints ( equations):
C continuity constraints ( equations):
1
2
n
C P C P i n
n
C C i n
n
C C i n
i i i i
i i
i i
( ) ( ) ,..,
( ) ( ) ,..,
( ) ( ) ,..,
' '
'' ''
0 1 1
1
1 0 1 1
1
1 0 1 1
1
1
1
= = =
−
= = −
−
= = −
−
+
+
22
Cubic Splines� Have two degrees of freedom left (to reach 4n DOF)� Options
Natural end conditions: C1''(0) = 0, Cn''(1) = 0
Complete end conditions: C1'(0) = 0, Cn'(1) = 0
Prescribed end conditions (derivatives available at the ends):C1'(0) = T0, Cn'(1) = Tn
Periodic end conditionsC1'(0) = Cn'(1), C1''(0) = Cn''(1),
� Question: What parts of C(t) are affected as a result of a change in Pi ?
prescribedprescribed
naturalnatural
23
Bezier Curves
� Bezier curve is an approximation of given control points
� Denote by γ (t): t∈[0,1]
� Bezier curve of degree n is defined over n+1control points { Pi} i= 0, n
P1 P3P5
P1
P2
P0P0 P2 P4
)(tγ
)(tγ
24
De Casteljau Construction
);(:)(
);()()1(:)(
do to:=For
do to1:For
;:)( do to0:For
][
]1[]1[1
][
]0[
tPt
ttPtPttP
nji
nj
PtPni
nn
ji
ji
ji
ii
=
+−=
===
−−−
γ
γ (1/3)
Select t∈[0,1] value. Then,
t t = 1/3= 1/3
Geometric Modeling
Page
Computer GraphicsComputer Graphics
Copyright Gotsman, Elber, Barequet, Karni, Sheffer
Computer Science - Technion
25 26
Algebraic Form of Bezier Curves
Bezier curve for set of control points { Pi} i=0, n :
where { Bin(t)} i=0, n Bernstein basis of polynomial of
degree n
Cubic case:
∑∑=
−−−
=n
i
iini
nii tt
ini
nPtBPt
0
n
0=i
)1()!(!
!)( = )(γ
27
Algebraic Form of Bezier Curves
�
why?
� Curve is linear combination of basis functions
� Curve is affine combination of control points
∑ ∈∀=n
0=i
]1,0[,1)( ttBni
∑=
−−−
n
i
iini tt
ini
nPt
0
)1()!(!
! = )(γ
28
Properties of Bezier Curves� γ (t) is polynomial of degree n� γ (t) is contained in the convex hull CH(P0,…,Pn)� γ (0) = P0 and γ (1) = Pn
� γ '(0) = n(P1−P0) and γ '(1) = n(Pn−Pn-1)� γ (t) is affine invariant and variation diminishing� γ (t) is intuitive to control via Pi and it follows the general
shape of the control polygon� γ '(t) is a Bezier curve of one degree less� Questions:
What is the shape of Bezier curves whose control points lie on one line?How can one connect two Bezier curves with C0 continuity? C1
? C2 ?
29
Drawbacks of Bezier Curves� Degree corresponds to number of control points
Global support: change in one control point affects the entire curveFor large sets of points – curve deviates far from the points
� Cannot represent conics exactly. Most noticeably circles
Can be resolved by introducing a more powerful representation of rational curves.
For example, a 90 degrees arc as a rational Bezier curve:
.2where
)()()()()()(
)(
21
20
222
211
200
2222
2111
2000
=
++++=
w
ww
tBwtBwtBw
tBPwtBPwtBPw tCP0
=(0,1)
P1=(1,1)
P2 =(1,0)
30
B-Spline Curves� Idea: Generate basis where functions are continuous
across the domains with local support
� For each parameter value only a finite set of basis functions is non-zero
� The parametric domain is subdivided into sections at parameter values called knots, { τi } .
� The B-spline functions are then defined over the knots
� The knots are called uniform knots if τi - τi-1 = c,constant. WLOG, assume c = 1.
∑−
=
=1
0
)()(n
iii tNPtC
Geometric Modeling
Page
Computer GraphicsComputer Graphics
Copyright Gotsman, Elber, Barequet, Karni, Sheffer
Computer Science - Technion
31
Uniform Cubic B-Spline Curves� Definition (uniform knot sequence, τi - τi-1 = 1):
),[
),[
),[
),[
6/)1(
6/)463(
6/)1333(
6/
)(
),3[,)()(
43
32
21
1
3
2
1
3
23
23
3
3
1
0
3
++
++
++
+
+
+
+
−
=
∈
∈
∈
∈
−=
−=
−=
−=
−
+−
+++−=
∈=∑
ii
ii
ii
ii
i
i
i
i
i
n
iii
t
t
t
t
tr
tr
tr
tr
r
rr
rrr
r
tN
nttNPt
ττ
ττ
ττ
ττ
τ
τ
τ
τ
γ
32
Uniform Cubic B-Spline Curves� For any t ∈ [3, n]:
(prove it!)
� For any t ∈ [3, n] at most four basis functions are non zero
� Any point on a cubic B-Spline is a convex combination of at most four control points
1)(1
0
3 =∑−
=
n
ii tN
[ )
.)(
)()(
Then, .,Let
3
3
0
30
3
1
00
3
430
∑
∑
−=
−
==
=
=
∈
τ
τ
γ
ττ
iii
n
iiitt
tNP
tNPt
t
33
� B-Splines do not interpolate control pointsin particular, the uniform cubic B-spline curves do not interpolate the end points of the curve.Why is the end points’ interpolation important?
� Two ways are common to force endpoint interpolation:Let P0 = P1 = P2 (same for other end)Add a new control point (same for other end) P-1 = 2P0 – P1 and a new basis function N-1
3(t).
� Question: What is the shape of the curve at the end points if the first method is used?What is the derivative vector of the curve at the end points if the first method is used?
Boundary Conditions for Cubic B-Spline Curves
34
Local Control of B-spline CurvesControl point Pi
affects γ (t) only fort∈(τi, τi+4)
B-spline
35
Properties of B-Spline Curves�
� For n control points, γ (t) is a piecewise polynomial of
degree 3, defined over t∈[3, n)�
� γ(t) is affine invariant and variation diminishing� γ(t) follows the general shape of the control polygon and
it is intuitive and ease to control its shape� Questions:
What is γ (τi) equal to?What is γ '(τi) equal to?What is the continuity of γ (t) ? Prove !
U4
03),..,()(
−
=+∈
n
iii PPCHtγ
),3[,)()(1
0
3 nttNPtn
iii ∈= ∑
−
=
γ
36
From Curves to Surfaces
� A curve is expressed as inner product of coefficients Pi and basis functions
� Treat surface as a curves of curves. Also known as tensor product surfaces
� Assume Pi is not constant, but are functions of a second, new parameter v:
∑=
=n
iii uBPuC
0
)()(
∑=
=m
jjiji vBQvP
0
)()(
Geometric Modeling
Page
Computer GraphicsComputer Graphics
Copyright Gotsman, Elber, Barequet, Karni, Sheffer
Computer Science - Technion
37
From Curves to Surfaces (cont’d)Then
or
∑∑
∑ ∑
∑
= =
= =
=
=
=
=
n
ii
m
jjij
n
ii
m
jjij
n
iii
uBvBQ
uBvBQ
uBPuC
0 0
0 0
0
)()(
)()(
)()(
∑∑= =
=n
ii
m
jjij uBvBQvuS
0 0
)()(),( BezPatch
38
Surface Constructors
� Construction of the geometry is a first stage in any image synthesis process
� Use a set of high level, simple and intuitive, surface
constructors: Bilinear patchRuled surfaceBoolean sumSurface of RevolutionExtrusion surfaceSurface from curves (skinning)Swept surface
39
Bilinear Patches
� Bilinear interpolation of 4 3D points - 2D analog of 1D linear interpolation between 2 points in the plane
� Given P00, P01, P10, P11 the bilinear surface for u,v∈[0,1]is:
� Questions:What does an isoparametric curve of a bilinear patch look like ?Can you represent the bilinear patch as a Bezier surface?When is a bilinear patch planar?
11100100 )1()1()1)(1(),( uvPPvuvPuPvuvuP +−+−+−−=
40
PP1010
PP1111
PP0000
PP1010
PP0101
xx
yy
41
� Given two curves a(t) and b(t), the corresponding ruled surface between them is:
The corresponding points on a(u) and b(u) are connected by straight lines
� Questions: When is a ruled surface a bilinear patch?When is a bilinear patch a ruled surface?
Ruled Surfaces
S(u,v) = v a(u) + (1-v)b(u)
a(u)b(u)
42
Geometric Modeling
Page
Computer GraphicsComputer Graphics
Copyright Gotsman, Elber, Barequet, Karni, Sheffer
Computer Science - Technion
43
Surface of Revolution� Rotate a, usually planar,
curve around an axis
� Consider curve β(t) = (βx(t), 0, βz(t))
and let Z be the axis of revolution. Then,
).(),(
),sin()(),(
),cos()(),(
uvuz
vuvuy
vuvux
z
x
x
βββ
===
44
Extrusion
� Extrusion of a, usually planar, curve along a
linear segment.
� Consider curve β(t) andvector
� Then
.)(),( VvuvuSr
+= β
Vr
45
Sweep Surface� Rigid motion of one (cross section) curve along another
(axis) curve:
� The cross section may change as it is swept
Question: Is an extrusion a special case of a sweep?a surface of revolution?
Recommended