Download presentation
Presentation is loading. Please wait.
Published byMegan McKenzie Modified over 9 years ago
1
CS 551/651 Advanced Graphics Technical Background
2
FLTK Hopefully you downloaded and compiled successfully –Questions Assignment 1 – Warmup –Interactive B-Spline Editor –Due two weeks from today
3
Topics you should know Object, world, camera coord spaces Lookat point, up vector, angle of view, near/far clipping planes, view frustum Homogeneous coords Transformation matrices Rendering pipeline
4
Affine Transformations A transformation that preserves –Angles –Lengths –Parallel lines Ex –Translation –Rotation –Scaling –Reflection –Shear
5
Round-off Errors Consider rotating a polygonal model about y-axis x z Moon = Rot y (5) Moon Moon = Rot y (5) Rot y (5) Moon Moon = Rot y (n) Moon
6
Orthonormalization All rows of transformation matrix must: –Have unit length –Be orthogonal to one another Row 1 dot Row 2 = 0 –One technique to orthonormalize Normalize row 1 (excluding last column) Row 1 x Row 2 = Row 3 (normalize) Row 3 x Row 1 = Row 2 (normalize) –Errors were shifted in matrix
7
Rotations Give me four rotation representations 3x3 matrix Euler Angles Axis-angle Quaternion - Interpolation - Gimbal Lock - Compiling Rot Seqs and their shortcomings…
8
Representing 3 Rotational DOFs 3x3 Matrix (9 DOFs) –Rows of matrix define orthogonal axes Euler Angles (3 DOFs) –Rot x + Rot y + Rot z Axis-angle (4 DOFs) –Axis of rotation + Rotation amount Quaternion (4 DOFs) –4 dimensional complex numbers
9
Rotation Matrix 9 DOFs must reduce to 3 Rows must be unit length (-3 DOFs) Rows must be orthogonal (-3 DOFs) Drifting matrices is very bad –Numerical errors results when trying to gradually rotate matrix by adding derivatives –Resulting matrix may scale / shear –Gram-Schmidt algorithm will re-orthogonalize your matrix Difficult to interpolate between matrices
10
Euler Angles ( x, y, z ) = R z R y R x –Rotate x degrees about x-axis –Rotate y degrees about y-axis –Rotate z degrees about z-axis Axis order is not defined –(y, z, x), (x, z, y), (z, y, x)… are all legal –Pick one
11
Euler Angles Rotations not uniquely defined –ex: (z, x, y) = (90, 45, 45) = (45, 0, -45) takes positive x-axis to (1, 1, 1) –cartesian coordinates are independent of one another, but Euler angles are not Gimbal Lock –Term derived from mechanical problem that arises in gimbal mechanism that supports a compass or a gyro
12
Gimbal Lock
13
Occurs when two axes are aligned Second and third rotations have effect of transforming earlier rotations –ex: Rot x, Rot y, Rot z If Rot y = 90 degrees, Rot z == -Rot x
14
Interpolation Interpolation between two Euler angles is not unique ex: (x, y, z) rotation –(0, 0, 0) to (180, 0, 0) vs. (0, 0, 0) to (0, 180, 180) –Interpolation about different axes are not independent
15
Interpolation
16
Chapter 3 Interpolation First let’s talk about functions –Read Appendix B.4 –Explicit equation: y = f(x) Dependent on choice of coordinate axes Not defined if more than one f(x) for x, sqrt(9) –Implicit equation: f(x, y) = 0 Quick to see if (x,y) is on curve Difficult to generate series of f(x) for x:0 10 –Parametric: x = f(t), y = f(t)
17
Equations Polynomial: only containing variables raised to a power Linear, quadratic, cubic: polynomial equation with highest power of 1, 2, 3 Transcendental: equations containing trig functions, logs, exponentials
18
Continuity Zeroth-order (C 0 ): the value of the function f(x 0 ) is arbitrarily close to the value of f(x 0 + ) First-order (C 1 ): first derivative is continous Second-order (C 2 ): second derivative is continuous
19
Piecewise Curve Segments One curve constructed by connecting many smaller segments end-to-end Piecewise linear: a sequence of straight line segments Continuity describes the joint
20
Specifying Curves Control Points –A set of points that influence the curve’s shape Knots –Control points that lie on the curve Interpolating Splines –Curves that pass through the control points (knots) Approximating Splines –Control points merely influence shape
21
Linear Interpolation or For generic blending functions: Matrix forms: P0 P(u) P1
22
Interpolation Functions Hermite Bezier B-spline –Global vs. local control
23
Animating with Interpolation Most variables are controlled with parametric equations –x-position, y-position, z-position –x-, y-, z- rotation axis, rotation angle –Size, color, texture… Most parametric equations are constructed from key frames
24
Motion Along a Curve Equal increments in interpolation parameter result in unequal jumps in function space t f(t) tt tt
25
Arc Length Arc length is the distance along the curve To ensure constant speed of curve evaluation, perform arc length parameterization of curve –Compute a mapping offline of arc length values to parameter values –Analytically compute arc length
26
Arc Length Given parameters u 1 and u 2, find LENGTH(u 1, u 2 ) Given an arc with length s and a parameter u 1, find u 2 s.t. LENGTH (u 1, u 2 ) is s Can we compute s = G(u) = distance from start of curve to point at u? If so, G -1 is used to build arc length parameterized curve: P(G -1 (s))
27
Analytic Computation Cubic curve example:
28
Forward Differencing Sample curve a many parameter values Create piecewise linear representation of curve from parameter evaluations Compute linear distance between samples Store distances in table Limitations/Shortcomings?
29
Adaptive Approach Adaptively subdivide First step, compare: –length (start, middle) + length (middle, end) –length (start, end) If error is too large, subdivide Use link list to store data
30
Numerical Computation Numerical methods exist to approximate integral of curve given sample points/derivatives Instead of using sum of linear segments, use numerical method to compute sum of curved segments
31
Gaussian Quadrature Computes the arc length of a cubic curve Adaptive gaussian integration monitors errors to subsample Build a table that maps parameter values to arc length values To solve arc length at u, find u i and u i+1 that bound u Use gaussian quadrature to compute intermediate arc length between that at u i and u i+1
32
Gaussian Quadrature Compute u s.t. length (u 1, u) = s Solve: s – length(u 1, u) = 0 Newton-Raphson does this for us: f = s – length(u 1, p n-1 ) f’= dp/du evaluated at p n-1
33
Newton-Raphson Be aware that Newton-Raphson could set p n to a value not defined by curve f’(p n-1 ) could be 0 (divide by 0)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.