• No results found

LEC_20_Curve Generation.pdf

N/A
N/A
Protected

Academic year: 2020

Share "LEC_20_Curve Generation.pdf"

Copied!
44
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

For higher level of modeling ,especially construction of highly realistic models.

(3)

We clearly need a way of representing these curves in a more mathematical fashion.

Ideally, our descriptions will be:

Reproducible - the representation should give

the same curve every time

Computationally Quick

Easy to manipulate, especially important for

design purposes

Flexible

Easy to combine with other segments of curve.

(4)

Techniques

Interpolation Approximation

(5)

Continuity

Parametric

Continuity ContinuityGeometric

(6)

Parametric derivatives of the two sections to be proportional to each other at their common boundaries

G0Zero order geometric continuity: two curve

sections must have same coordinate positions at the boundary point.

G1parametic first derivates are proportional

G2Both first and second order derivatives of

two curves are proportional at boundary

(7)

Parametric derivatives of the two sections to be equal to each other at their common boundaries

C0Zero order Parametric continuity: two

curve sections must have same

coordinate positions at the boundary point.

C1parametic first derivates are equal

C2Both first and second order derivatives

of two curves are equal at the intersection.

(8)

Zero Order

First Order

Second Order

(9)

Show that two curves N(t)=(t2+2t-2,t2)

R(t)=(t2+2t+1,t+1)

1. are C0 and G0 continuous .

(hint: where they join at N(1)=R(0))

2. Do they meet C1 and G1 Continuity?

(10)

The convex polygon boundary that encloses a set of control points is called the convex hull.

Imagine a rubber band stretched around the

positions of the control points so that each control point is either on the perimeter of the hull or inside it.

(11)

A poly line connecting control points in sequence.

Other names for the series of straight-line sections connecting the control points in the order specified are control polygon and

characteristic polygon

(12)

A curve drawn by distributing several small weights along the length of the strip to hold it in position on the drafting table.

In computer graphics it is defined as

“Composite curve formed with the polynomial curve sections satisfying specified continuity

conditions on the boundary of the curve Sections.”

(13)

Three ways to represent a spline

1. Using a set of boundary conditions that is

imposed on the spline.

2. Using the matrix that characterizes the

spline.

3. Using the set of blending functions(or

basis functions) that determine the position along the curve path by combining the specified geometric constraint on the curve.

(14)

Parametric cubic polynomial representations for the x coordinate along the path of the spline is

X(u)=axu3+b

xu2+cxu+dx 0<=u<=1 Boundary Conditions

x(0), x(1), x`(0), x`(1)

These four boundary conditions are efficient for determining the Four coefficients ax,bx,cx,dx.

(15)

X(u)=[u3 u2 u 1] =U.C

U row matrix power of parameter u C Coefficient Column matrix.

ax bx cx dx

=

d

c

b

a

p

p

p

p

.

0

1

2

3

0

1

0

0

1

1

1

1

1

0

0

0

)

1

`(

)

0

`(

)

1

(

)

0

(

(16)

We can use the boundary condition and solve for the coefficients as follow

C=Mspline Mgeom

MgeomFour element column matrix

containing boundary conditions.

Mspline4-by-4 matrix that transforms the geometric constraint values to the polynomial coefficients and provides a characterization for the spline curve

x(u)=U.Mspline.Mgeom

Mspline characterises the spline

representatations and is often called BASIS FUNCTION.

(17)

Cubic polynomial offer reasonable compromise

between flexibility and speed of computation.

Compared to higher order polynomial these

cubic splines require less calculations and memory and they are more stable.

Compared to lower-order polynomials, cubic

splines are more flexible for modeling arbitrary curve shapes.

Natural Cubic Splines: Two adjacent curved

sections have the same first and second order

parametric derivatives at their common boundary. Thus a natural cubic spline has C2 continuity.

(18)

A curve with specified tangent at each control point. Unlike natural cubic splines, hermite splines can be

adjusted locally because each curve section is locally dependent on its endpoint constraints.

P(u)=[x(u),y(u),z(u)] represents a curve with control points pk and pk+1.

P(0)=Pk P(1)=Pk+1 P`(0)=DPk P`(1)=DPk+1

Where DPk and DPk+1 are tangents at control points pk and pk+1

(19)

X(u)=axu3+b

xu2+cxu+dx 0<=u<=1

the matrix representations for above is

P(u)=[u3 u2 u 1]

and the derivative of position vector p(u) is

P`(u)=[3u2 2u 1 0] a b c d

(20)

Pk Pk+1 DPk DPk+1

0 0 0 0 1 1 1 1 0 0 1 1 3 2 1 0

a b c d a b c d

2 -2 1 1 -3 3 -2 -1 0 0 1 0 1 0 0 0

Pk Pk+1 DPk DPk+1

= MHGH

MH Hermite matrix which is the inverse of the Constraint matrix

GH Geometric matrix

(21)

P(u)=[u3 u2 u 1] =U.M

HGH

the polynomial can be represented as

H(u)=U.MH also called Blending function

P(u)=Pk(2u3-3u2+1)+P

k+1(-2u3+3u2)-DPk(u3

-2u2+u)+DP

k+1(u3-u2) a

b c d

(22)

Bezier splines have a number of properties

that make them highly useful and convenient for curve and surface design .

One of the most flexible curves

Bezier curve sections can fitted to any number

of control points.

A Bezier curve is a polynomial of degree one

less than the number of control points used. Ex. Three points generate a parabola, 4 points a cubic curve and so forth.

(23)
(24)

We are given n+1 control points

Pk(xk,yk,zk) where k ranges from 0 to n.

Now the bezier polynomial function can

be represented with

The bezier blending function is

Where C(n,k) are binomial coefficeints

)!

(

!

!

)

,

(

k

n

k

n

k

n

C

=

1

0

)

(

)

(

0 ,

=

=

P

BEZ

u

where

u

u

P

n

k k k n

)

1

(

)

,

(

)

(

,

u

k

n

uk

k

n

C

u

BEZ

k n

=

(25)

They pass through first and last control points

ie p0=p(0) and pn=p(1).

The control point on the Bezier have global

control in comparison to B-splines where it is

local.

The sum of all the bezier blending functions if

the curve lies with in the convex hulk is always 1 and all are always positive

∑n

i=0 Bi,n(u)=1

(26)

Find the equation of the Bezier Curve that passes through points (0,0) and (-2,1) and is controlled through points (7,5) and (2,0).

(27)

P(u)=(1-u)3p

0+3u(1-u)2p1+3u2(1-u)p2+u3p3

B0,3(u)=3C

0u0(1-u)3-0=(1-u)3

B1,3(u)=3C

1u1(1-u)3-1=3u(1-u)2

B2,3(u)=3C

2u2(1-u)3-2=3u2(1-u)

B3,3(u)=3C

3u3(1-u)3-3=u3

HINT

1

0

)

(

)

(

0 ,

=

=

P

BEZ

u

where

u

u

P

n

k k k n

)

1

(

)

,

(

)

(

,

u

k

n

uk

k

n

C

u

BEZ

k n

=

(28)

For Bezier Curve whose control points are P0(4,2), P1(8,8) and P2(16,4).

What is the degree of the Curve?

What are the coordinates at parametric

midpoint?

(29)

Degree=no of control points-1

order=degree+1

Blending function of the curve

B0,2(u)=2C

0u0(1-u)2-0=(1-u)2

B1,2(u)=2C

1u1(1-u)2-1=2u(1-u)

B2,2(u)=2C

2u2(1-u)2-2=u2

(30)

The Bezier Curve with given control points is

C(u)=P0B0,2(u)+P1B1,2(u)+P2B2,2(u)

X(u)=X0B0,2(u)+X1B1,2(u)+X2B2,2(u) Y(u)=Y0B0,2(u)+Y1B1,2(u)+Y2B2,2(u)

Given

X0=4 x1=8 x2=16 Y0=2 y1=8 y2=4

(31)

X(u)=4B0,2(u)+8B1,2(u)+16B2,2(u) X(u)=4u2-8u+4

Similarly

Y(u)=-10u2+12u+2

Now Values at parametric mid point U=0.5 is

X(.5)=1 Y(.5)=5.5

(32)

The Bezier blending function is given as

Where

Generate an expression for the blending function of a cubic Bezier curve.

Plot rough sketch of the blending function generated.

)!

(

!

!

)

,

(

k

n

k

n

k

n

C

=

)

1

(

)

,

(

)

(

,

u

k

n

uk

k

n

C

u

BEZ

k n

=

(33)

As the curve is cubic n=3 therefore the curve will have

Control points =4 and hence 4 blending functions

B

0,3

(u)=

3

C

0

u

0

(1-u)

3-0

=

(1-u)

3

B

1,3

(u)=

3

C

1

u

1

(1-u)

3-1

=

3u(1-u)

2

B

2,3

(u)=

3

C

2

u

2

(1-u)

3-2

=

3u

2

(1-u)

B

3,3

(u)=

3

C

3

u

3

(1-u)

3-3

=

u

3
(34)

As blending function determines the shape of the curve of the values of parameter u where u<=0<=1.

When u=0 B0,3(0)=1 rest are 0 When u=1 B3,3(1)=1 rest are 0

Bezier curves pass through first(p0) and last points (p3).

The other blending functions B1,3(u) and B2,2(u) will affect the curve at intermediate values of u.

(35)

Calculate the value of u for which B1,2(u) and

B2,3(u) are maximum.

B`1,3=(1-u)(3-9u) B`1,3=0 u=1,1/3

B1,3 is maximum at u=1/3

Similarly B2,3 is maximum at u=2/3

(36)

BEZ0,3(u) BEZ1,3(u)

BEZ2,3(u) BEZ3,3(u)

u u

u u

(37)

These are the most widely used class of

approximating splines.

B-splines have two advantages over Bezier

splines:

The degree of a B-spline polynomial can be set

independently of the number of control points (with certain limitations),and

B-splines allow local control over the shape of a spline curve or surface

The trade-off is that B-splines are more

complex than Bezier splines

(38)

A B-spline is a generalisation of Bezier curve Let a vector known as the KNOT vector be

defined as

T={u0,u1,…….um}

Where T is non-decreasing sequence with ui ε[0,1] and P1,P2…Pn are control points.

(39)

The B-Spline curve is defined as

Blending function for B-Splines is represented by

the Cox-deBoor recursive formula.

points input 1 n of set u u u and 1 n d 2 where ) ( max min 0 , + = ≤ ≤ + ≤ ≤ =

= i n

i i k d

p

B P u

C

(40)

When the spacing between knot values is

constant, the resulting curve is called a

uniform B-spline. For example, we can set up a uniform knot vector as

[-1.5 -1.0 -1.0 -0.5 0.0 0.5 1.0 1.5]

(41)

For this class of splines, we can specify any values and

intervals for the knot vector.

With nonuniform B-splines, we can choose multiple internal

knot values and unequal spacing between the knot values. Some examples are

(42)

A rational function is simply the ratio of two

polynomials. Thus, a rational spline is the ratio of two spline functions. For example a rational B-spline curve can be described with the position vector:

where the pk are a set of n + 1 control-point positions.

Parameters wkare weight factors for the control points.

The greater the value of a particular wk the closer the curve is pulled toward the control point pk weighted by that parameter

= = = n k d k k n k d k k k u B w u B p w u P 0 , 0 , ) ( ) ( ) (
(43)

Rational splines have two important

advantages compared to non-rational splines.

they provide an exact representation for

quadric curves (conics),such as circles and ellipses

they are invariant with respect to a perspective

viewing transformation.

Non-rational splines, on the other hand,

are not invariant with respect to a

perspective viewing

transformation

Typically, graphics design packages use

non-uniform knot-vector representations for constructing rational B-splines.

These splines are referred to as NURBs

(non-uniform rational B-splines).

(44)

Sum of all the B-spline blending function, if the curve

lies within the convex hull is always 1, and are always positive

Any curve having n+1 control points will have n+1

blending functions

This curve has degree(d)=order(p)-1 and continuity Cp-2

over the range of u.

Each piece of B-spline is influenced by P control points B-spline have local control over the shape of the curve.

in=0 Bk,d =1

References

Related documents