You are on page 1of 20

Basic Geometry

Basic Geometry - Center for Graphics and Geometric Computing,


Technion
2
Some Linear Algebra
Vectors and inner products
Commutative
Linear operator
Orthogonally
Orthonormality
L
2
-Norm
Normalized vector


v
v
v
v v v
c c b b a a v v
c b a v
=
=
+ + =
=
,
,
, ,
2 1 2 1 2 1 2 1
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
3
Some Linear Algebra
Matrix Multiplication Linear
Transformation
Do not Commute




Vector-Matrix Multiplication
Treat the vector as a 1d matrix.
Observe the right dimensions
(
(
(
(

+ + +
=
(
(
(
(

(
(
(
(

* * * *
* * * *
* * * *
* * *
* * *
* * *
* * *
* * *
* * * *
* * * *
* * * *
dh cg bf ae
h
g
f
e d c b a
A B B A =
| |
(
(
(
(

+ + +
=
(
(
(
(

*
*
*
* * *
* * *
* * *
* * *
dh cg bf ae
h
g
f
e
d c b a
Bv vB=
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
4
Determinants
If A is a [2 x 2] matrix then det(A) = ad-bc
In this case, det(A) = area of parallelogram
defined by vectors (a,c) and (b,d)
General determinate is defined recursively
by minors
minors are computed by eliminating the
row and column of an entry and
computing the determinant on the
residue.



Few reminders
Determinants are multiplicative
|AB|=|A||B|
|A|=|A
T
|

a b
A
c d
(
=
(

1
( 1)
n
i j
nxn ij ij
j
A a M
+
=
=

Basic Geometry - Center for Graphics and Geometric Computing,


Technion
5
Cross products
The cross product of two vectors V
1
and V
2

V
1
=(x
1
,y
1
,z
1
),V
2
=(x
2
,y
2
,z
2
)
is defined (in determinant form)





Meanings
The area of the parallelogram that is defined by V
1
and V
2

The direction of the normal to the plane that is determined by V
1

and V
2

A vector which is orthogonal to both V
1
and V
2
2 2 2
1 1 1 2 1

z y x
z y x
z y x
V V =
|V
1
x V
2
|
V
1
V
2
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
6
Cross Product

Properties
V
1
x V
2
= V
2
x V
1
Reverse the direction.

|V
1
x V
2
|= |V
1
||V
2
|sin(o)


V
1
V
2
o
V
1
x V
2
V
2
x V
1
=
-V
1
x V
2
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
7
Right and Left Coordinate Systems
Question: What is a positive angle of rotation around an axis
specified by a vector ?

Answer: Align your thumb with the vector. Your other fingers
indicate the direction of a positive rotation.

Definition: A three-dimensional left (right) coordinate system is such
that the positive rotation direction around the Z axis using the left
(right) thumb rotates X towards Y.
A three-dimensional left
coordinate system.
A three-dimensional right
coordinate system.
X
Y Y Z X
Z
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
8
Coordinate Systems
Modeling Coordinate System
World Coordinate System
View Coordinate System
Projection Transform
Screen Coordinate System
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
9
Demo
Modeling and World Coordinate Systems
The modeling coordinate system is the coordinate system
where the object is defined (modeled)
Customarily, objects are modeled around the center of axes
Why?
The world coordinate system is the global coordinate
system where all the object reside
To move objects from one coordinates system to the other we
apply transformations on the object
Multiply the vertices of a polygonal object by a proper [4X4]
matrix
Modeling Transform
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
10
View Coordinate System
A coordinate system that is centered on the virtual
camera
All objects in a scene are either in positive (in front of
the camera) or negative (behind) Z
Positions the viewing volume in the world.
After multiplying objects by the viewing matrix, these
objects are transformed from the world coordinate
system to the view (camera) coordinate system
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
11
Projection Transform & screen
coordinates
The location where a 3D object is projected onto a 2D plane
(image).
There are several options there will be discussed during the
lectures
Usually it is preferred to consider normalized projected space
where the projection transform maps to [-1,1]X[-1,1] square




After the projection transform took place, the object is not yet in
device coordinate systems.
These are the integer values
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
12
The complete pipeline
For every vertex V in a polygonal model apply M, the
concatenated matrix which contain all the
transformations.
(
(
(
(

(
(
(
(

(
(
(
(

(
(
(
(

=
` ` ` `
` ` ` `
` ` ` `
` ` ` `
' ' ' ' ' ' ' '
' ' ' ' ' ' ' '
' ' ' ' ' ' ' '
' ' ' ' ' ' ' '
' ' ' '
' ' ' '
' ' ' '
' ' ' '
p o n m
l k j i
h g f e
d c b a
p o n m
l k j i
h g f e
d c b a
p o n m
l k j i
h g f e
d c b a
p o n m
l l j i
h g f e
d c b a
M
Modeling
Matrix
Viewing
Matrix
Projection
Matrix
Screen
Matrix
M V V = '
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
13
Line equations
What are the available forms
Explicit form F(x) = ax +b
Implicit form F(x,y) = ax + by +c = 0
Parametric form F(t) = P
0
+t(P
1
- P
0
)
Applications
A point on a line query
Traverse the line
Rendering

Basic Geometry - Center for Graphics and Geometric Computing,
Technion
14
Point-Line Distance
<(P
0
P
1
),(P-P
2
)> = 0
<(P
0
P
1
),(P
0
+t(P
1
-P
0
)-P
2
)> = 0
Solve for t



Substitute into the first equation to get the value of P.
Find the distance between P and P
2
as usual.

P
P
1

P
0

P
2

(1) :P = P
0
+t(P
1
-P
0
)
2 0 1 0 2 0 1 0 2 0 1 0
1 0 1 0
( )( ) ( )( ) , x x x x y y y y P P P P
t
P P P P
+ < >
= =

Basic Geometry - Center for Graphics and Geometric Computing,
Technion
15
Point-Plane Distance
The projection of the line (P
a
,P
b
) on the normal is
given by:


Substitute the following to solve the equation:
P
a
P
b
P

Ax+By+Cz+D =0
P=(x,y,z)
o
n
( ) ( ) ( )
b a b a b a
A x x B y y C z z
Dist
n
+ +
=
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
16
Line-Line Intersection
1 1 1 1 2 2 2 2
0 1 0 0 1 0
1 2
1 1 1 1 2 2 2 2
0 1 0 0 1 0
( ) ( ) ( ) ( )
[0,1] [0,1]
( ) ( ) ( ) ( )
x t x x x t x r x x x r
L t L r
y t y y y t y r y y y r
= + = +

= e = e

= + = +


At an intersection point, the x and y values are equal in both
representations, forming two linear equations in two unknowns (r,t).
Question: What is the meaning of r,t < 0 or r,t >1 ?
(x
0
1
,y
0
1
)
(x
1
1
,y
1
1
)
(x
1
2
,y
1
2
)
(x
0
2
,y
0
2
)
L
1
L
2
1 1 1 2 2 2
0 1 0 0 1 0
1 1 1 2 2 2
0 1 0 0 1 0
( ) ( )
( ) ( )
x x x t x x x r
y y y t y y y r
+ = +
+ = +
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
17
Linear Operators
Definition: A linear operator, L:AB, satisfies the following:
L(aX+bY) = aL(X) + bL(Y)
Examples
( ) ( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
D af x bg x D af x D bg x
aD f x bD g x
+ = +
= +
Scaling
( ) ( ) ( ) ( ) ( ) ( )
( ) ( )
( ) ( ) ( ) ( ) x g bS x f aS
x bsg x asf
x bg x af s x bg x af S
+ =
+ =
+ = +
Differentiation
D(h(x)) = h(x)
S(h(x)) = sh(x)
Question: Is F(X) = oX+| a linear operation ?
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
18
Linear Operators (cont).
Answer: No !!
( )
( )
( ) ( )
( ) ( ) (1 )
( ) ( ) (1 )
F aX bY
aX bY
aX bY
a X b Y
a X b Y a b
aF X bF Y a b
o |
o o |
o o |
o | o | |
|
+
= + +
= + +
= + +
= + + + +
= + +
Definition: An affine operator, A, satisfies:
A(aX+bY) = aA(X) + bA(Y), for a+b = 1
Question: Is F(X) = oX+| an affine operation ?
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
19
Convexity
.
2 1
, 2 For .
1
.
1
of an is
1
say that We
.
1
0 , 1 ,
1
let and points, be
1
Let
P P P n
n
i
i
P CH P
n
i
i
P
i
P
n
i i
a P
n
i i
a
i
a
n
i
i
a n
n
i
i
P
e =
=
e
=
=
=
=
> =
= =
|
|
.
|

\
|
)
`

)
`

)
`

)
`


n combinatio affine

An object 0 is convex iff for any two points
P,Qe0,
tP+(1-t)Qe0, te[0,1].
P
Q
( )Q t tP + 1
0
The convex hull CH(0), of an object 0,
is the minimal convex shape C, such
that 0_C.
C
0
C=CH(0)
Basic Geometry - Center for Graphics and Geometric Computing,
Technion
20
Curves
( ) ( ) ( )
| |
T C t
dC t
dt
x t y t = ' = = ' '
( )
,
C(t) may be thought of as the
trajectory of a point in time.
The unit length tangent vector is
( )
( ) ( ) | |
( ) ( )
2 2
,
t y t x
t y t x
t C T
' + '
' '
= =

( ) t C
( )
dt
t dC
T =
Let C(t)=[x(t),y(t)] te[T
0
,T
1
]

be a continuous uni-
variate parametric curve. The tangent vector is
T=C(t):
C(t) is the velocity vector at
time t.

You might also like