Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney) - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)

Description:

Let's start with the fact that orthogonal vectors have 0 inner product. ... vectors (orthogonal unit vectors) ... The x axis must be orthogonal, (-st,ct) ... – PowerPoint PPT presentation

Number of Views:87
Avg rating:3.0/5.0
Slides: 42
Provided by: DavidJ1
Learn more at: http://www.cs.umd.edu
Category:

less

Transcript and Presenter's Notes

Title: Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)


1
Geometry(Many slides adapted from Octavia Camps
and Amitabh Varshney)
2
Goals
  • Represent points, lines and triangles as column
    vectors.
  • Represent motion as matrices.
  • Move geometric objects with matrix
    multiplication.
  • Refresh memory about geometry and linear algebra

3
Vectors
  • Ordered set of numbers (1,2,3,4)
  • Example (x,y,z) coordinates of pt in space.

4
Vector Addition
Vw
v
w
5
Scalar Product
av
v
6
Inner (dot) Product
The inner product is a SCALAR!
7
How do we prove these properties of the inner
product? Lets start with the fact that
orthogonal vectors have 0 inner product. Suppose
one vector is (x,y), and WLOG x,ygt0. Then, if we
rotate that by 90 degrees counterclockwise, well
get (y, -x). Rotating the vector is just like
rotating the coordinate system in the opposite
direction. And (x,y)(y,-x) xy yx 0. Next,
note that vw (vw)/(vw) vw
This means that if we can show that when v and w
are unit vectors vw cos alpha, then it will
follow that in general vw v w cos
alpha. So suppose v and w are unit
vectors. Next, note that if w1 w2 w, then vw
v(w1w2) vw1 vw2. For any w, we can
write it as the sum of w1w2, where w1 is
perpendicular to v, and w2 is in the same
direction as v. So vw1 0. vw2 w2,
since vw2/w2 1. Then, if we just draw a
picture, we can see that cos alpha w2
vw2 vw.
8
Points
Using these facts, we can represent points.
Note (x,y,z) x(1,0,0) y(0,1,0) z(0,0,1) x
(x,y,z).(1,0,0) y (x,y,z).(0,1,0) z
(x,y,z).(0,0,1)
9
Lines
  • Line y mx a
  • Line sum of a point and a vector
  • P P1 ad
  • (whered is a column vector)
  • Line Affine sum of two points
  • P a1P1 a2P2, where a1 a2 1
  • Line Segment For 0 a1, a2 1, P lies
    between P1 and P2
  • Line set of points equidistant from the origin
    in the direction of a unit vector.

d
P1
P2
P1
10
Plane and Triangle
  • Plane sum of a point and two vectors
  • P P1 au b v
  • Plane set of points equidistant
  • from origin in direction
  • of a vector.
  • Triangle Affine sum of three points
  • with ai ³ 0
  • P a1P1 a2P2 a3P3,
  • where a1 a2 a3 1
  • P lies between P1, P2, P3

v
u
P1
P3
P2
P1
11
Generalizing ...
  • Affine Sum of arbitrary number of points
    Convex Hull
  • P a1P1 a2P2 anPn, where a1 a2
    an 1 and ai ³ 0

12
Normal of a Plane
  • Plane sum of a point and two vectors
  • P P1 au bv
  • P - P1 au bv
  • Ifn is orthogonal tou andv (n u v )
  • n T (P - P1) an T u bn T v 0

13
Implicit Equation of a Plane
  • n T (P - P1) 0
  • a x
    x1
  • Letn b P y P1 y1
  • c z
    z1
  • Then, the equation of a plane becomes
  • a (x - x1) b (y - y1) c (z - z1) 0
  • a x b y c z d 0
  • Thus, the coefficients of x, y, z in a plane
    equation define the normal.

n
v
u
P1
14
Normal of a Triangle
  • Normal of the plane containing the triangle (P1,
    P2 , P3 )
  • n (P2 - P1) (P3 - P1)

P3
P2
Normal pointing towards you
Normal pointing away from you
P1
P2
P1
P3
  • Models constructed with consistent ordering of
    triangle vertices
  • - all clockwise or all counter-clockwise.
  • Usually normals point out of the model.

15
Normal of a Vertex in a Mesh
nv (n1 n2 nk) / k åni / k
average of adjacent triangle normals or
better nv å (Ai ni) / (k å (Ai) )
area-weighted average of adjacent triangle
normals
16
Geometry Continued
  • Much of last classes material in Appendix A

17
Matrices
Sum
A and B must have the same dimensions
18
Matrices
Product
A and B must have compatible dimensions
Identity Matrix
19
Matrices
  • Associative T(U(Vp)) (TUV)p
  • Distributive T(uv) Tv Tv

20
Matrices
Transpose
If
A is symmetric
21
Matrices
Determinant
A must be square
22
Matrices
Inverse
A must be square
23
Euclidean transformations
24
2D Translation
P
t
P
25
2D Translation Equation
26
2D Translation using Matrices
P
27
Scaling
P
P
28
Scaling Equation
P
s.y
P
y
x
s.x
29
Rotation
P
P
30
Rotation Equations
Counter-clockwise rotation by an angle ?
31
  • Why does multiplying points by R rotate them?
  • Think of the rows of R as a new coordinate
    system. Taking inner products of each points
    with these expresses that point in that
    coordinate system.
  • This means rows of R must be orthonormal vectors
    (orthogonal unit vectors).
  • Think of what happens to the points (1,0) and
    (0,1). They go to (cos theta, -sin theta), and
    (sin theta, cos theta). They remain orthonormal,
    and rotate clockwise by theta.
  • Any other point, (a,b) can be thought of as
    a(1,0) b(0,1). R(a(1,0)b(0,1) Ra(1,0)
    Ra(0,1) aR(1,0) bR(0,1). So its in the
    same position relative to the rotated coordinates
    that it was in before rotation relative to the x,
    y coordinates. That is, its rotated.

32
Degrees of Freedom
R is 2x2
4 elements
BUT! There is only 1 degree of freedom ?
The 4 elements must satisfy the following
constraints
33
Transformations can be composed
  • Matrix multiplication is associative.
  • Combine series of transformations into one
    matrix. (example, whiteboard).
  • In general, the order matters. (example,
    whiteboard).
  • 2D Rotations can be interchanged. Why?

34
Rotation and Translation
)
(
)
(
x
y
1
cos q -sin q tx
sin q cos q ty
0 0 1
Rotation, Scaling and Translation
)
(
)
(
x
y
1
a -b tx
b a ty
0 0 1
35
Rotation about an arbitrary point
  • Can translate to origin, rotate, translate back.
    (example, whiteboard).
  • This is also rotation with one translation.
  • Intuitively, amount of rotation is same either
    way.
  • But a translation is added.

36
Stretching Equation
P
Sy.y
P
y
x
Sx.x
37
Stretching tilting and projecting(with weak
perspective)
38
Linear Transformation
SVD
39
Affine Transformation
40
Viewing Position
  • Express world in new coordinate system.
  • If origins same, this is done by taking inner
    product with new coordinates.
  • Otherwise, we must translate.

41
Suppose, for example, we want to have the y axis
show how we are facing. We want to be at (7,3),
facing in direction (ct,st). The x axis must be
orthogonal, (-st,ct). If we want to express
(x,y) in this coordinate frame, we need to take
(ct,st)(x-7,y-3), and (-st,ct)(x-7,y-3). This
is done by multiplying by matrix with rows
(-st,ct) and (ct,st)
42
Simple 3D Rotation
Rotation about z axis. Rotates x,y coordinates.
Leaves z coordinates fixed.
43
Full 3D Rotation
  • Any rotation can be expressed as combination of
    three rotations about three axes.
  • Rows (and columns) of R are orthonormal vectors.
  • R has determinant 1 (not -1).

44
  • Intuitively, it makes sense that 3D rotations
    can be expressed as 3 separate rotations about
    fixed axes. Rotations have 3 degrees of freedom
    two describe an axis of rotation, and one the
    amount.
  • Rotations preserve the length of a vector, and
    the angle between two vectors. Therefore,
    (1,0,0), (0,1,0), (0,0,1) must be orthonormal
    after rotation. After rotation, they are the
    three columns of R. So these columns must be
    orthonormal vectors for R to be a rotation.
    Similarly, if they are orthonormal vectors (with
    determinant 1) R will have the effect of rotating
    (1,0,0), (0,1,0), (0,0,1). Same reasoning as 2D
    tells us all other points rotate too.
  • Note if R has determinant -1, then R is a
    rotation plus a reflection.

45
3D Rotation Translation
  • Just like 2D case

46
Transformation of lines/normals
  • 2D. Line is set of points (x,y) for which
    (x,y).(ab)T0. Suppose we rotate points by R.
    We want a matrix, T, so that
  • R(x,y) .T

47
3D Viewing Position
  • Rows of rotation matrix correspond to new
    coordinate axis.

48
Rotation about a known axis
  • Suppose we want to rotate about u.
  • Find R so that u will be the new z axis.
  • u is third row of R.
  • Second row is anything orthogonal to u.
  • Third row is cross-product of first two.
  • Make sure matrix has determinant 1.
Write a Comment
User Comments (0)
About PowerShow.com