Computer Graphics - Transformations - Philipp Slusallek Vector - - PowerPoint PPT Presentation

β–Ά
computer graphics
SMART_READER_LITE
LIVE PREVIEW

Computer Graphics - Transformations - Philipp Slusallek Vector - - PowerPoint PPT Presentation

Computer Graphics - Transformations - Philipp Slusallek Vector Space Math recap 3D vector space over the real numbers 1 = = 2 3 Vectors written as n x 1 matrices Vectors describe


slide-1
SLIDE 1

Philipp Slusallek

Computer Graphics

  • Transformations -
slide-2
SLIDE 2

Vector Space

  • Math recap

– 3D vector space over the real numbers

  • π’˜ =

𝑀1 𝑀2 𝑀3 ∈ π‘ΎπŸ’ = β„πŸ’

– Vectors written as n x 1 matrices – Vectors describe directions – not positions!

  • All vectors conceptually start from the origin of the coordinate system

– 3 linear independent vectors create a basis

  • Standard basis

𝒇1, 𝒇2, 𝒇3 = 1 , 1 , 1

– Any 3D vector can be represented uniquely with coordinates 𝑀𝑗

  • π’˜ = 𝑀1π’‡πŸ + 𝑀2π’‡πŸ‘ + 𝑀3π’‡πŸ’

𝑀1, 𝑀2, 𝑀3 ∈ ℝ e1 e2 e3

slide-3
SLIDE 3

Vector Space - Metric

  • Standard scalar product a.k.a. dot or inner product

– Measure lengths

  • 𝑀 2 = 𝑀 β‹… 𝑀 = 𝑀1

2 + 𝑀2 2 + 𝑀3 2

– Compute angles

  • 𝑣 β‹… 𝑀 = 𝑣 𝑀 cos(𝑣, 𝑀)

– Projection of vectors onto other vectors

  • 𝑣 cos(πœ„) = 𝑣⋅𝑀

𝑀 = 𝑣⋅𝑀 𝑀⋅𝑀

u v Ι΅ 𝑣 cos(πœ„)

slide-4
SLIDE 4

Vector Space - Basis

  • Orthonormal basis

– Unit length vectors

  • 𝑓1 = 𝑓1 = 𝑓1 =1

– Orthogonal to each other

  • 𝑓𝑗 β‹… 𝑓

π‘˜ = πœ€π‘—π‘˜

  • Handedness of the coordinate system

– Two options: 𝑓1 Γ— 𝑓2 = ±𝑓3

  • Positive:

Right-handed (RHS)

  • Negative: Left-handed (LHS)

– Example: Screen Space

  • Typical: X goes right, Y goes up (thumb & index finger, respectively)
  • In a RHS: Z goes out of the screen (middle finger)

– Be careful:

  • Most systems nowadays use a right handed coordinate system
  • But some are not (e.g. RenderMan) οƒ  can cause lots of confusion
slide-5
SLIDE 5

Affine Space

  • Basic mathematical concepts

– Denoted as A3

  • Elements are positions (not directions!)

– Defined via its associated vector space V3

  • 𝑏, 𝑐 ∈ 𝐡3 ⇔ βˆƒ! 𝑀 ∈ π‘Š3: 𝑀 = 𝑐 βˆ’ 𝑏
  • β†’: unique, ←: ambiguous

– Operations on A3

  • Subtraction yields a vector
  • No addition of affine elements

– Its not clear what the some of two points would mean

  • But: Addition of points and vectors:

– 𝑏 + 𝑀 = 𝑐 ∈ 𝐡3

  • Distance

– 𝑒𝑗𝑑𝑒 𝑏, 𝑐 = 𝑏 βˆ’ 𝑐

v b a

slide-6
SLIDE 6

Affine Space - Basis

  • Affine Basis

– Given by its origin o (a point) and the basis of an associated vector space

  • π’‡πŸ, π’‡πŸ‘, π’‡πŸ’, 𝒑 :

π’‡πŸ, π’‡πŸ‘, π’‡πŸ’ ∈ π‘Š3; 𝒑 ∈ π‘©πŸ’

  • Position vector of point p

– (π‘ž βˆ’ 𝑝) is in π‘Š3

e1 e2 e3

  • p

p-o

slide-7
SLIDE 7

Affine Coordinates

  • Affine Combination

– Linear combination of (n+1) points

  • π‘ž0, … , π‘žπ‘œ ∈ π΅π‘œ

– With weights forming a partition of unity

  • 𝛽0, … , π›½π‘œ ∈ ℝ with 𝑗 𝛽𝑗 = 1

– π‘ž = 𝑗=0

π‘œ

π›½π‘—π‘žπ‘— = π‘ž0 + 𝑗=1

π‘œ

𝛽𝑗(π‘žπ‘— βˆ’ π‘ž0) = 𝑝 + 𝑗=1

π‘œ

𝛽𝑗𝑀𝑗

  • Basis

– (π‘œ + 1) points form am affine basis of π΅π‘œ

  • Iff none of these point can be expressed as an affine combination of

the other points

  • Any point in π΅π‘œ can then be uniquely represented as an affine

combination of the affine basis π‘ž0, … , π‘žπ‘œ ∈ π΅π‘œ

  • Any vector in another basis can be expressed as a linear

combination of the π‘žπ‘—, yielding a matrix for the basis

slide-8
SLIDE 8

Affine Coordinates

  • Closely related to β€œBarycentric Coordinates”

– Center of mass of (π‘œ + 1) points with arbitrary masses (weights) 𝑛𝑗 is given as

  • π‘ž =

π‘›π‘—π‘žπ‘— 𝑛𝑗 = 𝑛𝑗 𝑛𝑗 π‘žπ‘— = π›½π‘—π‘žπ‘—

  • Convex / Affine Hull

– If all 𝛽𝑗 are non-negative than p is in the convex hull

  • f the other points
  • In 1D

– Point is defined by the splitting ratio 𝛽1: 𝛽2

  • π‘ž = 𝛽1π‘ž1 + 𝛽2π‘ž2 =

π‘žβˆ’π‘ž2 π‘ž2βˆ’π‘ž1 π‘ž1 + π‘žβˆ’π‘ž1 π‘ž2βˆ’π‘ž1 π‘ž2

  • In 2D

– Weights are the relative areas in Ξ”(𝐡1, 𝐡2, 𝐡3)

  • 𝑒𝑗 = 𝛽𝑗 =

Ξ”(𝑄,𝐡 𝑗+1 %3,𝐡 𝑗+2 %3) Ξ”(𝐡1,𝐡2,𝐡3)

  • π‘ž = 𝛽1𝐡1 + 𝛽2𝐡2 + 𝛽3𝐡3

p p1 p2

𝐡1 𝐡2 𝐡3

Note: Length and area measures are signed here

slide-9
SLIDE 9

Affine Mappings

  • Properties

– Affine mapping (continuous, bijective, invertible)

  • T: A3 β†’ A3

– Defined by two non-degenerated simplicies

  • 2D: Triangle, 3D: Tetrahedron, ...

– Invariants under affine transformations:

  • Barycentric/affine coordinates
  • Straight lines, parallelism, splitting ratios, surface/volume ratios

– Characterization via fixed points and lines

  • Given as eigenvalues and eigenvectors of the mapping
  • Representation

– Matrix product and a translation vector:

  • π‘Όπ‘ž = π‘©π‘ž + 𝒖 with A ∈ β„π‘œΓ—π‘œ, t ∈ β„π‘œ

– Invariance of affine coordinates

  • π‘Όπ‘ž = 𝑼 π›½π‘—π‘žπ‘— = 𝑩 π›½π‘—π‘žπ‘— + 𝒖 = 𝛽𝑗(π‘©π‘žπ‘—) + 𝛽𝑗𝒖 = 𝛽𝑗(π‘Όπ‘žπ‘—)
slide-10
SLIDE 10

Homogeneous Coordinates for 3D

  • Homogeneous embedding of R3 into the projective 4D

space P(R4)

– Mapping into homogeneous space

  • ℝ3 βˆ‹

𝑦 𝑧 𝑨 ⟢ 𝑦 𝑧 𝑨 1 ∈ 𝑄 ℝ4

– Mapping back by dividing through fourth component

  • π‘Œ

𝑍 π‘Ž 𝑋 ⟢ π‘Œ/𝑋 𝑍/𝑋 π‘Ž/𝑋

  • Consequence

– This allows to represent affine transformations as 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 (later)

slide-11
SLIDE 11

Point Representation in 2D

  • Point in homogeneous coordinates

– All points along a line through the origin map to the same point in 2D

(x,y) π‘ž = (π‘Œ, 𝑍, 𝑋) W=1 𝑦 = π‘Œ 𝑋 𝑧 = 𝑍 𝑋

slide-12
SLIDE 12

Homogeneous Coordinates in 2D

  • Some tricks (work only in P(R3), i.e. only in 2D)

– Point representation

  • π‘Œ =

π‘Œ 𝑍 𝑋 ∈ 𝑄 ℝ3 , 𝑦 𝑧 = π‘Œ 𝑋 𝑍 𝑋

– Representation of a line π‘š ∈ ℝ2

  • Dot product of l vector with point in plane must be zero:

– π‘š = 𝑦 𝑧 𝑏𝑦 + 𝑐𝑧 + 𝑑 β‹… 1 = 0 = π‘Œ ∈ 𝑄(ℝ3) π‘Œ β‹… π‘š = 0, l= 𝑏 𝑐 𝑑

  • Line l is normal vector of the plane through origin and points on line

– Line trough 2 points p and p’

  • Line must be orthogonal to both points
  • π‘ž ∈ π‘š ∧ π‘žβ€² ∈ π‘š ⇔ π‘š = π‘ž Γ— π‘žβ€²

– Intersection of lines l and l’:

  • Point on both lines  point must be orthogonal to both line vectors
  • π‘Œ ∈ π‘š ∩ π‘šβ€² ⇔ π‘Œ = π‘š Γ— π‘šβ€²
slide-13
SLIDE 13

Line Representation

  • Definition of a 2D Line in P(R3)

– Set of all point P where the dot product with l is zero π‘š = (𝑏, 𝑐, 𝑑) π‘ž = (π‘Œ, 𝑍, 𝑋)

π‘ž β‹… π‘š = 0

slide-14
SLIDE 14

Line Representation

  • Line

– Represented by normal vector to plane through line and origin π‘š = (𝑏, 𝑐, 𝑑)

𝑏𝑦 + 𝑐𝑧 + 𝑑 β‹… 1 = 0

slide-15
SLIDE 15

Line through 2 Points

  • Construct line through two points

– Line vector must be orthogonal to both points – Compute through cross product of point coordinates π‘š = (𝑏, 𝑐, 𝑑) π‘ž = (π‘Œ, 𝑍, 𝑋) π‘žβ€² = (π‘Œ, β€² 𝑍, β€² 𝑋′)

π‘š = π‘ž Γ— π‘žβ€²

slide-16
SLIDE 16

Intersection of Lines

  • Construct intersection of two lines

– A point that is on both lines and thus orthogonal to both lines

  • Computed by cross product of both line vectors

π‘š π‘šβ€² π‘ž

π‘ž = π‘š Γ— π‘šβ€²

slide-17
SLIDE 17

Orthonormal Matrices

  • Columns are orthogonal vectors of unit length

– An example

  • 1

1 1

– Directly derived from the definition of the matrix product:

  • π‘π‘ˆπ‘ = 1

– In this case the transpose must be identical to the inverse:

  • π‘βˆ’1 ≔ π‘π‘ˆ
slide-18
SLIDE 18

Linear Transformation: Matrix

  • Transformations in a Vector space: Multiplication by

a Matrix

– Action of a linear transformation on a vector

  • Multiplication of matrix with column vectors (e.g. in 3D)

π‘žβ€² = π‘Œβ€² 𝑍′ π‘Žβ€² = π‘Όπ‘ž = π‘ˆ

𝑦𝑦

π‘ˆ

𝑦𝑧

π‘ˆ

𝑦𝑨

π‘ˆ

𝑧𝑦

π‘ˆ

𝑧𝑧

π‘ˆ

𝑧𝑨

π‘ˆ

𝑨𝑦

π‘ˆ

𝑨𝑧

π‘ˆ

𝑨𝑨

π‘Œ 𝑍 π‘Ž

  • Composition of transformations

– Simple matrix multiplication (π‘ΌπŸ, then π‘ΌπŸ‘)

  • π‘ΌπŸ‘π‘ΌπŸπ‘ž = π‘ΌπŸ‘ π‘ΌπŸπ‘ž = π‘ΌπŸ‘π‘ΌπŸ π‘ž = π‘Όπ‘ž

– Note: matrix multiplication is associative but not commutative!

  • π‘ΌπŸ‘π‘ΌπŸ is not the same as π‘ΌπŸπ‘ΌπŸ‘ (in general)
slide-19
SLIDE 19

Affine Transformation

  • Remember:

– Affine map: Linear mapping and a translation

  • π‘Όπ‘ž = π‘©π‘ž + 𝒖
  • For 3D: Combining it into one matrix

– Using homogeneous 4D coordinates – Multiplication by 4x4 matrix in P(R4) space

  • π‘žβ€² =

π‘Œβ€² 𝑍′ π‘Žβ€² 𝑋′ = π‘ˆπ‘ž = π‘ˆ

𝑦𝑦

π‘ˆ

𝑦𝑧

π‘ˆ

𝑦𝑨

π‘ˆ

𝑦π‘₯

π‘ˆ

𝑧𝑦

π‘ˆ

𝑧𝑧

π‘ˆ

𝑧𝑨

π‘ˆ

𝑧π‘₯

π‘ˆ

𝑨𝑦

π‘ˆ

𝑨𝑧

π‘ˆ

𝑨𝑨

π‘ˆ

𝑨π‘₯

π‘ˆ

π‘₯𝑦

π‘ˆ

π‘₯𝑧

π‘ˆ

π‘₯𝑨

π‘ˆ

π‘₯π‘₯

π‘Œ 𝑍 π‘Ž 𝑋

– Allows for combining (concatenating) multiple transforms into one using normal (4x4) matrix products

  • Let’s go through the different transforms we need:
slide-20
SLIDE 20

Transformations: Translation

  • Translation (T)

– 𝑼 𝑒𝑦, 𝑒𝑧, 𝑒𝑨 π‘ž = 1 𝑒𝑦 1 𝑒𝑧 1 𝑒𝑨 1 𝑦 𝑧 𝑨 1 = 𝑦 + 𝑒𝑦 𝑧 + 𝑒𝑧 𝑨 + 𝑒𝑨 1

T(2,1)B B x y

slide-21
SLIDE 21

Translation of Vectors

  • So far: only translated points
  • Vectors: Difference between 2 points

– 𝑀 = π‘ž βˆ’ π‘Ÿ = π‘žπ‘¦ π‘žπ‘§ π‘žπ‘¨ 1 βˆ’ π‘Ÿπ‘¦ π‘Ÿπ‘§ π‘Ÿπ‘¨ 1 = π‘žπ‘¦ βˆ’ π‘Ÿπ‘¦ π‘žπ‘§ βˆ’ π‘Ÿπ‘§ π‘žπ‘¨ βˆ’ π‘Ÿπ‘¨ – Fourth component is zero

  • Consequently: Translations do not affect vectors!
  • 𝑼 𝑒𝑦, 𝑒𝑧, 𝑒𝑨 𝑀 =

1 𝑒𝑦 1 𝑒𝑧 1 𝑒𝑨 1 𝑀𝑦 𝑀𝑧 𝑀𝑨 = 𝑀𝑦 𝑀𝑧 𝑀𝑨

slide-22
SLIDE 22

Translation: Properties

  • Properties

– Identity

  • 𝑼 0,0,0 = 𝟐 (Identity Matrix)

– Commutative (special case)

  • 𝑼 𝑒𝑦, 𝑒𝑧, 𝑒𝑨 𝑼 𝑒𝑦

β€² , 𝑒𝑧 β€² , 𝑒𝑨 β€²

= 𝑼 𝑒𝑦

β€² , 𝑒𝑧 β€² , 𝑒𝑨 β€² 𝑼 𝑒𝑦, 𝑒𝑧, 𝑒𝑨 =

𝑼(𝑒𝑦 + 𝑒𝑦

β€² , 𝑒𝑧 + 𝑒𝑧 β€² , 𝑒𝑨 + 𝑒𝑨 β€²)

– Inverse

  • π‘Όβˆ’πŸ 𝑒𝑦, 𝑒𝑧, 𝑒𝑨 = 𝑼 βˆ’π‘’π‘¦

β€² , βˆ’π‘’π‘§ β€² , βˆ’π‘’π‘¨ β€²

slide-23
SLIDE 23

Basic Transformations (2)

  • Scaling (S)

– 𝐓 𝑑𝑦, 𝑑𝑧, 𝑑𝑨 = 𝑑𝑦 𝑑𝑧 𝑑𝑨 1 – Note: 𝑑𝑦, 𝑑𝑧, 𝑑𝑨 β‰₯ 0 (otherwise see mirror transformation) – Uniform Scaling s: s = 𝑑𝑦 = 𝑦𝑧 = 𝑑𝑨

B x y S(2,1)B x y

slide-24
SLIDE 24

Basic Transformations

  • Reflection/Mirror Transformation (M)

– Reflection at plane (x=0)

  • π‘΅π’š =

βˆ’1 1 1 1 𝑦 𝑧 𝑨 1 = βˆ’π‘¦ 𝑧 𝑨 1

  • Analogously for other axis
  • Note: changes orientation

– Right-handed rotation becomes left-handed and v.v. – Indicated by det 𝑁𝑗 < 0

– Reflection at origin

  • 𝑡𝒑 =

βˆ’1 βˆ’1 βˆ’1 1 𝑦 𝑧 𝑨 1 = βˆ’π‘¦ βˆ’π‘§ βˆ’π‘¨ 1

  • Note: changes orientation in 3D

– But not in 2D (!!!): Just two scale factors – Each scale factor reverses orientation once

B x y Mx B B x y Mo B

a a b b c c a b c a b c

slide-25
SLIDE 25

Basic Transformations (4)

  • Shear (H)

– 𝑰 β„Žπ‘¦π‘§, β„Žπ‘¦π‘¨, β„Žπ‘§π‘¨, β„Žπ‘§π‘¦, β„Žπ‘¨π‘¦, β„Žπ‘¨π‘§ = 1 β„Žπ‘¦π‘§ β„Žπ‘¦π‘¨ β„Žπ‘§π‘¦ 1 β„Žπ‘§π‘¨ β„Žπ‘¨π‘¦ β„Žπ‘¨π‘§ 1 1 𝑦 𝑧 𝑨 1 = 𝑦 + β„Žπ‘¦π‘§π‘§ + β„Žπ‘¦π‘¨π‘¨ 𝑧 + β„Žπ‘§π‘¦π‘¦ + β„Žπ‘§π‘¨π‘¨ 𝑨 + β„Žπ‘¨π‘¦π‘¦ + β„Žπ‘¨π‘§π‘§ 1 – Determinant is 1

  • Volume preserving (as volume is just shifted in some direction)

B x y H(1,0,0,0,0,0)B x y

slide-26
SLIDE 26

Rotation in 2D

  • In 2D: Rotation around origin

– Representation in spherical coordinates

  • 𝑦 = 𝑠 cos πœ„ ⟢ 𝑦′ = 𝑠 cos(πœ„ + 𝜚)

𝑧 = 𝑠 sin πœ„ ⟢ 𝑧′ = 𝑠 sin(πœ„ + 𝜚)

– Well know property

  • cos πœ„ + 𝜚 = cos πœ„ cos 𝜚 βˆ’ sin πœ„ sin 𝜚

sin πœ„ + 𝜚 = cos πœ„ sin 𝜚 + sin πœ„ cos 𝜚

– Gives

  • 𝑦′ = 𝑠 cos πœ„ cos 𝜚 βˆ’ 𝑠 sin πœ„ sin 𝜚 = 𝑦 cos 𝜚 βˆ’ 𝑧 sin 𝜚

𝑧′ = 𝑠 cos πœ„ sin 𝜚 + 𝑠 sin πœ„ cos 𝜚 = 𝑦 sin 𝜚 + 𝑧 cos 𝜚

– Or in matrix form

  • 𝑆𝑨 𝜚 = cos 𝜚

βˆ’sin 𝜚 sin 𝜚 cos 𝜚 R(90Β°)B B x y x y Ι΅ ΙΈ x’ y’

slide-27
SLIDE 27

Rotation in 3D

  • Rotation around major axes

– π‘Ίπ’š 𝜚 = 1 cos 𝜚 βˆ’sin 𝜚 sin 𝜚 cos 𝜚 1 – 𝑺𝒛 𝜚 = cos 𝜚 sin 𝜚 1 βˆ’ sin 𝜚 cos 𝜚 1 – π‘Ίπ’œ 𝜚 = cos 𝜚 βˆ’sin 𝜚 sin 𝜚 cos 𝜚 1 1 – 2D rotation around the respective axis

  • Assumes right-handed system, mathematically positive direction

– Be aware of change in sign on sines in 𝑺𝒛

  • Due to relative orientation of other axis
slide-28
SLIDE 28

Rotation in 3D (2)

  • Properties

– 𝑺𝒃 0 = 𝟐 – 𝑺𝒃 πœ„ 𝑺𝒃 𝜚 = 𝑺𝒃 πœ„ + 𝜚 = 𝑺𝒃 𝜚 𝑺𝒃 πœ„

  • Rotations around the same axis are commutative (special case)

– In general: Not commutative

  • 𝑺𝒃 πœ„ 𝑺𝒄 𝜚 β‰  𝑺𝒄 𝜚 𝑺𝒃 πœ„
  • Order does matter for rotations around different axes

– 𝑺𝒃

βˆ’πŸ πœ„ = 𝑺𝒃 βˆ’πœ„ = 𝑺𝒃 𝑼 πœ„

  • Orthonormal matrix: Inverse is equal to the transpose

– Determinant is 1

  • Volume preserving
slide-29
SLIDE 29

Rotation Around Point

  • Rotate object around a point p and axis a

– Translate p to origin, rotate around axis a, translate back to p

  • 𝑺𝒃 π‘ž, πœ„ = 𝑼 π‘ž 𝑺𝒃 𝜚 𝑼 βˆ’π‘ž

B x y p B’= T(-p)B x y p B’’= Rz(ΙΈ)B’x y p T(p)B’’ x y p

slide-30
SLIDE 30

Rotation Around Some Axis

  • Rotate around a given point p and vector r (|r|=1)

– Translate so that p is in the origin – Transform with rotation R=MT

  • M given by orthonormal basis (r,s,t) such that r becomes the x axis
  • Requires construction of a orthonormal basis (r,s,t), see next slide

– Rotate around x axis – Transform back with R-1 – Translate back to point p

x y z r t s x y z r t s x y z r t MT M 𝑆 π‘ž, 𝑠, 𝜚 = π‘ˆ(π‘ž)𝑁(𝑠)𝑆𝑦 𝜚 π‘π‘ˆ(𝑠)T(βˆ’p) s

Figure without translation aspect

slide-31
SLIDE 31

Rotation Around Some Axis

  • Compute orthonormal basis given a vector r

– Using a numerically stable method – Construct s such that it is normal to r (verify with dot product)

  • Use fact that in 2D, orthogonal vector to (x,y) is (-y, x)

– Do this in coordinate plane that has largest components

  • 𝑑’ =

0, βˆ’π‘ 

𝑨, 𝑠 𝑧 , if 𝑦 = argmin𝑦,𝑧,𝑨 𝑠 𝑦 , 𝑠 𝑧 , 𝑠 𝑨

βˆ’π‘ 

𝑨, 0, 𝑠 𝑦 , if 𝑧 = argmin𝑦,𝑧,𝑨 𝑠 𝑦 , 𝑠 𝑧 , 𝑠 𝑨

βˆ’π‘ 

𝑧, 𝑠 𝑦, 0 , if 𝑨 = argmin𝑦,𝑧,𝑨 𝑠 𝑦 , 𝑠 𝑧 , 𝑠 𝑨

– Normalize

  • 𝑑 =

𝑑′ 𝑑′

– Compute t as cross product

  • 𝑒 = 𝑠 Γ— 𝑑

– r,s,t forms orthonormal basis, thus M transforms into this basis

  • 𝑁(𝑠) =

𝑠

𝑦

𝑑𝑦 𝑒𝑦 𝑠

𝑧

𝑑𝑧 𝑒𝑧 𝑠

𝑨

𝑑𝑨 𝑒𝑨 1 , inverse is given as its transpose: π‘βˆ’1 = π‘π‘ˆ

slide-32
SLIDE 32

Concatenation of Transforms

  • Multiply matrices to concatenate

– Matrix-matrix multiplication is not commutative (in general) – Order of transformations matters!

B x y T(1,1)B x y Rz(45Β°)B x y Rz(45Β°) T(1,1)B x y T(1,1)Rz(45Β°)B x y

slide-33
SLIDE 33

Transformations

  • Line

– Transform end points

  • Plane

– Transform three points

  • Vector

– Translations to not act on vectors

  • Normal vectors (e.g. plane in Hesse form)

– Problem: e.g. with non-uniform scaling

B x y n S(2,1,1)B x y S(2,1,1)n S(2,1,1)

slide-34
SLIDE 34

Transforming Normals

  • Dot product as matrix multiplication

– π‘œ β‹… 𝑀 = π‘œπ‘ˆπ‘€ = π‘œπ‘¦ π‘œπ‘§ π‘œπ‘¨ 𝑀𝑦 𝑀𝑧 𝑀𝑨

  • Normal N on a plane

– For any vector 𝑀 in the plane: π‘œπ‘ˆπ‘€ = 0 – Find transformation 𝑡’ for normal vector, such that :

  • π‘΅β€²π‘œ π‘ˆ 𝑡𝑀 = 0

π‘œπ‘ˆ π‘΅β€²π‘ˆπ‘΅ 𝑀 = 0 π‘΅β€²π‘ˆπ‘΅ = 1 and thus π‘΅β€²π‘ˆπ‘΅π‘΅βˆ’1 = 1π‘΅βˆ’1 π‘΅β€²π‘ˆ = π‘΅βˆ’1 𝑡′ = (π‘΅βˆ’1)π‘ˆ

– 𝑡’ is the adjoint of 𝑡

  • Exists even for non-invertible matrices
  • For 𝑡 invertible and orthogonal 𝑁′ = π‘βˆ’1 π‘ˆ = π‘π‘ˆ π‘ˆ = 𝑁
  • Remember:

– Normals are transformed by the transpose of the inverse of the 4x4 transformation matrix of points and vectors