Beruflich Dokumente
Kultur Dokumente
3CG 2006
B4 Computational Geometry
David Murray
david.murray@eng.ox.ac.uk
www.robots.ox.ac.uk/dwm/Courses/3CG
Michaelmas 2006
2/1
3CG 2006
Overview
Computational geometry is concerned with
the derivation of techniques
the design of efficient algorithms and
the construction of effective representations
for geometric computation.
Techniques from computational geometry are used in:
Computer Graphics
Computer Aided Design
Computer Vision
Robotics
3/1
3CG 2006
Topics
Lecture 1: Euclidean, similarity, affine and projective
transformations. Homogeneous coordinates and matrices.
Coordinate frames. Perspective projection and its matrix
representation.
Lecture 2: Perspective projection and its matrix representation.
Vanishing points. Applications of projective transformations.
Lecture 3: Convexity of point-sets, convex hull and algorithms.
Conics and quadrics, implicit and parametric forms, computation
of intersections.
Lecture 4: Bezier curves, B-splines. Tensor-product surfaces.
4/1
3CG 2006
Useful Texts
Bartels, Beatty and Barsky, An introduction to splines for use in computer
graphics and geometric modeling, Morgan Kaufmann, 1987. Everything you
could want to know about splines.
Faux and Pratt, Computational geometry for design and manufacture, Ellis
Horwood, 1979. Good on curves and transformations.
Farin, Curves and Surfaces for Computer-Aided Geometric Design : A
Practical Guide, Academic Press, 1996.
Foley, van Dam, Feiner and Hughes, Computer graphics - principles and
practice, Addison Wesley, second edition, 1995. The computer graphics
book. Covers curves and surfaces well.
Hartley and Zisserman Multiple View Geometry in Computer Vision, CUP,
2000. Chapter 1 is a good introduction to projective geometry.
ORourke, Computational geometry in C, CUP, 1998. Very straightforward
to read, many examples. Highly recommended.
Preparata and Shamos, Computational geometry, an introduction,
Springer-Verlag, 1985. Very formal and complete for particular algorithms.
5/1
3CG 2006
3CG 2006
6/1
3CG 2006
7/1
3CG 2006
8/1
9/1
3CG 2006
Lecture 1.
Lecture 1:
Transformations, Homogeneous Coordinates, and Coordinate
Frames
10 / 1
3CG 2006
Hierarchy of transformations
We will look at linear transformations represented by matrices
of increasing generality:
Euclidean
Similarity
Affine
Projective
We consider both
2D 2D mappings
3D 3D transformations
11 / 1
3CG 2006
t
O
O
In vector notation, a Euclidean transformation is written
x0 = Rx + t
R is the orthogonal rotation matrix, RR > = I, and x0 etc are column
vectors.
12 / 1
3CG 2006
y
B
Model
y
W
y
B
y
A
x
B
t
x
B
xA
x
cos sin
In an aligned frame xA =
xB .
sin
cos
Check using the point (1, 0). It should be (+ cos , + sin ) in the
A frame.
Then xW = xA + tOrigin of B in W .
Check the above using the origin of A. It should be tOBW in W
frame ...
13 / 1
3CG 2006
In 3D ...
In 3D the transformation X0 = R 33 X + T has 6 dof. Two major ways
of representing 3 rotation
rotation about successive new axes: eg ZYX Euler angles
rotation about old fixed axes: eg ZXY roll-pitch-yaw
In each case the order is important, as rotations do not commute.
XW
X1
X2
cos p sin p 0
cos p 0
= sin p
0
0
1
cos e 0 sin e
1
0
= 0
sin e 0 cos e
1
0
0
= 0 cos c sin c
0 sin c
cos c
X1
y
1
y
W
X2
z2
z1
e
XB
x2
x1
z
B
x
1
p
x
2
y
B
c
y
2
14 / 1
3CG 2006
Start
Y
X
15 / 1
3CG 2006
16 / 1
3CG 2006
0
x
tx
x
A
+
=
y
ty
y0
with A a 2 2 non-singular matrix.
In vector form:
x0 = Ax + t
Angles and length ratios are not preserved.
How many points required to determine an affine transform in
2D?
17 / 1
3CG 2006
This is non-isotropic if 1 =2 .
3
If A is a symmetric matrix.
then A can be decomposed as: (its an eigen-decomposition)
cos sin
1 0
cos
sin
A = R D R> =
sin
cos
0 2
sin cos
where 1 and 2 are its eigenvalues. i.e. scalings in two dirns
rotated by .
18 / 1
3CG 2006
xA ()
= a + d
xB ()
x0A ()
x0B ()
b + d
= Ax + t
=
A(a + d) + t
(Aa + t) + (Ad)
a0 + d0
A(b + d) + t
(Ab + t) + (Ad)
=0
b
= b0 + d0
Lines are still parallel they both have direction d0 .
Affine transformations also preserve ...
=0
19 / 1
3CG 2006
A1 x + t1
x2
A2 x1 + t2
A2 (A1 x + t1 ) + t2
(A2 A1 )x + (A2 t1 + t2 )
x
are represented by a three vector
y
=
If instead 2D points
x
y then the transformation can be represented by a 3 3
1
matrix ...
20 / 1
3CG 2006
Homogeneous notation
The matrix has block form:
..
a
a
.
t
x
11
12
..
a21 a22 . ty
t
x
1
1
. . . . . . ... . . .
..
0 0 . 1
x0
1
=
A
0>
x
y
Ax + t
=
...
1
1
21 / 1
3CG 2006
x1
x2
x3
such that
x = x1 /x3
y = x2 /x3
x1
x1
x2 and x2
x3
x3
For example, the homogeneous vectors (2, 3, 1)> and (4, 6, 2)>
represent the same inhomogeneous point (2, 3)>
22 / 1
3CG 2006
x
x
y
y
1
1 2 3
2 4
6
4 5 6 and 8 10 12
0 0 1
0 0
2
x1
x1 /x3
x2
x2 /x3
x3
23 / 1
3CG 2006
X
X= Y
Z
is represented by a homogeneous 4-vector:
X1
X2
X3
X4
such that
X =
X1
X4
Y =
X2
X4
Z =
X3
X4
24 / 1
3CG 2006
0
X
X1
Y
X0
R T
R T
X
20 =
=
X3
1
0> 1 44 Z
0> 1
0
X4
1
with
0
X0
X1
1
X0 = Y 0 = 0 X20
X4
Z0
X30
25 / 1
3CG 2006
R RW
0>
TRW
1
Then
R RW
XR
=
1
0>
TRW
1
XR
1
=
XW
1
R LW
0>
TLW
1
XL
1
1
R LW
0>
TLW
1
XW
1
44
XL
1
XL
1
26 / 1
3CG 2006
Links
4,5,6
Link 1
Base Frame Tool Frame
Kinematic chain:
R T6 TT6
R 32 0
R 21
XT
=
...
1
0>
1
0> 1
0>
44
XB
=
1
T21
1
R 1B
0>
T1B
1
X
1
27 / 1
3CG 2006
TBA
1
= R AB XB + TAB
XB
= R BA (XA TAB )
XB
= R BA XA R BA TAB
BUT XB
TBA
= R BA XA + TBA
= R BA TAB
(TAB is Origin of B in A)
(TBA is Origin of A in B)
28 / 1
3CG 2006
h11
x10
x20 = h21
x30
h31
h12
h22
h32
h13
x1
h23 x2
h33
x3
x10
h11 x + h12 y + h13
=
,
x30
h31 x + h32 y + h33
y0 =
x20
h21 x + h22 y + h23
=
x30
h31 x + h32 y + h33
29 / 1
3CG 2006
p12
p22
p32
p42
p13
p23
p33
p43
p14
X1
X2
p24
p34 X3
p44
X4
3CG 2006
30 / 1
31 / 1
3CG 2006
Mathematical idealized
camera 3D 2D
Image coordinates xy
X
y
O
f
image
plane
x
X
=
f
Z
Y
y
=
f
Z
X
or x = f
Z
y
f
Z
32 / 1
3CG 2006
Examples
Circle in space, orthogonal to and centred on the Z -axis:
Y
X
a
Z
X()
x()
(x, y )
33 / 1
3CG 2006
Examples ctd/
cone
grazing
rays
34 / 1
3CG 2006
In inhomogeneous coords
X
y
x = f X/Z
O
f
X
x1
1 0 0 0
x2 = 0 1 0 0 Y = [I | 0] X
Z
1
x3
0 0 1 0
1
Check that
x = x1 /x3 = X /Z
y = x2 /x3 = Y /Z
35 / 1
3CG 2006
Example: a 3D point
X
6
Non-homogeneous Y = 4 is imaged at
Z
2
(x, y ) = (6/2, 4/2) = (3, 2).
In homogeneous notation using 3 4 projection matrix:
6
x
x1
1 0 0 0
6
4
4
y = x2 = 0 1 0 0
2 =
x3
0 0 1 0
2
1
which is the 2D inhomogeneous point (x, y ) = (3, 2).
36 / 1
3CG 2006
XC
1
=
R
0>
T
1
XW
1
OC
R, T
ZC
OW
YW
XC
XW
x1
1 0 0 0
x2 = 0 1 0 0 R>
0
x3
0 0 1 0
T
1
XW
1
= [ R | T]
XW
1
37 / 1
3CG 2006
xc
1
1
= Kc 0
0
0
1
0
0
0
1
0
Rc
0
0>
0
Tc
1
1
Ro
0>
To
1
Xo
1
38 / 1
3CG 2006
A
B
C
C
B
A
38 / 1
3CG 2006
C
A
B
C
C
B
A
38 / 1
3CG 2006
C
A
B
C
C
B
A