0% found this document useful (0 votes)
14 views137 pages

Direct Stiffness Method: Dr. Amit R. Singh March 4, 2024

Uploaded by

purnima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views137 pages

Direct Stiffness Method: Dr. Amit R. Singh March 4, 2024

Uploaded by

purnima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 137

Direct Stiffness Method

Dr. Amit R. Singh


March 4, 2024

1 Introduction
Direct Stiffness Method is a simplified form of Finite Element Method that can be used to analyze systems of
springs, bars, or trusses. In the case of bars, and trusses, we will first have to discretize them into springs. Thus,
ultimately, we will be solving a system of springs. For simplicity, in this presentation, we will restrict ourselves
to linear 1D springs.

2 A Spring Element
We are familiar with the governing equation of linear springs. Our aim in this section, is to rewrite the spring
equation as a system of equations that relate the displacements of the end-points of the spring with the forces
acting at the end-points. Figure 1 shows a single spring element. The number in circle is called the element
index and it will identify a spring uniquely in a system of springs. The spring element has two nodes indexed 1,
and 2. The forces and displacements of the spring element have been indexed based on the node to which they
belong.

Figure 1: A single spring element with two nodes labeled 1, and 2. The spring element is numbered as 1 (in
circle). The nodal forces, F1 , and F2 , and the nodal displacements, u1 , and u2 , are as shown as arrows pointing
in their positive directions. The spring constant is k1 .

Case (a): node 1 is fixed.


Let node 1 of the spring be fixed and node 2 be displaced by u2 . The force required to impose this displacement
is
F2a = k1 u2 . (1)
For equilibrium, we must have
F1a = −F2a = −k1 u2 . (2)

Case (b): node 2 is fixed.


Let the node 2 of the spring be fixed and node 1 be displaced by u1 . The force required to impose this displacement
is
F1b = k1 u1 . (3)
For equilibrium, we must have
F2b = −F1b = −k1 u1 . (4)

1
Case (c): both the nodes are free.
The nodal forces vary linearly with the nodal displacements. Therefore, when both the nodes are allowed to
move, the nodal forces can be obtained by superposing the nodal forces of Cases (a), and (b) above.

F1 = F1a + F1b = k1 u1 − k1 u2 (5)


F2 = F2a + F2b = −k1 u1 + k1 u2 (6)

The above equations can be written in matrix form as


    
k1 −k1 u1 F1
= (7)
−k1 k1 u2 F2

This can be written as

K (1) u(1) = F (1) (8)

where K is called the element stiffness matrix and the number in the parenthesis in the superscript denotes the
element index.

3 A Network of Springs
The aim of this section is write a matrix equation for a network of springs analogous to equation 8. The
displacements of the unique nodes of the network will be the unknowns u. We have to find the global stiffness
matrix K that relates u to the applied loads F . We will start with a simple system of two springs connected in
series.
Figure 2 shows two spring elements connected in series. Although there are two springs, and each spring
element has two nodes, the number of unique nodes in this system is only three because the second node of the
first element and the first node of the second element are coupled and will always move together. So this system
has three degrees of freedom.

Figure 2: Two spring elements connected in series. The circled numbers are the spring indices. The global node
indices have been shown as numbers without circles.

To write down the governing equation of the system, we will again use the principle of superposition. We
will first split the system into two springs and then add-up the appropriate force equations. Figure 3 shows the
separated springs with their local node indices.

Figure 3: The separated spring elements. The circled numbers are the spring indices. The local node indices
have been shown as numbers without circles.

2
Applying equations 5 and 6 to spring 1, we can write
(1) (1) (1)
F1 = k1 u1 − k1 u2 (9)
(1) (1) (1)
F2 = −k1 u1 + k1 u2 (10)

Similarly for spring 2, we have


(2) (2) (2)
F1 = k2 u1 − k2 u2 (11)
(2) (2) (2)
F2 = −k2 u1 + k2 u2 (12)

In the above equations, the numbers in the parenthesis in the superscripts denote the spring element indices. We
(1) (2)
note that u2 and u1 represent the same physical point which corresponds to global nodal displacement u2 .
(1) (2)
Therefore, by the principle of linear superposition, we can add up the forces F2 , and F1 . Thus, we get three
force equations for this spring network.
(1) (1) (1)
F1 = k1 u1 − k1 u2 (13)
(1) (2) (1) (1) (2) (2)
F2 + F1 = −k1 u1 + k1 u2 + k2 u1 − k2 u2 (14)
(2) (2) (2)
F2 = −k2 u1 + k2 u2 (15)

Now we can switch from local force and node indices to the global force and node indices by noting that
(1) (1)
F1 = F1 u1 = u1
(1) (2) (1) (2)
F2 + F1 = F2 u2 = u1 = u2
(2) (2)
F2 = F3 u2 = u3

Equations 13, 14, and 15 can be written as

F1 = k1 u1 − k1 u2 (16)
F2 = −k1 u1 + (k1 + k2 )u2 − k2 u3 (17)
F3 = −k2 u2 + k2 u3 (18)

In matrix form, we have


    
k1 −k1 0 u1  F1 
−k1 k1 + k2 −k2  u2 = F2 (19)
0 −k2 k2 u3 F3
   

Thus, we have found a matrix equation of the form Ku = F where K is the global stiffness matrix or the
stiffness matrix of the spring network. It should be noted that because a single spring element has two degrees
of freedom, the element stiffness matrix is of shape 2×2. The spring network we have considered in this section
has three degrees of freedom and, as shown above, the global stiffness matrix is of shape 3×3. In general, the
global stiffness matrix of a spring network with M unique nodes will be of shape M × M . We should also note
that both the element stiffness matrix and the global stiffness matrix are symmetric.

4 Assembly
In the previous section, we derived the governing equation of the spring network by writing the force equations
for each node of each element separately and then adding up the forces that act on the same global node. This
approach will quickly become tedious as the number of springs in our system increases. Fortunately, there is a
systematic procedure to derive the global stiffness matrix from the element stiffness matrices. This process is
called assembly in finite element method context.
Let N be the number of springs in a network. Let each spring have n local nodes. Let M be the number of
unique nodes in the entire system. So M ≤ N × n. Assembly entails the following steps.
1. Map the local degrees of freedom of every element to the global degrees of freedom. Let G : (e, i) → I
denote a function that accepts element index e, and element node index i as inputs, and returns the global
node index I as an output. For the spring network of Section 3, using figures 2 and 3, we can write the
mapping as follows:

3
Element Index (e) Local Node Index (i) Global Node Index (G(e, i) = I)
1 1 1
1 2 2
2 1 2
2 2 3

Table 1: Mapping local node indices to the global node indices.

2. Initialize the global stiffness matrix as a matrix of zeros of size M × M where M is the number of unique
degrees of freedom of the system.
3. Update the elements of the global stiffness matrix K using the element stiffness matrices K (e) as follows:
for e in (1, N ) do
for i in (1, n) do
for j in (1, n) do
I = G(e, i)
J = G(e, j)
K[I, J] = K[I, J] + K (e) [i, j]
end for
end for
end for
If we apply this algorithm to the example of Section 3, we will get

e i j I = G(e, i) J = G(e, j) K[I, J]


1 1 1 1 1 K[1, 1] = k1
1 1 2 1 2 K[1, 2] = −k1
1 2 1 2 1 K[2, 1] = −k1
1 2 2 2 2 K[2, 2] = k1
2 1 1 2 2 K[2, 2] = k1 + k2
2 1 2 2 3 K[2, 3] = −k2
2 2 1 3 2 K[3, 2] = −k2
2 2 2 3 3 K[3, 3] = k2

which gives the same matrix as K in equation 19.

5 Solving a Spring Network


The goal of setting up the governing equation of a spring network is to be able to calculate the unknown nodal
displacements for given nodal forces. At first glance, it may appear that we can get the displacements by writing
u = K −1 F . But if we examine equation 19 carefully, we will find that the global stiffness matrix is singular! So
there is no unique solution for the nodal displacements. This makes physical sense because the spring system
shown in Figure 2 is free to move for any applied load. To get a unique solution, we need some boundary
conditions like fixing one of the nodes of spring network. The goal of this section is to learn how to modify the
governing matrix equation of a spring network when applying boundary conditions.
It should be noted that at any node of a spring network, we cannot specify both force and displacement
simultaneously because it will overconstrain the system. If, for a node, both force and displacement have not been
given then we will take the displacement as an unknown to be solved for and the force as zero. If the displacement
of a node is specified, then the force acting at that node is a reaction force and it needs to be calculated after
calculating the displacement of all the free nodes of the system.
Let’s consider the governing matrix equation of the spring network of Section 3. We had
    
k1 −k1 0 u1  F1 
−k1 k1 + k2 −k2  u2 = F2
0 −k2 k2 u3 F3
   

Suppose, as a boundary condition, it is given that u1 = U . Let force F3 = 5 units. Since force is not specified
for node 2, we will take it as 0.
    
k1 −k1 0  U   F1 
−k1 k1 + k2 −k2  u2 = 0
0 −k2 k2 u3 5
   

4
Now we have three equations for just two unknowns u2 , and u3 . We need to get rid of one equation. We
should note that F1 is a reaction force and it is an unknown. If we remove equation 1 from our system then
there will be no unknown force on the RHS. Therfore, we will remove the first row of the coefficient matrix and
the RHS vector.
 
  U   
−k1 k1 + k2 −k2 0
u =
0 −k2 k2  2  5
u3

Our coefficient matrix is not a square matrix anymore so we cannot invert it. But we have a known quantity
u1 = U in the vector that we want to solve for. Let’s shift the terms corresponding to u1 = U to the RHS. This
amounts to removing the first column from the coefficient matrix, removing the first row of the u vector and
modifying the entries of the RHS vector.

        
k1 + k2 −k2 u2 0 k1 U k1 U
= + =
−k2 k2 u3 5 0 5

Now the coefficient matrix is not singular and it can be inverted. Solving this system gives us
5
u2 = U +
k1
5 5
u3 = U + +
k2 k1
Finally, using the values of u1 , u2 , and u3 , we can calculate the reaction force F1 = −5.
Summarizing, for every displacement uI where I is the global node index, that is specified as a boundary
condition, we need to reduce the governing matrix equation as follows:
1. Subtract the product of uI and the I th column of the global stiffness matrix from the RHS F vector.

2. Drop the I th row and the I th column from the global stiffness matrix.
3. Drop the I th row from the u vector.
4. Drop the I th row from the RHS F vector.
5. Solve the reduced system of equation for the unknown nodal dispalcements obtained after the above steps.

6. Finally, use the nodal dispalcement values to calculate the reaction force at the I th node.

5
ME F318 Computer Aided Design
Geometric Transformations

BITS Pilani Dr. Amit R. Singh


Pilani Campus

1 / 23
What is a Geometric Transformation?

• A one-to-one mapping of elements from a set.


• Usually, it maps a set to itself.
• The inverse mapping must exist.

2 / 23 BITS Pilani, Pilani Campus


Classification of Geometric
Transformations

• Based on dimensions of the set.


• Based on some “special property” of the Transformation.

3 / 23 BITS Pilani, Pilani Campus


Classification based on “special property”

• Isometric Transformations: preserve angles and distances.


• Similarity Transformations: preserve angles and ratios of
distances.
• Affine Transformations: preserve parallelism.
• Projective Transformations: preserve collinearity.

4 / 23 BITS Pilani, Pilani Campus


Homogeneous Coordinates

Definition
If (x, y ) are the Euclidean coordinates of a point P, in R2 , and if
(x1 , x2 , x3 ) are any three real numbers such that x1 /x3 = x and
x2 /x3 = y , then the triple (x1 , x2 , x3 ) is said to be a set of
homogeneous coordinates for P.

5 / 23 BITS Pilani, Pilani Campus


Why Homogeneous Coordinates?

• One motivation: to define intersection of parallel lines.


• It “homogenizes” equations:
→ l1 x + l2 y + l3 = 0 becomes l1 x1 + l2 x2 + l3 x3 = 0.
→ a11 x 2 + 2a12 xy + a22 y 2 + 2a13 x + 2a23 y + a33 = 0.
becomes
a11 x12 + 2a12 x1 x2 + a22 x22 + 2a13 x1 x3 + 2a23 x2 x3 + a33 x32 = 0.
• It helps us write translations as a matrix multiplication.

6 / 23 BITS Pilani, Pilani Campus


Isometric Transformations

Definition
The general form of an 2D isometric transformation is
 ′   
x ϵ cos θ − sin θ tx x
y ′  =  ϵ sin θ cos θ ty  y 
1 0 0 1 1

where ϵ is either 1 or -1.

7 / 23 BITS Pilani, Pilani Campus


Properties of Isometric Transformations

• When ϵ = 1, orientation is preserved and the transformation is


a rigid body motion. Also called as Euclidean Transformations.
• When ϵ = −1, orientation is reversed and the transformation
is a reflection composed with a rigid body motion.
• This transformation preserves lengths, angles and areas. “Iso”
= same and “Metry” = distance.

8 / 23 BITS Pilani, Pilani Campus


Similarity Transformations

Definition
The general form of a similarity transformation is
 ′   
x s cos θ −s sin θ tx x
y ′  =  s sin θ s cos θ ty  y 
1 0 0 1 1

The upper left 2 × 2 matrix is a rotation matrix R multiplied by a


scalar s.

9 / 23 BITS Pilani, Pilani Campus


Properties of Similarity Transformations

• It preserves shape but not necessarily the size.


Mathematically, it preserves ratio of lengths and areas.
• The parameter s provides isotropic scaling.

10 / 23 BITS Pilani, Pilani Campus


Affine Transformations

Definition
The general form of an affine transformation or an affinity is
 ′   
x a11 a12 tx x
y ′  = a21 a22 ty  y 
1 0 0 1 1

The upper left 2 × 2 matrix is denoted as A, the affine matrix.

11 / 23 BITS Pilani, Pilani Campus


Properties of Affine Transformations

• The matrix A can be decomposed into two rotations and a


scaling in the following sequence

A = R(θ)R(−ϕ)DR(ϕ)
 
λ 0
where the R denote rotations and D = 1 is a scaling
0 λ2
matrix. This scaling happens along x and y directions which
are rotated by an angle −ϕ with respect to the original x − y -
axes.
• An affinity has 6 degrees of freedom. Hence it requires, 3
points in correspondence to uniquely determine it.

12 / 23 BITS Pilani, Pilani Campus


Properties of Affine Transformations
(contd.)

• In addition to the changes possible by similarity, affinity allows


for shearing i.e. non-isotropic scaling.
• Affinity preserves parallel lines.
• If |A| < 0, orientation is reversed. It can therefore be used for
reflection.

13 / 23 BITS Pilani, Pilani Campus


Projective Transformations

Definition
The general form of a projective transformation or a projectivity is
 ′   
x a11 a12 tx x
y ′  = a21 a22 ty  y 
1 v1 v2 v 1

Note
The element v in the transformation matrix is generally used to
scale all the other elements. So it is generally equal to 1. But in
some situations, its value needs to be set to 0. Therefore, we say
that the matrix has only 8 degrees of freedom.

14 / 23 BITS Pilani, Pilani Campus


Properties of Projective Transformations

• A projectivity has 8 degrees of freedom since it is a


homogeneous matrix. It requires correspondence between 4
non-collinear points before and after the transformation to
determine the projectivity.
• Collinearity is preserved.

15 / 23 BITS Pilani, Pilani Campus


Properties of Projective Transformations
(contd.)

A projective transformation can transform parallel lines into


intersecting lines by shifting points at infinity to finite positions.
Example
Consider a point at infinity (x1 , x2 , 0)T . Under affine
transformation we get,
    
 x1   x 
A 1

A t
x = x2
0T 1  2  
0 0

which is still a point at infinity.

16 / 23 BITS Pilani, Pilani Campus


Example (contd.)

But under projective transformation


     
 x1   x
A 1

A t

x = x
v T v  2  2
0 v1 x1 + v2 x2

we get a finite point if both v1 and v2 are not simultaneously 0.


Thus, projective transformations can map vanishing points.

17 / 23 BITS Pilani, Pilani Campus


Vanishing Point

Courtesy: Jakec - Own work, CC BY-SA 4.0, via Wikimedia Commons

18 / 23 BITS Pilani, Pilani Campus


Vanishing Point

Courtesy: Mgunyho, original drawing by NiharikaMaheshwari, CC BY-SA 4.0, via


Wikimedia Commons
19 / 23 BITS Pilani, Pilani Campus
Combined Transformations

Transforming a point P, represented by a column vector, by


transformation matrices T1 , T2 , . . . , Tn sequentially is the same as
transforming the point by a combined transformation matrix

T = Tn Tn−1 . . . T1 .

If P is represented by a row vector, then the combined


transformation matrix is

T = T1 T2 . . . Tn .

because P is pre-multiplied to a transformation matrix in this case.

20 / 23 BITS Pilani, Pilani Campus


Fixed Points

Definition
A fixed point of a transformation remains unchanged under the
action of the transformation.

21 / 23 BITS Pilani, Pilani Campus


Demonstrations

You can check out the interactive plots in the following notebooks
• DemoIsometry.ipynb
• DemoSimilarity.ipynb
• DemoAffinity.ipynb

22 / 23 BITS Pilani, Pilani Campus


Demonstrations (contd.)

1. A Geogebra based demonstration of a Projective Transformation has been made


available.
2. It demonstrates “Elation” which is a 2D geometric transformation represented
by the following matrix in homogeneous coordinates
 
1 0 0
0 1 0
v1 v2 v

3. In the demo, the original points and lines are shown in gray. Under the action of
the elation matrix, the points are projected to the red points that lie in a 3D
plane whose equation is z = v1 x + v2 y + v .
4. The final result of the projective transformation, shown in blue, are obtained by
modifying the homogeneous coordinates of the red-points such that their third
coordinate is 1. This is equivalent to projecting them to z = 1 plane. If we join
the blue points with their red counterparts, we will get lines which converge at
the origin i.e. origin is the point of projection.

23 / 23 BITS Pilani, Pilani Campus


ME F318 Computer Aided Design
Solids

BITS Pilani Dr. Amit R. Singh


Pilani Campus

1 / 23
Resources

The content presented here is based primarily on Unit 3 of this


website.

2 / 23 BITS Pilani, Pilani Campus


Representation of Solids

How to represent solids in a computer in a way that captures their


essential characteristics? The following qualities are desirable:
• Domain: A representation should be able to capture a sufficiently wide
variety of solids.
• Unamibiguous: We should be able to easily recognize the solid being
represented.
• Uniqueness: Ideally, there should be a unique way to represent every
solid.
• Accuracy: Geometrical dimensions and properties should be satisfied.
• Validity: A representation should not lead to impossible solids.
• Closure: Transformations of the representation should give valid solids.
• Compactness and Efficiency: A representation should take less memory
to store and should be quick to process.

3 / 23 BITS Pilani, Pilani Campus


Wireframe Representation

• It is one of the oldest ways to represent a solid.


• It consists of a table of node coordinates and a connectivity
table containing pair of nodes that make up edges.

• The edges can be curves, which would need more complex


tables.

4 / 23 BITS Pilani, Pilani Campus


Wireframe Representation: Ambiguity

Consider the following wireframe model

What solid does it represent?

It is still popular because of efficiency.

5 / 23 BITS Pilani, Pilani Campus


Boundary Representation (B-Rep)

• It is an extension of wireframe model that includes “face”


information. Thus, a solid is bound by well-organized surfaces
which define an interior and exterior of the solid.
• B-rep contains “topological” information like connectivity of
nodes and edges to form edges, and faces respectively,
orientation of the edges and the faces etc.
• It also contains “geometrical” information like equations of
edges and faces.

6 / 23 BITS Pilani, Pilani Campus


Importance of Orientation

The equation of faces should be such that the normal vector points
outwards.

Some surfaces are “non-orientable”. For example, the Möbius strip

7 / 23 BITS Pilani, Pilani Campus


The Winged-Edge Data Structure

• Credited to Baumgart, it is one of the oldest data structure


for B-rep.
• Assumptions: edges are lines, faces are polygons, and faces
have no holes.
• This data-structure uses edges to store almost all the
information.

8 / 23 BITS Pilani, Pilani Campus


The Winged-Edge Data Structure
Example

Following information is
needed for each edge
1. vertices
2. left and right faces,
3. the “predecessor” and
“successor” of this edge
when traversing its left
face, and
4. the predecessor and
successor of this edge
when traversing its right
face.
b, c, d, and e are the “wings” of a.
9 / 23 BITS Pilani, Pilani Campus
The Winged-Edge Data Structure
Example

Edge Vertices Faces Left Traverse Right Traverse


Name Start End Left Right Pred Succ Pred Succ
a A D 3 1 e f b c
b A B 1 4 c a f d
c B D 1 2 a b d e
d B C 2 4 e c b f
e C D 2 3 c d f a
f A C 4 3 d b a e

10 / 23 BITS Pilani, Pilani Campus


Euler-Poincaré Formula

Euler-Poincaré formula is a “one-sided” test to check validity of a


solid.
Definition
V − E + F − (L − F ) − 2(S − G ) = 0

V : Number of vertices L: Number of loops


E: Number of edges S: Number of shells
F : Number of faces G: Number of genus

11 / 23 BITS Pilani, Pilani Campus


Euler-Poincaré Formula (Contd.)

• Genus: “through” holes


• Shell: “internal voids” surrounded by a surface (which may
have holes!). The solid itself is counted as one shell. So
S ≥ 1.
• Loop: a “closed” chain of edges with at least one common
adjacent face.

12 / 23 BITS Pilani, Pilani Campus


Euler-Poincaré Formula Examples

1. Show that for a cube the formula should sum up to 0.


2. Calculate the Euler-Poincaré sum for a cube with a blind
rectangular hole.

3. Calculate the Euler-Poincaré sum for a cube with a through


rectangular hole.

(Figures are from https://pages.mtu.edu/∼shene/COURSES/cs3621/NOTES/model/euler.html)

13 / 23 BITS Pilani, Pilani Campus


Euler-Poincaré Formula Examples

Calculate the Euler-Poincaré sum for a cube with a through hole


and an internal cubical void.

(Figure is from https://pages.mtu.edu/∼shene/COURSES/cs3621/NOTES/model/euler.html)

14 / 23 BITS Pilani, Pilani Campus


Euler-Poincaré Formula Counter-example

We said that the Euler-Poincaré test is “one-sided”. Here is an


example of an invalid solid that satisfies the zero sum equation.

(Figure is from https://pages.mtu.edu/∼shene/COURSES/cs3621/NOTES/model/euler.html)

15 / 23 BITS Pilani, Pilani Campus


Counting Genus is Tricky

• Topology of a solid does not change if we twist, stretch, or


squash it without cutting or adding new parts.
• We must employ the above operations to check whether a
hole is really a through hole to count genus.
• We should not do these operations for other items of the
Euler-Poincaré formula as they will certainly change the
number of faces, edges, etc.

16 / 23 BITS Pilani, Pilani Campus


Counting Genus – an example

Consider a sphere with three symmetric radial holes that meet at


the center.

In this and the following related figures, the internal section is


shown on the right.
(Figure is from https://pages.mtu.edu/∼shene/COURSES/cs3621/NOTES/model/euler.html)

17 / 23 BITS Pilani, Pilani Campus


Counting Genus – an example

We can squeeze the portion of sphere between the holes to make it


into a shell as shown below.

(Figure is from https://pages.mtu.edu/∼shene/COURSES/cs3621/NOTES/model/euler.html)

18 / 23 BITS Pilani, Pilani Campus


Counting Genus – an example

Next, we can expand the top hole till the sphere reduces to a disk!

So, what is the actual genus of this solid?


(Figure is from https://pages.mtu.edu/∼shene/COURSES/cs3621/NOTES/model/euler.html)

19 / 23 BITS Pilani, Pilani Campus


Constructive Solid Geometry (CSG)

CSG is an alternative representation of solids. It consists of


• Primitives or building blocks: cube, triangular prism,
sphere, cylinder, cone, and torus
• Geometric Transformations: scaling, translation, and
rotation
• Boolean operations: Union, Intersection, Difference

20 / 23 BITS Pilani, Pilani Campus


CSG Primitives

• The primitive solids are available in some “standard” form.


• For example, a sphere would have a unit radius and be
centered at the origin.
• Similarly, a cube could have its center at the origin and the
side-length may be a single unit.
• The choice of the standard form may vary from one CAD
software to another.

21 / 23 BITS Pilani, Pilani Campus


CSG Expressions

To create a cube with a cubical through hole, the following


sequence of operations are needed:
1. Create cube 1, assuming that the standard form is centered at
the origin and has unit side length.
2. Scale cube 1 in x and y directions so that side-length is two
units.
3. Create cube 2.
4. Take a difference of cube 1 and cube 2.
The above steps can also be written as an expression
difference( scale( cube(L=1), x=2, y=2 ), cube(L=1) )

22 / 23 BITS Pilani, Pilani Campus


CSG Tree

The expression on the previous slide can also be represented as a


tree.

We can, thus, represent a composite solid as a graph and save it to


a file.

23 / 23 BITS Pilani, Pilani Campus


ME F318 Computer Aided Design
Surfaces

BITS Pilani Dr. Amit R. Singh


Pilani Campus

1 / 36
A Variety of Mathematical Surfaces

• Surfaces of revolution
• Quadric surfaces
• Sweep surfaces
• Bilinear surfaces
• Ruled surfaces
• Coon’s surfaces
• NURBS surfaces

2 / 36 BITS Pilani, Pilani Campus


A Variety of Mathematical Surfaces

• Surfaces of revolution
• Quadric surfaces
• Sweep surfaces
• Bilinear surfaces
• Ruled surfaces
• Coon’s surfaces
• NURBS surfaces

3 / 36 BITS Pilani, Pilani Campus


Parametric Mapping

Many surfaces can be represented as a mapping from a two


parameter space to three-dimensional Euclidean space.

4 / 36 BITS Pilani, Pilani Campus


Bilinear Surfaces

A bilinear surface is obtained by linear interpolation of four corner


points in the parameter space.

Q(u, v ) = P(0, 0) (1 − u) (1 − v ) + P(0, 1) (1 − u) v


+ P(1, 0) u (1 − v ) + P(1, 1) u v

5 / 36 BITS Pilani, Pilani Campus


Bilinear Surfaces

A bilinear surface is obtained by linear interpolation of four corner


points in the parameter space.

Q(u, v ) = P(0, 0) (1 − u) (1 − v ) + P(0, 1) (1 − u) v


+ P(1, 0) u (1 − v ) + P(1, 1) u v

In matrix form,
  
  P(0, 0) P(0, 1) 1 − v
Q(u, v ) = 1 − u u
P(1, 0) P(1, 1) v

6 / 36 BITS Pilani, Pilani Campus


Bilinear Surfaces

A bilinear surface is obtained by linear interpolation of four corner


points in the parameter space.

Q(u, v ) = P(0, 0) (1 − u) (1 − v ) + P(0, 1) (1 − u) v


+ P(1, 0) u (1 − v ) + P(1, 1) u v

In matrix form,
  
  P(0, 0) P(0, 1) 1 − v
Q(u, v ) = 1 − u u
P(1, 0) P(1, 1) v

What are the range of values u and v can take?

7 / 36 BITS Pilani, Pilani Campus


Ruled Surfaces

• Ruled surfaces are generated


by straight line moving
along a path with one
degree of freedom.
• Test of a ruled surface:
rotate a plane containing
the normal about the normal
and check if at any angle,
edge of the plane lies on the
Figure 6.27: Rogers, D. F. and Adams J. A.,
surface. Mathematical elements for Computer Graphics, 2nd Ed.,
McGraw-Hill, 1990.

8 / 36 BITS Pilani, Pilani Campus


Ruled Surfaces (contd.)

We can write an equation of a ruled surface as

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v

In matrix form,
 
  P(u, 0)
Q(u, v ) = 1 − v v
P(u, 1)

9 / 36 BITS Pilani, Pilani Campus


Ruled Surfaces (contd.)

We can write an equation of a ruled surface as

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v

In matrix form,
 
  P(u, 0)
Q(u, v ) = 1 − v v
P(u, 1)

Or alternatively,
 
  P(0, v )
Q(u, v ) = 1 − u u
P(1, v )

10 / 36 BITS Pilani, Pilani Campus


Ruled Surfaces (contd.)

We can write an equation of a ruled surface as

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v

In matrix form,
 
  P(u, 0)
Q(u, v ) = 1 − v v
P(u, 1)

Or alternatively,
 
  P(0, v )
Q(u, v ) = 1 − u u
P(1, v )

What is the difference in the two forms?

11 / 36 BITS Pilani, Pilani Campus


Developable Surfaces

• These are special ruled surfaces which can be “unfolded” unto


a plane without stretching or tearing.

12 / 36 BITS Pilani, Pilani Campus


Developable Surfaces

• These are special ruled surfaces which can be “unfolded” unto


a plane without stretching or tearing.
• Such surfaces are important for sheet-metal based products.

13 / 36 BITS Pilani, Pilani Campus


Developable Surfaces

• These are special ruled surfaces which can be “unfolded” unto


a plane without stretching or tearing.
• Such surfaces are important for sheet-metal based products.
• A surface (or its portion) is developable, if its “Gaussian”
curvature is identically zero.

14 / 36 BITS Pilani, Pilani Campus


Curvature of Surfaces

• Principal curvatures: κmin , κmin .

Figure 6.29: Rogers, D. F. and Adams J. A.,


Mathematical elements for Computer
Graphics, 2nd Ed., McGraw-Hill, 1990.

15 / 36 BITS Pilani, Pilani Campus


Curvature of Surfaces

• Principal curvatures: κmin , κmin .


• Principal curvature directions are
orthogonal.

Figure 6.29: Rogers, D. F. and Adams J. A.,


Mathematical elements for Computer
Graphics, 2nd Ed., McGraw-Hill, 1990.

16 / 36 BITS Pilani, Pilani Campus


Curvature of Surfaces

• Principal curvatures: κmin , κmin .


• Principal curvature directions are
orthogonal.
• Mean Curvature,
H = (κmin + κmax ) /2

Figure 6.29: Rogers, D. F. and Adams J. A.,


Mathematical elements for Computer
Graphics, 2nd Ed., McGraw-Hill, 1990.

17 / 36 BITS Pilani, Pilani Campus


Curvature of Surfaces

• Principal curvatures: κmin , κmin .


• Principal curvature directions are
orthogonal.
• Mean Curvature,
H = (κmin + κmax ) /2
• Gaussian Curvature,
K = κmin κmax Figure 6.29: Rogers, D. F. and Adams J. A.,
Mathematical elements for Computer
Graphics, 2nd Ed., McGraw-Hill, 1990.

18 / 36 BITS Pilani, Pilani Campus


Curvature of Surfaces (contd.)

Let subscripts denote partial differentiation with respect to a parameter.

19 / 36 BITS Pilani, Pilani Campus


Curvature of Surfaces (contd.)

Let subscripts denote partial differentiation with respect to a parameter.


For a biparametric surface,

A|Qv |2 − 2BQu · Qv + C |Qu |2


H=
2|Qu × Qv |3

20 / 36 BITS Pilani, Pilani Campus


Curvature of Surfaces (contd.)

Let subscripts denote partial differentiation with respect to a parameter.


For a biparametric surface,

A|Qv |2 − 2BQu · Qv + C |Qu |2


H=
2|Qu × Qv |3

AC − B 2
K=
|Qu × Qv |4

21 / 36 BITS Pilani, Pilani Campus


Curvature of Surfaces (contd.)

Let subscripts denote partial differentiation with respect to a parameter.


For a biparametric surface,

A|Qv |2 − 2BQu · Qv + C |Qu |2


H=
2|Qu × Qv |3

AC − B 2
K=
|Qu × Qv |4
 
A  
B = {Quu } {Quv } {Qvv } Qu × Qv
C
 

22 / 36 BITS Pilani, Pilani Campus


Coon’s Linear Surface

The key idea is to linearly blend four edge curves in the


parameteric space.

23 / 36 BITS Pilani, Pilani Campus


Coon’s Linear Surface

The key idea is to linearly blend four edge curves in the


parameteric space.
For a ruled surface, we blended two edge curves as follows:

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v

24 / 36 BITS Pilani, Pilani Campus


Coon’s Linear Surface

The key idea is to linearly blend four edge curves in the


parameteric space.
For a ruled surface, we blended two edge curves as follows:

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v

So, we may be tempted to write

Q(u, v ) = P(u, 0) (1 − v ) + P(u, 1) v


+ P(0, v ) (1 − u) + P(1, v ) u

25 / 36 BITS Pilani, Pilani Campus


Coon’s Linear Surface

The key idea is to linearly blend four edge curves in the


parameteric space.
For a ruled surface, we blended two edge curves as follows:

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v

So, we may be tempted to write

Q(u, v ) = P(u, 0) (1 − v ) + P(u, 1) v


+ P(0, v ) (1 − u) + P(1, v ) u

What is the problem in the above equation? Check the corners!

26 / 36 BITS Pilani, Pilani Campus


Coon’s Linear Surface (contd.)

The correct equation is

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v


+ P(0, v )(1 − u) + P(1, v )u
− P(0, 0)(1 − u)(1 − v ) − P(0, 1)(1 − u)v
− P(1, 0)u(1 − v ) − P(1, 1)uv

27 / 36 BITS Pilani, Pilani Campus


Coon’s Linear Surface (contd.)

The correct equation is

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v


+ P(0, v )(1 − u) + P(1, v )u
− P(0, 0)(1 − u)(1 − v ) − P(0, 1)(1 − u)v
− P(1, 0)u(1 − v ) − P(1, 1)uv

In matrix form,
  
  −P(0, 0) −P(0, 1) P(0, v ) 1 − v
Q(u, v ) = 1 − u u 1 −P(1, 0) −P(1, 1) P(1, v )  v 
P(u, 0) P(u, 1) 0 1

28 / 36 BITS Pilani, Pilani Campus


Coon’s Linear Surface (contd.)

The correct equation is

Q(u, v ) = P(u, 0)(1 − v ) + P(u, 1)v


+ P(0, v )(1 − u) + P(1, v )u
− P(0, 0)(1 − u)(1 − v ) − P(0, 1)(1 − u)v
− P(1, 0)u(1 − v ) − P(1, 1)uv

In matrix form,
  
  −P(0, 0) −P(0, 1) P(0, v ) 1 − v
Q(u, v ) = 1 − u u 1 −P(1, 0) −P(1, 1) P(1, v )  v 
P(u, 0) P(u, 1) 0 1

There is also a Coon’s bicubic surface. But we will not discuss it.

29 / 36 BITS Pilani, Pilani Campus


NURBS Surfaces

It is a blending of NURBS and control points in two parameters.


Pn Pm
i=0 j=0 hi,j Bi,j Ni,k (u)Mj,l (v )
Q(u, v ) = Pn Pm
i=0 j=0 hi,j Ni,k (u)Mj,l (v )

30 / 36 BITS Pilani, Pilani Campus


NURBS Surfaces

It is a blending of NURBS and control points in two parameters.


Pn Pm
i=0 j=0 hi,j Bi,j Ni,k (u)Mj,l (v )
Q(u, v ) = Pn Pm
i=0 j=0 hi,j Ni,k (u)Mj,l (v )

We can write it as
n X
X m
Q(u, v ) = Bi,j Si,j (u, v )
i=0 j=0

where
h N (u)Mj,l (v )
Si,j (u, v ) = Pn Pi,jm i,k
p=0 q=0 hp,q Np,k (u)Mq,l (v )

31 / 36 BITS Pilani, Pilani Campus


Properties of NURBS surfaces

1. Non-negativity:
Si,j (u, v ) ≥ 0 ∀u, v

32 / 36 BITS Pilani, Pilani Campus


Properties of NURBS surfaces

1. Non-negativity:
Si,j (u, v ) ≥ 0 ∀u, v
2. Partition of unity:
n X
X m
Si,j (u, v ) ≡ 1
i=0 j=0

33 / 36 BITS Pilani, Pilani Campus


Properties of NURBS surfaces

1. Non-negativity:
Si,j (u, v ) ≥ 0 ∀u, v
2. Partition of unity:
n X
X m
Si,j (u, v ) ≡ 1
i=0 j=0

3. Geometric invariance with respect to projective transformation


of the control points.

34 / 36 BITS Pilani, Pilani Campus


Properties of NURBS surfaces

1. Non-negativity:
Si,j (u, v ) ≥ 0 ∀u, v
2. Partition of unity:
n X
X m
Si,j (u, v ) ≡ 1
i=0 j=0

3. Geometric invariance with respect to projective transformation


of the control points.
4. The surface lies within the convex hull of the control polygon
net.

35 / 36 BITS Pilani, Pilani Campus


Properties of NURBS surfaces

1. Non-negativity:
Si,j (u, v ) ≥ 0 ∀u, v
2. Partition of unity:
n X
X m
Si,j (u, v ) ≡ 1
i=0 j=0

3. Geometric invariance with respect to projective transformation


of the control points.
4. The surface lies within the convex hull of the control polygon
net.
5. Variation diminishing property is not known.

36 / 36 BITS Pilani, Pilani Campus


ME F318 Computer Aided Design
Curves

BITS Pilani Dr. Amit R. Singh


Pilani Campus

1 / 50
Resources

Some useful resources for curves and surfaces:


1. Rogers, David F., and James Alan Adams. Mathematical
elements for computer graphics. McGraw-Hill, Inc., 1989.
(Chapter 5)
2. Zeid, Ibrahim. CAD/CAM theory and practice. McGraw-Hill
Higher Education, 1991. (Chapter 5)
3. Online: Representation of Curves and Surfaces (Sections 1.3
and 1.4)
4. Online: Introduction to Computing with Geometry and Notes.
(Units 5 and 6)

2 / 50 BITS Pilani, Pilani Campus


Bernstein Polynomials

Definition
Bernstein polynomials are defined as
n!
Bi,n (t) = (1 − t)n−i t i , i = 0, 1, . . . , n
i!(n − i)!

where

Bi,n (t) = 0 for i < 0 or i > n

and

B0,0 (t) = 1.

3 / 50 BITS Pilani, Pilani Campus


Properties of Bernstein polynomials

1. Non-negativity: Bi,n (t) ≥ 0, 0 ≤ t ≤ 1, i = 0, 1, . . . , n


Pn
2. Partition of unity: i=0 Bi,n (t) = 1
3. Symmetry: Bi,n (t) = Bn−i,n (1 − t)
4. Recursion:

Bi,n (t) = (1 − t)Bi,n−1 (t) + tBi−1,n−1 (t)

5. Derivative:
dBi,n (t)
= n [Bi−1,n−1 (t) − Bi,n−1 (t)] .
dt
Note: B−1,n−1 (t) = Bn,n−1 (t) = 0

4 / 50 BITS Pilani, Pilani Campus


Plots of Bernstein polynomials

Bi,n(t) for n = 3 Bi,n(t) for n = 4


1.0 1.0
i=0 i=0
i=1 i=1
0.8 0.8
i=2 i=2
i=3 i=3
0.6 0.6
Bi,n(t)

Bi,n(t)
i=4

0.4 0.4

0.2 0.2

0.0 0.0
0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00
t t

5 / 50 BITS Pilani, Pilani Campus


Bézier Curves

Definition
A Bézier curve of degree n, (and order n + 1), is defined as
n
X
P(t) = Pi Bi,n (t), 0 ≤ t ≤ 1.
i=0

where Pi are the control points and the basis functions Bi,n (t) are
the Bernstein polynomials.

Lines joining the control points (in sequence) form the control
polygon. What is a convex hull?

6 / 50 BITS Pilani, Pilani Campus


Convex Hull

Definition
A domain is called convex if for any two points P1 and P2 , the
segment P1 P2 lies entirely in the domain.

Definition
The convex hull of a set of points P is the boundary of the
smallest convex domain containing P.

7 / 50 BITS Pilani, Pilani Campus


A sample Bézier curve

P0 = (0, 0), P1 = (1, 4), P2 = (4, 1), P3 = (6, 2)

4 Bézier Curve
Control Polygon
Convex Hull
3

0
0 1 2 3 4 5 6

8 / 50 BITS Pilani, Pilani Campus


Properties of Bézier curves

1. Geometric invariance: Rigid body motion of the control


points, transforms the curve without changing the shape of
the curve.
Before Reflection After Reflection
4 Bézier Curve 4 Bézier Curve
Control Polygon Control Polygon
3 3

2 2

1 1

0 0
0 1 2 3 4 5 6 −6 −5 −4 −3 −2 −1 0

9 / 50 BITS Pilani, Pilani Campus


Properties of Bézier curves (contd.)

2. First and the last control points lie on the curve.


3. The first and the last edges of the control polygon are
tangents to the curve at the respective endpoints.
End-point Properties
4 Bézier Curve
Control Polygon
3

0
0 1 2 3 4 5 6

10 / 50 BITS Pilani, Pilani Campus


Properties of Bézier curves (contd.)

4. Bézier curve lies entirely within the convex hull of the control
points.

4 Bézier Curve
Control Polygon
Convex Hull
3

0
0 1 2 3 4 5 6

11 / 50 BITS Pilani, Pilani Campus


Properties of Bézier curves (contd.)

5. Symmetry: If we relabel the control points as Pn−i ∗ = Pi , then


the new Bézier curve relates to the original Bézier curve as
follows:
n
X n
X
Pi Bi,n (t) = Pi∗ Bi,n (1 − t).
i=0 i=0

What does this mean geometrically? Is this because of some


property of the Bernstein polynomials?

12 / 50 BITS Pilani, Pilani Campus


Properties of Bézier curves (contd.)

The following is called the variation diminishing property of Bézier


curve. It implies that the curve oscillates less than the control
polygon.
6. 2D: The number of times a straight line intersects with a
planar Bézier curve is not greater than the number of
intersections of the line with the control polygon.
7. 3D: The number of times a plane intersects a space Bézier
curve is not greater than the number of intersections of the
plane with the control polyhedron.

13 / 50 BITS Pilani, Pilani Campus


Variation Diminishing Property

14 / 50 BITS Pilani, Pilani Campus


de Casteljau’s Algorithm

Problem
Given the control points, how to calculate the point P(t0 ) i.e. the
point on the Bézier curve at t = t0 ?
• We can certainly evaluate the Bernstein polynomials at
t = t0 , and multiply with the corresponding control points
and add them up.
• But this method may have numerical instabilities especially if
the degree of the Bernstein polynomials is large.
• de Casteljau’s algorithm is a numerically stable alternative
(and an elegant result!)

15 / 50 BITS Pilani, Pilani Campus


de Casteljau’s Algorithm (contd.)

• The algorithm entails calculating points iteratively starting


from the original control points.
• Let Pi,j represent the j th control point at the i th iteration.
As per de Casteljau’s algorithm,

Pi,j = (1 − t0 )Pi−1,j + t0 Pi−1,j+1 where


i = 1, 2, . . . , n and
j = 0, 1, . . . , n − i

The point on the Bézier curve at t = t0 is

P(t0 ) = Pn,0

16 / 50 BITS Pilani, Pilani Campus


de Casteljau’s Algorithm Demo

Iteration 0
12
t = 0.4
10

0
0 5 10 15

17 / 50 BITS Pilani, Pilani Campus


de Casteljau’s Algorithm Demo

Iteration 1
12
t = 0.4
10

0
0 5 10 15

18 / 50 BITS Pilani, Pilani Campus


de Casteljau’s Algorithm Demo

Iteration 2
12
t = 0.4
10

0
0 5 10 15

19 / 50 BITS Pilani, Pilani Campus


de Casteljau’s Algorithm Demo

Iteration 3
12
t = 0.4
10

0
0 5 10 15

20 / 50 BITS Pilani, Pilani Campus


de Casteljau’s Algorithm Demo

Iteration 4
12
t = 0.4
10

0
0 5 10 15

21 / 50 BITS Pilani, Pilani Campus


de Casteljau’s Algorithm Demo

Iteration 5
12
t = 0.4
10

6
P (t = 0.4)
4

0
0 5 10 15

22 / 50 BITS Pilani, Pilani Campus


Composite Bézier Curves

To draw a complex curve there are two alternatives:


• Use a large number of points i.e. increase the degree n of the
Bézier curve.
• Connect multiple Bézier curves end to end!
The second approach requires us to ensure some continuity
conditions between consecutive curves.

23 / 50 BITS Pilani, Pilani Campus


Exercise

Problem
Derive the conditions for tangent and curvature continuity across
two Bézier curves P (1) (t) and P (2) (t).

Hint:
We need to know about derivatives of Bernstein polynomials.

24 / 50 BITS Pilani, Pilani Campus


Bézier Curve Playground

You can tinker with this Jupyter notebook to explore Bézier curves.

25 / 50 BITS Pilani, Pilani Campus


An excellent resource for Bézier and
B-spline curves

I came across a very nice website which has live demos of many
examples of Bézier and B-spline curves. Check it out:
https://pomax.github.io/bezierinfo.

26 / 50 BITS Pilani, Pilani Campus


Motivation for B-spline curves

• The whole Bézier curve changes if any of the control points is


changed due to the “global support” of Bernstein polynomials.
• We discussed that we can make complex shapes using a
composition of multiple low order Bézier curves. But we need
to enforce some continuity conditions at the joints.
• Is it possible to have piecewise low order polynomial curves
that take care of continuity “on their own”?
• B-spline curves address both these concerns.

27 / 50 BITS Pilani, Pilani Campus


Knot Vector

A B-spline of order k consists of multiple polynomial curves of


degree k − 1, “tied together” such that there is at most C k−2
continuity at the joints or knots.
Definition
A knot vector is a sequence of non-decreasing real numbers. It
parametrizes the “basis functions” or ‘B-splines’.

For example, if t0 ≤ t1 ≤ . . . ≤ tm then

T = (t0 , t1 , . . . , tm )

is a knot vector.

28 / 50 BITS Pilani, Pilani Campus


Types of Knot Vectors

• Uniform / Periodic: Equally spaced e.g. (0, 1, 2, 3, 4, 5, 6, 7).


• Open Uniform: Equally spaced except at the ends. e.g.
(0, 0, 0, 1, 2, 3, 3, 3). The first and the last knots are repeated
k times i.e. they have ‘multiplicity’ k.
• Non-uniform: Either unequally spaced or having repeated
internal knots or both e.g. (0, 1, 1, 3, 4, 8, 9, 9)
• Clamped: The first and the last knots are repeated k times
i.e. they have ‘multiplicity’ k. E.g. (0, 0, 0, 1, 2, 5, 7, 7, 7).

Note: The knot vector elements don’t have to be integers. Any


sequence of non-decreasing real numbers is acceptable e.g. [-0.03
-0.01, 0.23, 1.414, 3.141].

29 / 50 BITS Pilani, Pilani Campus


B(asis)-splines

Definition
For a given knot vector T and order k, the associated B-spline
functions are
t − ti ti+k − t
Ni,k (t) = Ni,k−1 (t) + Ni+1,k−1 (t)
ti+k−1 − ti ti+k − ti+1

where k > 1 and i = 0, 1, . . . , n and when k = 1


(
1 for ti ≤ t < ti+1
Ni,1 (t) =
0 otherwise

In the context of Ni,k (t), division by zero is taken to be zero.


How many elements should T have?

30 / 50 BITS Pilani, Pilani Campus


Properties of B-splines

1. Positivity: Ni,k (t) > 0, for ti < t < ti+k .


2. Local support: Ni,k (t) = 0 for t0 ≤ t ≤ ti , and
ti+k ≤ t ≤ tn+k .
Pn
3. Partition of unity: i=0 Ni,k (t) = 1 for t ∈ [t0 , tm ]. Note:
the tm is not a typo!
4. Recursion: by definition!
5. Continuity: Ni,k (t) has C k−2 continuity at each “simple”
knot.
6. Derivative: The derivative of Ni,k (t) is

dNi,k (t) k −1 k −1
= Ni,k−1 (t) − Ni+1,k−1 (t).
dt ti+k−1 − ti ti+k − ti+1

31 / 50 BITS Pilani, Pilani Campus


Examples of B-spline basis functions

Periodic or Uniform knot vector T = (0, 1, 2, 3, 4, 5, 6, 7)

0.6

0.5
N0,4 (t)
0.4
Ni,k (t)

N1,4 (t)
0.3 N2,4 (t)
N3,4 (t)
0.2

0.1

0.0
0 2 4 6
t

32 / 50 BITS Pilani, Pilani Campus


Examples of B-spline basis functions
(contd.)

Open Uniform knot vector T = (0, 0, 0, 0, 1, 2, 3, 4, 4, 4, 4)

1.0
N0,4 (t)
N1,4 (t)
0.8
N2,4 (t)
N3,4 (t)
0.6
Ni,k (t)

N4,4 (t)
N5,4 (t)
0.4
N6,4 (t)

0.2

0.0
0 1 2 3 4
t

33 / 50 BITS Pilani, Pilani Campus


Examples of B-spline basis functions
(contd.)

Non-uniform knot vector T = (0, 0, 1, 5, 8, 9, 9, 9, 10)


1.0
N0,4 (t)
N1,4 (t)
0.8
N2,4 (t)
N3,4 (t)
0.6
Ni,k (t)

N4,4 (t)

0.4

0.2

0.0
0 2 4 6 8 10
t

34 / 50 BITS Pilani, Pilani Campus


Examples of B-spline basis functions
(contd.)

Clamped knot vector T = (0, 0, 0, 1, 2, 5, 7, 7, 7)

1.0
N0,3 (t)
N1,3 (t)
0.8
N2,3 (t)
N3,3 (t)
0.6
Ni,k (t)

N4,3 (t)
N5,3 (t)
0.4

0.2

0.0
0 2 4 6
t

35 / 50 BITS Pilani, Pilani Campus


B-spline Curve

Definition
Given a set of n control points Pi , and an order 1 ≤ k ≤ n + 1, a
B-spline curve is defined as
n
X
P(t) = Pi Ni,k (t) for t ∈ [tk−1 , tn+1 ]
i=0

where Ni,k (t) are the B-spline basis functions and ti are elements
of a knot vector T = (t0 , t1 , . . . , tn+k ).

The point P(ti ) on the curve corresponding to ti ∈ T is called a


“knot point”. Portion of the curve between consecutive knot
points is called knot span.
How many “control knobs” do B-spline curves have?

36 / 50 BITS Pilani, Pilani Campus


A Sample B-Spline Curve

8 B-spline curve
Control Polygon
7
Convex hull
Pi : (1, 1), (3, 8), (6, 3), (9, 6)
6 Knot Points
T = (0, 1, 2, 3, 4, 5, 6)
5

Note: Knot points 4


do not always lie 3
on the control
2
polygon.
1
2 4 6 8

37 / 50 BITS Pilani, Pilani Campus


Properties of B-spline curves

1. Geometry invariance: The shape of the curve remains


unchanged under rigid body transformation of the control
points.
8 B-spline curve 8 B-spline curve
Control Polygon Control Polygon
7 7

6 6

5 5

4 4

3 3

2 2

1 1
2 4 6 8 −8 −6 −4 −2

38 / 50 BITS Pilani, Pilani Campus


Properties of B-spline curves

2. Unlike Bézier curves, B-spline curves do not generally pass


through the first and last control points.
3. To make the end control points lie on the curve, we should
increase the multiplicity of the first and last knots to k. This
is the clamped knot vector. E.g. T = (0, 0, 0, 1, 2, 5, 7, 7, 7)
gives the following curve.

2 B-spline curve
Control Polygon

2 4 6 8 10 12 14

39 / 50 BITS Pilani, Pilani Campus


Properties of B-spline curves (contd.)

4. B-spline curve has a continuity of C k−p−1 at a knot with


multiplicity p. If a knot is repeated k − 1 times, the curve
coincides on the control polygon at that knot.
5. Local support: A single span of a B-spline curve is controlled
by k control points, and a single control point affects k spans.
A control point Pi affects the curve in the parameter range
ti < t < ti+k , and the curve at a point t where tj < t < tj+1
is completely defined by control points Pj−(k−1) , . . . , Pj .
6. Convex Hull: Each span of the curve lies within the convex
hull of the control points affecting it.
7. B-spline curves also have variation diminishing property like
Bézier curves.

40 / 50 BITS Pilani, Pilani Campus


Example of Local Support and Convex
Hull

41 / 50 BITS Pilani, Pilani Campus


B-spline Curve generalizes Bézier Curve

• A B-spline curve of order k becomes a Bézier curve when


1. n + 1 = k i.e. k control points are used.
2. An open uniform knot vector is used

T = (t0 , t1 , . . . , tk−1 , tn+1 , . . . , tn+k )


where t0 = t1 = . . . = tk−1 = 0
and tn+1 = tn+2 = . . . = tn+k = 1

• There exists a generalization of the de Casteljau algorithm for


B-splines, called as the de Boor algorithm.

42 / 50 BITS Pilani, Pilani Campus


Calculating Ni,k (t)

t − ti Ni,k
Ni,k (t) = Ni,k−1 (t) Ni,k−1 Ni+1,k−1
ti+k−1 − ti Ni,k−2 Ni+1,k−2 Ni+2,k−2
ti+k − t . . .
+ Ni+1,k−1 (t) . . .
ti+k − ti+1 Ni,1 Ni+1,1 ... Ni+k−1,1

where k > 1 and i = 0, 1, . . . , n


and when k = 1 Ni−k+1,k ... ... Ni,k
. .
. .
(
1 for ti ≤ t < ti+1 Ni−2,3 Ni−1,3 Ni,3
Ni,1 (t) = Ni−1,2 Ni,2
0 otherwise
Ni,1

This needs practice!

43 / 50 BITS Pilani, Pilani Campus


Self Study: Closed B-spline Curves

Don’t Skip It!


There are two techniques:
• Wrapping control points
• Wrapping knots
Study this webpage.

44 / 50 BITS Pilani, Pilani Campus


Motivation

• B-Splines cannot even represent a circle (and other conic


sections, as well)!

Figure: Closed B-Spline curves with 8 control points. From right to


left, the order of the B-Spline is 3, 4, 6, and 10.

• The only way to express the equation of a circle in terms of


polynomials of a single parameter t is to use ratios of
2u 2
polynomials as follows: x = 1+u 2 y = 1−u
1+u 2

45 / 50 BITS Pilani, Pilani Campus


Rational curves

Definition
A parametric curve expressed in “homogeneous coordinates” is
called as a “rational” curve.
In homogeneous coordinates, a generic parametric space curve can
be written as P(t) = (x(t), y (t), z(t), w (t)).
By definition of homogeneous coordinates, this corresponds to the
following Cartesian coordinates
 
x(t) y (t) z(t)
P(t) = , ,
w (t) w (t) w (t)

Can you see why it is called a “ratio”nal curve?

46 / 50 BITS Pilani, Pilani Campus


Deriving NURBS equation

We begin with writing the control points of a B-spline in


homogeneous coordinates.
   
 xi  hi x i 
n   n  
yi hi y i
X   X  
h
P (t) = Ni,k (t) = Ni,k (t)
z hz
 i  i i
 
i=0   i=0 
1 hi

Pn 

 i=0 Ni,k (t)hi xi 

 
Pn Ni,k (t)hi yi 
 
i=0
= Pn
 i=0 Ni,k (t)hi zi 
 
 
 Pn N (t)h 
 
j=0 j,k j

47 / 50 BITS Pilani, Pilani Campus


Derivation of NURBS equation (contd.)

By definition of homogeneous coordinates, the corresponding


Euclidean coordinates of the curve are
Pn 
 i=0 N i,k (t)h i x i 
1 P
n

P(t) = Pn i=0 N i,k (t)h i y i
j=0 hj Nj,k (t) 
Pn 
i=0 Ni,k (t)hi zi

Therefore,
n
1 X
P(t) = Pn hi Ni,k (t)Pi
j=0 hj Nj,k (t)
i=0

The hi ’s allow us to assign different weights to different control


points.

48 / 50 BITS Pilani, Pilani Campus


Properties of NURBS curves

• NURBS curves have all the properties of B-spline curves.


• B-spline and Bézier curves are special cases of NURBS curves.
Think under what conditions you can get these special cases.
• NURBS curves are invariant under “projective”
transformations, whereas B-spline curves are invariant only
under “affine” transformations.

49 / 50 BITS Pilani, Pilani Campus


NURBS and Conic Sections

Consider a order 3, NURBS curve with 3 control points. Let


h0 = h2 = 1. We will take the knot vector T = (0, 0, 0, 1, 1, 1)

P0 N0,3 (t) + h1 P1 N1,3 (t) + P2 N2,3 (t)


P(t) =
N0,3 (t) + h1 N1,3 (t) + N2,3 (t)

h1 = 0 : Straight-line
0 < h1 < 1 : Elliptical curve
h1 = 1 : Parabolic curve
h1 > 1 : Hyperbolic curve

Note: N0,3 (t) = (1 − t)2 N1,3 (t) = 2t(1 − t) N2,3 (t) = t 2

50 / 50 BITS Pilani, Pilani Campus

You might also like