Computer Graphics Geometry Transformations - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Computer Graphics Geometry Transformations

Description:

Leaves affine coordinates invariant (see ... Invariance of affine coordinates. Tp= T( 1p1 2p2A( 1p1 2p2t ... So far we looked at points (affine entities) ... – PowerPoint PPT presentation

Number of Views:574
Avg rating:3.0/5.0
Slides: 43
Provided by: marcus45
Category:

less

Transcript and Presenter's Notes

Title: Computer Graphics Geometry Transformations


1
Computer Graphics- Geometry Transformations -
  • Marcus Magnor

2
Overview
  • So far
  • Ray tracing basics
  • Shading
  • Today
  • Geometry
  • Transformations
  • Next lecture
  • Ray tracing acceleration

3
Object Geometry Representation
4
Geometry Models
  • Digital representations of 2D surfaces in 3D
    space
  • Point clouds
  • Polygon meshes
  • Spline surfaces
  • Functions (explicit, implicit)
  • Volumes
  • Our assumptions
  • Opaque
  • Piecewise planar

5
Spline Surfaces
  • B-splines, NURBS
  • generalization of Bézier curve
  • Nonuniform rational B-splines
  • Continuous surface
  • Control points

6
Meshes
  • Discrete representation
  • Geometry
  • Vertices
  • Topology
  • Edges, faces

7
Face Orientation
  • Each face of a polygon mesh can be oriented by
    stating its vertices in order
  • Two orientations possible
  • Definitions
  • Normal points towards outside
  • Right-handed coordinate system
  • anti-clockwise order of vertices as you look down
    normal vector

8
Polygon Mesh
  • Two adjacent faces are oriented in the same
    direction if both faces traverse the adjoining
    edges vertices in opposite order

9
Eulers Polyhedral Formula
  • Fundamental property of convex polyhedra

Vertices v 8 Edges e 12 Faces f 6
v-ef2
10
Eulers Polyhedral Formula
11
Polygon Meshes
  • Geometry topology
  • Vertices
  • Faces (edges)
  • Euler formula
  • 2-2g fv-e
  • Normal orientation
  • Inside, outside
  • Vertex order per polygon

12
Vector Space
  • Known from Mathematics
  • Elements of a 3D vector space
  • v (v1, v2, v3)T ? V3 R3
  • Formally we write vectors a column vectors (n x
    1 matrix)!
  • Vectors describe directions not positions!
  • 3 linear independent vectors create a basis
  • e1, e2, e3
  • Any vector can uniquely be represented with
    coordinates
  • v v1 e1 v2 e2 v3 e3 (v1, v2, v3)T
  • Operations
  • Addition, Subtraction, Scaling,
  • Metric
  • Dot/inner product
  • Used for measurements of length (v2 v v)
    and angles cos(v1, v2) v1 v2 / v1 v2
  • Orthonormal basis
  • ei 1 ei ej ?ij right-/left handed e1 ?
    e2 /- e3

13
Euclidian Affine Space
  • Known from Mathematics
  • Affine Space A3
  • Elements are positions no directions!
  • Defined via its associated vector space V3
  • a, b ? A3 ? v ? V3 with v b a
  • ? unique, ? ambiguous
  • Addition of points and vectors (p v ? A3)
  • distance(a, b) length(a - b)
  • Operations on A3
  • Subtraction, but no addition
  • Affine Basis
  • o, e1, e2, e3
  • Origin o ? A3 , and
  • Basis of vector space
  • Position vector of point p
  • (p o) ? V3

e3
e2
o
e1
14
Affine Coordinates
  • Affine Combination
  • Linear combination of (n1) points
  • Weights for a partition of unity
  • b0, , bn ? An
  • Affine Coordinates
  • Barycentric coordinates
  • Center of mass (R ? mi ri / ? mi)
  • Affine weighted sum
  • Weights given by the splitting ratio
  • p ?1p1 ?2p2
  • ?1 ?2 1

15
Affine Mappings
  • Properties
  • Affine mapping (continuous, bijective,
    invertible)
  • T A3 ? A3
  • Defined by two non-degenerated simplexes
  • 2D Triangle, 3D Tetrahedron, ...
  • Leaves affine coordinates invariant (see below)
  • Other invariants
  • Straight lines, parallelism, splitting ratios,
    surface/volume ratios
  • Characterization via fixed points and lines
  • Eigenvalues and eigenvectors of the mapping
  • Representation of affine mappings
  • Linear mapping A plus a translation t
  • Tp A p t with (n x n) matrix A
  • Invariance of affine coordinates
  • Tp T(?1p1 ?2p2) A(?1p1 ?2p2) t ?1A(p1)
    ?2A(p2) ?1t ?2t ?1T(p1) ?2 T( p2)

?2
p
p1
?1
p2
16
Homogeneous Coordinates for 3D
  • Embedding of R3 into P(R4)
  • For the time being
  • Representation of transformations by 4x4 matrices
  • Mathematical trick
  • Convenient representation to express rotations
    and translations as matrix multiplications
  • Easy to find line through points,
    point-line/line-line intersections
  • Also important for projections

17
Point Representation
X(X,Y,W)
w1
18
Line Representation
19
Point on Line
20
Intersection of Lines
21
Line through 2 Points
22
Linear Map Matrix
  • Vector-Matrix Product
  • Action of a linear map on a vector
  • Multiplication of matrix with column vector
  • In some old text books sometimes row vector times
    matrix
  • Composition (first T1, then T2)
  • Matrix multiplication
  • T2T1 p T2(T1 p) (T2T1) p T p
  • Warning Matrix multiplication does not commute
    !!!

23
Basic Transformations
  • Translation

24
Translation of Vectors
  • So far we looked at points (affine entities)
  • Vectors are defined as the difference of two
    points
  • Consequently, for vectors W is always equal to
    zero
  • This means that translations DO NOT act on
    vectors
  • Which is exactly what we expect to happen

25
Translations
  • Properties
  • T(0,0,0) 1 (Identity Matrix)
  • T(tx, ty, tz)T(tx, ty,tz) T(tx tx, ty
    ty, tz tz)
  • T(tx, ty, tz)T(tx, ty,tz) T(tx,
    ty,tz)T(tx, ty, tz)
  • T-1(tx, ty, tz) T(-tx, -ty, -tz)

26
Basic Transformations
  • Rotation around major axis
  • Assumes right-handed coordinate system

27
Rotation
  • Rotation in 2D

y
r sin(??)
r sin?
??
?
r cos?
r cos(??)
x
28
Rotation
  • Properties
  • Ra(0) 1
  • R-1a(?) Ra(-?)
  • Ra(?) Ra(?) Ra(? ?)
  • Ra(?) Ra(?) Ra(?) Ra(?)
  • R-1a(?) Ra(-?) RTa(?)
  • BUT in general Ra(?) Rb(?) ? Rb(?) Ra(?)
  • For rotations around different axes, the order
    matters

29
Basic Transformations
  • Scaling
  • Uniform Scaling
  • sx sy sz

30
Basic Transformations
  • Reflection at Z
  • Warning Change of vertex order (normal
    orientation) !

31
Basic Transformations
  • Shear (deutsch Scherung)

H(1,0,0,0,0,0)
32
Concatenation of Transformations
  • In general, transformations do not commute

R(45)
T(1,1)
R(45) T(1,1)
T(1,1) R(45)
33
Rotation About Arbitrary Points
  • Example Rotate object about one vertex
  • Translate object from point to origin
  • Apply desired rotation
  • Translate object back to original position

34
Rotation about arbitrary Axis
  • Move base point to origin
  • T(-o)
  • Rotation around Y-axis, so that r is in YZ-plane
  • Use projection into XZ-plane
  • Ry(-?1) tan(?1) rx/rz
  • Rotation around X-axis, so that r is along
    Z-axis
  • Rx(?2) tan(?2) ry/ rz
  • Rotation around Z-axis with angle ?
  • Rotate back around X-axis
  • Rotate back around Y-axis
  • Translate back
  • Together
  • R(?, o, r) T(o)Ry(?1)Rx(-?2)Rz(?)Rx(?2)Ry(-?1)T(
    -o)

35
Interpretation of Matrices
  • Columns are transformed basis
  • Transformation into new basis M
  • Simple Write basis vectors into columns of matrix

x
z
y
z
y
x
36
Orthonormal Matrices
  • Orthonormal transformations
  • Images of basis vectors are again orthonormal
  • ei ej ?ij
  • Which means that

37
Transformations
  • Line
  • Transform end points
  • Plane
  • Transform three points
  • Vector
  • v p q (x, z, y, 0)T
  • Translations do not act on vectors
  • Normal vectors
  • Problem e.g. with non-uniform scaling
  • Re-normalization

38
Transforming Normals
  • Dot product as matrix multiplication
  • Normal N on a plane
  • For any vector T in the plane NT T 0
  • Find transformation M for normal vector, such
    that

Matrix multiplication
Dot product
39
Transforming Normals
  • Remember
  • Normals are transformed by
  • the transpose of the inverse
  • of the 4x4 transformation matrix of points and
    vectors
  • No problem with orthogonal transformations
  • E.g. rotation, uniform scaling
  • M-1 MT
  • M-1T MTT M

40
Coordinate Systems
  • Object Coordinates
  • Intrinsic coordinate system of an object
  • Hierarchical modeling
  • Modeling Transformations to world coordinates
  • World Coordinates
  • Root for hierarchical modeling
  • Reference system for the camera
  • Viewing Transformation to camera coordinates
  • Camera coordinates (Viewing Coordinates)
  • Reference system for lighting computations
  • Perspective Transformation to normalized
    (projection) coordinates

41
Hierarchical Modeling
body torso head shoulder larm
upperarm lowerarm hand
rarm upperarm lowerarm
hand hips lleg upperleg
lowerleg foot rleg
upperleg lowerleg foot
Translate 0 4 0 TransformBegin Draw Torso
Translate 0 3 0 Draw Shoulders
TransformBegin Rotate a 0 0 1 Draw
head TransformEnd TransformBegin
Translate 1.5 0 0 DRAW_ARM(a,b,c) TransformEnd
TransformBegin Translate 1.5 0 0
DRAW_ARM(d,e,f) TransformEnd TransformEnd
Draw hips TransformBegin TransformBegin
Translate 1 0 0 DRAW_LEG(g,h) TransformEnd
TransformBegin Translate -1 0 0
DRAW_LEG(i,j) TransformEnd TransformEnd
DRAW_ARM(a,b,c) Rotate b 0 0 1
Draw upperarm Translate 0 -2 0 Rotate
c 1 0 0 Draw lowerarm Translate 0
-2 0 Draw hand DRAW_LEG(g,h)
Rotate g 1 0 0 Draw upperleg Translate
0 2 0 Rotate h 1 0 0 Draw lowerleg
Translate 0 2 0 Draw foot
42
Wrap-Up
  • Geometry
  • Different representations
  • Here Polygon meshes
  • Face orientation, normal direction
  • Eulers Polyhedral Formula
  • Transformation
  • Homogeneous coordinates
  • Matrix representation
  • Transformation concatenation
Write a Comment
User Comments (0)
About PowerShow.com