Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric...

74
Email: [email protected] Website: http://www.uotechnology.edu.iq/dep-production/laith/index.html Lecture (2): Geometric Modeling / Wireframe Modeling

Transcript of Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric...

Page 1: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Email: [email protected]

Website: http://www.uotechnology.edu.iq/dep-production/laith/index.html

Lecture (2): Geometric Modeling / Wireframe Modeling

Page 2: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Engineering Graphics as Language

Graphic Representation

Expression of ideas by lines or marks

Drawings

Drawing

Technical

Expression of practical or technical ideas

Modern Manufacturing Design

Prior to the mid 1980’s most design and documentation was paper based.

Mechanical drawing or drafting

Beginning in the 1980’s CAD D=drafting

1990’s CAD D=design

3D wire frame, surface, and solid models

2000’s

Constraint based and parametric Design

Page 3: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

“The Chalice” c. 1450

Page 4: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Engine Illustration 1901

Page 5: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Aircraft Illustration 1950

Page 6: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Computer Illustration

Page 7: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

3D Raster [Software: Flash CAD]

2D Raster (first digital photo in 1957 USA)

[Software: Adobe PhotoShop]

Computer Graphics Categories:

2D Vector [Software: Adobe Illustrator] 3D Vector [Software: AutoCAD]

Page 8: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

is a data structure representing a generally rectangular grid of pixels, or points of color, viewable via a monitor, paper, or other display medium. Raster images are stored in image files with varying formats such as

(BMP, GIF, JPG, PNG)

A bitmap corresponds bit-for-bit with an image displayed on a screen. A bitmap is technically characterized by the width and height of the image in pixels and by the number of bits per pixel (a color depth, which determines the number of colors it can represent).

Raster-based image editors, such as Painter, Photoshop, MS Paint, and GIMP, revolve around editing pixels.

Raster Image is Lossy, jaggies when transforming.

A raster file is usually larger than a vector image file.

A raster file is usually difficult to modify without loss of information, although

there are software tools that can convert a raster file into a vector file for

refinement and changes (like Algolab Raster to Vector Conversion Toolkit ).

Most pixel-based image editors work using the RGB color model, but some

also allow the use of other color models such as the CMYK color model.

Raster graphics are resolution dependent. They cannot scale up to an arbitrary resolution without loss of apparent

quality. This property contrasts with the capabilities of vector graphics, which easily scale up to the quality of the

device rendering them. Raster graphics deal more practically than vector graphics with photographs and photo-

realistic images, while vector graphics often serve better for typesetting or for graphic design. Modern computer-

monitors typically display about 72 to 130 pixels per inch (PPI), and some modern consumer printers can resolve

2400 dots per inch (DPI) or more; determining the most appropriate image resolution for a given printer-resolution

can pose difficulties, since printed output may have a greater level of detail than a viewer can discern on a

monitor. Typically, a resolution of 150 to 300 pixel per inch works well for 4-color process (CMYK) printing.

Raster Image (Bitmap):

Page 9: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Vector Image :

A vector image is a collection of connected lines and curves that produce objects. When creating a vector image

in a vector illustration program, node or drawing points are inserted and lines and curves connect notes together.

This is the same principle as "connect the dots".

Each node, line and curve is defined in the drawing by the graphics software by a mathematical description.

Every aspect of a vector object is defined by math included node position, node location, line length and on down

the line. Text objects are created by connecting nodes, lines and curves. Every letter in a font starts out as a

vector object. Vector images are object-oriented while raster images are pixel oriented. A vector object will have a

"wireframe" underneath the colors in the object. In a vector object, colors are like clothes over the top of a

skeleton.

Vector images are defined by math, not pixels. They can be scaled up or down without any loss of quality. When

an illustration (drawing) program sizes a vector image up or down, it simply multiplies the mathematical

description of the object by a scaling factor.

Because vector images scale up or down without the loss of image quality, they can be output at any resolution

that a printer is capable of producing. Unlike raster images, quality is not limited by dots per inch or scanning

resolution. This is a big reason that vector graphics are so popular for clip art.

Since vector images are composed of objects not pixels, you can change the color of individual objects without

worrying about individual pixels.

Vector images do not need to keep track of each individual pixel in an image, only mathematical descriptions. For

this reason vector files are very small in file size.

File Formats

Common vector formats include EPS (Encapsulated PostScript), WMF (Windows Metafile), AI (Adobe Illustrator), CDR

(CorelDraw), DXF (AutoCAD), SVG (Scalable Vector Graphics) and PLT (Hewlett Packard Graphics Language Plot File)

Page 10: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Geometric Modeling

Classification of Geometric Models:

1. Graphical Models:

- 2D drafting [line, arc, circle, conics, text, symbol)

- 3D wireframe (1960’s)

2. Surface Models (late 1970’s)

- Bicubic

- Ruled

- Bezier

- B-spline

- NURBS (non uniform rational B-splines)

3. Solid Models (early 1980’s)

- Constructive solid geometry (CSG)

- Boundary representation (B-rep)

4. Solid Parametric/variational/feature-based Models (1990’s)

Page 11: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

A wireframe model is a skeletal description of a 3D object developed in the early 1960’s, was one of the most earliest geometric modeling techniques. There are no surfaces in a wireframe model; it consists only of points, lines, and curves that describe the edges of the object. It is simplest representation scheme and hence the fastest.Wireframes are rather incomplete (no mass properties).Possibly ambiguous representation, topological information is inadequate.Stores positions of lines (in 2D or 3D).It is helpful for drafting (easy multiple views & easy editing).Ambiguous surfaces limit the automatic possibilities (e.g. no volume calculation, no NC tool path generation)

Wireframe model (Developed in 1960’s ):

Types of 3D Modeling Systems

Page 12: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Wireframe modeling entities

• Analytic curves (Points, lines, circles, arcs, conics (ellipses, Parabolas, Hyperbolas))

May be very useful as planar curves, Not useful when the curves has to be a space curve

• Synthesis curves (parametric cubic curves, Bezier curves, B-spline curves, …….)

Useful to represent space curves, Useful for freeform modeling

A computer representation of a wireframe structure consists essentially of two types of

information:

•The first is termed metric or geometric data which relate to the 3D coordinate positions of the

wire-frame node’ points in space.

•The second is concerned with the connectivity or topological data, which relate pairs of points

together as edges.

Example : tetrahedron wireframe model

Page 13: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Advantages of wireframe

oEasy to construct

oMost economical in term of time and

memory requirement.

oUsed to model solid object.

oOften used for previewing objects in

an interactive scenario.

Disadvantages of wireframe

Tend to be not realistic

Ambiguity : complex model difficult to interpret.

Does not allow for use of photo realistic

rendering tools. *(some software capable of

hidden line removal on limited basis).

No ability to determine computationally

information on mass properties (e.g volume, mass,

moment etc) and line of intersect between two

faces of intersecting models.

No guarantee that the model definition is

correct, complete or manufacturable.

The creation of wireframe models usually

involves more user effort to input necessary

information than that of solid models, especially

for large and complex parts.

Page 14: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

1. Analytical Curves (lines, circles, ellipses, …….)

A- Non-parametric representation analytical curves

aXY

b

Y

a

X

RYX

cmXY

4

1

2

2

2

2

2

222

=

=+

=+

+=Line equation

Circle equation

Ellipse equation

Parabola equation

Although non-parametric representations of curve equations are used in some cases,

they are not in general suitable for CAD because:

The equation is dependent on the choice of the coordinate system

Implicit equations must be solved simultaneously to determine points on the

curve, inconvenient process.

If the curve is to be displayed as a series of points or straight line segments, the

computations involved could be extensive.

Wireframe modeling entities

Page 15: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Conventional explicit and implicit forms have drawbacks

Example explicit form:

Example implicit form:

Representation of Curves

cmxy +=

0=++ cbyax

Drawbacks of Conventional Representations

•The represent unbounded geometry

•They may be multi-valued

•Difficult to evaluate points along the curve

•Depends on coordinate system

Page 16: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Explicit non-parametric representation of a general 3-D curve

P = [ x y z ]T = [ x f(x) g(x) ]T

P = Position vector of any point P on the curve

Implicit Non-parametric representation of a curve is the intersection of twosurfaces defined by

F(x, y, z) = 0

G(x, y, z) = 0

P

P(x, y, z)

Disadvantages of Non-parametric

Representations

Explicit non-parametric representation can not be used for closed curves (like circles)and multi-valued curves (like parabolas). Because it is a one-to-one relationship.

The above problem is overcome by implicit representation but the latter is laborious.

Implicit representation requires that two surface equations be solved for “y” and “z”for a given value of “x”

Infinite slope situations can not be dealt with in computer program

Shapes of most objects are coordinate system independent

Displaying curve as a series of points or line segments because computationallyextensive and hence expensive.

Page 17: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

B- Parametric representation of analytical curves

In parametric representation, each point on a curve is expressed as a function of a

parameter u. The parameter acts as a local coordinate for points on the curve.

TT uzuyuxzyxuP )]()()([][)( ==

For 3D Curve

maxmin ≤≤ uuu

• The parametric curve is bounded by two parametric values Umin and Umax

• It is convenient to normalize the parametric variable u to have the limits 0 and 1.

It overcomes all difficulties of the non-parametric representations

It allows multi-valued and closed functions to be easily defined

It replaces the use of slopes with that of tangent vectors

The equations are polynomials and thus computationally more suitable than

equations involving roots

Advantages of Parametric Representation:

Page 18: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

u

u

v

Curve, P=P(u)Surface, P=P(u,v)

Parametric Representation

Cubic polynomials are the lowest-order polynomials that can represent a non-planar curve

Parametric Cubic Polynomial Curves

3

3

2

210)( uuuu kkkkp +++=

The curve can be defined by 4 boundary conditions

Page 19: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 20: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Parametric form of a curve

It is a one-to-one mapping from the parametric space (Euclidean space E1 in u values) to

the Cartesian space (E3 in x, y, z values)

u=0u

u=umin u=umax

umin

umax

P’(u)P(u)

X

Y

Z

n

u

u

u

X

Y

Z

uuminumax

Page 21: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

1- Lines

)(

1≤≤0)(

)(

1≤≤0)(

121

121

121

121

zzuzz

uyyuyy

xxuxx

uPPuPP

+=

+=

+=

+=

The above equation defines a line bounded by the endpoints P1 and P2 whose associated parametric value are 0 and 1

• A line connecting two points P1 and P2.

• Define a parameter u such that it has the values 0 and 1 at P1 and P2 respectively

Vector form

Scalar form

Page 22: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

• The basic parametric equation of a circle can be written as

For circle in XY plane, the parameter u is the angle measured from the X-axis to any point P on the circle.

c

c

c

zz

uuRyy

uRxx

=

+=

+=

π2≤≤0sin

cos

2- Circles

3- Circular Arcs

Circular arcs are considered a special case of circles. A circular arc parametric equation is given as

c

esc

c

zz

uuuuRyy

uRxx

=

+=

+=

≤≤sin

cos

Where us and ue are the starting and ending angles of the arc respectively

Page 23: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Curves that are constructed by many curve segments are called Synthesis Curves

• Analytic curves are not sufficient to meet geometric design requirements of mechanical parts

• Products such as car bodies, airplanes, propeller blades, etc. are a few examples that require

free-form or synthetic curves and surfaces

• Mathematical approaches to the representation of curves in CAD can be based on either

• Interpolation

• Approximation

If the problem of curve design is a problem of data fitting, the classic interpolation solutions are used.

If the problem is dealing with free form design with smooth shapes, approximation methods are used.

4- Synthesis Curves

Need for synthetic curves arises in two occasions:

When a curve is represented by a collection of measured data points, and

When an existing curve must change to meet new design requirements – the designer needs a curve

representation that is directly related to the data points and is flexible enough to bend, twist or

change the shape by changing one or more data points.

Page 24: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

interpolated

approximated

Control points

Page 25: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 26: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

The approach of “segmentation”: continuity requirements

•Most often, a complex is modeled by several curve segments pieced together end to end.•This is the approach of “segmentation” because each time we analyzing a “curve segment” rather than theentire curve•Continuity at the joints of curve segments decides the degree smoothness of the curve•Various continuity requirements – Co, C1, C2 – can be specified as indication of degree smoothness

Zero-order continuity (Co) yields a position continuous curve

First (C1) order continuity implies slope continuity

Second (C2) order continuity implies curvature continuity

A C1 curve is minimum acceptable curve for engineering design

A cubic polynomial is the minimum-order polynomial that can guarantee the generation of all

three Co, C1 and C2 continuities.

The cubic order polynomial is the lowest degree polynomial allowing inflection within a curve

segment

A cubic polynomial is the lowest degree curve that allows representation of nonplanar

(twisted) 3-D curves in space.

Higher order polynomials (>3) are not used in CAD because of the following disadvantages:

They tend to oscillate about the control points

They are computationally expensive and inconvenient

They are uneconomical of storing curve and surface representations in the computer.

Page 27: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Control of shape of curve

For efficient design, shape of the curve should be controllable most effectively in the

easiest possible way

Type of input data plays a crucial role

Control points and slope information are more easy to use than curvature

information

Two types of control exist:

Local control

Global control

Local control is more desirable

Global control is said to be present if change in one control point or tangent vector results in

change of overall shape of the curve segment

Local control is said to be present if change in one controlpoint or tangent vector results in

change of shape of curve local to that point

Local Control and Global Control

Page 28: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

1- Interpolation

Finding an arbitrary curve that fits (passes through) a set of given points. This problem is encountered, for

example, when trying to fit a curve to a set of experimental values.

Types of interpolation techniques:

Lagrange polynomial

Parametric cubic (Hermite)Parametric cubic

Lagrange interpolation - 4 points

Hermite interpolation - 2 points, 2 slopes

p0

p3

p2

p1

Lagrange

p0

p1

P1’P0’

Hermite

Page 29: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

1- Lagrange Interpolation Polynomial

Page 30: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

When constructing interpolating polynomials, there is a tradeoff between having a better fit and

having a smooth well-behaved fitting function.

The more data points that are used in the interpolation, the higher the degree of the resulting

polynomial, and therefore the greater oscillation it will exhibit between the data points.

Therefore, a high-degree interpolation may be a poor predictor of the function between points,

although the accuracy at the data points will be "perfect."

Page 31: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Example:

Page 32: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

The tangent function and its interpolant

Assignment: Construct Lagrange Interpolation Polynomial in Matlab

Page 33: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

It passes through the control points and therefore it is an interpolate.It has only up to C1 continuity

2- Hermite Cubic Spline

•They are used to interpolate the given data but not to design free-form curves.•(Cubic) Splines derive their name from “French curves or splines”•Hermite cubic spline is one type of general parametric cubic spline – with degree equal to 3and being determined by two data points and tangent vectors at the data points.•Hermite Cubic Spline can be a 3-D planar curve or 3-D twisted curve.

tscoefficein algebraic)(or Polynomial

parameter

1≤≤0,)( ∑3

0

=

=

==

i

i

i

i

C

u

uuCuP

Parametric Equation of Hermite Cubic Spline Segment:

Page 34: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Hermite Cubic Spline : A spline is a parametric curve defined by control points•The term spline dates from engineering drawing, where a spline was a piece of flexible wood used to draw smooth curves•The control points are adjusted by the user to control the shape of the curve

A Hermite spline is a curve for which the user provides:The endpoints of the curveThe parametric derivatives of the curve at the endpoints

The parametric derivatives are dx/dt, dy/dt, dz/dt

That is enough to define a cubic Hermite spline, more derivatives are required for higher order curves

Say the user provides

A cubic spline has degree 3, and is of the form:

For some constants a, b, c and d derived from the control points, but how?

We have constraints:The curve must pass through x0 when t=0

The derivative must be x’0 when t=0

The curve must pass through x1 when t=1

The derivative must be x’1 when t=1

1010 ,,, xxxx ′′

dctbtatx +++= 23

Page 35: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Solving for the unknowns gives:

Rearranging gives: 0

0

0101

0101

233

22

xd

xc

xxxxb

xxxxa

=

′=

′′=

′+′++=

)2(

)(x

)132(

)32(

23

0

23

1

23

0

23

1

tttx

tt

ttx

ttxx

+′+

′+

++

+=

[ ]′′=

10121

0011

1032

00322

3

0101t

t

t

xxxxxor

A point on a Hermite curve is obtained by multiplying each control point by some function and

summing

The functions are called basis functions

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

1.2

x1

x0

x'1

x'0

Page 36: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

We can treat x in the mapping as a vector. Its components can be explicitly written as

′′

′′

′′

=

10121

0011

1032

00322

3

0101

0101

0101

t

t

t

zzzz

yyyy

xxxx

z

y

x

Assignment: Construct Hermite Cubic Spline in Matlab

Page 37: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Example: Hermite Curve

Given:

(a) Coordinates at Point 0,

(b) Slope at Point 0,

(c) Coordinates at Point 1, and

(d) Slope at Point 1.

Algorithm will generate a cubic curve.

P0’

P0

P1

P1’

Page 38: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Hermite Curve

Let the parametric curve be P(u) = au3 + bu2 + cu + d.

where u is the parameter that ranges from 0 to 1

A defined Hermite curve has a defined set of coefficients a, b, c, d.

Substituting a value u into the equation gives a point on the Hermite curve.

Substituting many values of u from 0 to 1 will trace out the curve.

Given the two points and two slopes, p0, p1, p0’ and p1’, our objective is to find the coefficients a, b, c, d.

Page 39: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Deriving the Coefficients of the Hermite CurveP(u) = au3 + bu2 + cu + d

P(u) = [ u3 u2 u 1 ]

a

b

c

d

Derivative P’(u) = [ 3u2 2u 1 0 ]

a

b

c

d

But, P(0) = p0 = a x 03 + b x 02 + c x 0 + d x 1

Therefore, in matrix form,

p0 0 0 0 1 a

p1 1 1 1 1 b

p0’ 0 0 1 0 c

p1’ 3 2 1 0 d

=

P’(0) = p0’ = a x 3 x 02 + b x 2 x 0 + c x 1 + d x 0

P’(1) = p1’ = a x 3 x 12 + b x 2 x 1 + c x 1 + d x 0

P(1) = p1 = a x 13 + b x 12 + c x 1 + d x 1

Page 40: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Deriving the Coefficients of the Hermite Curvea 0 0 0 1 p0

b 1 1 1 1 p1

c 0 0 1 0 p0’

d 3 2 1 0 p1’

=

-1

a 2 -2 1 1 p0

b -3 3 -2 -1 p1

c 0 0 1 0 p0’

d 1 0 0 0 p1’

=

Rearranging, P(u) = p0(2u3 – 3u2 + 1) + p1(-2u3 + 3u2) + p0’(u3 -2u2 + u) + p1’(u

3 – u2)

Use this equation to generate Hermite curve given control points and slopes.

Solve for a,b,c,d by using matrix inverse:

We get: a = 2p0 - 2p1 + p0’ + p1’ b = -3p0 + 3p1 - 2p0’ - p1’ c = p0’ d = p0

Next, substitute back to equation P(u) = au3 + bu2 + cu + d

We get: P(u) = (2p0 - 2p1 + p0’ + p1’)u3 + (-3p0 + 3p1 - 2p0’ - p1’)u

2 + p0’u + p0

Page 41: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

2- Approximation

Approximation approaches to the representation of curves provide a smooth shape that

approximates the original points, without exactly passing through all of them.

Two approximation methods are used:

•Bezier Curves : It does not pass through the control points but only approximates the trend, Ithas only up to C1 continuity•B-spline Curves: It is also most generally an approximator; an interpolating B-Spline is alsosometimes possible. It has upto C2 continuity

Bezier Curves

B-spline curves

Page 42: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Bezier Curves

Given n+1 control points, P0, P1, P2, ….., Pn, the Bezier curve is defined by the following

polynomial of degree n

1≤≤0)()( ∑0

, uPuBuPn

i

ini

=

=

where

P(u) is any point on the curve

Pi is a control point, Pi = [xi yi zi]T

Bi,n are polynomials (serves as basis function for the Bezier Curve)

In evaluating these expressions

00 = 1

0! =1

C(n,0) = C(n,n)=1 when u and i are 0

The above equation can be expanded to give

n

n

n

n

nnn uPuunnCPuunCPuunCPuPuP +++++= )-1()1-,(.....)-1()2,()-1()1,()-1()( 1-

1-

2-2

2

1-

10

For 0 ≤ u ≤ 1)!-(!

!),(

)-1(),()( -

,

ini

ninC

uuinCuB ini

ni

=

=

Page 43: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Control

polygon

A Bezier curve is a polynomial curve approximating a control polygon

Bezier Curve Example

Page 44: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Bezier Curve Disadvantages

•Difficult to interpolate points

•Cannot locally modify a Bezier curveGlobal Modification

Local Modification

Page 45: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Composite Curves

Curves can be represented by connected segments to form a composite curve

There must be continuity at the mid-points

12

3

4

Degrees of Continuity

•Position continuity (endpoints connected)

•Gradient or slope continuity (1st derivative)

•Curvature continuity (2nd derivative)

•Higher derivatives as necessary

Page 46: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

12

3

Connected (C0 continuity)

Curve Continuity

1

2

Continuous

tangent

Tangent continuity (C1 continuity)

Continuous

curvatureCurvature continuity (C2 continuity)

12

Page 47: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

A cubic spline has C2 continuity at intermediate points

Cubic splines do not allow local control

12

3

4

Cubic polynomials

Composite Curves

Page 48: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Example: Bezier Curve

The coordinates of four control points relative to a current WCS are given by:

P0=[2 2 0]T

P1=[2 3 0]T

P2=[3 3 0]T

P3=[3 2 0]T

Find the equation of the resulting Bezier curve. Also find points on the curve for u=0, 0.25, 0.5, 1

Solution:

No. of control points (n+1) = 4

n= 3

The Bezier polynomial is given as : 1≤≤0)()( ∑0

, uPuBuPn

i

ini

=

=

P(u)= B0,3*P0 + B1,3*P1 + B2,3*P2 + B3,3*P3 …………..(1)

Evaluating the Bi,3 values using

)!-(!

!),(

)-1(),()( -

,

ini

ninC

uuinCuB ini

ni

=

=

Page 49: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

33-33

3,3

22-32

3,2

21-31

3,1

30-30

3,0

)-1()!3-3(!3

!3)(

)-1(3)-1()!2-3(!2

!3)(

)-1(3)-1()!1-3(!1

!3)(

)-1()-1()!0-3(!0

!3)(

uuuuB

uuuuuB

uuuuuB

uuuuB

==

==

==

==

Substitute the values of Bi,3 into equation (1), gives:

3

3

2

2

2

1

3

0 )-1(3)-1(3)-1()( uPuuPuuPuPuP +++=

For u=0 P(0) = [2 2 0]T

u=0.25 P(0.25)= [2.156 2.56 0]T

u=0.50 P(0.50)= [2.50 2.75 0]T

u=0.10 P(0.10)= [3 2 0]T

P1 P2

P0 P3

u=0

u=1/4

u=1/2

u=3/4

u=1

Page 50: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Generating Piecewise-Continuous Bezier Splines

P0

P1

P2

P3

P4

P5

Given control points

Page 51: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Generating Piecewise-Continuous Bezier Splines

P0

P1

P2

P3

P4

P5

Determine the slopes we want at each point.

For first point P0, let slope be P1 – P0. Similarly for last point.

For every other point Pn, its slope is Pn+1 – Pn-1.

Page 52: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Generating Piecewise-Continuous Bezier Splines

P0

P1

P2

P3

P4

P5

Add in new control points so that final spline will have C2 continuity.

For example, Pa should be P1 – 0.166667 x P1’.

Pa

Page 53: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Generating Piecewise-Continuous Bezier Splines

P0

P1

P2

P3

P4

P5

Generate cubic Bezier spline between each pair of original control points, using

the two original control points and the two new control points.

Page 54: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Generating Piecewise-Continuous Bezier Splines

P0

P1

P2

P3

P4

P5

Generate cubic Bezier spline between each pair of original control points

Page 55: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Generating Piecewise-Continuous Bezier Splines

P0

P1

P2

P3

P4

P5

Generate cubic Bezier spline between each pair of original control points

Page 56: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

B-spline Curves

Given n+1 control points P0, P1, ……., Pn, the B-spline curve of degree (k-1) defined by these

control points is given as

max

0

, ≤≤0)()( ∑ uuPuNuP i

n

i

ki=

Where

• P(u) is any point on the curve

• Pi is a control point

• Ni,k(u) are the B-spline basis functions of degree k

• The parameter k controls the degree (k-1) of the resulting B-spline curve and usually

independent of the number of control points

• It should be noted that the range of u is not 0 to 1, but it varies with the number of

control points and the degree of the curve

0 ≤ u ≤ ( (n+1) – (k-1) )

0 ≤ u ≤ n – k + 2

If k = 2, we get a linear curve

If k = 3, we get quadratic curve

If k = 4, we get cubic curve

Page 57: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

• The B-spline basis functions are given as

otherwise

uuuN

uu

uNuu

uu

uNuuuN

ii

i

iki

ki

ki

iki

ki

iki

1

1,

1

1,1

1

1,

,

≤≤

0

1

)()(

)()()(

+

++

+

+

+

=

+=

The ui are called parametric knots or knot values. These values form a sequence of non-

decreasing integers called knot vector. The point on the curve corresponding to a knot ui is

referred to as a knot point. The knot points divide a B-spline curve into curve segments.

>

<

+

+=

nj

njk

kj

kn

kju j ≤≤

2

1

0

Where: 0 ≤ j ≤ n+k

• The number of knots (n + k + 1) are needed to create a (k-1) degree curve defined by (n+1)

control points

Page 58: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Uniform Cubic B-spline

Four control points are required to define the curve for 0≤t<1 (t is the parameter)Not surprising for a cubic curve with 4 degrees of freedom

The equation looks just like a Bezier curve, but with different basis functionsAlso called blending functions - they describe how to blend the control points to make the curve

( ) ( ) ( ) ( )3

3

32

2

32

11

32

0

3

0

4,

6

13331

6

1364

6

1331

6

1

)()( ∑

tPtttPttPtttP

tBPtxi

ii

+++++++=

==

Does the curve interpolate its endpoints?

Does it lie inside its convex hull?

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

t

B0,4

B1,4 B2,4

B3,4

( )

( )

( )

( )3

3

32

2

32

11

32

0

6

1

33316

1

3646

1

3316

1)(

tP

tttP

ttP

tttPtx

+

+++

++

+=

Basis Functions

Page 59: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

The blending functions sum to one, and are positive everywhereThe curve lies inside its convex hull

The curve does not interpolate its endpoints.

There is also a matrix form for the curve:

[ ]=

10001

1333

4063

1331

6

1)(

2

3

3210t

t

t

PPPPtx

++

+=

u

uuu

uu

u

u

3

22

32

3

3331

364

)1(

6

1)(b

Blending Functions

Page 60: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

convex hull property

If we examine the cubic B-spline from the perspective of each control (data) point, each interior point contributes (through the blending functions) to four segmentsWe can rewrite p(u) in terms of the data points as

defining the basis functions {Bi(u)}

puBupii )()( ∑=

In terms of the blending polynomials

2≥

2≤1

1≤≤1

1≤2

2

0

)1(

)(

)1(

)2(

0

)(

3

2

1

0

+

+<+

+<<

<

<

+

+

=

iu

iui

iui

iui

iui

iu

ub

ub

ub

ub

uBi

Page 61: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Curve:

n+1 is the total number of control pointsd is the order of the curves, 2 ≤ d ≤ n+1Bk,d are the uniform B-spline blending functions of degree d-1Pk are the control pointsEach Bk,d is only non-zero for a small range of t values, so the curve has local control

() ()∑0

,

n

k

dkk tBPtX=

=

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

-3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

t

B0,4 B1,4 B2,4 B3,4 B4,4 B5,4 B6,4

Uniform Cubic B-spline Blending Functions

Page 62: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Computing the Curve

() ()∑0

4,

n

k

kk tBPtX=

=

0

0.05

0.1

0.15

0.2

0.25

-3

-2.7

-2.4

-2.1

-1.8

-1.5

-1.2

-0.9

-0.6

-0.3 0

0.3

0.6

0.9

1.2

1.5

1.8

2.1

2.4

2.7 3

3.3

3.6

3.9

4.2

4.5

4.8

t

P0B0,4

P1B1,4P2B2,4

P3B3,4

P4B4,4

P5B5,4

P6B6,4

The curve can’t start until there are 4 basis functions active

Page 63: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

The Advantage of Using B-spline Curves :

B-spline curves require more information (i.e., the degree of the curve and a knot vector) and a

more complex theory than Bézier curves. But, it has more advantages to offset this shortcoming.

First, a B-spline curve can be a Bézier curve.

Second, B-spline curves satisfy all important properties that Bézier curves have.

Third, B-spline curves provide more control flexibility than Bézier curves can do.

For example, the degree of a B-spline curve is separated from the number of control points.

More precisely, we can use lower degree curves and still maintain a large number of control

points.

We can change the position of a control point without globally changing the shape of the whole

curve (local modification property). Since B-spline curves satisfy the strong convex hull property,

they have a finer shape control.

Moreover, there are other techniques for designing and editing the shape of a curve such as

changing knots.

However, keep in mind that B-spline curves are still polynomial curves and polynomial curves

cannot represent many useful simple curves such as circles and ellipses. Thus, a generalization of

B-spline, NURBS, is required.

Page 64: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Hermite curves are good for single segments where you know the

parametric derivative or want easy control of it

Bezier curves are good for single segments or patches where a

user controls the points

B-splines are good for large continuous curves and surfaces

NURBS are the most general, and are good when that generality is

useful, or when conic sections must be accurately represented (CAD)

How to Choose a Spline

Page 65: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -

Summary of Free Form Curves

Page 66: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 67: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 68: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 69: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 70: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 71: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 72: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 73: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -
Page 74: Lecture (2): Geometric Modeling / Wireframe …Geometric Modeling Classification of Geometric Models: 1. Graphical Models: - 2D drafting [line, arc, circle, conics, text, symbol) -