You are on page 1of 174

Introduction to CAD/CAM

IITK ME 761A Dr. J. Ramkumar 1


• CAD can be defined as the use of computer systems to perform
certain functions in the design process.
• CAM is the use of computer systems to plan, manage and control
the operations of manufacturing plant through either direct or
indirect computer interface with the plant’s production resources.

IITK ME 761A Dr. J. Ramkumar 2


From CAM definition, the application of CAM falls into
two broad categories:
1. Computer monitoring and control .

Process data
Computer Process

Process data
Computer Process
Control signals

IITK ME 761A Dr. J. Ramkumar 3


2. Manufacturing support application .

Process data
Computer Mfg
Control signals operations

IITK ME 761A Dr. J. Ramkumar 4


The Product Cycle and CAD/CAM
In order to establish the scope and definition of CAD/CAM
in an engineering environment and identify existing and
future related tools, a study of a typical product cycle is
necessary. The following Figure shows a flowchart of such a
cycle.

IITK ME 761A Dr. J. Ramkumar 5


Typical Product Life Cycle
The Design Process
Design definitions, Collecting relevant
Design specifications, and design information
needs requirements and feasibility study
Synthesis
Analysis The CAD Process
Design documentation and Design modeling
Design Design Design
communication and simulation Design conceptualization
evaluation optimization analysis

The Manufacturing Process


Production planning
The CAM Process
Design and
procurement of new
Process planning
tools Quality control Packaging
Production Shipping
Order materials

NC, CNC, DNC


programming

Marketing

IITK ME 761A Dr. J. Ramkumar 6


• The product begins with a need which is identified based on customers'
and markets' demands.
• The product goes through two main processes from the idea
conceptualization to the finished product:
1. The design process.
2. The manufacturing process.

The main sub-processes that constitute the design process are:


1. Synthesis.
2. Analysis.

IITK ME 761A Dr. J. Ramkumar 7


Implementation of a Typical CAD Process on a
CAD/CAM system
Delineation of Design changes Design and
geometric model Analysis algorithms

Definition translator Drafting and


detailing

Geometric model
Documentation

Interface algorithms
To CAM Process
IITK ME 761A Dr. J. Ramkumar 8
CAD Tools Required to Support the Design Process

Design phase Required CAD tools


Design conceptualization Geometric modeling techniques; Graphics aids;
manipulations; and visualization
Design modeling and simulation Same as above; animation; assemblies; special
modeling packages.
Design analysis Analysis packages; customized programs and
packages.
Design optimization Customized applications; structural optimization.

Design evaluation Dimensioning; tolerances; BOM; NC.


Design communication and documentation Drafting and detailing…

IITK ME 761A Dr. J. Ramkumar 9


Implementation of a Typical CAM Process on a CAD/CAM
system
Geometric model Inspection

Interface algorithms
Assembly

Process planning Packaging

NC programs
To shipping and marketing
IITK ME 761A Dr. J. Ramkumar 10
CAM Tools Required to Support the Design Process
Manufacturing phase Required CAM tools

Process planning CAPP techniques; cost analysis;


material and tooling specification.
Part programming NC programming

Inspection CAQ; and Inspection software

Assembly Robotics simulation and


programming

IITK ME 761A Dr. J. Ramkumar 11


Definitions of CAD Tools Based on Their Constituents

Computer graphics
concepts

CAD
tools

Geometric modeling
Design tools

IITK ME 761A Dr. J. Ramkumar 12


Definition of CAD Tools Based on Their Implementation in a Design
Environment

Hardware
Design tools + Computer (control unit; display terminals; = CAD tools
I/O devices

Software (graphics;
modeling; applications
programs

IITK ME 761A Dr. J. Ramkumar 13


Definitions of CAM Tools Based on Their Constituents

Networking
concepts

CAM
tools

CAD
Mfg tools

IITK ME 761A Dr. J. Ramkumar 14


Definition of CAM Tools Based on Their Implementation in a
Manufacturing Environment

Hardware
(control unit; display terminals;
I/O devices

Mfg tools + Computer Software (CAD; NC;


= CAM tools
MRP; CAPP…)

Networking
IITK ME 761A Dr. J. Ramkumar 15
Definitions of CAD/CAM Tools Based on Their
Constituents

Mfg tools Design tools

CAD/CAM
tools Geometric
Networking modeling

Computer
graphics
concepts
IITK ME 761A Dr. J. Ramkumar 16
Definition of CAD/CAM Tools Based on Their Implementation in an
Engineering Environment

Hardware

Design and Software


+ Computer = CAD/CAM tools
Mfg tools

Networking
IITK ME 761A Dr. J. Ramkumar 17
Typical Utilization of CAD/CAM Systems in an Industrial Environment
Geometric modeling and graphics package
Process planning
Geometric modeling
of conceptual design CAPP package

Is design evaluation
Yes Are there manufacturing
No discrepancies in CAD
Possible with available
Standard software? databases?
Design
package Yes
Develop customized No
Design testing
programs and packages
And evaluation NC programming NC
package

Programming
No Is final design package
Applicable? Machining

Yes
Inspection
Drafting Inspection
And Robotics
Assembly package
Documentation IITK ME 761A Dr. J. Ramkumar 18
Automation and CAD/CAM
Automation can be defined as the technology concerned
with the application of complex mechanical, electronic,
and computer-based systems in the operation and control
of manufacturing systems.

IITK ME 761A Dr. J. Ramkumar 19


Types of Manufacturing Systems
1. Continuous-flow processes. Continuous dedicated production of large amount of bulk
product. Continuous manufacturing is represented by chemicals, plastics, petroleum, and
food industries.
2. Mass production of discrete products. Dedicated production of large quantities of one
product (with perhaps limited model variations). Examples include automobiles,
appliances and engine blocks.
3. Batch production. Production of medium lot sizes of the same product. The lot may be
produced once or repeated periodically. Examples: books, clothing and certain industrial
machinery.
4. Job-shop production. Production of low quantities, often one of a kind, of specialized
products. The products are often customized and technologically complex. Examples:
prototypes, aircraft, machine tools and other equipment.

IITK ME 761A Dr. J. Ramkumar 20


Continuous-flow
production
Mass production

Production Batch production


quantity

Job shop
production

Product variety

IITK ME 761A Dr. J. Ramkumar 21


Category Automation achievements
Continuous-flow process •Flow process from beginning to end
•Sensors technology available to measure important process
variables
•Use of sophisticated control and optimization strategies
•Fully computer automated lines
Mass production of discrete products •Automated transfer machines
•Dial indexing machines
•Partially and fully automated assembly lines
•Industrial robots for spot welding, part handling, machine
loading, spray painting, etc.
•Automated material handling systems
•Computer production monitoring
Batch production •Numerical control (NC), direct numerical control (DNC),
computer numerical control (CNC).
•Adaptive control machining
•Robots for arc welding, parts handling, etc.
•CIM systems.

Job shop production •Numerical control, computer numerical control


IITK ME 761A Dr. J. Ramkumar 22
Computer Technology in Automation

Most of the automated production systems implemented today make use of


computers. CAD/CAM in addition to its particular emphasis on the use of
computer technology, is also distinguished by the fact that it includes not only the
manufacturing operations but also the design and planning functions that precede
manufacturing.

To emphasize the differences in scope between automation and CAD/CAM,


consider the following mathematical model:

IITK ME 761A Dr. J. Ramkumar 23


TTlc = BQT1 + BT2 + T3
TTcl = total time during the product life cycle
B = The number of batches produced throughou t the product life cycle.
Q = The number of units produced in each batch.
T1 = The time required to produce one unit of product.
T2 = The time associated with planning and setting up for
each batch of production .
T3 = The time required for designing the product and for all the other
activities that are accomplish ed once for each different product .
Tlc = The average time spent on each unit of product
T2 T3
during its life cycle = T1 + +
Q BQ
IITK ME 761A Dr. J. Ramkumar 24
T1 The most important term in mass production and batch
production

T2 & T3 become very important in job shop


manufacturing.
Automation technology is concerned with reducing
T1 &T2the with emphasis on the unit production time
T1
CAD/CAM concerned with reducing all three terms, but is perhaps
focused on terms. The emphasis in CAD/CAM includes
the design and planning function of the product
T2 & lifeTcycle.
3

IITK ME 761A Dr. J. Ramkumar 25


Advantages of CAD/CAM systems
• Greater flexibility. • Better product design.
• Reduced lead times. • Greater manufacturing control.
• Reduced inventories. • Supported integration.
• Increased Productivity. • Reduced costs.
• Improved customer service. • Increased utilization.
• Improved quality. • Reduction of machine tools.
• Improved communications with • Less floor space.
suppliers.

IITK ME 761A Dr. J. Ramkumar 26


Introduction to Geometric Transformation

• Computer graphics plays an important role in the product


development process by generating, presenting, and
manipulating geometric models of objects.
• During the product development process, for proper
understanding of designs, it is necessary not only to generate
geometric models of objects but also to perform such
manipulations on these objects as rotation, translation and
scaling.

IITK ME 761A Dr. J. Ramkumar 27


Introduction to Geometric transformation
• Essentially, computer graphics is concerned with generating, presenting and
manipulating models of an object and its different views using computer hardware,
software and graphic devices.
• Usually the numerical data generated by a computer at very high speeds is hard to
interpret unless one represents the data in graphic format and it is even better if the
graphic can be manipulated to be viewed from different sides, enlarged or reduced
in size.
• Geometric transformation is one of the basic techniques that is used to accomplish
these graphic functions involving scale change, translation to another location or
rotating it by a certain angle to get a better view of it.

IITK ME 761A Dr. J. Ramkumar 28


2D Transformations

IITK ME 761A Dr. J. Ramkumar 29


Rotation About the Origin
y-axis

To rotate a line or polygon, we must rotate each of


(x2,y2)
its vertices.
(x1,y1)

To rotate point (x1,y1) to point (x2,y2) we observe: B


r

From the illustration we know that: (0,0)


x-axis

sin (A + B) = y2/r cos (A + B) = x2/r


sin A = y1/r cos A = x1/r

IITK ME 761A Dr. J. Ramkumar 30


Rotation About the Origin
From the double angle formulas: sin (A + B) = sinAcosB + cosAsinB
cos (A + B)= cosAcosB - sinAsinB

Substituting: y2/r = (y1/r)cosB + (x1/r)sinB

Therefore: y2 = y1cosB + x1sinB

We have x2 = x1cosB - y1sinB


y2 = x1sinB + y1cosB

P2 = R P1 .

(x2) (cosB -sinB) (x1)


(y2) = (sinB cosB) (y1)

IITK ME 761A Dr. J. Ramkumar 31


Translations
Moving an object is called a translation. We translate a point by adding to the x and y coordinates,
respectively, the amount the point should be shifted in the x and y directions. We translate an
object by translating each vertex in the object.

P2 = P 1 + T
Ty

P1 = ( x1 ) T = ( tx )
Tx ( y1 ) ( ty )

P2 = (x1 + tx)
(y1 + ty)

IITK ME 761A Dr. J. Ramkumar 32


Scaling
Changing the size of an object is called a scale. We scale an object by scaling the x and y coordinates
of each vertex in the object.

.
P2 = S P1

S = (sx 0) P1 = ( x1 )
(0 sy) ( y1 )

P2 = (sxx1)
(syy1)

IITK ME 761A Dr. J. Ramkumar 33


Homogeneous Coordinates
Although the formulas we have shown are usually the most efficient way to implement programs to
do scales, rotations and translations, it is easier to use matrix transformations to represent and
manipulate them.

In order to represent a translation as a matrix operation we use 3 x 3 matrices and pad our points to
become 1 x 3 matrices.

cos ø -sin ø 0
Rø = sin ø cos ø 0
(x)
0 0 1 Point P = (y)
(1)
Sx 0 0
S = 0 Sy 0
0 0 1

1 0 Tx
T = 0 1 Ty
0 0 1
34
IITK ME 761A Dr. J. Ramkumar
Composite Transformations - Scaling
Given our three basic transformations we can create other transformations.

Scaling with a fixed point


A problem with the scale transformation is that it also moves the object being scaled.

Scale a line between (2, 1) (4,1) to twice its length.


(2 0 0) =
(0 1 0) (2) (4)
(0 0 1) (1) (1)
(1) (1)
(2 0 0) =
(0 1 0) (4) (8)
Bef ore
(0 0 1) (1) (1)
(1) (1) Afte r

0 1 2 3 4 5 6 7 8 9 10

IITK ME 761A Dr. J. Ramkumar 35


Composite Transforms - Scaling (cont.)
If we scale a line between (0, 1) (2,1) to twice its length, the left-hand endpoint does not move.

(2 0 0) =
(0 1 0) (0) (0)
(0 0 1) (1) (1)
(1) (1)
(2 0 0) =
(0 1 0) (2) (0)
(0 0 1) (1) (1) Bef ore

(1) (1) Afte r

0 1 2 3 4 5 6 7 8 9 10

(0,0) is known as a fixed point for the basic scaling transformation. We can used composite
transformations to create a scale transformation with different fixed points.

IITK ME 761A Dr. J. Ramkumar 36


Fixed Point Scaling
Scale by 2 with fixed point = (2,1)
• Translate the point (2,1) to the origin
• Scale by 2
• Translate origin to point (2,1)

(1 0 2) (2 0 0) (1 0 -2) = (2 0 -2)
(0 1 1) (0 1 0) (0 1 -1) (0 1 0)
(0 0 1) (0 0 1) (0 0 1) (0 0 1)

(2 0 -2) (2)= (2)


(0 1 0) (1) (1)
(0 0 1) (1) (1) Bef ore

Afte r
(2 0 -2) (4)= (6)
(0 1 0) (1) (1)
(0 0 1) (1) (1) 0 1 2 3 4 5 6 7 8 9 10

IITK ME 761A Dr. J. Ramkumar 37


More Fixed Point Scaling
Scale by 2 with fixed point = (3,1)
• Translate the point (3,1) to the origin
• Scale by 2
• Translate origin to point (3,1)

(1 0 3) (2 0 0) (1 0 -3) = (2 0 -3)
(0 1 1) (0 1 0) (0 1 -1) (0 1 0)
(0 0 1) (0 0 1) (0 0 1) (0 0 1)

(2 0 -3) =
(2) (1)
Bef ore
(0 1 0) (1) (1)
Afte r
(0 0 1) (1) (1)

(2 0 -3) =
(4) (5) 0 1 2 3 4 5 6 7 8 9 10
(0 1 0) (1) (1)
(0 0 1) (1) (1)
IITK ME 761A Dr. J. Ramkumar 38
Rotation about a Fixed Point
Rotation of ø Degrees About Point (x,y)
• Translate (x,y) to origin
• Rotate
• Translate origin to (x,y)

(x,y) (x,y)

(1 0 x) (cosø -sinø 0)(1 0 -x) (cosø -sinø -xcosø + ysinø + x )


(0 1 y) (sinø cosø 0)(0 1 -y) = (sinø cosø -xsinø - ycosø + y )
(0 0 1) (0 0 1)(0 0 1) (0 0 1 )

You rotate the box by rotating each vertex.


IITK ME 761A Dr. J. Ramkumar 39
Shears

Original Data y Shear x Shear

1 0 0 1 b 0
a 1 0 0 1 0
0 0 1 0 0 1

GRAPHICS --> x shear --> GRAPHICS

IITK ME 761A Dr. J. Ramkumar 40


Reflections
Reflection about the y-axis Reflection about the x-axis

-1 0 0 1 0 0
0 1 0 0 -1 0
0 0 1 0 0 1

IITK ME 761A Dr. J. Ramkumar 41


More Reflections
Reflection about the origin Reflection about the line y=x

-1 0 0 0 1 0
0 -1 0 1 0 0
0 0 1 0 0 1

IITK ME 761A Dr. J. Ramkumar 42


Concatenation of Transformations

• Concatenating
– affine transformations by multiplying together
– sequences of the basic transformations
➔ define an arbitrary transformation directly
– ex) three successive transformations

p1 p2
p A B C q

p1 = Ap q = (C(B(Ap ))) = CBAp CBA


p2 = Bp1
q = Cp2 M = CBA
q = CBp1 q = Mp p M q
q = CBAp
43
IITK ME 761A Dr. J. Ramkumar
Matrix Concatenation Properties

• Associative properties
M1  M2  M3 = M1  (M2  M3 ) = (M1  M2 )  M3

• Transformation is not commutative


– Order of transformation may affect transformation position

IITK ME 761A Dr. J. Ramkumar 44


Two-dimensional composite transformation (1)

• Composite transformation
– A sequence of transformations
– Calculate composite transformation matrix rather than applying individual transformations

P' = M2  M1  P
• CompositeP'= MP
two-dimensional translations
– Apply two successive translations, T1 and T2

T1 = T (t1x , t1 y )
T2 = T (t 2 x , t 2 y )
= T2  (T1  P)matrix
P' transformation
– Composite = (Tin2 coordinate
T1 )  P form

T(t 2 x , t 2y )  T(t1x , t1y ) = T(t1x + t 2 x , t1y + t 2 y )

IITK ME 761A Dr. J. Ramkumar 45


Two-dimensional composite transformation (2)

• Composite two-dimensional rotations


– Two successive rotations, R1 and R2 into a point P
P' = R(1 )  {R( 2 )  P}
P' = {R(1 )  R( 2 )}  P

– Multiply two rotation matrices to get composite transformation matrix


R(1 )  R( 2 ) = R(1 +  2 )
P' = R(1 +  2 )  P
• Composite two-dimensional scaling
S(s1x , s1y )  S(s 2 x , s 2 y ) = S(s1x  s 2 x , s1y  s 2 y )
P' = S(s1x  s 2 x , s1y  s 2 y )  P

IITK ME 761A Dr. J. Ramkumar 46


Two-dimensional composite transformation (3)

• General two-dimensional Pivot-point rotation


– Graphics package provide only origin rotation
– Perform a translate-rotate-translate sequence
• Translate the object to move pivot-point position to origin
• Rotate the object
• Translate the object back to the original position

– Composite ( coordinates
r , y r )  Rin
T( x matrix ) = R( x r , y r , )
)  T( − x r ,− y rform

IITK ME 761A Dr. J. Ramkumar 47


Two-dimensional composite transformation (4)

• Example of pivot-point rotation

IITK ME 761A Dr. J. Ramkumar 48


Pivot-Point Rotation

(xr,yr) (xr,yr) (xr,yr) (xr,yr)

Translate Rotate Translate

T (xr , yr )  R( )  T (− xr ,− yr ) = R(xr , yr , )


1 0 x r  cos  − sin  0 1 0 − x r  cos  − sin  x r (1 − cos ) + y r sin  
0 1 y r    sin  cos 0  0 1 − y r  =  sin  cos  y r (1 − cos  ) − x r sin  

0 0 1   0 0 1 0 0 1   0 0 1 

IITK ME 761A Dr. J. Ramkumar 49


General Fixed-Point Scaling

(xr,yr) (xr,yr) (xr,yr) (xr,yr)

Translate Scale Translate

T (x f , y f ) S (sx , s y ) T (− x f ,− y f ) = S (x f , y f , sx , s y )
1 0 x f  s x 0 0 1 0 − x f  s x 0 x f (1 − s x ) 
0 1 yf   0 sy 0  0 1 − yf  = 0 sy y f (1 − s y ) 
       

0 0 1  0 0 1
  0 0 1   0 0 1 

IITK ME 761A Dr. J. Ramkumar 50
Two-dimensional composite transformation (7)

• General two-dimensional scaling directions


– Perform a rotate-scaling-rotate sequence
– Composite matrix in coordinates form
R −1( )  S( s1, s 2 )  R( )
s1 cos 2  + s 2 sin2  ( s 2 − s1 ) cos sin 0
 
=  ( s 2 − s1 ) cos sin s1 sin2  + s 2 cos 2  0
 0 0 1
 
s1


s2
IITK ME 761A Dr. J. Ramkumar 51
General Scaling Directions
• Converted to a parallelogram
y y
(1/2,3/2) (2,2)
(0,1) (1,1)

(3/2,1/2)
(0,0) (1,0) x (0,0) x

Scale
 s1 cos 2  + s2 sin 2  ( s2 − s1 ) cos sin  0 y s2
 
R −1 ( )  S ( s1 , s2 )  R ( ) =  ( s2 − s1 ) cos sin  s1 sin 2  + s2 cos 2  0
 0 0 1 xs
 1

IITK ME 761A Dr. J. Ramkumar 52


General Rotation (1/2)
• Three successive rotations about the three axes

rotation of a cube about the z axis rotation of a cube about the y axis

?
rotation of a cube about the x axis
53
IITK ME 761A Dr. J. Ramkumar
General Rotation (2/2)
R = Rx R y Rz

1 0 0 0  cos  0 sin  0 cos  − sin  0 0


0 cos  − sin  0  0 1 0 0  sin  cos  0 0
   
0 sin  cos  0 − sin  0 cos  0  0 0 1 0
   
0 0 0 1  0 0 0 1  0 0 0 1

IITK ME 761A Dr. J. Ramkumar 54


Examples

IITK ME 761A Dr. J. Ramkumar 55


IITK ME 761A Dr. J. Ramkumar 56
IITK ME 761A Dr. J. Ramkumar 57
3D Transformation
◼ A 3D point (x,y,z) – x,y, and z coordinates
◼ We will still use column vectors to represent points
◼ Homogeneous coordinates of a 3D point
(x,y,z,1)
◼ Transformation will be performed using 4x4 matrix

x
z
58
Right-handed Coordinate System
x  y = z; y  z = x; z  x = y

x
z Left hand coordinate system
Not used in this class and
Not in OpenGL
59/94
3D Transformation
◼ Very similar to 2D transformation

◼ Translation transformation
 x   1 0 0 t x  x 
    
 y   0 1 0 t y  y 
 z  =  0 0 1 t x  z 
    
 1  0 1  1 
   0 0

Homogenous coordinates

60
3D Transformation
◼ Very similar to 2D transformation

◼ Scaling transformation
 x   s x 0 0 0  x 
    
 y   0 sy 0 0  y 
 z  =  0 0 sz 0  z 
    
1 0 1  1 
   0 0

Homogenous coordinates

61
3D Transformation
◼ 3D rotation is done around a rotation axis
◼ Fundamental rotations – rotate about x, y, or z axes
◼ Counter-clockwise rotation is referred to as positive rotation
(when you look down negative axis)

+ x
z

62
3D Transformation
◼ Rotation about z – similar to 2D rotation
x' = x cos  − y sin 
y ' = x sin  + y cos 
z' = z

 x   cos  − sin  0 0  x  y
    
 y   sin  cos  0 0  y 
 z  =  0 0 1 0  z 
     +
1  0 1  1 
x
   0 0 z

63
3D Transformation
◼ Rotation about y: z -> y, y -> x, x->z
z

z ' = z cos  − x sin 


x' = z sin  + x cos  y
x
y' = y

 x   cos  0 sin  0  x  y
    
 y   0 1 0 0  y 
 z   =  − sin  0 cos  0  z 
    
1  0 1  1 
x
   0 0 z

64
3D Transformation
◼ Rotation about x (z -> x, y -> z, x->y)
x

y ' = y cos  − z sin 


z ' = y sin  + z cos  z
y
x' = x

 x   1 0 0 0  x  y
    
 y   0 cos  − sin  0  y 
 z  =  0 sin  cos  0  z 
    
 1  0 1  1 
x
   0 0 z

65
Inverse of 3D Transformations
◼ Invert the transformation
◼ In general, X= AX’->x’=A-1X
 x  1 − t x  x' 
 x   1 0 0 t x  x    
0 0
 
      y 0 1 0 − t y  y ' 
 y   0 1 0 t y  y   z  = 0
 z  =  0 − t x  z ' 
t x  z 
0 1
0 1     
      1  0 1   
 1  0    0 0  1 
   0 0 1  
 1 
T(tx,ty,tz) T(-tx,-ty,-tz)

 x   cos  − sin  0  x   x   cos  sin  0 0  x' 


  
0
      
 y   sin  cos  0 0  y   y   − sin  cos  0 0  y ' 
 z  =  0 z = 0 0  z ' 
0 1 0  z    
0 1
 
     1  0
1  0 1  1     0 0 1  1 
   0 0

Rz ( − )
Rz ( )
3D Rotation about Arbitrary Axes

◼ Rotate p about the by the
r angle 

r
z
p = ( x, y, z )

67
3-D Rotation
◼ General rotations in 3-D require rotating about an arbitrary
axis of rotation

◼ Deriving the rotation matrix for such a rotation directly is a


good exercise in linear algebra

◼ The general rotation matrix is a combination of coordinate-


axis rotations and translations!

68
3D Rotation about Arbitrary Axes

◼ Rotate p about the by the
r angle 

r
z
p = ( x, y, z )

69
3-D Rotation
◼ General rotations in 3-D require rotating about an arbitrary
axis of rotation

◼ Deriving the rotation matrix for such a rotation directly is a


good exercise in linear algebra

◼ Standard approach: express general rotation as composition


of canonical rotations
◆ Rotations about x, y, z

70
Composing Canonical Rotations
◼ Goal: rotate about arbitrary vector r by θ
◆ Idea: we know how to rotate about x,y,z

⧫ Set up a transformation that superimposes rotation axis onto


one coordinate axis
⧫ Rotate about the coordinate axis

⧫ Translate and rotate object back via inverse of the


transformation matrix

71
Composing Canonical Rotations
◼ Goal: rotate about arbitrary vector r by θ
◆ Idea: we know how to rotate about x,y,z

⧫ So, rotate about z by - until r lies in the xz plane


⧫ Then rotate about y by -β until r coincides with +z

⧫ Then rotate about z by θ

⧫ Then reverse the rotation about y (by β )

⧫ Then reverse the rotation about z (by )

72
3D Rotation about Arbitrary Axes

◼ Rotate p about the by the
r angle 

r
z
p = ( x, y, z )

73
3D Rotation about Arbitrary Axes
◼ Translate so that rotation axis passes through the origin

r
z

x
T −1 Rz ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
74
3D Rotation about Arbitrary Axes
◼ Rotation by −  z-axis
about

z

r

y

x
T −1 Ry ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
75
3D Rotation about Arbitrary Axes
◼ Rotation by −  y-axis
about

z

r 

x
T −1 Ry ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
76
3D Rotation about Arbitrary Axes
◼ Rotation by  z-axis
about

z

r

x
T −1 Ry ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
77
3D Rotation about Arbitrary Axes
◼ Rotation by  y-axis
about

z

r 

x
T −1 Ry ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
78
3D Rotation about Arbitrary Axes
◼ Rotation by  z-axis
about

z

r

y

x
T −1 Rz ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
79
3D Rotation about Arbitrary Axes
◼ Translate the object back to original point

r
z

y

x
T −1 Rz ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
80
3D Rotation about Arbitrary Axes
◼ Final transformation matrix for rotating about an arbitrary
axis 
r
z

y

x
T −1 Rz ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
81
3D Rotation about Arbitrary Axes
◼ Final transformation matrix for rotating about an arbitrary
axis 
r
z

y

x
T −1 Rz ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T
82
3D Rotation about Arbitrary Axes
◼ Final transformation matrix for rotating about an arbitrary
axis

T −1 Rz ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T

 r11 r12 r13 0


 
 r21 r22 r23 0
=
r r32 r33 0
 31 
0 0 0 1
3D Rotation about Arbitrary Axes
◼ Final transformation matrix for rotating about an arbitrary
axis

T −1 Rz ( ) Ry (  ) Rz ( ) Ry (−  ) Rz (− )T

 r11 r12 r13 0


 
 r21 r22 r23 0
=
r r32 r33 0
 31 
0 0 0 1

A 3 by 3 Rotation matrix—orthogonal matrix


Rotation Matrices
◼ Orthonormal matrix:
◆ orthogonal (columns/rows linearly independent)

◆ normalized (columns/rows length of 1)

85
Rotation Matrices
◼ Orthonormal matrix:
◆ orthogonal (columns/rows linearly independent)

◆ normalized (columns/rows length of 1)

◼ The inverse of an orthogonal matrix is just its transpose:

−1 T
 r11 r12 r13   r11 r12 r13 
   
 r21 r22 r23  =  r21 r22 r23 
r r33  r r33 
 31 r32  31 r32
86
Rotation Matrices
◼ Orthonormal matrix:
◆ orthogonal (columns/rows linearly independent)

◆ normalized (columns/rows length of 1)

◼ The inverse of an orthogonal matrix is just its transpose:

−1 T
 r11 r12 r13   r11 r12 r13 
   
 r21 r22 r23  =  r21 r22 r23 
r r33  r r33 
 31 r32  31 r32
87
Examples

IITK ME 761A Dr. J. Ramkumar 93


IITK ME 761A Dr. J. Ramkumar 94
IITK ME 761A Dr. J. Ramkumar 95
Examples

IITK ME 761A Dr. J. Ramkumar 96


IITK ME 761A Dr. J. Ramkumar 97
IITK ME 761A Dr. J. Ramkumar 98
IITK ME 761A Dr. J. Ramkumar 99
IITK ME 761A Dr. J. Ramkumar 100
IITK ME 761A Dr. J. Ramkumar 101
IITK ME 761A Dr. J. Ramkumar 102
IITK ME 761A Dr. J. Ramkumar 103
IITK ME 761A Dr. J. Ramkumar 104
IITK ME 761A Dr. J. Ramkumar 105
IITK ME 761A Dr. J. Ramkumar 106
IITK ME 761A Dr. J. Ramkumar 107
IITK ME 761A Dr. J. Ramkumar 108
IITK ME 761A Dr. J. Ramkumar 109
Splines and Bezier Curves

IITK ME 761A Dr. J. Ramkumar 110


• |Representing Curves
– A number of small line-segments joined
• Interpolation
• Parametric equations
• Types of curve we study
– Natural Cubic Splines and Bezier Curves
• Derivation
• Implementation
IITK ME 761A Dr. J. Ramkumar 111
“Computers can’t draw curves.”

The more points/line segments


that are used, the smoother the
curve.

IITK ME 761A Dr. J. Ramkumar 112


Why have curves ?
• Representation of “irregular surfaces”
• Example: Auto industry (car body design)
– Artist’s representation
– Clay / wood models
– Digitizing
– Surface modeling (“body in white”)
– Scaling and smoothening
– Tool and die Manufacturing

IITK ME 761A Dr. J. Ramkumar 113


Curve representation
• Problem: How to represent a curve easily and efficiently
• “Brute force and ignorance” approaches:
• storing a curve as many small straight line segments
– doesn’t work well when scaled
– inconvenient to have to specify so many points
– need lots of points to make the curve look smooth
• working out the equation that represents the curve
– difficult for complex curves
– moving an individual point requires re-calculation of the entire curve

IITK ME 761A Dr. J. Ramkumar 114


Solution - Interpolation
•Define a small number of points

•Use a technique called “interpolation” to


invent the extra points for us.

•Join the points with a series of (short)


straight lines

IITK ME 761A Dr. J. Ramkumar 115


The need for smoothness
• So far, mostly polygons
• Can approximate any geometry, but
– Only approximate
– Need lots of polygons to hide discontinuities
• Storage problems
– Math problems
• Normal direction
• Texture coordinates
– Not very convenient as modeling tool
• Gets even worse in animation
– Almost always need smooth motion

IITK ME 761A Dr. J. Ramkumar 116


Geometric modeling
• Representing world geometry in the computer
– Discrete vs. continuous again
• At least some part has to be done by a human
– Will see some automatic methods soon
• Reality: humans are discrete in their actions
• Specify a few points, have computer create something which
“makes sense”
– Examples: goes through points, goes “near” points

IITK ME 761A Dr. J. Ramkumar 117


Requirements
• Want mathematical smoothness
– Some number of continuous derivatives of P
• Local control
– Local data changes have local effect
• Continuous with respect to the data
– No wiggling if data changes slightly
• Low computational effort

IITK ME 761A Dr. J. Ramkumar 118


A solution
• Use SEVERAL polynomials
• Complete curve consists of several pieces
• All pieces are of low order
– Third order is the most common
• Pieces join smoothly
• This is the idea of spline curves
– or just “splines”

IITK ME 761A Dr. J. Ramkumar 119


Parametric Equations - linear
Walk from P0 to P1 at a constant
speed.
P1 x1,y1
(13,8) Start from P0 at t=0
(7.5,4)
dy
Arrive at P1 at t=1
P0
dx = x1 - x0
dx
x0 ,y0
(2,3) dy = y1 - y0
Where are you at a general time t?
x(t) = x0 + t.dx
Equation(s) of a straight line as a y(t) = y0 + t.dy
function of an arbitrary parameter
t. IITK ME 761A Dr. J. Ramkumar 120
Why use parametric equations?
• One, two, three or n-dimensional representation is
possible
• Can handle “infinite slope” of tangents
• Can represent multi-valued functions

IITK ME 761A Dr. J. Ramkumar 122


• Natural Cubic Spline
• Bezier Curves

IITK ME 761A Dr. J. Ramkumar 123


Splines
• Define the “knots”
– (x0,y0) - (x3,y3)
• Calculate all other points

spline

knots

IITK ME 761A Dr. J. Ramkumar 124


Continuity
• Parametric continuity Cx
– Only P is continuous: C0
• Positional continuity
– P and first derivative dP/du are continuous: C1
• Tangential continuity
– P + first + second: C2
• Curvature continuity
• Geometric continuity Gx
– Only directions have to match

IITK ME 761A Dr. J. Ramkumar 125


Order of continuity

G (0) C (0) 0 th order continuity

(a)

G (1) C (1) 1st order continuity

(b)

( 2) ( 2) 2nd order continuity


G C

(c)

IITK ME 761A Dr. J. Ramkumar 126


Wiggling effect
• Example:
– Four data points
– Third degree polynomial
– Might look something like:
• This the ONLY third degree polynomial which fits the
data
• Wiggling gets much worse with higher degree

IITK ME 761A Dr. J. Ramkumar 127


Polynomial parametric equations
• To represent a straight line -
linear parametric equation (i.e.
one where the highest power of t
was 1).
• For curves, we need polynomial
equations. Why? Because the
graphs of polynomial equations
wiggle!

IITK ME 761A Dr. J. Ramkumar 128


Natural Cubic Spline
• spline, n. 1 A long narrow and relatively thin piece or strip
of wood, metal, etc. 2 A flexible strip of wood or rubber
used by draftsmen in laying out broad sweeping curves,
as in railroad work.

• A natural spline defines the curve that minimizes the


potential energy of an idealized elastic strip.

IITK ME 761A Dr. J. Ramkumar 129


• A natural cubic spline defines a curve, in which the points
P(u) that define each segment of the spline are
represented as a cubic P(u) = a0 + a1u + a2u2 + a3u3
• Where u is between 0 and 1 and a0, a1, a2 and a3 are (as
yet) undetermined parameters.
• We assume that the positions of n+1 control points Pk,
where k = 0, 1,…, n are given, and the 1st and 2nd
derivatives of P(u) are continuous at each interior control
point.

IITK ME 761A Dr. J. Ramkumar 130


Why cubic?
• Undesirable wiggles and oscillations for higher orders

• The lowest order polynomials to satisfy the following conditions

Caution! Heavy math ahead!

IITK ME 761A Dr. J. Ramkumar 132


Parameterization
Q(u )

umin u0
un
u u1 u n −1
u max
u2
A parametrically defined curve

u min = u0  u1    u n −1  u n = u max
 x (u )  (u0 , u1 ,  , u n −1 , u n )
Q (u ) = 
 y (u )  knot sequence
 z (u ) 
 knot vector
 
If ui = i, then uniform knot sequence

IITK ME 761A Dr. J. Ramkumar 133


“Re-parameterization”
Ym (u )

Y1 (u ) Y (u )

Y0 (u )
Y2 (u )

u0 u1 u2 u3 u i u i +1 um

i i +1

Y (u ), ui  u  ui+1 non-uniform
u − ui
Yi (u ) = Y ( ), i = 0,1, 2,, n
ui+1 − ui
0  u 1

IITK ME 761A Dr. J. Ramkumar 134


Interpolation versus Approximation
V0 V6
V1 V5

Interpolation
V3

V2 V4

Approximation V4
V3

V0

V6
V2 V5
V1

IITK ME 761A Dr. J. Ramkumar 135


Hermite Interpolation Y5 (u )
y6
Y0 (u ) Y (u ) y3 y5
y0
y1
y2 y4


  u
u =0 1 2 3 4 5 u =6

Yi (u ) = ai + bi u + ci u 2 + d i u 3
0  u  1 i = 0,...,5

 Yi ( 0) = ai ≡ yi ai = yi

 Y (1) = a + b + c + d ≡ y
 i i i i i i +1 bi = Di
 Yi (1) (0) = bi ≡ Di ci = 3( yi +1 − yi ) − 2 Di − Di +1

 Y (1) (1) = b + 2c + 3d ≡ D d i = 2( yi − yi +1 ) + Di + Di +1
 i i i i i +1

IITK ME 761A Dr. J. Ramkumar 136


Hermite Spline
• Say the user provides x0 , x1 , x0 , x1
• A cubic spline has degree 3, and is of the form:
x = at 3 + bt 2 + ct + d
– 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

IITK ME 761A Dr. J. Ramkumar 137


How to specify slope Di
(1) Pi +1
y i −1 Pi
yi +1
Pi −1
yi

Computing D i automatically
e.g.fitting a parabola through yi-1 , yi , and yi +1

(2)  (y i − yi −1 ) + (1 −  )( yi +1 − yi )
weighted avrage 0    1

(3) specifyingdirectly

IITK ME 761A Dr. J. Ramkumar 138


Hermite Spline
A Hermite spline is a curve for which the user provides:
– The endpoints of the curve
– The 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

IITK ME 761A Dr. J. Ramkumar 139


Hermite Spline
• Solving for the unknowns gives:
a = −2 x1 + 2 x0 + x1 + x0
b = 3x1 − 3x0 − x1 − 2 x0
c = x0
d = x0

• Rearranging gives:
x = x1 ( −2t 3 + 3t 2 ) or − 2 3 0 0  t 3 
 2  
+ x0 ( 2t 3 − 3t 2 + 1) −3 0 1  t 2 
x = x1 x0 x1 x0  
+ x1 (t 3 − t 2 )  1 −1 0 0  t 
+ x0 (t 3 − 2t 2 + t )   
 1 −2 1 0  1 

IITK ME 761A Dr. J. Ramkumar 140


Hermite curves in 2D and 3D
• We have defined only 1D splines:
x = f(t:x0,x1,x’0,x’1)
• For higher dimensions, define the control points in higher
dimensions (that is, as vectors)

− 2 3 0 0  t 3 
 x   x1 x1 x0    2
1
x0
 y =  y  2 −3 0  t 
   1 y0 y1 y0  
 1 −1 0 0  t 

z   z1 z0 z1 z0 
 1  
 −2 1 0 1 
IITK ME 761A Dr. J. Ramkumar 141
Basis Functions
• A point on a Hermite curve is obtained by multiplying each control
point by some function and summing
• The functions are called basis functions

1.2

0.8

0.6 x1
x0
0.4

x'1
0.2
x'0
0

-0.2

-0.4

IITK ME 761A Dr. J. Ramkumar 142


Hermite and Cubic Spline Interpolation

V0 V6
V1 V5

V3

V2 V4

An interpolating cubic spline

Qi (u ) = ( xi (u ), yi (u ))
Vi = ( xi , y i )

IITK ME 761A Dr. J. Ramkumar 143


Spline Interpolation
C ( 2 ) continuity at joints (knots) Ym−1 (u )
 ym
Y0 (u ) Y (u ) yi
y0
y1 Y (u )
1
yi +1
y2
Yi −1 (1) = yi
Yi (0) = yi
4m − 4
Yi −(11) (1) = Yi (1) (0)
Yi −( 21) (1) = Yi ( 2 ) (0) 1  i  m −1

need two more Eq’s to determine all coefficients


Y0 (0) = y0 2 note : Yi (u) = ai + bi u + ci u 2 + di u 3 0  i  m − 1
Ym −1 (1) = ym
Y0( 2 ) (0) = 0
Ym( 2−1) (1) = 0

Natural Spline
IITK ME 761A Dr. J. Ramkumar 144
Deriving Natural Cubic Splines
(4)  2ci −1 + 6d i −1 = 2ci
yi = ai + bi t + ci t 2 + di t 3
(1) Yi −1 (1) = yi ai = yi
(2) Yi (0) = yi bi = Di
1  i  m −1
(3) Yi −(11) (1) = Yi (1) (0) ci = 3( yi +1 − yi ) − 2 Di − Di +1
(4) Yi −( 21) (1) = Yi ( 2 ) (0) d i = 2( yi − yi +1 ) + Di + Di +1
(5) Y0 (0) = y0
(6) Ym −1 (1) = ym By substitution and simplification,
(7) Y0( 2 ) (0) = 0 Di −1 + 4 Di + Di +1 = 3( yi +1 − yi −1 )
1  i  m −1
(8) Ym( 2−1) (1) = 0
Applying end - conditions
From (7),
2c0 = 0
By substituti on and simplifica tion,
2 D0 + D1 = 3( y1 − y0 )
Similarly, from (8)
Dm −1 + 2 Dm = 3( ym − ym −1 ) 145

IITK ME 761A Dr. J. Ramkumar


Tri-Diagonal Matrix for Natural Cubic Spline

2 1   D0   3( y1 − y0 ) 
1 4 1   D   3( y − y ) 
  1   2 0 
 1 4 1      
    
 1 4 1   =
   
 . . . .      
    
 1 4 1     3( y m − y m − 2 ) 

 1 2  Dm   3( y m − y m −1 ) 

IITK ME 761A Dr. J. Ramkumar 146


Closed Curves Pi

P2

P0
P1 Pm

Di −1 + 4 Di + Di +1 = 3( yi +1 − yi −1 )

4 1 1   D0   3( y1 − y m ) 
1 4 1   D   3( y − y ) 
  1   2 0 
 1 4 1      
    
 1 4 1   =
   
 . . . .      
    
 1 4 1     3 ( y m − y m−2 
)
1
 1 4  Dm   3( y0 − y m −1 ) 

IITK ME 761A Dr. J. Ramkumar 147


Examples

IITK ME 761A Dr. J. Ramkumar 148


149
IITK ME 761A Dr. J. Ramkumar
Exercise

IITK ME 761A Dr. J. Ramkumar 150


Bezier Curves
• An alternative to splines

• M. Bezier was a French mathematician who worked for the Renault


motor car company.

• He invented his curves to allow his firm’s computers to describe the


shape of car bodies.

IITK ME 761A Dr. J. Ramkumar 151


Bezier Approximation
How to provideR1 and R4 ? P2 P3

R1 R4

P4 P4
P1 P1
Instead of providingR1 and R4 , providetwo additionalcontrol points ! ! !

P2 and P3

 Approximation

IITK ME 761A Dr. J. Ramkumar 152


Bezier curves
• Typically, cubic polynomials
• Similar to Hermite interpolation
– Special way of specifying end tangents
• Requires special set of coefficients
• Need four points
– Two at the ends of a segment
– Two control tangent vectors

IITK ME 761A Dr. J. Ramkumar 153


Bezier curves
• Control polygon: control points connected to each other

• Easy to generalize to higher order


– Insert more control points
– Hermite – third order only

IITK ME 761A Dr. J. Ramkumar 154


De Casteljau algorithm
• Can compute any point on the curve in a few iterations
• No polynomials, pure geometry
• Repeated linear interpolation
– Repeated order of the curve times
• The algorithm can be used as definition of the curve

IITK ME 761A Dr. J. Ramkumar 155


De Casteljau algorithm

Third order, u=0.75

IITK ME 761A Dr. J. Ramkumar 156


De Casteljau algorithm

IITK ME 761A Dr. J. Ramkumar 157


De Casteljau algorithm

IITK ME 761A Dr. J. Ramkumar 158


De Casteljau algorithm

IITK ME 761A Dr. J. Ramkumar 159


De Casteljau Algorithm
P1 1− t t P2
t
1− t 1− t
t 1− t t
t

1− t

P3
P0 P0
1− t

(1− t ) P0 + tP1 1− t
t (1− t ) 2 P0 + 2(1− t )tP1 1− t (1− t ) 3 P0
P1 1− t t +t 2 P2 + 3(1− t ) 2 tP1

(1− t ) P1 + tP2 t + 3(1− t )t 2 P2


1− t
t (1− t ) 2 P1 + 2(1− t )tP2 +t 3P3
P2 1− t t +t 2 P3
3
 3
t
(1− t ) P2 + tP3  
  
i =0  i 
(1− t ) i
t 3−i

P3
IITK ME 761A Dr. J. Ramkumar 160

Now,
 −1 3 3 1  P1 
 3 0  P2 
3
 3 i

Q (t ) = t 3 t2 t 
1
−6 3
 
i
i =0  
 t (1 − t ) 3− i
=1
− 3 3 0 0  P3 
  
 1 0 0 0  P4 
What does it mean ?
= T  M b  Gb

1 (1 − t ) 3
Q (t ) = (1 − t ) P1 + 3t (1-t ) P2 + 3t (1-t ) P3 + t P4
3 2 2 3 t3
3t (1-t ) 2
3
 3 i
=    t (1 − t ) 3−i Pi , 0  t 1
i =0  i  3t 2 (1-t )

(t + (1 − t )) 3
0 1

IITK ME 761A Dr. J. Ramkumar 161


Examples

IITK ME 761A Dr. J. Ramkumar 162


IITK ME 761A Dr. J. Ramkumar 163
IITK ME 761A Dr. J. Ramkumar 164
Bezier Polynomial Function
P(t)= σ𝑛𝑖=0 𝐶𝑖 𝐵𝑖𝑛 (𝑡)

n! n −i
Bin (t ) = .t .(1 − t )
i

i!(n − i )!
Ai is the control points (xi, yi)

IITK ME 761A Dr. J. Ramkumar 165


Parametric equations for x(t),y(t)
n
x (t ) =  xi .Bin (t )
i =0

n
y (t ) =  yi .Bin (t )
i =0

IITK ME 761A Dr. J. Ramkumar 166


Numerical problem
Question: Generate a Bezier curve using the following control points: (2,0), (4,3),
(5,2), (4,-2), (5,-3), (6,-2)
Solution: Control points =6 ,Therefore n=5

P(t)= σ5𝑖=0 𝐴𝑖 𝐵𝑖𝑛 (𝑡)

= σ5𝑖=0 𝐴𝑖 𝑛 𝐶𝑖 𝑡 𝑖 (1-t) n-i

X(t) =σ5𝑖=0 𝑥𝑖 5 𝐶𝑖 𝑡 𝑖 (1-t) 5-i


Y(t)= σ5𝑖=0 𝑦𝑖 5 𝐶𝑖 𝑡 𝑖 (1-t) 5-i

IITK ME 761A Dr. J. Ramkumar 167


IITK ME 761A Dr. J. Ramkumar 168
Some Bezier Curves

IITK ME 761A Dr. J. Ramkumar 169


Bezier Curves - properties
• Not all of the control points are on the line
– Some just attract it towards themselves
• Points have “influence” over the course of the line
• “Influence” (attraction) is calculated from a polynomial expression
• (show demo applet)

IITK ME 761A Dr. J. Ramkumar 170


Convex Hull property
P2

P4

P1

P3
IITK ME 761A Dr. J. Ramkumar 171
Bezier Curve Properties
• The first and last control points are interpolated
• The tangent to the curve at the first control point is along the line joining the
first and second control points
• The tangent at the last control point is along the line joining the second last
and last control points
• The curve lies entirely within the convex hull of its control points
– The Bernstein polynomials (the basis functions) sum to 1 and are everywhere positive
• They can be rendered in many ways
– E.g.: Convert to line segments with a subdivision algorithm

IITK ME 761A Dr. J. Ramkumar 172


Disadvantages

• The degree of the Bezier curve depends on the


number of control points.

• The Bezier curve lacks local control. Changing


the position of one control point affects the entire
curve.

IITK ME 761A Dr. J. Ramkumar 173


Invariance
• Translational invariance means that translating the control points
and then evaluating the curve is the same as evaluating and then
translating the curve
• Rotational invariance means that rotating the control points and
then evaluating the curve is the same as evaluating and then
rotating the curve
• These properties are essential for parametric curves used in
graphics
• It is easy to prove that Bezier curves, Hermite curves and
everything else we will study are translation and rotation invariant

IITK ME 761A Dr. J. Ramkumar 174


Longer Curves
• A single cubic Bezier or Hermite curve can only capture a small class of
curves
– At most 2 inflection points
• One solution is to raise the degree
– Allows more control, at the expense of more control points and higher degree
polynomials
– Control is not local, one control point influences entire curve
• Alternate, most common solution is to join pieces of cubic curve together into
piecewise cubic curves
– Total curve can be broken into pieces, each of which is cubic
– Local control: Each control point only influences a limited part of the curve
– Interaction and design is much easier

IITK ME 761A Dr. J. Ramkumar 175


Piecewise Bezier Curve
P0,1 P0,2

“knot”
P0,0
P1,3
P0,3
P1,0
P1,2
P1,1

IITK ME 761A Dr. J. Ramkumar 176


Continuity
• When two curves are joined, we typically want some degree of continuity
across the boundary (the knot)
– C0, “C-zero”, point-wise continuous, curves share the same point where they join
– C1, “C-one”, continuous derivatives, curves share the same parametric derivatives where
they join
– C2, “C-two”, continuous second derivatives, curves share the same parametric second
derivatives where they join
– Higher orders possible
• Question: How do we ensure that two Hermite curves are C1 across a knot?
• Question: How do we ensure that two Bezier curves are C0, or C1, or C2
across a knot?

IITK ME 761A Dr. J. Ramkumar 177


Achieving Continuity
• For Hermite curves, the user specifies the derivatives, so C1 is achieved
simply by sharing points and derivatives across the knot
• For Bezier curves:
– They interpolate their endpoints, so C0 is achieved by sharing control points
– The parametric derivative is a constant multiple of the vector joining the first/last 2
control points
– So C1 is achieved by setting P0,3=P1,0=J, and making P0,2 and J and P1,1 collinear, with J-
P0,2=P1,1-J
– C2 comes from further constraints on P0,1 and P1,2

IITK ME 761A Dr. J. Ramkumar 178


Bezier Continuity
P0,1 P0,2

P0,0
P1,3
J

P1,2
P1,1
Disclaimer: PowerPoint curves are not Bezier curves, they are
interpolating piecewise quadratic curves! This diagram is an
approximation.

IITK ME 761A Dr. J. Ramkumar 179


Problem with Bezier Curves
• To make a long continuous curve with Bezier segments requires
using many segments
• Maintaining continuity requires constraints on the control point
positions
– The user cannot arbitrarily move control vertices and automatically
maintain continuity
– The constraints must be explicitly maintained
– It is not intuitive to have control points that are not free

IITK ME 761A Dr. J. Ramkumar 180


Bezier Basis Functions for d=3
1.2

0.8 B0
B1
0.6
B2
0.4 B3

0.2

IITK ME 761A Dr. J. Ramkumar 181

You might also like