Paths, Smoothing, Least Squares Fit CS 551/651 Spring 2002.

Slides:



Advertisements
Similar presentations
Arc-length computation and arc-length parameterization
Advertisements

Parametric Curves Ref: 1, 2.
© University of Wisconsin, CS559 Spring 2004
Parametric Equations Local Coordinate Systems Curvature Splines
Discrete Differential Geometry Planar Curves 2D/3D Shape Manipulation, 3D Printing March 13, 2013 Slides from Olga Sorkine, Eitan Grinspun.
Morphing & Warping 2D Morphing Involves 2 steps 1.Image warping “get features to line up” 2.Cross-dissolve “mix colors” (fade-in/fadeout transition)
Geometric Modeling Notes on Curve and Surface Continuity Parts of Mortenson, Farin, Angel, Hill and others.
Links and Joints.
UBI 516 Advanced Computer Graphics
Extended Gaussian Images
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Computational Geometry & Collision detection
Basic geostatistics Austin Troy.
Sasha Vasserman.  Two triangles are similar if two pairs of corresponding angles are congruent.
Trajectory Generation
Computer Animation Algorithms and Techniques
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions.
Graphs Chapter 1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA A A AAA A.
Surfaces Chiew-Lan Tai. Surfaces 2 Reading Required Hills Section Hearn & Baker, sections 8.11, 8.13 Recommended Sections 2.1.4, , 3D Computer.
Offset of curves. Alina Shaikhet (CS, Technion)
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Curves Locus of a point moving with one degree of freedom
Lines and Planes in Space
CSE554SimplificationSlide 1 CSE 554 Lecture 7: Simplification Fall 2014.
Chapter 7: Vectors and the Geometry of Space
כמה מהתעשייה? מבנה הקורס השתנה Computer vision.
3-D Modeling Concepts V part 2.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
1 Preliminaries Precalculus Review I Precalculus Review II
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
October 14, 2014Computer Vision Lecture 11: Image Segmentation I 1Contours How should we represent contours? A good contour representation should meet.
Curves.
Slide 5- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Interpolating Values.
Vectors and the Geometry of Space 9. Three-Dimensional Coordinate Systems 9.1.
CSE554SimplificationSlide 1 CSE 554 Lecture 7: Simplification Fall 2013.
Vectors and the Geometry of Space 2015
CSE554Fairing and simplificationSlide 1 CSE 554 Lecture 6: Fairing and Simplification Fall 2012.
Parametric Surfaces Define points on the surface in terms of two parameters Simplest case: bilinear interpolation s t s x(s,t)x(s,t) P 0,0 P 1,0 P 1,1.
CS 551 / 645: Introductory Computer Graphics Mathematical Foundations.
Lecture 16 - Approximation Methods CVEN 302 July 15, 2002.
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.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Course 8 Contours. Def: edge list ---- ordered set of edge point or fragments. Def: contour ---- an edge list or expression that is used to represent.
04/18/02(c) 2002 University of Wisconsin Last Time Hermite Curves Bezier Curves.
Review CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
CS 551/651 Advanced Graphics Technical Background.
11/26/02(C) University of Wisconsin Last Time BSplines.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
VECTORS AND THE GEOMETRY OF SPACE 10. VECTORS AND THE GEOMETRY OF SPACE In this chapter, we introduce vectors and coordinate systems for three-dimensional.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Basic Theory (for curve 01). 1.1 Points and Vectors  Real life methods for constructing curves and surfaces often start with points and vectors, which.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Section 7.1 The Rectangular Coordinate System and Linear Equations in Two Variables Math in Our World.
Copyright © 2011 Pearson Education, Inc. Conic Sections CHAPTER 13.1Parabolas and Circles 13.2Ellipses and Hyperbolas 13.3Nonlinear Systems of Equations.
Introduction to Parametric Curve and Surface Modeling.
Calibrating a single camera
Calculus III Exam Review
Fitting Curve Models to Edges
4.2 Polynomial Functions and Models
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Vectors and the Geometry of Space
Camera Calibration class 9
Introduction to Parametric Curve and Surface Modeling
Calibration and homographies
In this chapter, you will learn the following:
Presentation transcript:

Paths, Smoothing, Least Squares Fit CS 551/651 Spring 2002

Following a Path How do we compute an object’s first- person view as it follows a path? –Situate a local coordinate system about the object and orient the system Positive z-axis points frontward –Frontward is first derivative, P’(s) Positive y-axis points upward –Upward is cross product of z-axis and P’’(s) Positive x-axis points left –Cross product of z- and y-axes

Newton-Raphson No guarantees that it will find the roots of an equation Or that it will be efficient Caught Here

Cross Product Right Hand Rule See: Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A Twist your hand about the A-axis such that B extends perpendicularly from your palm As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

Frenet Frame The local coordinate system If curve has no curvature, technique fails –Use Frenet Frame from before straight section starts (and interpolate rotation about z-axis if necessary) Use dot product of y-axis before and after straight section to determine interpolation amount

Frenet Frame Discontinuity in the curvature causes jump in local coordinate system Can be jumpy if curve is not very smooth Doesn’t reflect desirable camera effects like banking into a corner A curve that moves downward in 3-space will cause Frenet frame to orient upside-down

Alternative Orientation Methods Define a natural notion of ‘UP’, y-axis –The opposite direction of gravity Define a focal point, z-axis –z-axis = focal_point – cur_pos –x-axis = z-axis x UP –y-axis = z-axis x x-axis Passing close to focal point causes extreme changes How do you automatically update focal point?

Lookahead If cur_pos = p(s), the focal point = p(s+  s) –Note, should be arc length parameterization to prevent wandering camera What about the end of curve (where s+  s is undefined)? –Extrapolate curve in the direction of its tangent

Smoothing Data Frequently we use a series of points to represent paths We turn points into piecewise Bezier curve But may be overkill Alternatives

Smoothing Data Average a point with its neighbors –But this causes flattening of curves Fit cubic curve to subsets of points –Curve is inherently smooth –Sample curve at midpoint for new point

Cubic Curves P(u) = au 3 + bu 2 + cu + d For a point, P i, build curve from its four neighbors –P i-2, P i-1, P i+1, P i+2 –Evaluate the cubic at its midpoint (u = ½) –Average cubic midpoint and P i

Evaluating the Cubic P i-2 = P(0) = d P i-1 = P(1/4) = a 1/64 + b 1/16 + c1/4 + d P i+1 = P(3/4) = a 27/64 + b 9/16 + c¾ + d P i+2 = P(1) = a + b + c + d 4 equations and 4 unknowns… solve

Evaluating Cubic What about endpoints? P i+1 and P i+2 don’t exist –P’ 0 = P (P 1 – P 2 ) Second in from beginning or end? –Build a quadratic (parabola) –P(u) = au 2 + bu + c –Solve for a, b, and c using P 0, P 2, P 3 –P 1 is averaged with P(1/3)

Overconstrained Cubics Earlier, we solved for cubic coefficients using Gaussian Elimination / Linear Programming We solved for x such that Ax = b A was square and invertable

Overconstrained Cubics What if we had 10 points and we wished to fit a line, quadratic, or cubic to them? Ax = b Matrix dimensions: –[10 x 4] * [4 x 1] = [10 x 1] –Cannot trivially invert A

Least Squares Fit Select a cubic curve (the x-vector in our example) that minimizes the standard deviation of the distances between the points and the cubic curve:

Least Squares Fit E is the error function: f(u) is a function of (a, b, c, d) and u –It is the parametric cubic curve We want to minimize E Wherever E is minimized:

Least Squares Fit Compute the partial derivative of E w.r.t. a, b, c, and d Set each partial derivative equal to 0 We now have four equations and four unknowns Solve… This method is slow and there are better least squares solution methods

Linear Least Squares We just talked about linear least squares –The cubic equation is nonlinear because x is raised to powers greater than 1 ax 3 + bx 2 + cx + d –But fitting a cubic to a set of data is linear curve fitting Parameters (a, b, c, d) enter into the formula as simple multipliers of terms that are added together

An example Fit a line to data: –The vertical deviation of the i th piece of data (x i, y i ) is: d i = y i – y = y i – (mx i + b) Where m and b are the unknown parameters –By minimizing square of deviations d 2 i = (y i – y) 2 = (y i – (mx i + b)) 2

An example Minimize sum of d i and set partials to 0 m= b=

Computer Tools Write your own function Mathematica –Fit [data, {1, x}, x] Excel –Linest (y-array, x-array, count, statistics) See for more info

Robustness of Least Squares Effective, complete, and appropriate for many problems in science/engineering Estimates of unknowns are optimal Efficient use of data Not good for extrapolation past endpoints Sensitive to presence of outliers –Model validation is useful

Convolution Kernels Another smoothing technique Imagine data define stepwise function Create the kernel –Centered around zero –Symmetric –Has finite support –Area under curve equals 1 Box Gaussian Tent

Convolution Kernels Compute new (averaged) points by convolving kernel with data Slide kernel over all points Watch for overlap at beginning and end New value for P1 is:

Determining a Path on Surface Consider a polygonal terrain map Assume you have the (x,y,z) coordinates of two endpoints What are the values of intermediate points on the line?

Path Determination Construct a plane that passes through the two points and is (roughly) perpendicular to the ground plane –How do we compute the perpendicular? –How doe we compute the plane? Intersect plane with the terrain polys –How?

Path Determination If the terrain is modeled as a parametric surface: f(u, v) = z Linearly interpolate between (u 1, v 1 ) and (u 2, v 2 ) and solve for f(u interp, v interp )

Path Determination What if ground is constructed from many triangles and we wish to only walk along the edges? –Start from the first point –And then what? Consider all coincident edges Project each edge to straight line on path. How? Dot product (remember to normalize)

Path Determination Edge with smallest angle is selected Keep applying until destination is reached Guaranteed to reach destination?

Downhill Paths To go downhill –Cross product of surface normal and ‘up’ gives you a surface tangent vector (perpendicular to down) –Cross product of surface tangent and normal vector defines downhill vector

Reminder Read papers and write questions for Tuesday Assignment due Thursday at 9:00 a.m. Warping and morphing are next