Beruflich Dokumente
Kultur Dokumente
• Efficient Solutions
– Midpoint Circle Algorithm
Mid point Circle Algorithm
• For a given radius r and screen center position
(xc, yc) – setup an algorithm from origin (0, 0).
• Then each calculated position (x, y) is moved
to proper screen position by adding xc to x and
yc to y.
• Octant – x=0 to x=y in 1st quadrant.
• Slope of the curve (circle) varies from 0 to -1.
• Unit steps in x direction.
Mid point Circle Algorithm
• To apply the midpoint method, we define a
circle function:
• The circle function tests in (3) are performed for the mid
positions between pixels near the circle path at each sampling
step.
0 m1 1
• R-2:
m1 m2 = −1
m2 = −1/ m1
m2 −1
m2 1
Midpoint Ellipse Algorithm
• Regions 1 and 2 (Fig. 3-25) can be processed in
various ways.
[ m] x + [c ] x + [ k ] x = 0
➢ But now what do we do with
this?
Engineering problems
• What is the nature of this
equation?
[ m] x + [c ] x + [ k ] x = 0
• Type:
➢ Algebraic?
➢ Transcendental – Log, Exp,
Trigonometric?
➢ ODE – Functions of single ➢ Parametric?
variable and its derivatives ➢ Differential?
➢ PDE – Multiple independent ➢ Integral?
variable functions and partial
derivatives
Engineering problems
• Now what is the exact nature of
this ODE?
[ m] x + [c ] x + [ k ] x = 0
• Order: Second
• Degree: one
• Linear or nonlinear? – Depends on
power of variable and its
derivatives too.
• Linear
➢ Numerical methods – Is this • Solution techniques:
an IVP or BVP? ➢ Exact methods – applied to simple
➢ IVP: Runge – Kutta, problems (2 parts: homogeneous
Predicator Corrector etc. and particular)
➢ BVP: Shooting methods, ➢ Numerical methods – applied to
FDM, FEM complex problems too
Engineering problems
• If actual structure would have
been replaced by several
pieces or elements – each
continuous structural
member and BVP
• Solution:
➢ finite element software assembles the governing algebraic
equations in matrix form and computes the unknown values of the
primary field variable(s) and then derived variables.
FEM procedure
• Post processing: Analysis and the evaluation of solution results
referred to as post processing.
Global Local
Natural
Stresses and Equilibrium
x = [ x y z]T
u = [u v w]T
f = [ fx fy f z ]T
T = [Tx Ty Tz ]T
Pi = [ Px Py Pz ]iT
= [ x y z yz xz xy ]T
= [ x y z yz xz xy ]T
Potential Energy
• Out of two popular approaches (Potential energy approach and
Galerkin’s approach) to present FEM, we adopt the Potential energy
approach throughout the text.
• Five nodes
• Total: 5 DOF
x − x1 + 1
=
x2 − x1 2
• Unknown displacement field within an element will be interpolated
by linear shape function (Good approximation – as number of
elements go up)
• Shape functions
Shape functions
Recalled?
Recalled CST?
Not functions of x
Element stiffness matrix
Compare this 1 2
equation with: U = kx
What can be said 2
about K?
e
u T fA dx = Ae f qT N T dx
e
Element Body force vector
Element Body force vector
e
u T T dx = T qT N T dx
e
Element Traction force vector
Important equations
Element body load vector Element Stiffness Matrix Element traction load vector
[First row of K × Q] - F1
Penalty approach
Firstly from unreduced K: N × N, identify ‘max(kij)’, then take modulus of that and
multiply that by 104 and assign it to C
Reactions:
One dimensional Finite Element
Examples
• Firstly divide the domain into two 1D elements:
• How? – Averaging the area
[First row of K × Q] - F1
(a) Nodal displacements using penalty approach
Firstly find C; Secondly identify the places in K and F where C and C × ai can be
added respectively
Here 1st and 3rd nodes are fixed and thus a1 and a3 are zero
C should be added to 1st and the 3rd diagonal elements of K; and nothing should be
added to F as a1 and a3 are zero
(b) Stress in each element
(c) Reaction forces:
• Two reactions at two fixed nodes – 1 and 3
• What is the equation to find reaction force for penalty approach?
• What do we consider: is B’ free or fixed?
• Firstly let us assume B’ is free, and find displacement at B’: If it comes to be less
than 1.2 mm – then our assumption is valid; otherwise B’ has to be considered
fixed after being displaced by 1.2 mm.
• Nothing has been said about boundary condition approach: you may use any.
1
Temperature Effects
• Moreover due to this additional load
we have new equation to find stress:
One dimensional Finite Element
Example with
“Temperature Effects”
(b) Using elimination approach:
• Nodes (DOF) 1 and 3 are fixed – so K reduces to 1×1 value:
For further reading (for examinations)
Problem definition
and conceptualisation
Geometric modelling
and spatial analysis
For example Design
of an office chair Engineering analysis
and optimization
Prototype development
Manufacturing process
development
Manufacturing
Implementation
How can CAD be fit in conventional
design cycle?
How can CAD be fit in conventional
design cycle?
How can CAD be fit in conventional
design cycle?
How can CAD be fit in conventional
design cycle?
How can CAD be fit in conventional design cycle?
How can CAD be fit in conventional
design cycle?
Customer CAM
feedback Marketing
cycle
Reasons for implementing a CAD
system
• Computers can store and handle large amount
of eng. Data; that can be utilized for design
and analysis.
• Complex geometrical shapes can be visually
inspected and checked.
• CAD tools make design, simulation, analysis
and optimization an easy task.
• CAD systems can easily be integrated with
CAM systems.
CAD applications
• Applications are numerous in fields like
Mechanical, Electrical and Architectural.
• Geometric engine:
➢Heart of modeling
➢Provides functions to perform modeling and
construction, editing and manipulation,
drafting and documentation.
➢Creating this represents a means and not a
goal for engineers.
CAD applications
• Checking interference between mating parts
in an assembly.
• Deformation, stress and strain analysis of
machine components.
CAD benefits
• Improved productivity
• Shorter lead times
• Customer’s modifications are easier to make
• Improved accuracy of design
• In analysis, easier recognition of component
interactions
• Fewer errors in NC part programming
• Saves materials and machining time by
utilizing optimization algorithms.
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
CAD benefits: Analysis example
• Without actual manufacturing of the component,
stress analysis is done.
• How to verify the results???
• Make a prototype and by placing strain gauges
calculate deformations at various section under
loads; and then finding stresses analytically and
compare the same with the software results.
• Saves a good amount of time
• This design can further be optimized
Scope of CAD
• CAD is a subset of the design process (As shown earlier
in design cycle)
• Activities of CAD systems: mass properties, FEA,
dimensioning, tolerancing, assembly modeling,
generating shaded images, documentation and drafting.
Geometric Computer
modeling graphics
CAD
Design
CAD programming
• CAD systems are powerful software applications, they
employ complex geometric modeling concepts,
computer graphics algorithms, software techniques,
design and analysis theories, manufacturing techniques
and database and management concepts.
COMPUETR GRAPHICS: Scan conversion; Bresenham’s Algorithm for line, circle and Ellipse. Standards
for graphics programming, features of GKS, other graphics standards, PHIGS, IGES, PDES. Standards in
CAD.
UNIT II 09
GEOMETRIC TRANSFORMATIONS: Geometric transformations- 2D and 3D translation, scaling,
rotation, shear and reflection, homogeneous transformations
UNIT III 12
PLANE & SPACE CURVES: Types of mathematical representation of curves, parametric representation
of line, circle, ellipse, parabola, hyperbola. Wire frame models, wire frame entities parametric
representation of synthetic curves Hermit cubic splines, Bezier curves, B-splines, constructive solid
geometry
FINITE ELEMENT METHOD : Introduction, FEM procedure, Types of elements, stiffness matrix,
Boundary conditions, shape functions, 1-D structural problem, effect of temperature.
ME401T
UNIT IV 09
Computer Programming: Use of computer programming in design of machine elements, thermal
system and fluid systems, development of computer program using C, Matlab, etc. for machine
components like shaft, spring, coupling, gears, bearing etc., plotting graphs using programming
language, generalized programming, optimization in design.
Approximate Total : 39
Hrs
Texts and References
1. CAD/CAM: Computer Aided design and Manufacturing by Mikell Groover and Zimmer, Pearson
Education .
2. Computer Aided Engineering & Design by Jim Browne, New Age International Publications.
3. Computer Graphics & design by P. Radhakrishnan, C.P. Kothanadaraman, New age publication.
4. CAD / CAM - Chris McMohan, Jimmie Brown Addison – Wesley.
5. CAD/CAM Theory & Practice by Ibrahim Zeid, Tata Mc Graw Hill.
6. Finite Element Analysis by Chandrupatla, EEE Publication.
7. Computer graphics principles and practice by Hearn and Baker
Subject Learning Objectives
• Understand the nature of CAD systems, their
basic structures, their engineering tasks, and
their use to create geometric models of simple
parts.
• Understand the graphics displays, 2D and 3D
transformations.
• Understand the mathematical representation
of plane and space curves.
• Computer programming in Mechanical Design
In other words
What is CAD?
ME 401T
How can mechanical
component designs How can these
be programmed? entities be
transformed?
• Algorithms for displaying straight lines are based on the above line
equation and the calculations.
• For given Δx interval we can calculate corresponding Δy interval as:
y = m x voltage difference in analog devices
• For given Δx interval we can calculate corresponding Δy interval as:
xk +1 = xk + x = xk + (1/ m) yk +1 = yk + y = yk + 1
DDA Line drawing algorithm Logic
• The previous equations should be used if the line is to be drawn from
left end point to right:
• For the reverse case i.e. from right to the left: Decrement should be
given and not the increment:
• If |m| ≤ 1 then we sample Δx = -1 and Δy = -m
xk +1 = xk + x = xk − 1 yk +1 = yk + y = yk − m
• For the lines with negative slope same equations can be used, i.e. If m <
0 but |m| ≤ 1 and a line is to be drawn from left end point to the right
one then we set Δx = 1 and Δy = m and increment in x and y can be
determined as:
xk +1 = xk + x = xk + 1 yk +1 = yk + y = yk + m
DDA Line drawing algorithm
1. Input the two line end points: (x0, y0) and (x1, y1)
2. Calculate the x (Horizontal) and y (Vertical) differences as:
dx = x1 - x0 and dy = y1 - y0
3. steps = abs(dx) if abs(dx) > abs(dy)
steps = abs(dy) if abs(dy) > abs(dx)
i. e. (1, 3) & (8,7) then dx = 7 and dy = 4; so m = 4/7 < 1, so Δx = 1 and
Δy = m and find x and y increment accordingly – 7 (steps) times.
4. Start from (x0, y0)
5. X – increment = dx/steps and Y – increment = dy/steps
6. Repeat step 5 of the algorithm steps times or till you reach the end
point coordinates.
DDA Line drawing algorithm Example
Example 1: Draw a line connecting two points (2, 7) and (15, 10) by DDA
algorithm:
Solution:
1. x0 = 2, y0 = 7, x1 = 15, and y1 = 10
2. abs(dx) = 13; and abs(dy) = 3
3. steps = 13
4. Plot (2,7) – 0th step.
5. X - increment = 1, and Y – increment = 3/13 = 0.23
DDA Line drawing algorithm Example cont…
Sr. No. x y Rounded y (x, Rounded y)
0 2 7 7 (2, 7)
1 3 7.23 7 (3, 7)
2 4 7.46 7 (4, 7)
3 5 7.69 8 (5, 8)
4 6 7.92 8 (6, 8)
5 7 8.15 8 (7, 8)
6 8 8.38 8 (8, 8)
7 9 8.61 9 (9, 9)
8 10 8.84 9 (10, 9)
9 11 9.07 9 (11, 9)
10 12 9.3 9 (12, 9)
11 13 9.53 10 (13, 10)
12 14 9.76 10 (14, 10)
13 15 9.99 10 (15, 10)
DDA Line drawing algorithm Example cont…
(x, Rounded y)
(2, 7)
(3, 7)
(4, 7)
(5, 8)
(6, 8)
(7, 8)
(8, 8)
(9, 9)
(10, 9)
(11, 9)
(12, 9)
(13, 10)
(14, 10)
(15, 10)
DDA Line drawing algorithm drawbacks
• Although DDA is fast, the accumulation of round off error in successive
additions of floating point increment can cause the calculated pixel
position to drift away from the true line path for long line segments.
y = m( xk + 1) + b
d1 = y − yk d 2 = ( yk + 1) − y
d1 = m( xk + 1) + b − yk d 2 = yk + 1 − m( xk + 1) − b
d1 − d 2 = ?
Bresenham’s line algorithm
pk = x(d1 − d 2 )
the kth step pk +1 = 2y xk +1 − 2x yk +1 + c
pk = 2y xk − 2x yk + c
Bresenham’s line algorithm
pk +1 − pk = 2y ( xk +1 − xk ) − 2x ( yk +1 − yk )
xk +1 = xk + 1
pk +1 = pk + 2y − 2x ( yk +1 − yk )
The first parameter P0 is evaluated as:
P0 satisfies the line equation as:
y0 = m x0 + b
y
y0 = x0 + b
x
pk = 2y xk − 2x yk + 2y + x(2b − 1)
p0 = 2y xo − 2x y0 + 2y + x(2b − 1)
y
p0 = 2y xo − 2x( x0 + b) + 2y + x(2b − 1)
x
p0 = 2y − x
Bresenham’s line algorithm
• For a line with positive slope greater than 1,
interchange the roles of x and y directions.
• That is step along the y direction in unit steps and
calculate successive x.
• For negative slope the procedure is same.
Steps for Bresenhms Line Drawing
Algorithm
1. Input the two end points and store the left end
Point in (x0,y0)
2. Load (x0,y0) into the frame buffer (plot the first
point)
Otherwise
Point to plot is (xk+1, yk+1)
pk+1 = pk + 2Δy - 2Δx
• Analogy:
Governing equilibrium equations : Mechanics and
thermal fluids :: Geometric modeling : CAD/CAM
The Role of Geometric Modeling in
a CAD system
Why study mathematical basis of geo-
modeling?
• Provides a good understanding of terminology
encountered in the CAD/CAM field.
• Enables users to decide which type of entity to use
in a particular model to meet geometric
requirements such as slopes and/or curvatures.
• Users become able to interpret any unexpected
results they may encounter from using a particular
CAD/CAM system.
• Better evaluation criteria
Goal of geo-modeling?
• To create solid or surface models
• Construction of these models begins with points,
lines, and curves
• Complex models, such as bottles and hair dryers,
require surfaces.
• We extend curves to create surfaces
• We then use surfaces to create solids
Curves
Analytic Synthetic
Points, lines, arcs, circles, Various types of spline
conics (ellipses, (Cubic spline, B –
parabolas, hyperbolas), spline), Bezier curve
fillets and chamfers Interpolated (limited
flexibility in shape
Can be represented by creation – from data
simple mathematical points) and
equations approximated (the
most flexibility) curves
Curve representation
A curve descried by coordinate data: impractical
• Large storage
• Computationally intensive
• Exact shape of the curve remains unknown
• No exact calculations can be done – intersection of
curves, physical properties of an object like volume
A curve descried by analytic equation
• Effect of data points on curve behavior, control,
continuity and curvature
Curve Representation
Classification of mathematical representation of
curve:
• Parametric and non-parametric
Explicit Y = a+ bx+ cx2+ dx3
• Nonparametric
Implicit (x-h)2+(y-k)2 = r2
• Explicit: a unique value of dependent variable for
each value of independent variable.
• Implicit: No distinction is made between
dependent and independent variables.
Limitations of non-parametric form
Limitations of non-parametric form:
P-P1 is proportional to
P2-P1 such that
Analytic curves (Lines)
Thus the equation
becomes
In scalar form
Analytic curves (Lines)
Analytic curves (Lines)
Tangent vector of the The independence of the
line is given by: tangent vector from u
reflects the constant slope
In scalar form: of the straight line
Analytic curves (Lines)
The unit vector in the
direction of the line is
given by
L is the parameter in
equation
Once the user inputs , P1 ,
Thus the tangent and L, the other end point
vector is n. P2 is calculated using the
equation
Which method do you know to solve this problem?
L3 : P = P4 + u ( P4 − P3 )
L1 ⊥ L2 : ( P2 − P1 ) • ( P3 − P1 ) = 0
L1 L3 : ( P2 − P1 ) ( P4 − P3 ) = 0
P = P1 + u ( P2 − P1 )
x2 − x1 = 2
y2 − y1 = 2
z2 − z1 = 0
A = P2 − P1 A = P2 − P1
B = P4 − P3 B = P3 − P4
( P2 − P1 ) • ( P4 − P3 ) ( P2 − P1 ) • ( P3 − P4 )
cos = cos =
P2 − P1 P4 − P3 P2 − P1 P3 − P4
L1 : P = P1 + u ( P2 − P1 ) L1 : P = ( P2 − P1 )
/
P3 = P1 + 0.5( P2 − P1 )
L2 : P = ( P4 − P3 )
/
L2 : P = P3 + u ( P4 − P3 )
Yes they are constant.
L1 : P = P1 + 0.25( P2 − P1 )
Because tangent vectors of lines are
L2 : P = P3 + 0.25( P4 − P3 )
their slopes, and lines have constant
slopes.
Analytic curves (Circles)
• Circles and circular arcs
are among the most
common entities used in
geometric modeling.
xn +1 = xc + R cos(u + u )
yn +1 = yc + R sin(u + u )
zn +1 = zn
Analytic curves (Circles)
xn +1 = xc + R cos(u + u )
yn +1 = yc + R sin(u + u )
zn +1 = zn
For Arcs:
x = 2 + 2 cos u
y = 2 + 2sin u 0 u 2
z=0 P(u ) = P1 + u ( P2 − P1 )
P / (u ) = ( P2 − P1 )
P1 : u =
2
P1 = 4
0
Analytic curves (Ellipses)
• Mathematically the ellipse is a curve generated by a
point moving in space such that at any position the
sum of its distances from two fixed points (foci) is
constant and equal to the major diameter
B sin u cos
A cos u sin
A cos u cos
Inclined Ellipse
A = Pc − PH = ( xc − xH ) + ( yc − yH ) + ( zc − zH )
2 2 2
Analytic curves (Parabolas)
• The parabola is
defined
mathematically as
a curve generated
by a point which
moves such that
its distance from a
fixed point (the
focus) is always
equal to its
distance to a fixed
line (the directrix).
Analytic curves (Parabolas)
• It is not a closed
curve
• If the range of y
is limited
Analytic curves (Parabolas)
xn = xv + Au 2
yn = yv + 2 Au
z n = zv
xn +1 = xv + A(u + u ) 2
yn +1 = yv + 2 A(u + u )
zn +1 = zv
Analytic curves (Parabolas)
Non-parametric
implicit form:
Synthetic curves
• Analytic curves are usually not sufficient to meet the
geometric design requirements of mechanical parts.
n ! n−r r
r −i r
P (u ) =
r
( n − r ) ! j =0
B j ,n − r (u ) ( −1) Pi + j
i =0 i
Characteristics of the Bezier curve