Geometry and Transformation - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

Geometry and Transformation

Description:

... on line is an affine combination of two points A ... If we work in an affine space we can add a single point, the origin, to the ... Affine Transformations ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 54
Provided by: IIT89
Category:

less

Transcript and Presenter's Notes

Title: Geometry and Transformation


1
Geometry and Transformation
2
Objectives
  • Introduce the elements of geometry
  • Scalars
  • Vectors
  • Points
  • a minimum set of primitives from which we can
    build more sophisticated objects
  • Develop mathematical operations among them in a
    coordinate-free manner
  • Define basic primitives
  • Line segments
  • Polygons

3
Coordinate-Free Geometry
  • When we learned simple geometry, most of us
    started with a Cartesian approach
  • Points were at locations in space p(x,y,z)
  • We derived results by algebraic manipulations
    involving these coordinates
  • This approach was nonphysical
  • Physically, points exist regardless of the
    location of an arbitrary coordinate system
  • Most geometric results are independent of the
    coordinate system

4
Scalars
  • Need three basic elements in geometry
  • Scalars, Vectors, Points
  • Scalars can be defined as members of sets which
    can be combined by two operations (addition and
    multiplication) obeying some fundamental axioms
    (associativity, commutivity, inverses)
  • Examples include the real and complex number
    systems under the ordinary rules with which we
    are familiar
  • Scalars alone have no geometric properties

5
Vectors
  • Physical definition a vector is a quantity with
    two attributes
  • Direction
  • Magnitude
  • Examples include
  • Force
  • Velocity
  • Directed line segments
  • Most important example for graphics
  • Can map to other types

6
Vector Operations
  • Every vector has an inverse
  • Same magnitude but points in opposite direction
  • Every vector can be multiplied by a scalar
  • There is a zero vector
  • Zero magnitude, undefined orientation
  • The sum of any two vectors is a vector
  • Use head-to-tail axiom

w
v
?v
v
-v
u
7
Linear Vector Spaces
  • Mathematical system for manipulating vectors
  • Operations
  • Scalar-vector multiplication u?v
  • Vector-vector addition wuv
  • Expressions such as
  • vu2w-3r
  • Make sense in a vector space

8
Vectors Lack Position
  • These vectors are identical
  • Same direction and magnitude
  • Vectors spaces insufficient for geometry
  • Need points

9
Points
  • Location in space
  • Operations allowed between points and vectors
  • Point-point subtraction yields a vector
  • Equivalent to point-vector addition

vP-Q
PvQ
10
Affine Spaces
  • Point a vector space
  • Operations
  • Vector-vector addition
  • Scalar-vector multiplication
  • Point-vector addition
  • Scalar-scalar operations
  • For any point define
  • 1 P P
  • 0 P 0 (zero vector)

11
Lines
  • Consider all points of the form
  • P(a)P0 a d
  • Set of all points that pass through P0 in the
    direction of the vector d

12
Parametric Form
  • This form is known as the parametric form of the
    line
  • More robust and general than other forms
  • Extends to curves and surfaces
  • Two-dimensional forms
  • Explicit y mx h
  • Implicit ax by c 0
  • Parametric
  • x(a) ax0 (1-a)x1
  • y(a) ay0 (1-a)y1

13
Curves and Surfaces
  • Curves are one parameter entities of the form
    P(a) where the function is nonlinear
  • Surfaces are formed from two-parameter functions
    P(a, b)
  • Linear functions give planes and polygons

P(a)
P(a, b)
14
Convexity
  • An object is convex iff for any two points in the
    object all points on the line segment between
    these points are also in the object

P
P
Q
Q
not convex
convex
15
Affine Sums
  • Consider the sum of points
  • Pa1P1a2P2..anPn
  • Can show by induction that this sum makes sense
    iff
  • a1a2..an1
  • in which case the affine sum of the points is a
    point.
  • or a1a2..an0
  • in which case the affine sum is a vector

16
Example of Affine combinations
  • Parametric Line Equation
  • has geometric meaning (in an affine sense)
  • The weights t and (1-t) create an affine
    combination.The result is a point (on the line).
  • Any point on line is an affine combination of two
    points A and B of the line.

17
Planes
  • A plane can be defined by a point and two vectors
    or by three points

P
v
Q
R
R
u
P(a,b)Ra(Q-R)b(P-R)
P(a,b)Raubv
18
Triangles
T(a,ß) aP ßQ(1- a - ß)R
convex sum of S(a) and R
  • convex sum of P and Q

for 0lta, b, ab lt1, we get all points in
triangle
19
Representation
  • Until now we have been able to work with
    geometric entities without using any frame of
    reference, such as a coordinate system
  • Need a frame of reference to relate points and
    objects to our physical world.
  • For example, where is a point? Cant answer
    without a reference system
  • World coordinates
  • Camera coordinates

20
Coordinate Systems
  • Consider a basis v1, v2,., vn
  • A vector is written va1v1 a2v2 .anvn
  • The list of scalars a1, a2, . anis the
    representation of v with respect to the given
    basis
  • We can write the representation as a row or
    column array of scalars

a a1 a2 . anT
21
Example
  • v2v13v2-4v3
  • a2 3 4T
  • Note that this representation is with respect to
    a particular basis
  • For example, in OpenGL we start by representing
    vectors in the object space but later the system
    needs a representation in terms of the camera
    (eye) space

22
Vector Bases
  • Which is correct?
  • Both are because vectors have no fixed location

v
v
23
Frames
  • Vector bases are insufficient to represent points
  • If we work in an affine space we can add a single
    point, the origin, to the basis vectors to form a
    frame, also called coordinate systems.

v2
v1
P0
v3
24
Representation in a Frame
  • Frame determined by (P0, v1, v2, v3)
  • Within this frame, every vector can be written as
  • va1v1 a2v2 .anvn
  • Every point can be written as
  • P P0 b1v1 b2v2 .bnvn

25
Confusing Points and Vectors
  • Consider the point and the vector
  • P P0 a1v1 a2v2 .anvn
  • va1v1 a2v2 .anvn
  • They appear to have the similar coordinates
  • pa1 a2 a3 va1 a2 a3
  • which confuses the point with the vector
  • A vector has no position

v
p
v
Vector can be placed anywhere
point fixed
26
A Single Representation
  • If we define 0P 0 and 1P P then we can write
  • va1v1 a2v2 a3v3 a1 a2 a3 0 v1 v2 v3 P0
    T
  • P P0 b1v1 b2v2 b3v3 b1 b2 b3 1 v1 v2
    v3 P0 T
  • Thus we obtain the four-dimensional homogeneous
    coordinate representation
  • v a1 a2 a3 0 T
  • p b1 b2 b3 1 T

27
Homogeneous Coordinates
  • The homogeneous coordinates p x y z w T
  • If w0, it represents a vector
  • if w1, x y z 1 represents a point
  • If w?0, we return to a three dimensional point
    (for w?0) by
  • x?x/w
  • y?y/w
  • z?z/w
  • Note that homogeneous coordinates replaces points
    in three dimensions by lines through the origin
    in four dimensions

28
Vector Dot Product
  • Definition uv uxvx uyvy uzvz
  • Properties
  • Norm
  • Angle
  • Perpendicularity

u
?
v
29
Vector Cross Product
  • The cross product of vector u and v is a vector
    perpendicular to both u and v and of length uxv
    uvsin?
  • Properties

Example u (2, -1, 0), v (1, 1, 0) What are
the lengths of u and v? What is the angle between
u and v? What is the cross product of u x v?
30
Normal
  • Every plane has a vector n normal (perpendicular,
    orthogonal) to it
  • Points on the plane have the form P(a,b)Raubv,
    we can use the cross product to find
  • n u ? v and the plane equation
  • (P(a, b) - R) ? n0

v
u
R
31
Coordinate Systems
  • The use of coordinate systems (frames) is
    fundamental to computer graphics
  • Coordinate systems are used to describe the
    locations of points in space
  • We often use a Cartesian coordinate system
  • A coordinate system is determined by its origin
    and bases
  • Multiple coordinate systems make graphics
    algorithms easier to understand and implement
  • Use transformations to change coordinates among
    them

32
Change of Coordinate Systems
  • Some operations are easier in one coordinate
    system than in another
  • Consider two representations of a the same vector
    with respect to two different frames. The
    representations are

aa1 a2 a3
bb1 b2 b3
where
va1v1 a2v2 a3v3 a1 a2 a3 v1 v2 v3
T b1u1 b2u2 b3u3 b1 b2 b3 u1 u2 u3 T
33
Transformations
  • Transformations convert points between coordinate
    systems
  • Use transformation to map point coordinates from
    one coordinate system to another.

(2,3)
(1,2)
ux-1 vy-1
v
v
y
y
u
u
xu1 yv1
x
x
34
Transformations(Active Interpretation)
  • In a fixed coordinate system, transformations
    modify an objects shape and location
    (coordinates)
  • The previous interpretation is better for some
    problems, this one is better for others

(2,3)
xx-1 yy-1
y
(1,2)
y
xx1 yy1
x
x
35
Modeling transformations
  • We start with 3-D models defined in their own
    model space
  • Modeling transformations orient models within a
    common coordinate frame called world space
  • All objects, light sources, and the viewer live
    in world space

36
Viewing Transformation
  • Another change of coordinate systems
  • Maps points from world space into eye space
  • Viewing position is transformed to the origin
  • Viewing direction is oriented along some axis
  • Easy to define a viewing volume

37
Affine Transformations
  • In Computer Graphics, we are primarily interested
    in Affine transformations
  • A transformation T is said to be an affine
    transformation if
  • T maps vectors to vectors and points to points
  • T is a linear transformation on the vectors
  •                              
  • Properties of Affine Transformations
  • T preserves affine combinations on the points
  •                                                 
                      
  • where                   
  • Affine transformations map lines to lines
                                         
  • Affine transformations preserve ratios of
    distance along a line(converse is also true
    preserves ratios of such distances ? affine).


38
Affine Transformations (cont)
  • Affine transformations preserve ratios of
    distance along a line
  • Affine transformations map parallel lines to
    parallel lines
  • How to prove this?
  • Example affine transformations
  • Translation, rotation (rigid body motion)
  • Scale, shear, reflection

39
2D Transformations
  • Need to change orientation, size or shape of
    object (either of entire model or drawing
    primitives)
  • Fundamental Transformations
  • Translation
  • Scaling
  • Rotation
  • shear
  • In 2D, An affine transformation of point
    coordinates can expressed as

40
2D Translation
  • Moves an object

y
y
by
x
x
bx
41
2D Scaling
  • Resizes an object in each dimension

y
y
syy
y
x
x
sxx
x
42
2D Rotation
  • Rotate counter-clockwise about the origin by an
    angle ?

y
y
?
x
x
43
X-Axis Shear
  • Shear along x axis (What is the matrix for y axis
    shear?)

y
y
x
x
44
Reflect About X Axis
x
x
  • What is the matrix for reflect about Y axis?

45
Homogeneous Coordinates
  • Use three numbers to represent a point in 2D
  • Homogeneous notation
  • Vector (x, y, 0)
  • Point (x, y, 1)
  • Think it as imbedding of vectors and points in
    space of one higher dimension
  • Point (x, y) (wx, wy, w) for any constant w?0
  • In 3D case, (x, y, z) becomes (x, y, z, 1)
  • Translation can now be represented with matrix
    multiplication!
  • Same matrix for point and vector transformations

46
Translation
  • Points (x, y) are transformed as
  • x x dx, y y dy
  • Vectors dont change
  • Matrix representation

Point
Vector
47
Scaling about the origin
  • Points transforms as
  • Vector transforms as
  • Matrix Formulation

Point
Vector
48
Rotation
  • Rotate counter-clockwise for a rotation angle
  • Points transform as
  • Vector transform as
  • Matrix formulation

49
Composition of Transformations
  • What happens when you apply a rotation
    transformation to an object that is not at the
    origin?

y
y
x
x
50
Compositions of Transformations
  • Suppose we want to rotate around an arbitrary
    point P
  • Idea Compose simple transformations
  • 1. Translate P to origin
  • 2. Rotate around origin
  • 3. Translate origin back to P
  • Suppose P
  • Then the desired transformation would be

51
Rotating About an Arbitrary Point
y
y
x
x
y
y
x
x
52
Compositions of Transformations
Order is important !
53
Example
Derive the transformation matrix representing the
transformation in the picture. The coordinates of
the upper right corner of the rectangle are (50,
40), what Are its new coordinates after
transformation?
Write a Comment
User Comments (0)
About PowerShow.com