/
Class 8 Class 8

Class 8 - PowerPoint Presentation

luanne-stotts
luanne-stotts . @luanne-stotts
Follow
380 views
Uploaded On 2017-01-10

Class 8 - PPT Presentation

Splines CS770870 Splines Smooth piecewise curves Mostly cubic polynomials Parametric curves Control points Knots Some interpolate pass through the control points Others do not Hierarchical ID: 508198

splines vector match points vector splines points match point3f curves define dy1 center top len derivatives control point common

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Class 8" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Class 8Splines

CS770/870Slide2

Splines

Smooth piecewise curves

Mostly cubic polynomials

Parametric curves

Control points

Knots

Some interpolate (= pass through) the control points,

Others do not.Slide3

Hierarchical Bicubic B-SplinesSlide4

Hermite splines

Define end points and gradients.

Continuity C0 end points match

C1 1

st

derivatives match

C2 2

nd

derivatives matchSlide5

Splines are parametric polynomials

y

u

y = a +

bu

+

cu

2

+du

3

Splines

are arrange to have continuity at the joins (knots)

C0: The curves touch at the join point.C1: The curves also share a common tangent direction at the join point.C2: The curves also share a common center of curvature at the join point.yu

Continuity

At knotSlide6

Hermites

C1 continuous

Matching end points, matching gradients

Example: u

1 = 0, y1 = 2.0, dy1/du

1 = 1 u2 = 1, y2 = 3.0, dy

2 /du2 = -2Find a,b,c,d

to define the curve

Write out the equation

y = a +

bu

+

cu

2 +du3dy/du = b + 2cu +3du2Slide7

General derivation

For any (y1,g1) (y2,g2)Slide8

In C++

_ay = y1;

_by = dy1;

_cy

= 3.0f*(y2 - y1) - 2.0*dy1 - dy2;_dy = 2.0f*(y1 - y2) + dy1 + dy2;Slide9

2D Hermites

Just do it twice, y is a function of u.

x is a function of u.

To get a 3D Hermite, just do it 3 times for x, for y and for z.

x,y,z all are functions of a common u.Slide10

How to calculate normals

For the start just define a normal at right angles to the starting forward vector. E.g. start track horizontally F(0,0,1), S(1,0,0), T(010);

Do this by defining the gradients.

dx

/du = 0; dy/dz = 1; dz

/du = 1; For the next segment, 0f the 100 segments.Take the cross product of the new forward vector with the old top vector (result a new sideways vector).Take the cross product of the new sideways vector with the new forward vector to get the new top vector.Slide11

Construct box

Use the vectors.

Center +/-

halfwidth to get the sides.Center – thickness to define the bottom.

Use the normals in the rendering loop.Slide12

To make the view follow the object

Use

gluLookAt

(ex,ey,ez,atx,aty,atz,upx,upy,upz);

The at position, should be the center of the ball. The up direction should use the top vector

Case 1: Wingman, View eye position using the sideways vectorCase 2: Above and behind. Use the up vector and the forward vector to define the eye

position.Slide13

typedef

float Point3f[3];

Point3f *BoxTopL

, *BoxTopR, *BoxBotL, *BoxBotR

; BoxTopL = new Point3f[len];

BoxTopR = new Point3f[len];

BoxBotL

= new Point3f[

len

];

BoxBotR = new Point3f[len]; Draw the top, the bottom, the left, the right.Slide14

Natural Cubic splines

If we have n control points and n

splines

we can make a set of curves. Such that end points match (2

dof).First derivatives match (1 dof).Second derivatives match (2

dof). = anglular accelerationBut we lose local control.Solve a system of equations.