CSK CIM Modelling I Mod (2024)
CSK CIM Modelling I Mod (2024)
C S Kumar
CAD-CAM and Robotics Lab
Mechanical Engineering
IIT Kharagpur
Lecture Topics
• Basics of Modelling in CAD
• Database Representations
• Solid Modelling
Form Models
Multi-view Drawings
Types of views
Isometric Perspective
Perspective and
3D rendering
CAD/CAM/CAE
The Role of Geometric
ModelingCAD
in aSystem
Computer
Display
Mathematical
User representation
Interface Drawing
(Database)
Generation
Determine Determine
Geometric
Modeling Analysis and
Technique Manufacturing
General Requirements
Problems:
Training is necessary to understand the drawing
Mistakes often occur
Does not support subsequent applications such as finite element
analysis (FEA) or NC part programming
Wireframe Modeling
• Developed in 1960s and referred as “a stick figure” or “an edge
representation”
• The word “wireframe” is related to the fact that one may imagine
a wire that is bent to follow the object edges to generate a
model.
• Model consists entirely of points, lines, arcs and circles, conics,
and curves.
• In 3D wireframe model, an object is not recorded as a solid.
Instead the vertices that define the boundary of the object, or the
intersections of the edges of the object boundary are recorded
as a collection of points and their connectivity.
or
fro nt
fron t
ambiguous
Example of Wireframe Modeling
Surface Modeling
• A surface model is a set of faces.
• A surface model consists of wireframe entities that form
the basis to create surface entities.
• In general, a wireframe model can be extracted from a
surface model by deleting or blanking all surface entities
• Shape design and representation of complex objects such
as car, ship, and airplane bodies as well as castings
Free-form, Curved, or
Analytical Surfaces Sculptured Surface
Examples of Surface Models
• Surface models define only the geometry, no topology.
• Shading is possible
Spaces
out
• Primitive Instancing - uses large numbers (200 - 300) of “primitives" to build object - used
for programming NC machine tools (past)
• Cell Decomposition, Spatial Enumeration, Octree (connected cubes of varying size) –
used for irregular objects, image processing, medical applications (CT)
Information complete, unambiguous, accurate solid model
Constructive Solid
Geometry (CSG)
• Pre-defined geometric primitives
• Boolean operations
Defined
Geometric
Features
Boolean Operations
in CSG
• Union, U
• Intersection, n
• Difference, or Subtraction, -
U - - n
CSG Tree
Alternative Paths of Modeling
A lengthy,
lousy
process
Sweeping
Sweeping can be carried out in two different forms:
• Extrusion - to produce an object model from a 2D cross-section
shape, the direction of extrusion, and a given depth. Advanced
applications include curved extrusion guideline and varying
cross-sections.
• Revolving - to produce a rotation part, either in solid or in shell
shape. Revolving a 2D cross-section that is specified by a closed
curve around the axis of symmetry forms the model of an axially
symmetric object.
box( a, b, c) cylinder( h, r)
z
z
x
y
y
x
Z
primitives
X
-*
box( 25, 25, 15) Trans( 5 2,0, 15) Rot(Y, 45) Trans(-5,
-5, 0, -5) box( 10, 25, 10)
Questions:
Non-Unique representation
Boundary of a solid ?
Boundary of surfaces?
Boundary of points ?
BREP
Boundary of surfaces…
(b) Faces: boundary of solid
bounded, connected subsets of Surfaces
…
An Edge-Based Model F aces:
f1 e1 e4 e5
f2 e2 e6 e4
f3 e3 e5 e6
f4 e3 e2 e1
v4
e6 E d ges:
e4 e1 v1 v2
e5 v3 e2 v2 v3
e3 v3 v1
e3 e2 e4 v2 v4
e5 v1 v4
v1 v2 e6 v3 v4
e1
V e r tic e s :
v1 x1 y1 z1
v2 x2 y2 z2
v3 x3 y3 z3
v4 x4 y4 z4
v5 x5 y5 z5
v6 x6 y6 z6
BREP Example
v4
e6
v8
e12 v3
e5 e11 e10 e4
v7
e9
e8
v5 e2
e7 v6
e3
v1 v2
e1
BREP Example
Vertices:
v4 v1 x 1 y 1 z1
v2 x 2 y 2 z2
e6 v3 x 3 y 3 z3
v8
e12
v4 x 4 y 4 z4
v3
e5 e11
e9
e10
v7
e4
v5 x 5 y 5 z5
v5
e8
e2 v6 x 6 y 6 z6
e7 v6
e3 v7 x 7 y 7 z7
v1
e1 v2 v8 x 8 y 8 z8
v9 x 9 y 9 z9
v 10 x 10 y 10 z 10
v 11 x 11 y 11 z 11
v 12 x 12 y 12 z 12
BREP Example.. Edges:
e1 v1 v2
v4
e2 v2 v3
e3 v3 v1
e6
e4 v2 v4
v8 e5 v1 v4
e11 e10
e12
e4 v3 e6 v3 v4
e5 v7
e9 e7 v5 v6
e8
v5 v6
e2 e8 v6 v7
e7
e3 e9 v7 v5
v1
e1 v2
e10 v6 v8
e11 v5 v8
e12 v7 v8
BREP Example… Faces:
f1 l1 l2
f2 l3
v4
f3 l4
f4 l5
e6
v8 f5 l6
e12 f6 l7
e11 e10 e4 v3
e5 v7 f7 l8
e9
e8
v5 e2 Loops:
e7 v6
l1 +e1 +e4 -e5
e3
l2 -e7 +e11 -e10
v1 v2 l3 +e2 +e6 -e4
e1
l4 +e5 -e6 +e3
l5 -e1 -e3 -e2
l6 +e7 +e8 +e9
l7 +e10 -e12 -e8
l8 -e11 -e9 +e12
BREP: Winged edge data structure
Solid
s_faces f_solid
f_loops l_face
l_coedge c_loop
v_start v_end
face
Area of Face
co-edges
e6
e4 e4
Face CCW convention => e5
e2
Each edge is once +ve, once -ve
e1
Body, Face, Polygon
(Edge Loop), Edge, Vertex
Euler Operators
MBFV: Make body, face,
vertex
MME: Make multi edges
MEF: Make edge, face
KEML: Kill edge, make loop
Intrinsic Properties
• Curvature as a function of arc length: rate of change
of tangent vector
• Torsion as a function of arc-length: how much a space
curve deviates from a plane curve or rate of change of
binormal vector
Explicit Equations
Y = f(x)
• There is only one y value for each x value; not vice-
versa
• Easy to generate points or plot of the curves
• Can easily check whether a point lies on the curve
• Cannot represent closed or multiple-valued curves
Implicit Equations
Can represent closed form or multiple-valued:
f(x,y)=0
• Mostly deal with polynomial or rational functions
• Implicits are a proper superset of rational parametric
E.g. Line: Ax + By + C = 0
Conic: Ax2+ 2Bxy + Cy2 + Dx + Ey + F = 0
â
P = [ x y 1], &
Q= A B D õ
B C E
D E F
P is given by homogeneous coordinates
Conic Curves
121
Translating into usable math
• Smoothness
• in drafting spline, comes from physical curvature minimization
• in CG spline, comes from choosing smooth functions
• usually low-order polynomials
• Control
• in drafting spline, comes from fixed pegs
• in CG spline, comes from user-specified control points
136
Defining spline curves
• At the most general they are parametric curves
137
Defining spline curves
• Generally f(t) is a piecewise polynomial
• for this lecture, the discontinuities are at the integers
• e.g., a cubic spline has the following form over [k, k + 1]:
138
Coordinate functions
139
Control of spline curves
140
How splines depend on their controls
141
Trivial example: piecewise linear
• This spline is just a polygon
• control points are the vertices
• But we can derive it anyway as an illustration
• Each interval will be a linear function
• x(t) = at + b
• constraints are values at endpoints
• b = x0 ; a = x1 – x0
• this is linear interpolation
142
Trivial example: piecewise linear
• Vector formulation
• Matrix formulation
143
Trivial example: piecewise linear
• Basis function formulation
• regroup expression by p rather than t
144
Trivial example: piecewise linear
• Vector blending formulation: “average of points”
• blending functions: contribution of each point as t changes
145
Trivial example: piecewise linear
• Basis function formulation: “function times point”
• basis functions: contribution of each point as t changes
146
Seeing the basis functions
• Basis functions of a spline are revealed by how the curve changes in
response to a change in one control
• to get a graph of the basis function, start with the curve laid out in a straight,
constant-speed line
• what are x(t) and y(t)?
• then move one control straight up
147
Hermite splines
• Less trivial example
• Form of curve: piecewise cubic
• Constraints: endpoints and tangents (derivatives)
148
Hermite splines
• Solve constraints to find coefficients
149
Hermite splines
• Matrix form is much simpler
• cofficients = rows
• basis functions = columns
• note p columns sum to [0 0 0 1]T
150
Longer Hermite splines
• Can only do so much with one Hermite spline
• Can use these splines as segments of a longer curve
• curve from t = 0 to t = 1 defined by first segment
• curve from t = 1 to t = 2 defined by second segment
• To avoid discontinuity, match derivatives at junctions
• this produces a C1 curve
151
Hermite splines
• Hermite blending functions
152
Hermite splines
• Hermite basis functions
153
Continuity
• Smoothness can be described by degree of continuity
• zero-order (C0): position matches from both sides
• first-order (C1): tangent matches from both sides
• second-order (C2): curvature matches from both sides
• Gn vs. Cn
zero order first order second order
154
Continuity
• Parametric continuity (C) of spline is continuity of coordinate
functions
• Geometric continuity (G) is continuity of the curve itself
• Neither form of continuity is guaranteed by the other
• Can be C1 but not G1 when p(t) comes to a halt (next slide)
• Can be G1 but not C1 when the tangent vector changes length abruptly
155
Control
• Local control
• changing control point only affects a limited part of spline
• without this, splines are very difficult to use
• many likely formulations lack this
• natural spline
• polynomial fits
156
Control
• Convex hull property
• convex hull = smallest convex region containing points
• think of a rubber band around some pins
• some splines stay inside convex hull of control points
• make clipping, culling, picking, etc. simpler
157
Affine invariance
• Transforming the control points is the same as transforming the curve
• true for all commonly used splines
• extremely convenient in practice…
158
Matrix form of spline
159
Hermite splines
• Constraints are endpoints
and endpoint tangents
160
Hermite basis
161
Affine invariance
• Basis functions associated with points should always sum to 1
162
Hermite to Bézier
• Mixture of points and vectors is awkward
• Specify tangents as differences of points
164
Bézier matrix
C(n,k) tk (1 – t)n – k
165
Bézier basis
166
Convex hull
• If basis functions are all positive, the spline has the convex hull
property
• we’re still requiring them to sum to 1
167
Chaining spline segments
• Hermite curves are convenient because they can be made long
easily
• Bézier curves are convenient because their controls are all points and
they have nice properties
• and they interpolate every 4th point, which is a little odd
• We derived Bézier from Hermite by defining tangents from control
points
• a similar construction leads to the interpolating Catmull-Rom spline
168
Chaining Bézier splines
• No continuity built in
• Achieve C1 using collinear control points
169
Subdivision
• A Bézier spline segment can be split into a two-segment
curve:
[FvDFH]
• de Casteljau’s algorithm
• also works for arbitrary t
170
Cubic Bézier splines
• Very widely used type, especially in 2D
• e.g. it is a primitive in PostScript/PDF
• Can represent C1 and/or G1 curves with corners
• Can easily add points at any position
171
B-splines
• We may want more continuity than C1
– http://en.wikipedia.org/wiki/Smooth_function
• We may not need an interpolating spline
• B-splines are a clean, flexible way of making long splines with
arbitrary order of continuity
• Various ways to think of construction
– a simple one is convolution
– relationship to sampling and reconstruction
172
Cubic B-spline basis
173
Deriving the B-Spline
• Approached from a different tack than Hermite-style constraints
• Want a cubic spline; therefore 4 active control points
• Want C2 continuity
• Turns out that is enough to determine everything
174
Efficient construction of any B-spline
175
B-spline construction, alternate view
• Recurrence
• ramp up/down
• Convolution
• smoothing of basis fn
• smoothing of curve
176
Cubic B-spline matrix
177
Other types of B-splines
• Nonuniform B-splines
• discontinuities not evenly spaced
• allows control over continuity or interpolation at certain points
• e.g. interpolate endpoints (commonly used case)
• Nonuniform Rational B-splines (NURBS)
• ratios of nonuniform B-splines: x(t) / w(t); y(t) / w(t)
• key properties:
• invariance under perspective as well as affine
• ability to represent conic sections exactly
178
Converting spline representations
• All the splines we have seen so far are equivalent
• all represented by geometry matrices
179
Evaluating splines for display
• Need to generate a list of line segments to draw
• generate efficiently
• use as few as possible
• guarantee approximation accuracy
• Approaches
• reccursive subdivision (easy to do adaptively)
• uniform sampling (easy to do efficiently)
180
Evaluating by subdivision
• Recursively split spline
• stop when polygon is
within epsilon of curve
[FvDFH]
• Termination criteria
• distance between control points
• distance of control points from line
p2
p4
p1 p3
181
Evaluating with uniform spacing
• Forward differencing
• efficiently generate points for uniformly spaced t values
• evaluate polynomials using repeated differences
182