bézier and b-spline curves for cadtangent vector of the parametric curve • differentiate with...

Post on 04-Mar-2021

4 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Bézier and B-spline curvesfor CAD

Kenjiro T. MiuraShizuoka University

Based on Prof. Ohtake’s ppt :http://www.den.rcast.u-tokyo.ac.jp/~yu-ohtake/GeomPro/

2

Objectives• Learn basics of the curves frequently used in

CG and CAD.• Learn offset and curvature of the parametric

curve.

3

Outlines• What is a parametric curve?

• Bézier curve

• Tangent and normal

• Curvature

• B-spline curve

• Space curve

4

Representation of plane curve• Explicit :

– Limited d.o.f.

• Parametric :– Easy to use, high d.o.f.– Easy to extend to space curves

• Implicit : – Also called iso-lines

)(xfy =

( ))(),()( tytxt =c

0),( =yxf

21 xy −=

)sin,(cos)( ttt =c

01 22 =−− yx

5

Parametric

• Explicit representation for each coordinate

( ))(),()( tytxt =c

x

y

t

t

y

x

t

)(tx

)(ty

6

Rendering of parametric curve• Use polyline

( ) ( )( )sec0,sec0 yx

( ) ( )( ) sec10sec0,, ≤≤ ttytx  

( ) ( )( )sec5,sec5 yx

( ) ( )( )sec10,sec10 yx Points for 0.5 sec interval

7

Outlines• What is a parametric curve?

• Bézier curve

• Tangent and normal

• Curvature

• B-spline curve

• Space curve

8

Frequently used for CAD• Bézier curve• B-spline curve

Bézier curve B-spline closed curve

99

Practical example

• Outline font– Always smooth with any zooming

Outline font(vector image)

Dot font(raster imags)

10

Problem dealt by Bézier(For car design)

• Generate a curve based on a sequence of points in a plane.

• Change the shape according to the move of the points

Change of the design

Move “control points”

11

Bézier’s idea• Add smooth functions to represent the whole

shape!Given data

Multiply

Add!

12

Bernstein basis function• Probability of “Repeated trial”

– Probability for t trial, n times, get i times.

iniin ttC −− )1(

)(tBni0 < t < 1 と書く

)}(),(),(),({ 33

32

31

30 tBtBtBtB

100% lottry three times

Three wins: 100%

A lot : win a time among three tries,

Win one time.t

)(3 tBi

13

∑=

=n

ii

ni xtBtx

0)()(

)(tBni i

ni xtB )(

∑=

n

i 0

=

=

=

=

i

n

i

ni

i

n

i

ni

ytBty

xtBtx

0

0

)()(

)()(

Same for y

14

Cubic Bézier curve• The most frequently used curve

– # of control points = 4– Convenient for spedifying the start and end

points and tangent vectors there.– Cubic polynomials → Next page

),(:pointstart 00 yx ),(:point end 33 yx

),( 11 yx

),( 22 yxDirection of the curve

at the start point

Direction of the curveat the end point

15

Cubic Bézier curve(x coordinate)

3332

321

310

30

3

0

3

)()()()(

)()(

xtBxtBxtBxtB

xtBtxi

ii

+++=

=∑=

2

13113

31

)1(3)1()(

ttttCtB

−=

−= − cubic polynomial of t• t = 0 , 0• t = 1 , double roots• t = 1/3, max

t

)(3 tBi

),( 00 yx ),( 33 yx

),( 11 yx

),( 22 yx

16

Properties of Bézier curve• Remains the same shape with a

coordinate system translation.• Inside the Convex hull

Translate coordinatesystem

Reason : point on the curve is a positive weighted sum of the control points

Origin

Origin

17

Outlines• What is a parametric curve?

• Bézier curve

• Tangent and normal

• Curvature

• B-spline curve

• Space curve

18

Tangent and normal vectors• Tangent vector : direction of the curve• Normal vector : perpendicular to tangent

forwardside※ look at the carfrom the top

19

Tangent vector of the parametric curve

• Differentiate with respect to the parameter

=

dttdy

dttdxt )(,)()(t

timeelapsedlocationcurrent locationNext

timeelapsedntvectordisplacemeectorvelocity v

−=

=

slow

fasterPoints of the

same time interval

If the parameter is time, velocity vector

Make e-time to infinitesimal= differentiate

20

Tangent vector of Bézier curve• Differentiate the basis functions

– Control points are coefficients

==

==

∑∑

∑∑

==

==

i

n

i

ni

i

n

i

ni

i

n

i

ni

i

n

i

ni

ydt

tdBytBdtd

dttdy

xdt

tdBxtBdtd

dttdx

00

00

)()()(

)()()(

)(tt

)31)(1(3)1(3)( 231 tttt

dtd

dttdB

−−=−=

First derivative of B1

21

Bézier spline curve• Connect Bézier curves of low degree

(usually cubic)– Locate control points to be parallel at joints.

jointjoint

※ At the end points of a Bezier curve, tangent to the polylines made of the control points.

Make control points locate on the same line

22

Normal vector• Rotate tangent vector by 90 degrees.

– Usually use a unit normal vector whose length=122 )()()(,)()(

+

−=

dttdy

dttdx

dttdx

dttdytn

Normal vectorTangent vector

),(vectoriseanticlockw degrees 90 rotate

),(vector

xy

yx

−↓

),(1vector

lengthunit ),(vector

22yx

yx

yx

+

23

Offset curve• Trajectory made by translating points on the curve

in the direction of norma vector– When machine with a ball-end mill

the path of its center is on the offset curve

Work’s shape

tool

)()( trt nc + r : radius of the machining tooln : unit normal vector

24

Outlines• What is a parametric curve?

• Bezier curve

• Tangent and normal

• Curvature

• B-spline curve

• Space curve

25

Curvature and radius of curvature• ROC : radius of the best fit circle

– If positive, the same direction of the normal vector• Curvature : reciprocal of ROC (0 if straight)

ROC (positive)

Normal vectorROC (negative)

26

Application of radius of curvature• Cannot machine with a tool with a radius

llaeger the ROC.– Useful for tool selection

Tool

Work’ s shape Cannot machine(Self-intersection of

the offset curve)

27

Calculation of curvature

ROC×rotation of tangent vector [radian] = length of the approximate arc

( ))(),()( tytxt =cκ1

=Rθd

ds

Consider small change

dsdθκ =

• Approximate the curve with a circle

: change of the angle

28

Calculation of curvature

reference line for angle

Tangent line θ ( ) ( )∫ +=

=

t

ttdtdtdytdtdxts

dttdxdttdyt

0

ˆˆ)ˆ(ˆ)ˆ()(:length arc

)()()(tan:line tangent of slope

22

θ

1)()()()()(

==

dttds

dttd

tdstdt θθκ

( ) ( )( ) 23

22

2222

)()(

)()()()(

)(dttdydttdx

dttyddttxddttdydttdx

t+

Use the equations below

※ need second derivative

29

Evolute curve• Trajectory of the best fit circle circle

– Translate in the normal direction by the ROC. – Pass through points where the offset line breaks.

)()( vectornormalunit ROC

ttR n×

)(:curve tc

)()()(:Evolue

tntRtc +

Points where the offset curve breaks

30

Approximate ROC with a polyline• Radius of the circle which passes through

3 points– Remind the sine theorem

c

bS

aCalculate ROC

at point Owith the side lengths

and area of triangle OAB

O

A B

31

Outlines• What is a parametric curve?

• Bezier curve

• Tangent and normal

• Curvature

• B-spline curve

• Space curve

32

Problems on Bezier curve• Degree increases with the number of control

points.• One movement will change the whole shape.点の移動

Of degree 30!

Change around here, too.

33

B-spline curve(different from Bézier spline)

• Example of quadratic B-spline curve– The curve is tangent at the middle point of the

control point polyline.

( )∑ −= iitNt pc 2)(

Format is the sum of (basis func.×pos. of c.p.)

34

B-spline basis function

otherwise1||

01||

)(1 ≤

+−

=tt

tN

≤≤

+−+−

=otherwise

2/3|| if else2/1|| if

08/)912||4(

4/3||)( 2

2

2 tt

ttt

tN

( )∑ −= ixitNtx 2)(

35

How to make B-spline basis func.• Recursively defined by the following

convolution

otherwise1/2|t| if

01

)(0 ≤

=tN

∫ −=+ dsstNsNtN nn )()()( 01

s1/2-1/2

Area here is

t

( ))(1 tsN −−Reverse right and left

( )tN 2

1

-t

36

Outlines• What is a parametric curve?

• Bezier curve

• Tangent and normal

• Curvature

• B-spline curve

• Space curve

37

Space curve in parametric form

• Only add z coordinate.

Herical curve : ),sin,cos()( thtrtrt =c

( ))(),(),()( tztytxt =c

38

Binormal and torsion (space curve)

• Drive a car on a space curve– tangent t : ongoing direciton– normal n : curve direction(cannot defined for

straight line )– binormal b : top direction for the driver

• Curvature κ : degree of curve

• Torsion τ: Vibration of head

tb

n

39

Frenet-Serret formula (space curve)

)()()()()()()()(

)()()(

sskssssss

sss

tbnnb

nt

−=′−=′

=′

ττ

κ

tb

n

tb

n

κ

τ

Match the origins of the two frames.

top related