Curves and Surfaces CSE 3 AGR Paul Taylor

  • Slides: 34
Download presentation
Curves and Surfaces CSE 3 AGR - Paul Taylor 2009

Curves and Surfaces CSE 3 AGR - Paul Taylor 2009

Polynomials of Degree n • Degree is equal to the highest exponent of a

Polynomials of Degree n • Degree is equal to the highest exponent of a term. • Higher exponents result in more and more possible curves • A degree n Polynomial can represent all curves that can be represented by ANY <n polynomials.

Linear x • https: //harmon-middleschool. wikispaces. com/file/view/Graph. psd. jpg

Linear x • https: //harmon-middleschool. wikispaces. com/file/view/Graph. psd. jpg

Quadratic x 2 • http: //www. nipissingu. ca/calculus/tutorials/quadratics. html

Quadratic x 2 • http: //www. nipissingu. ca/calculus/tutorials/quadratics. html

Cubic x 3 • http: //en. wikipedia. org/wiki/File: Polynomialdeg 3. svg

Cubic x 3 • http: //en. wikipedia. org/wiki/File: Polynomialdeg 3. svg

Quartic x 4 • http: //en. wikipedia. org/wiki/Quartic_equation

Quartic x 4 • http: //en. wikipedia. org/wiki/Quartic_equation

Quintic x 5 • http: //en. wikipedia. org/wiki/File: Polynomialdeg 5. png

Quintic x 5 • http: //en. wikipedia. org/wiki/File: Polynomialdeg 5. png

Representin’ Explicit Implicit Parametric

Representin’ Explicit Implicit Parametric

Explicit • Solve the new state of the system based on its previous state

Explicit • Solve the new state of the system based on its previous state

Explicit • Just like in High-School • One variable is dependant, the other Independant

Explicit • Just like in High-School • One variable is dependant, the other Independant • Y = f(x) – Eg: y = x 2 • Sometimes the function is invertertable • X = g(y) – Eg: x = y(1/2)

Problems Explicit Functions can fail on specific orientations!!! A Simple Line y = mx

Problems Explicit Functions can fail on specific orientations!!! A Simple Line y = mx + c A Vertical Line all values of Y will only exist for 1 value of x

A Circle • A circle is a curve with a constant rate of bending

A Circle • A circle is a curve with a constant rate of bending • The closest we can get using an explicit rep: • Y = (r 2 + x 2) • Y = - (r 2 - x 2) • Given 0 ≤ |x| ≤ r

3 D Explicit Functions • We need two functions to represent a curve in

3 D Explicit Functions • We need two functions to represent a curve in 3 D. • Given X we have 2 dependant variables: – Y = f(x) – Z = f(x)

Explicit Surfaces • A Surface requires two independent variables Z = f( x, y)

Explicit Surfaces • A Surface requires two independent variables Z = f( x, y)

Pros & Cons of Explicits • Mathematically Perfect – But Mathematicians never had to

Pros & Cons of Explicits • Mathematically Perfect – But Mathematicians never had to render an infinite value!!! – A Good use of explicits is intersection testing • Did the ray Intersect the Circle? • r = (y 2 + x 2) – A sphere • r = - (z 2 + y 2 + x 2)

Implicit • Solve the new state of the system based on its previous state

Implicit • Solve the new state of the system based on its previous state and the current state

Implicits • F( x, y) = 0 In 2 Dimensions: A Line: Ax +

Implicits • F( x, y) = 0 In 2 Dimensions: A Line: Ax + by + c = 0 A Circle: x 2 + y 2 – r 2 = 0

Pros & Cons of Implicits Also very useful for membership testing. Eg: Does (3,

Pros & Cons of Implicits Also very useful for membership testing. Eg: Does (3, 7) belong to the curve? Curves must be described as the intersection of two curved surfaces. : -S Quadrics are a quadratic polynomial type of surface, which can be represented implicitly. - Quadrics are also simple to intersect with lines

Parametric Equations These guys are pretty much the staple diet of Cg curves! Basically

Parametric Equations These guys are pretty much the staple diet of Cg curves! Basically they are created using three related explicit functions

Pros & Cons of Parametrics • Always solvable! • Great for cheating with pre-calculated

Pros & Cons of Parametrics • Always solvable! • Great for cheating with pre-calculated Basis Matrices

Joining Cubics • Continuity is what we need!! – We have two levels of

Joining Cubics • Continuity is what we need!! – We have two levels of continuity • Geometric and Parametric • Geometric is simply ‘it looks pretty good!’ • Parametric is where the continuity is perfectly defined. – Parametric Continuity infers geometric Continuity » This is not transient – We can create Geometric Continuity by slacking off on Parametric Equations

3 Levels of Cohesion • Level 0 – Both curves share a point in

3 Levels of Cohesion • Level 0 – Both curves share a point in space • Level 1 – Both curves share the point in space and have tangents (Gradients) that point in the same direction. (matching Velocity in time based visualisation) • Level 2 – Both curves share the point in space and have tangents (Gradients) that point in the same direction with the same magnitude (matching velocity and acceleration in time based visualisation) –

Geometric Continuity Levels • G 0 – Curves are Joined • G 1 –

Geometric Continuity Levels • G 0 – Curves are Joined • G 1 – First Derivatives are Proportional • G 2 – First & Second Derivatives are Proportional

Polynomial Continuity Levels • C 0 – Curves are Joined • C 1 –

Polynomial Continuity Levels • C 0 – Curves are Joined • C 1 – First Derivatives are Equal • C 2 – First & Second Derivatives are Equal

Hermite Form Curves • Specified by: – The 2 Endpoints – The Tangents at

Hermite Form Curves • Specified by: – The 2 Endpoints – The Tangents at the endpoints • Both Direction and Velocity

Bezier Form Curves

Bezier Form Curves

Natural Cubic Spline • This type of spline can contain n control points •

Natural Cubic Spline • This type of spline can contain n control points • Generating the coefficients requires an n+1 square Matrix!!!

Spline • A special mathematical function defined piecewise by polynomials – In Human Readable

Spline • A special mathematical function defined piecewise by polynomials – In Human Readable Format: • Joining Polynomials Together

B-Spline is short for basis spline

B-Spline is short for basis spline

Non-Uniform Rational Basis Splines (NURBS)

Non-Uniform Rational Basis Splines (NURBS)

Lerping • It’s a bad name, but we need to do it! • Thus

Lerping • It’s a bad name, but we need to do it! • Thus we can convert our curves to line segments, and surfaces to polygonsm – Remember that Quad patches may look easy, but may not turn out flat!!!

Considerations • How large is the spline being represented? • How close is it

Considerations • How large is the spline being represented? • How close is it to the screen? • How much time do you want to spend rendering? • Do you want to generate micro-polygons for a awesomely shaded image? (Render. Man style)

Generating Normals whilst Lerping • Perpendicular line gradients have a product of -1 •

Generating Normals whilst Lerping • Perpendicular line gradients have a product of -1 • Thus the normal x gradient = -1 • -1 / gradient = normal * In 1 axis only, you will need to accumulate and normalise the Vector!! (or is it already normalised? ? )

References http: //spec. winprog. org/curves/ http: //graphics. msu. ru/courses/cg 99/notes/l ect 13/curves. htm

References http: //spec. winprog. org/curves/ http: //graphics. msu. ru/courses/cg 99/notes/l ect 13/curves. htm