1 / 25

CS 551/651 Advanced Graphics

CS 551/651 Advanced Graphics. Arc Length. Assignment 1. Due Week from Thursday Building a Cubic B ézier curve OpenGL/Glut Insert up to 100 points Render Bézier curve using recursive subdivision Left mouse button to add, middle to move, and right to remove FLTK is extra credit.

silas
Download Presentation

CS 551/651 Advanced Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 551/651Advanced Graphics Arc Length

  2. Assignment 1 • Due Week from Thursday • Building a Cubic Bézier curve • OpenGL/Glut • Insert up to 100 points • Render Bézier curve using recursive subdivision • Left mouse button to add, middle to move, and right to remove • FLTK is extra credit

  3. Papers for Next TuesdayPresenters Needed • Tour Into the Picture • William T. Reeves, Particle systems - a technique for modelling a class of fuzzy objects. In SIGGRAPH '83, Computer graphics 17, 3, July 1983. • " Animation of plant development," Przemyslaw Prusinkiewicz, Mark S.Hammel, and Eric Mjolsness. Siggraph 1993.

  4. 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

  5. Arc Length • Given parameters u1 and u2, find LENGTH(u1, u2) • Given an arc with length s and a parameter u1, find u2 s.t. LENGTH(u1, u2) 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))

  6. Analytic Computation Cubic curve example:

  7. 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?

  8. 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

  9. 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

  10. Gaussian Quadrature • Commonly used to integrate function between –1 and +1 • Function to be integrated is evaluated at fixed points within [-1, 1] and multiplied by a precalculated weight • More sample points leadsto better accuracy

  11. Adaptive Gaussian Integration • Gaussian quadrature uses sampling to preseve accuracy • How many samples are necessary for given curve? • Adaptive gaussian integration monitors errors to subsample when necessary • Start trying few samples and add more as necessary • Recursive like spline subdivision

  12. Adaptive Gaussian Integration • Build a table that maps parameter values to arc length values • To solve arc length at u, find ui and ui+1that bound u • Use gaussian quadrature to compute intermediate arc length between that at uiand ui+1

  13. Finding u given s • Must compute u s.t. length (u1, u) = s • Solve: s – length(u1, u) = 0 • Find the zeros (roots) of the function • Newton-Raphson does this for us: • f = s – length(u1, pn-1) f’= dp/du evaluated at pn-1

  14. Newton-Raphson • Be aware that Newton-Raphson could set pn to a value not defined by curve • f’(pn-1) could be 0 (cannot divide by 0)

  15. s(t) t Speed Control • Given arc-length parameterized curve • Let s(t) define amount the curve has traveled given t • For simplicity, normalize total distance to 1 • Monotonic (can’t go backwards) and continuous • To ease in/out, make s(t) = ease (t) that looks like:

  16. Speed Control • Easing in/out: • -pi/2 shifts curve rightward • +1 shifts curve upward • Divide by 2 scales from 0 to 1

  17. vel(t) v0 t t1 t2 Speed Control • Transcendental functions are expensive • Table lookups are one possibility\ • Roll your own • User specifies acceleration period, deceleration period, and max velocity

  18. v0 t t1 t2 Speed Control • Distance traveled is area under curve • User selects two of three unknowns and distance traveled constraint determines third • Integrate velocity function to find s(t)

  19. SLERPing • Quaternions are points on the unit sphere in four dimensions • Unit sphere in three dimensions plus a fourth dimension representing the rotation about the normal at a point on the sphere • Interpolating quats • Linearly interpolate each of four components • Doesn’t quite work right

  20. SLERPing • Linear interpolation doesn’t produce constant velocity interpolation of quats • Instead, interpolate along the arc on sphere between two quats

  21. SLERPing • Which way do we go? • Long way or short way around sphere • q = [s,v] = [-s,-v] = -q • Compute angle between q1 and q2 • Four dimensional dot product • cos(Q)= q1qq2 = s1*s2 + v1q v2 • If positive, this is shortest, • Else, interpolate between q1 and -q2

  22. SLERPing • SLERP: • Unit quaternion is not guaranteed • What about continuity of interpolation?

  23. Continuity of SLERP • Interpolate between points • [p0, …, pn-1, pn, pn+1, …] • Bezier interpolation would compute intermediate points for each pn • To define tangent at pn • Define bn to be point before pn • Define an to be point after pn

  24. Continuity of SLERP • an = (pn – pn+1 + pn * ½) + (½ * pn+1) • pn + pn – an = bn pn pn+ pn – pn+1 an pn-1 pn+1

  25. an bn+1 qn+1 qn Continuity of SLERP • To compute midway (average) points between quats, SLERP halfway • Instead of adding vectors, concatenate rotations P1 = slerp(qn, qn, 1/3) P2 = slerp(an, bn+1, 1/3) P3 = slerp (bn+1, qn+1, 1/3) P12 = slerp (p1, p2, 1/3) P23 = slerp (p2, p3, 1/3) P = slerp (p12, p23, 1/3)

More Related