GSM Endsem Merged
GSM Endsem Merged
Modelling
Abhishek Verma
Department of Industrial Design
NIT Rourkela
Autumn 2024
Course Structure
• Introduction to Computer Graphics • Assignments (10)
• Geometric Modeling
• Transformations • Best of 8 (for all)
• Solid Modeling
• Best of 7 ( for attendance
• Curves over 90 %)
• Surfaces
GEOMETRIC AND SOLID MODELLING
Introduction to Computer
Graphics
INTRODUCTION TO COMPUTER GRAPHICS
• Computer Graphics involves creation, display, manipulation and storage
of pictures and experimental data/models or images for proper
visualization using a computer. Computers are becoming a powerful tool
for the rapid and economic production of pictures.
Abhishek Verma
Department of Industrial Design
NIT Rourkela
Autumn 2024
ID3207 : Geometric and Solid Modelling
Geometric Transformations
Transformation
• Transformation changes the way object appears
• Implementing changes in size of object, its position on screen or its
orientation is called as transformation
Transformations
Basic 2-Dimensional Transformation
• Translation
• Scaling
• Rotation
Translation
• Translation is a process of changing the position of an object in a
straight line path from one coordinate location to another.
Translation
Translation
Translation Polygon
Rotation
• Rotation transformation re-position an object along a circular parth in
X-Y Plane.
Matrix Multiplication is
not Commutative within
different operations
Commutative within
same time of operations
Reflection and Shear Transformation
• Reflection : Produces a mirror image of an object relative to an axis of
reflection
Ttx,ty,tz to p=(x,y,z)
P’ =S.P
Projections
• Transform 3D objects onto a 2D Plane
• 2 Types of projections
• Perspective
• Parallel
Axonometric Projections
• The oblique axis, called receding axis is drawn either at 30o or 45o
• While analytic curves provide a very compact form and simplify the
computation of properties such as area and volumes
• Synthetic curves provide designers with great flexibility and control of a
curve shape by changing the position of control points
Analytic Curves
Parametric Representation of Synthetic
Curves
• Analytic curves are usually not sufficient to meet geometric
design requirements of mechanical parts.
• Many products need free-form or synthetic curved surfaces
• E.g. car Bodies, ship hulls, airplane fuselage and wings, shoe
insoles and bottles
Synthetic Curves
Why we need Synthetic Curves
• The need for synthetic curves in design arises on occasion :
x = f (t ) y = g (t )
• Sketch and identify the curve defined by the parametric equations
x = t 2 − 2t y = t +1
= y 2 − 4y + 3
x = t 2 − 2t y = t +1 0t 4
Synthetic curves
• Lagrange Interpolation curves
• Hermite interpolation curves
• Bezier curves
• B-spline Curves
• NURBS
Continuity
• The notion of continuity 6 was developed for explicit functions to describe
when a curve does not break or tear
• If it meets these conditions, it is described as C0. C0 continuity is defined
by the popular description:
• "A curve is continuous if it can be drawn without lifting the pencil from the
paper."
Continuity
• If the derivative curve is also continuous, then the curve is first-order
differentiable and is said to be C 1 continuous. Extending this idea, it is
said that a curve is Ck differentiable if the kth derivative curve is
continuous.
• Practically, this means that a C 1 continuous curve will not kink. Higher
degrees of continuity imply a smoother curve.
C0 continuity
C1 Continuity
C2 Continuity
Application of Parametric continuity
• Many products, although they look prismatic, are not.
Curvature
• Visual difference between curvature vs. tangent connection of
surfaces
Regular Fillet
Equal Curvature – C2
T
P ( u , v ) = x ( u , v ) , y ( u , v ) , z ( u , v )
T
P(u) = x ( u ) , y ( u ) , z(u)
z
u=const
Umax
--
p(x,y,z) v=const
n
Umin --
p(u) y
y P = P1 + u(P2 - P1), 0 u 1
x
Lines
z P2-P1 P2, u=1
P
P1,
u=0
P P2
P1
y
P = P1 + u(P2 - P1), 0 u 1
x
x = x1 + u(x2 − x1)
y = y1 + u( y2 − y1 ) 0 u 1
z = z1 + u(z 2 −z 1)
Circle
Representation 1 (Non-parametric)
x 2
+ y 2
= 1
(a) x = u
y = 1− u 2
Recursive approach
xn = r cos
y -- Pn
n = r sin
xn+1 = r cos( + d ) = r c o s c o s d − r sin sin d
x n +1 = x n c o s d − y n s i n d
y -- Pn+1
n +1 = y n c o s d + x n s i n d
{ x = xo + Acos
y = y o + B sin
z = zo
0 2
explicit x = cy2
x = x o + Au 2
parametric y = y o + 2Au 0u
z = zo
Hyperbola
x2 y 2
implicit − 2 =1
a 2 b
x = a cosh u
parametric y = b sinh u 0u
z = zo
Parametric Representation
of Synthetic Curves
• Analytic curves are usually not sufficient to meet geometric
design requirements of mechanical parts.
• Many products need free-form, or synthetic curved
surfaces.
• Examples: car bodies, ship hulls, airplane fuselage and
wings, propeller blades, shoe insoles, and bottles
• The need for synthetic curves in design arises on
occasions:
▪ when a curve is represented by a collection of measured
data points and (generation)
▪ when a curve must change to meet new design
requirements. (modification)
The Order of Continuity
The order of continuity is a term usually used to measure
the degree of continuous derivatives (C0 , C1 , C2).
y y
i=2 i=2
i=1 i=3 i=1 i=3
x x
Simplest Case Linear Segment High order polynomial may lead to “ripples”
(2) (3)
(1) (4)
M (x) ai x + bi
y'' (x) = R(x) = =
EI EI
y(x) = [
1 ai 3 bi 2
EI 6
x + x + ci x + d
2 ] Cubic Spline
Drafting Spline
Hermite Cubic Splines
P(u) = x(u), y(u), z(u)T
Cubic Spline
x(u) = c3 x u 3 + c2 x u 2 + c1x u + c0 x
34 = 12
y( u) = c 3y u 3
+ c 2y u 2
+ c1y u + c0 y coefficients to
z (u ) = c 3z u 3
+ c 2z u 2
+ c1z u + c0 z be determined
–
→ ! i
3
() () () ()
p u = x u y u z u = Ciu (0 u 1)
T
C!
i=0
!3
C !
3 2
= u u u 1 !2 =[U ][C]
T
C1
!
C0
Hermite Cubic Splines
⇀ 3 ⇀ ⇀ ⇀ ⇀
P = Ci u = C3u + C2u + C1u + C0
i 3 2 1
i=0 –→, ! ! !
P = 3C3u2 + 2C 2u + C1
⇀ ⇀
P0 = C0
u=0 ⇀' ⇀
Two P!0 = C
!
1
! ! !
43 equations
End P = C +C +C +C from two
Points 1
u =1 ! ! ! !
1 0
3 2
control points
1 = 3C3 + 2C
2 + C1
'
P
p0’
--
Boundary Conditions:
P0 '
Location of the two
end points and their u=0
u=1
slopes
p1
P
--1 p1’
P0
p0 P'
1
Hermite Cubic Splines
C0 = P0
! !'
C1 = P0 12 unknowns
! ! → !' !' and
C2 = 3(P1 − P0 ) − 2P0 − P1
! ! ! !' !' 12 equations
C3 = 2(P0 − P1) + P0 + P1
–
→ 3
# i # 3 # 2 # 1 # All
P = Ciu = C3u + C2u + C1u + C0 parameters
can be
determined
⇀ ⇀ ⇀
i=0
→'
Hermite Cubic curve in
!' vector form
+ (u − 2u + u)P0 + (u − u )P1
3 2 3 2
!
In matrix form: 2 −2 1 1 P0
P!
Based on:
Location of
u3 u2 1 −3 3 −2 −1 !1 the two end
u 0 0 1 0 P0' points and
1 !' their slopes
0 0 0 P1
→
=U T
MH V 0 u 1
→' ⇀ ⇀ ⇀'
P (u) = (6u − 6u)P0 + (−6u + 6u)P1 + (3u − 4u +1)P0
2 2 2
⇀'
+ (3u − 2u)P1 0 u 1
2
Limitations with Hermite Curves
n — segment(each polygon)
n + 1 — vertices (each polygon) an d n u mb e r of control points
u 0, 1
Bezier Curve
• P. Bezier of the French automobile company of
Renault first introduced the Bezier curve.
• A system for designing sculptured surfaces of
automobile bodies (based on the Bezier curve)
n=2
i 0 1 2
2! 2! 2!
n! =1 =2 =1
i!(n − i)! 0! 2! 1! 1! 2! 0!
Bernstein Polynomial
i 0 1 2
2! 2! 2!
n! =1 =2 =1
i!(n − i)! 0! 2! 1! 1! 2! 0!
Bi,n (u) =
n
ui (1− u)n−i
n!
p(u) = pi Bi,n (u)
i=0 i!(n − i) !
→ →
2 → + 2 u(1− u) p 2→
p (u) = 1 (1− u) p0 +1 u p2
→ → → → 1
p '(u) = −2(1− u) p + 2(1− 2u) p + 2up
→ →
0 1 2
p (0) = p0 r r r
p '(0) = 2( p1 − p0 )
→ → r r r
p (1) = p2 p '(1) = 2( p2 − p1 )
The order of Bezier curve is a function of the number of control points. Four
control points (n=3) always produce a cubic Bezier curve.
p3
p1 p0
p2
p2
p2 p3 p1 p1
p0
p0 p3
p3 p0
p1 p2
p3 p1
p2
p0
p1 p0
p3
p1 p2
p2
p1 p2
p1 p2 p1
pn,p3 pn,p3
Convex Hull Property
An Example
The coordinates of four control points relative to a current WCS are given by
T
T , P = 3 3 0 T , P = 3 2 T
P0 = 2 2 0 , P1 = 2 3 0
2 3
0
Find the equation of the resulting Bezier curve. Also find points on curve for
u = 0, 1 4 , 1 2 , 3 4 ,1
P1 P2
P0 P3
Solution
P (u ) = P0 (1− u) + 3Pu ( ) + ( ) + 0 u 1
3 2 2 3
1 1− u 3Pu
2 1− u Pu
3
Substituting the u values into his equation gives
P(0) = P0 = 2 2 0T
27 9 1 u = 0, ¼, ½, ¾, 1
1 27
P = P0 + P1 + P2 + P3 = 2.156 2.563 0T
4 64 64 64 64
P3(3,2)
P0(2,2)
Improvements of Bezier Curve Over
the Cubic Spline
• The shape of Bezier curve is controlled only by its defining
points (control points). First derivatives are not used in
the curve development as in the cubic spline.
• The order or the degree of the Bezier curve is variable
and is related to the number of points defining it; n+1
points define a nth degree curve.
This is not the case for cubic splines where the degree is
always cubic for a spline segment.
• The Bezier curve is smoother than the cubic splines
because it has higher-order derivatives.
B-Spline
f o r m)
0 jk
uj =
j − k +1 k jn
n−k +2 jn
where, 0 j n+k, thus if a curve with (k-1) degree and
(n+1) control points is to be developed, (n+k+1) knots
then are required with 0 u umax = n – k +2
k-‐1
Knot Value Calculation
vertex
2
3
5’’’
7
5’’
4
6
1
5
An Example
n = 3; 4 control points
n increases – wider base
k = 4; 4-1=3 cubic polynomial
k increases – wider & taller
uj: 0 ≤ j ≤ n+k= 7
Calculating the Knots, uj
1 ui u ui+1
N i,1 =
1 u = u max and u u i+1 and u − u i = 1
Calculating Ni,1 0 otherwise
0
=0
0
Calculating Ni,k
Calculating Ni,k
Result
hi N i ,k (u )
Ri ,k = n (hi − scalar )
h N i i ,k (u )
i =0
If hi = 1, then Ri,k (u) = Ni,k (u) ,it is the representation of a B-Spline curve.
then
Advantages of NURBS
• Serve as a genuine generalizations of non-rational B-spline forms
as well as rational and non-rational Bezier curves and surfaces
• Offer a common mathematical form for representing both standard
analytic shapes (conics, quadratics, surface of revolution, etc) and
free-from curves and surfaces precisely. B-splines can only
approximate conic curves.
• Provide the flexibility to design a large variety of shapes by using
control points and weights. increasing the weights has the effect of
drawing a curve toward the control point.
• Have a powerful tool kit (knot insertion/refinement/removal, degree
elevation, splitting, etc.
• Invariant under scaling, rotation, translation, and projections.
• Reasonably fast and computationally stable.
• Clear geometric interpretations
Surface Modelling
Dr. Abhishek Verma
Department of Industrial Design
NIT Rourkela
Surface Representation
•
From CAD/CAM point of view surfaces are as important as curves and solids. We
need to have an idea of curves for surface creation. In the same way surfaces
form the boundaries of the solids.
• Types
• Analytical surfaces
Eg. Plane surfaces, sphere, ellipsoid
• Synthetic surfaces
Eg. Bicubic surface, Bezier surface
• Application
• Modeling parts in CAD/CAM, representation of data surfaces like isothermal planes,
stress surfaces/contours
Paraboloid
Surface Representation
• It is just an extension of representation of curves.
• We can represent a surface as a series of grid points inside its
bounding curves.
• Surfaces can be in two-dimensional space (planar) or in three-
dimensional space (general surfaces).
• Surface can be described using non-parametric or parametric equations
• Surfaces can be represented by equations to pass through all the data
points (fitting) or have patches of them connected at the data points
(approximations)
Non-parametric Representation
• In general a surface or surface patch is represented analytically by an
equation of the form
P(x, y, z) = [x y z] = [x y f (x, y)]
Where P is the position vector. The natural choice for f(x,y) is a polynomial.
Thus for analytical representation of surfaces we can use equations of type
Parametric Representation
• In parametric surfaces a vector valued function P(u,v) of two variables is used
as follows:
• We may use any other parametric curve like cubic spline, Bezier, B-spline
curve can be used which is denoted as P(t) in the sweep surface below:
• If the curve on z=0 plane is swept along z by n units One needs to take the curve
in such a way to avoid surface degeneracies in
full or in part.
Sweep Surface
• In addition to open curves, closed curves and polygons can be used to
create sweep surfaces
• Such surfaces enclose finite volume (with end caps)
• A square or rectangle swept along a straight path results in
parallelepiped
• A triangle swept along straight path yields wedge
• A circle along a straight path results in cylinder
• A circle of decreasing radius -> cone
• Rotation along with sweep can be combined to give a twist to the
generated surface.
Lofted Surface
Equivalence of Surfaces
• Two surfaces S1 and S2 are equivalent if S1 can be mapped onto S2 by a
continuous mapping “without tearing and duplication” and S2 can be similarly be
mapped onto S1.
• This notion of equivalence is somewhat like the notion of a homeomorphism that
is, an invertible map, f : S1 → S2, such that both f and its inverse, f-1, are
continuous.
Triangulation of Surfaces
• Triangulation (tiling) and Orientability
• Definition by P. S. Aleksandrov (1956): A triangulation surface is orientable iff it is
possible to orient all of the triangles in such a way that every two triangles that
have common side are coherently oriented, otherwise it is called non-orientable.
• If Z1 and Z2 are triangulations of the same surface, Z1 is orientable iff Z2 is
orientable.
Thank You
Surface Modelling
Dr. Abhishek Verma
Department of Industrial Design
3D Modelling
• 3D Representations
• Wireframe models
• Surface Models
• Solid Models
• Meshes and Polygon soups
• Voxel/Volume models
• Decomposition-based
• Octrees, voxels
• Modeling in 3D
• Constructive Solid Geometry (CSG),
Breps and feature-based
Representing 3D Objects
• Exact
• Wireframe
• Parametric Surface
• Solid Model
• CSG
• BRep
• Implicit Solid Modeling
• Approximate
• Facet / Mesh
• Just surfaces
• Voxel
• Volume info
Representing 3D Objects
• Exact
• Precise model of object topology
• Mathematically represent all geometry
• Approximate
• A discretization of the 3D object
• Use simple primitives to model topology and geometry
Negatives when Representing 3D Objects
• Exact
• Complex data structures
• Expensive algorithms
• Wide variety of formats, each with subtle nuances
• Hard to acquire data
• Translation required for rendering
• Approximate
• Lossy
• Data structure sizes can get HUGE, if you want
good fidelity
• Easy to break (i.e. cracks can appear)
• Not good for certain applications
• Lots of interpolation and guess work
Positives when Representing 3D Objects
• Exact • Approximate
• Precision • Easy to implement
• Simulation, modeling, etc • Easy to acquire
• Lots of modeling environments • 3D scanner, CT
• Physical properties • Easy to render
• Many applications (tool path • Direct mapping to the
generation, motion, etc.) graphics pipeline
• Compact • Lots of algorithms
Exact Representations
• Wireframe
• Parametric Surface
• Solid Model
• operations
• CSG, BRep, implicit geometry
Wireframes
• Basic idea:
• Represent the model as the set of all of its edges
• Example: A simple cube – 12 lines – 8 vertices
• How about the faces?
Issues with Wireframes
• Visually ambiguous
• No surfaces!
• What’s inside? What’s outside?
• Hidden line removal?
• What does validity entail?
• Don’t we just have a bunch of wires?
• Do they need to add up to something?
• How to model wireframe shapes?
• Wire by wire? Not very easy!
Surface Models
• Basic idea:
• Represent a model as a set of faces/patches
• Limitations:
• Topological integrity; how do faces “line up”?; which way is
‘inside’/ ‘outside’?
• Used in many CAD applications
• Why? They are fine for drafting and rendering, not as good for
creating true physical models
3D Mesh File Formats
• Some common formats
• STL
• SMF
• OpenInventor
• VRML
Minimal
• Vertex + Face
• No colors, normals, or texture
• Primarily used to demonstrate geometry algorithms
Full- Featured
• Colors / Transparency
• Vertex-Face Normals (optional, can be computed)
• Scene Graph
• Lights
• Textures
• Views and Navigation
Simple Mesh Format (SMF)
• Michael Garland
• http://graphics.cs.uiuc.edu/~garland/
• Triangle data
17
Solid Modelling Methods
• Constructive solid geometry (CSG or C-Rep):
In a CSG, physical objects are created by combining elementary
shapes known as primitives like blocks, cylinders, cones, pyramids
and spheres. The Boolean operations like union (∪), difference (–)
and intersection (∩) are used to carry out this task.
• Sweep Representation
• Cell decomposition
18
Why Solid Modelling ?
Solid Modeling Supports,
19
Why Solid modeling ?
• Weakness of wireframe and surface modeling
– Ambiguous geometric description
– incomplete geometric description
– lack topological information
– Tedious modeling process
– Awkward user interface
22
Solid Modeling Using Boolean
32
Solid Representation Schemes
• Constructive solid geometry ( CSG )
• Boundary representation (B-Rep)
• Spatial occupancy enumeration
• Cell decomposition
• Sweep representation
38
SWEEP REPRESENTATION
Sweep
• Useful in creating 3 D solid models that possess translational,
rotational or other symmetries.
• Class includes,
1) Solids of uniform thickness in given direction –
Known as extruded solids and are created via linear
or translational sweep
2) Axisymmetric solids – Solids of revolution which can
be created via rotational sweep
Solids that have a uniform thickness in a particular direction and axisymmetric
solids can be created by what is called Transitional (Extrusion) and Rotational
(Revolution) Sweeping
Extrusion Revolution
41
Sweeping
42
Sweep Representation
43
Sweep
• Based on the notion of moving a point, curve, of a surface
along a given path
• Three types,
1) Linear
2) Non linear and
3) Hybrid sweeps
49
Constructive Solid Geometry : CSG
• This is a solid modeling method that combines simple solid
primitives to build more complex models using Boolean
operators: union, difference and intersection.
50
Primitive Solids and Boolean Operations
The basic primitive solid:
51
52
Constructive Solid Geometry
• CSG defines a model in terms of combining basic and
generated (using extrusion and sweeping operation) solid
shapes.
• CSG uses Boolean operations to construct a model (George
Boole, 1815-1864, invented Boolean algebra).
• There are three basic Boolean operations:
53
Boolean Operations in CSG
58
Boolean Operations
Subtract
Intersection
Union
60
Solid Modeling
Example Using CSG Union
Cut
65
78
BOUNDARY REPRESENTATION
(B-rep)
BOUNDARY REPRESENTATION (B-rep)
• A solid model is formed by defining the surfaces that form
its boundary (edges and surfaces)
85
• A Loop is an ordered alternating sequence of vertices and edges. A loop defines a
non-self-intersecting, piecewise, closed space curve which, in turn, may be a
boundary of a face.
Body
• Geometry relates to the
information containing shape
Genus
defining parameters, such as the
coordinates of the vertices
Face Surface
88
B-Rep Model
91
Solid modeling system
If a solid modeling system is to be designed,
1. The domain of its representation scheme must be
defined
2. The basic elements must be identified
3. The proper operators that enable to build complex
objects must be developed
4. Suitable date structure to store all relevant data
5. Other system and geometric utilities (such as
intersection algorithms) may also need to be designed
Polyhedral objects
Classified into 4 classes,
1. Simple polyhedra
2. With faces of inner loops
3. With not through holes
4. With handles
Simple polyhedra
• Do not have holes
• Each face is bounded by a single set of connected edges
With faces of inner loops
With not through holes
With handles
Curved edges
• Representation is more complex
• Direct and indirect schemes
• Direct scheme – edge is represented by a curve equation
and ordered endpoints
• Indirect scheme – edge is represented by the intersection
of two surfaces
Spatial Occupancy Enumeration
Spatial-Partitioning Representations
Describe objects as collections of adjoining nonintersecting solids
118
Voxel based Spatial-occupancy
enumeration
– Defines objects using identical cells arrayed in a fixed and
regular grid (called voxels)
119
120
Quadtrees
based Spatial-occupancy enumeration
▪ Quadtrees
121
Voxel Quadtrees 122
Quadtrees
123
124
Octrees
based Spatial-occupancy enumeration
▪ Octrees
Disadvantage of decomposition
• Not a Convenient method for construction of solid
• Approximation method
128
Cell decomposition
• Special decomposition method.
• In cell decomposition method , the object divided In the form
of a cell.
• All cells are made of box like objects, but need not be same
size and shape.