Lecture 4a - Universiti Teknologi Malaysiajamalt/sme4513/Lec4a wireframe.pdfWireframe and Curve...

Post on 13-Jul-2020

2 views 0 download

transcript

Lecture 4aLecture 4a

Wireframe and CurveWireframe and Curve

Lecture 3 1

Type of modelingType of modeling

Wire frameSatah keratan

SurfaceSolid

Satah keratan

Pemodelan Permukaan Pemodelan PepejalPemodelan Kerangkadawai

Lecture 3 2

What we cover?

T f titiType of entitiesTopologies and geometriesWhy we need certain number of commands to modelParametric entities and its development toward surface

Lecture 3 3

Types of entityCircleLine

Y

Polyline

Y

Circle

Y

X XX

X X

Curves3D Polyline

Lecture 3 4

Definition Topology and geometry

TopologyTopologyis the connectivity and associativity of the object entities. Topology states that L1 shares vertex with L2 when L1 and L2 is two connected lineswhen L1 and L2 is two connected lines

Geometryyis metric information which defines the entities of the obejcts. Geometry states that the coordinates of the vertices of a lines.

Geometric modeling requires both topology and geometry as its low-level model definition.

Lecture 3 5

Importance of topology and geometric in model definition

Make each model unique no two models Make each model unique, no two models has the same low-level definitionDetermine the method to build the entitiesDetermine the method to build the entitiesDetermine the manipulation of the entitiesDetermine the position of the entities in Determine the position of the entities in space

Lecture 3 6

Understanding topology and geometry

Topology has vertical relationship with Topology has vertical relationship with other topology. Geometry has horizontal relationship with topology.

Line

Topology Geometry

Curve Straight line

Vertex CoordinatesVertex Coordinates

Lecture 3 7

Understanding topology and geometry – con’tSame geometry but different topologySame geometry but different topology

Same topology but different geometry

Lecture 3 8

Geometry of curves

The geometry of the curves is defined by The geometry of the curves is defined by their arrays of points or by their mathematical representations.pMathematical representation is preferable description due to its practicality for computational purposes.The mathematical representation can be divided into two types; implicit and divided into two types; implicit and parametric

Lecture 3 9

Curve representation: implicitImplicit LineImplicit f(x,y) = 0

f(x,y,z) = 0

0)x(xy)y(yx)xy(x)yx(y 1211211212 =−+−−−−−

Circle

Line

f(x,y,z) 00ryx 222 =−+

Ellipse

Circle

1by

ax 22

=⎟⎠⎞

⎜⎝⎛+⎟

⎠⎞

⎜⎝⎛

p

xayn

0i

ii=∑

=

Curve

Lecture 3 10

verticescontroltotal1nwithtcoefficienisawhere +

Curve representation: parametric

Parametric LineParametric x = x(t)y = y(t)

t)((t)t)x(xxx(t) 121121 −+=−+= yyyy

Circle

Line

z = z(t)where

t)πsin(2r(t)t)πcos(2rx(t) == y

Ellipse

Circle

10 ≤≤ t

t)πsin(2by(t)t)πcos(2ax(t) ==

C

Ellipse

illi hffi iih

ta(t)tax(t)n

0i

ii

n

0i

ii == ∑∑

==

y

Curve

Lecture 3 11

verticescontroltotal1nwithtcoefficienisawhere +

Circle: Implicit and Parametric representation

ParametricImplicitImplicit

Parametric representation generates evenly spaced points and hence generates more smooth curves.

Lecture 3 12

Synthetic curve representation

I t l ti th dInterpolation methodCubic, cubic spline (piecewise polynomial)

Approximation methodBezier, B-Spline, Non-rational & rational curve,uniform and non-uniform

Lecture 3 13

Parametric Cubic

3i 1t0taP(t) ≤≤∑

Parametric Cubic Equation

23

0ii 1t0taP(t) ≤≤=∑

=

012

23

3 atatataP(t) +++=

P(t): point on the curveai:algebraic coefficient

Lecture 3 14

Parametric Cubic: con’tt = 0 P(0) = a0 eq1t = 0 P(0) = a0 eq1

t = 1 P(1) = a3 + a2 + a1 + a0 eq2

Set the t ngent t P(0) nd P(1)Set the tangent at P(0) and P(1)t = 0 P’(0) = a1 eq3

t =1 P’(1) = 3a3 + 2a2 + a1 eq4

Set the equation a0, a1, a3 and a4 in terms of P(0), P(1), P’(0) and P’(1) and insert into the parametric cubic equation.

P(t) = (2t3 – 3t2 + 1)P(0) + (-2t3 + 3t2)P(1) +

(t3 – 2t2 + t)P’(0) + (t3 – t2)P’(1)

Lecture 3 15

Parametric Cubic: con’t

x(t) = (2t3 – 3t2 + 1)x(0) + (-2t3 + 3t2)x(1) + (t3 – 2t2 + t)x’(0) + (t3 – t2)x’(1)

y(t) = (2t3 – 3t2 + 1)y(0) + (-2t3 + 3t2)y(1) + (t3 – 2t2 + t)y’(0) + (t3 – t2)y’(1)

Used constraint: slope of the end point.

Matrix representation

[ ] ⎥⎥⎤

⎢⎢⎡

⎥⎥⎤

⎢⎢⎡

−−−−

=]1[]0[

12331122

1)( 23 PP

ttttP [ ]⎥⎥⎥

⎦⎢⎢⎢

⎣⎥⎥⎥

⎦⎢⎢⎢

=

]1[']0['

00010100

1)(

PP

ttttP

Lecture 3 16

Cubic SplineWhat is spline? What is spline?

Spline is introduced to replace flexible curve. Flexible curve enables the continuity yof the curve to second derivative (C2)

C bi li i i l f t i bi Cubic spline is a special for parametric cubic (first derivative at each ends of the segment) with ensure continuity at second derivative. Therefore, smoother curve is generated.

Lecture 3 17

Curve continuity

Lecture 3 18

Cubic spline: con’t

012

23

3 atatataP(t) +++=Cubic polynomial equation

23 a2ta6(t)P" +=Second derivative

At Pi end point of segment curve i-1 when t =1 start point of segment curve I when t = 0

P”i-1(1) = P”i(0)

At Pi+1 end point of segment curve i when t =1 i+1 start point of segment curve i+1 when t = 0

P”i(1) = P”i+1(0)

Lecture 3 19

Cubic spline: con’tCubic spline equationCubic spline equation

)(34 '' −=++ i PPPPP )(34 1111 −++− −=++ iiiii PPPPP

If second derivatives both end point of curve segment i-1 and start point of curve segment I is equal to 0 the curve is natural cubic I is equal to 0, the curve is natural cubic spline

Lecture 3 20

Interpolation vs approximationInterpolationInterpolation

It is originated for data-fitting. The curve generated will go through the g g gvertices

ApproximationApproximationThe curve is not necessarily passing through all of the verticesGenerate free-form surface.Suitable to model car body, hull etc.

Lecture 3 21

Bezier Curve

Basic EquationBasic Equation

0

10

)()(=

≤≤

=∑N

ii

t

BiPtP

:110

+≤≤

verticestotalNt

Bi is blending function1! NiN 1)1(

)!(! −−−

= Nii vv

iNiNB

Lecture 3 22

Bezier Curve: example4 vertices: (0 0) (1 4) (2 2) and (3 5)4 vertices: (0,0), (1,4), (2,2) and (3,5)

Based from basic eqBased from basic eqP(t)= P(0)(1-t)3 + P(1)3t(1-t)2 + P(2) 3t2(1-v) + P(3)v3

Therefore

x(t)= x0 (1-t)3 + x13t(1-t)2 + x2 3t2(1-v) + x3 v3

y(t)= y0 (1-t)3 + y13t(1-t)2 + y2 3t2(1-v) + y3 v3

Lecture 3 23

Bezier Curve: example

1,4

3,5t x y

0 0 0

0.1 0.102 0.347

0.2 0.216 0.616

0.3 0.354 0.849

0.4 0.528 1.088

0 5 0 75 1 375

2,2

0.5 0.75 1.375

0.6 1.032 1.752

0.7 1.386 2.261

0.8 1.824 2.944

0,0

0.9 2.358 3.843

1 3 5

Lecture 3 24

B-Spline CurvePiecewise collection of nPiecewise collection of Bezier Curve, connected end to end.

Degree function k is 1

)()(

1

0,

tttforN

VtNtP

ii

n

iiki

+

=

⎨⎧ ≤≤

=∑

Degree function k is introduced. This degree function basically pushes the curve away.

)(

0,

andotherwise

N ti⎩⎨=

)()()(

)()()(

1,11

1,1

, tNtttt

tNtt

ttN kiiki

kiki

iki

iki −+

++

+−

−+ −

−+

−−

=

Ni,k : blending function

Lecture 3 25

B-Spline: k = 2 and k = 3k 2 li

)()()(

)()()(

2,012

22,0

01

03,0 tN

tttt

tNttttN

−+

−−

=

k =2 linear 1

2

)()()(

)()()(

)()(

2,123

32,1

12

13,1

1201

tNtttt

tNttttN

tttt

−+

−−

=

)()()(

)()()(

103

100

20 tNtt

tNttN−

+−

=

k =3 0

3

)()()(

)()()(

)()(

)()(

1,124

41,1

13

12,1

1,023

1,002

2,0

tNtttt

tNttttN

tttt

−+

−−

=

−−

4

Lecture 3 26

...

B-Spline: k = 4

)()( tt

k = 4 1

2

)()(

)()(

)()()(

)()()(

51

4,114

44,0

03

04,0

tNtt

tNttN

tNtttt

tNttttN

−+

−+

−−

=

...

)()(

)()()(

4,125

4,114

14,1 tN

tttN

ttN

−+

−=

03

4

Lecture 3 27

B-Spline

{0,1.5,2.5,3}

{0,1.8,2.8,3}t varies

k=2

k=3

k=4

k varies

Lecture 3 28

Rational Curve

Introduce the homogeneous coordinate and Introduce the homogeneous coordinate and space. It is referred as weight (w(t))

Parametric curveP(t) = [ x(t), y(t), z(t)]P(t) [ x(t), y(t), z(t)]

Rational CurveP(t) = [ x(t)/w(t), y(t)/w(t), z(t)/w(t) ]

Lecture 3 29

Homogenous CoordinateCoordinate declaration

(x, y, z)

Homogenous coordinate(x*, y*, z*, h)

W

h: scalar vector

Homogenous coordinate( x*/h, y*/h, z*/h, 1)

Ph (x,y,h)

P2d (x/h,y/h,1)1

X

Lecture 3 30

Y

Disadvantages of wire frame

M lti l i t t tiMultiple interpretation

Lecture 3 31

Disadvantages of wire frame

Ambiguous modelmodel

Unreal object (silhouette I li(silhouette line)

Isoline

Lecture 3 32(a) (b)