0% found this document useful (0 votes)
135 views140 pages

Advanced CAD-Geometric Modeling-Transforms

The document discusses advanced CAD topics including geometric modeling, transformations, parametric curves, splines, solid modeling, and API programming. Geometric modeling represents how objects are defined using solids, surfaces, curves and points and is important for meeting geometric requirements, simulations, and modifying models. It also discusses common CAD software, modeling techniques like sweeping and CSG, standards for data exchange, and representations of curves and surfaces.
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)
135 views140 pages

Advanced CAD-Geometric Modeling-Transforms

The document discusses advanced CAD topics including geometric modeling, transformations, parametric curves, splines, solid modeling, and API programming. Geometric modeling represents how objects are defined using solids, surfaces, curves and points and is important for meeting geometric requirements, simulations, and modifying models. It also discusses common CAD software, modeling techniques like sweeping and CSG, standards for data exchange, and representations of curves and surfaces.
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/ 140

Advanced CAD

2. Geometric Modeling,
3. Transformations
Hikmet Kocabaş, Prof., PhD.
Istanbul Technical University
Lectures, Outline of the course
1 Advanced CAD Technologies, Hardwares, Softwares
2 Geometric Modeling, 2D Drawing
3 Transformations, 3D
4 Parametric Curves
5 Splines, NURBS
6 Parametric Surfaces
7 Solid Modeling
8 API programming
Why Study Geometric Modeling
The knowledge of the geometric modeling entities
increase your productivity.
Understand how the math presentation of various
entities relates to a user interface.
Understand what is impossible and which way can be
more efficient when creating or modifying an entity.
Control the shape of an existing object in design.
The storage, computation and transformation of
objects. Calculate the intersections and physical
properties of objects.
Geometric Modeling is important
• to meet certain geometric requirements
• such as slopes and/or curvatures in model
• interpretation of unexpected results
• evaluations, simulations of CAD/CAM systems cutting
• use of the tools in particular (robotic) applications
• creation of new attributes
• modify the obtained models
Geometric Modeling in CAD
Geometric modeling is only a means not the goal in
engineering. Engineering analysis needs product
geometry; the degree of detail depends on the analysis
procedure that uses the geometry.
Basic Elements of a CAD System
.
Fundamental Features
• Geometry: Position, direction, length, area, normal,
tangent, etc.
• Interaction: Size, continuity, collision, intersection
• Topology
• Differential properties: Curvature, arc-length
• Physical attributes
• Computer representation & data structure
• Others…
Professional CAD/CAE/CAM products
Unigraphics (UGS), NX (EDS)
I-DEAS (SDRC)
Pro/Engineer, Pro/Mechanica, Pro/E, Creo (PTC)
AutoCAD (AutoDesk, Inventor)
ANSYS (ANSYS Inc.)
CATIA, Delmia, SolidWorks (Dassault Systemes - IBM)
Nastran, Patran (MacNeal-Schwendler)

SurfCam, Solid Edge (EDS), MicroStation, Intergraph,
CADKey, DesignCAD, ThinkDesign,
3DStudio MAX, Rhinoceros, …
AutoCAD
A world’s leading PC-based 3D mechanical design
package, from AutoDesk Inc.
Used to be the primary PC drafting package (dealer, PC)
The world’s most popular CAD software due to its lower
cost and PC platform
New features:
• ACIS 3.0 Advanced Solid Modeling Engine
• NURBS Surface Modeling
• Robust Assembly Modeling and Automated Associative
Drafting
Flexible programming tools, AutoLISP, ADS and ARX
Integrated CAD/CAM Tools
ANSYS (from ANSYS Inc.)
• A growth leader in CAE and integrated design
analysis and optimization (DAO) software
• Covering solid mechanics, kinematics, dynamics,
and multi-physics (CFD, EMAG, HT, Acoustics)
• Interfacing with key CAD systems
NASTRAN (from MacNeal-Schwendler): PATRAN
provides an open flexible MCAE environment for
multidisciplinary design analysis.
Pro/MECHANICA (integrated with Pro/E)
Integrated CAD/CAM Tools
SURFCAM (from Surfware Inc. CA)
• An outgrowth of the Diehl family’s machine shop
• A system for generating 2~5- axis milling, turning,
drilling, and wire EDM.
• Toolpath verification (MachineWorks Ltd.)

Rhinoceros (NURBS modeling)


– Industrial, marine, and jewelry designs; cad/cam;
rapid prototyping; and reverse engineering
Applications of CAD
Geometric modeling, visual computing
• Computer graphics
Visualization, animation, virtual reality
• CAD/CAM visualization
• Virtual Prototyping
Engineering, manufacturing
• Computer vision
• Mesh generation
• Physical simulation
• Design optimization tool path
• Reverse engineering, Prototyping
meshes
in FEA
CAD
Software
.
Surface Modeling
• Models 2D surfaces in 3D space
• All points on surface are defined
• useful for machining, 3d printing, visualization, etc.

Surfaces
have no thickness,
no volume or solid properties.

Surfaces may be open or closed.


Surfaces from Curves
Edge of surface
to be created

No cross overs outside


surface edge, therefore Curves cross over outside
surface can be created surface edge, therefore it
can not be created
Reverse Engg workflow
• . Topology of
a triangle
Solid Modeling

• Complete and unambiguous (clear, exact)


• Models have volume, and mass properties
Associativity
• In modern CAD packages, drawings are associated with
the underlying model, so that changes to the model
cause drawings to be updated
• A CAD package has bi-directional associativity if:
– A change to the model automatically updates the drawing AND
– A change to the drawing automatically updates the model

Changes

Model
Drawing
Drawing Set Up and Layout

• Drawing Size
• Drawing Projection Angle

Selected views
• Front
• Top
• Right
• Isometric
Generic CAD Process
.
CAD Software, Graphic User Interface
Geometrical model
2D/3D
Exact or faceted with planar polygons
Mass properties
Editing
Parametric
Object Organization
Named Objects
Layers
Part libraries
Drawing Output
Drafting module
CAD Software, Graphic User Interface
Analysis Module
Finite Elements
Plastic Flow
Kinematics/Collisions
Dynamics
Importing/Exporting
Surface formats: IGES, DXF, CDL
Solid Formats: PDES/STEP, ACIS, SAT
Files for systems such as NASTRAN
Can be linked to a user written program
Rendering
Hidden line
Shaded Image
Ray Tracing
Real Time Rotations
Graphics Standards
(GKS, PHIGS, OpenGL, IGES, PDES, STEP, DWG, DXF,
Parasolid, ACIS,…)
Graphics Standards
Several graphics standards have been developed over
the years, including CORE (1977-1979),
GKS (Graphical Kernel System, 1984-1985),
GKS-3D (added 3D capabilities),
PHIGS (Programmer’s Hierarchical Graphics sys.1984),
PHIGS+ include more powerful 3D graphics functions,
X-Windows system (1987), and
OpenGL is adapted from Unix system.
DirectX (1994) API developed by Windows for 3D
animation.
IGES, STEP, ACIS data exchange formats
.
IGES, STEP, PDES, Parasolid formats
IGES (Initial Graphics Exchange Specification) initially
published by ANSI in 1980. Version 5.3 (1996) is the last.
STEP (STandard for the Exchange of Product model data)
(ISO 10303) released in 1994. A neutral representation of
product data. Every year new parts are added or new
revisions of older parts are released. This makes STEP the
biggest standard within ISO.
PDES (Product Data Exchange Specification, PDDI)
originated in 1988 by McDonnell Aircraft Corporation.
Parasolid (owned by Siemens) can represent wireframe,
surface, solid, cellular and general non-manifold models.
It stores topological and geometric information defining
the shape of models in transmitting files.
Solid modeling techniques
Sweeping,
Half Spaces,
CSG,
B-rep
Migration of standards towards STEP
.
STEP configuration controlled 3D Design
(Standard for the Exchange of Product model data)
STEP is also referred as ISO 10303. (start.1984..1994…)
https://cadexchanger.com/step
STEP, BREP: Boundary Representation
B-rep represent solids by their surfaces
Vector versus Raster Graphics
.
Raster Graphics
Tessellation
Sampling & Antialiasing

It is easy to rasterize mathematical line segments into


pixels, but polynomials and other parametric functions
are harder.
Vector Graphics
.
Curve representation equations
A line can be defined using either parametric equation
or implicit, explicit nonparametric equations.

P2 (x2 ,y2)
P(u)= (x,y)

P1 (x1 ,y1)
Curve representation
equations
There are two types of curve equations
(1) Parametric equation
x, y, z coordinates are related by a parametric
and independent variable (u, θ or t)
Point on 3-D curve: p = [x(u) y(u) z(u)]
Point on 2-D curve: p = [x(u) y(u)]

(2) Nonparametric equation


x, y, z coordinates are related by a function
Implicit:
Explicit:
Curve representation equations
Which is better for CAD/CAE ? : Parametric equation
It is good for calculating the points at a certain interval
along a curve.
Example:
Circle
Comparison
Explicit Form
• Easy to render
• Unique representation
• Difficult to represent all tangents
Implicit Form
• Easy to determine if a point lies on, inside, or outside a
curve or surface
• Unique representation
• Difficult to render
Parametric Representation
• Easy to render and common in modeling
• Representation is not unique
solids
Geometric Modeling
A typical solid model is defined by solids, surfaces,
curves, and points.
Solids are bounded by surfaces. They represent solid
objects. Analytic shape.
Surfaces are bounded by lines. They represent
surfaces of solid objects, or planar or shell objects.
Quadric surfaces, sphere, ellipsoid, torus.
Curves are bounded by points. They represent edges
of objects. Lines, polylines, curve.
Points are locations in 3-D space. They represent
vertices of objects. A set of points.
surfaces triangles lines, curves,
points,
polygons point cloud
Geometric Modeling
There is a built-in hierarchy among solid model entities.
Points are the foundation entities. Solids
Surfaces
Curves are built from the points, Curves
Surfaces from curves, Points

Solids from surfaces.

The wire frame models does’nt


have the surface definition.
Difference between wire,
surface and solid model
Vector Algebra and Transformations
Source books:
Computer Aided Geometric Design, Thomas W.
Sederberg, 2003.
CAD/CAM Theory and Practice , Ibrahim Zeid, McGraw
Hill , 1991, Mastering CAD/CAM, ed. 2004

Points and Vectors


Motions and Projections
Homogeneous matrix algebra
Geometric View of Points & Vectors

• vectors have no fixed position


• had-to-tail rule – useful to express functionality
C=A+B
• points & vectors – distinct geometric types!
• a given vector can be defined as from a fixed reference point
(origin) to the given point p
Vectors (Lines) in Affine Space
Symbols:
α, β, γ - scalars
P, Q, R – points
u, v, w – vectors
Typical geometrical
operations:
| α v| = | α | | v |
v = P – Q => P = v + Q
( P – Q )+ ( Q – R ) = P – R
P(α) = P0 + α d
(a line in an affine space – param.form)
Vector Sums in Affine Space
new point P can be defined as
P=Q+αv
Point R
v=R–Q
and
P = Q + α(R –Q)= αR + (1- α)Q
P = α1 R+ α 2 Q
where
α1 + α 2 = 1
Representation of 3D Transformations
Z axis represents depth
Right Handed System
When looking “down” at the origin,
Positive rotation is CCW.

Left Handed System


When looking “down”,
positive rotation is in CW.
More natural interpretation
for displays, big z means “far”

(into screen)
Points, Vectors and Coordinate Systems
The Cartesian coordinates (x, y, z) are the distances of
the vertex with respect to the coordinate system we
defined.

Unit Vectors
A unit vector is a vector whose
length equals unity.
Vectors
A vector can be pictured as a line segment of definite
length with an arrow on one end.
We will call the end with the arrow
the tip or head
and the other end the tail.

Equivalent Vectors
Two vectors are equivalent if they have the same
length, are parallel, and point in the same direction
(have the same sense) as shown in Figure.
Unit vectors
The symbols i, j, and k denote vectors of “unit length”
(based on the unit of measurement of the coordinate
system) which point in the positive x, y, and z
directions respectively (see Figure). Unit vectors allow
us to express a vector in component form

P = (a, b, c) = ai + bj + ck

Unit Vectors
A unit vector is a vector
whose length equals unity.
Points and Vectors
An expression such as (x, y, z) can be called a triple of
numbers. A triple can signify either a point or a vector.
Relative Position Vectors Given two points P1 and P2,
we can define P2/1 = P2 − P1
as the vector pointing from P1 to P2. This notation
P2/1 is widely used in engineering mechanics, and can
be read “the position of point P2 relative to P1”
(see Figure).
The distance between two points
In a Euclidean space we define the distance between
two points p and q as the norm of the vector p – q.

Because points correspond to vectors, for a fixed origin,


and vectors correspond to column matrices, for a fixed
basis, there is also a one-to-one correspondence between
points and column matrices. A pair (origin, basis) is called a
frame or coordinate system. For a fixed frame, points
correspond to column matrices.
Vector algebra
.
Vector algebra
.
Vector algebra
.
Vector algebra

.
Vector Algebra
Given two vectors P1 = (x1, y1, z1) and P2 = (x2, y2, z2),
the following operations are defined:
Addition:
P1 + P2 = P2 + P1 = (x1 + x2, y1 + y2, z1 + z2)

Subtraction:
P1 − P2 = (x1 − x2, y1 − y2, z1 − z2)
Vector Algebra
Using matrix notation a
Vector can be written as
x = x1e1 + x2e2 +…+ xnen
x = EX.
The correspondence between vectors and matrices
preserves addition and multiplication by a scalar.
The matrix Z that corresponds to the sum of two vectors
z = x + y is the sum
Vector Algebra
For multiplication by a scalar, Z = a X, or
cP1 = c (x1 , y1 , z1) = (cx1 , cy1 , cz1)

The inner or dot product, denoted x . y ,


is another operation defined on vectors. It produces a
scalar given two vector arguments. The square root of
the inner product of a vector with itself is the norm or
length of the vector, denoted
The length of x in an orthonormal basis becomes
Vector Algebra, Dot (Scaler) Product
Length of a vector:

Dot Product: The dot product


of two vectors is defined
P1 · P2 = |P1||P2| cosθ

where θ is the angle


between the two vectors.
Dot (Scaler) Product
Two vectors are orthogonal if their dot product is zero.
The cosine of the angle
between two vectors is given by
The most convenient bases are
the orthonormal bases, composed of unit vectors.
In an orthonormal basis the inner product
of two vectors is x.y = XTY = x1y1 + x2y2 +…+ xnyn
where the superscript (T) denotes matrix transposition,
obtained by interchanging
rows with columns.
Vector Algebra, Dot (Scaler) Product
Since the unit vectors i, j, k are mutually perpendicular,
i·i=j·j=k·k=1
i · j = i · k = j · k = 0.
Since the dot product obeys the distributive law
P1 · (P2 + P3) = P1 · P2 + P1 · P3,
we can easily derive the very useful equation
P1 · P2 = (x1i + y1j + z1k) · (x2i + y2j + z2k)
= (x1 * x2 + y1 * y2 + z1 * z2)
Vector Algebra, Angle between Vectors
The dot product allows us to easily compute the angle
between any two vectors. From the dot product
equation

Example. Find the angle between vectors (1, 2, 4) and


(3,−4, 2).
Vector (Cross) Product
Finally, there is an additional operation on vectors,
called the vector product (also known as cross, or
exterior product), that is very useful, especially in 3-D.
Here we define it in terms of components in a right-
handed, orthonormal, 3-D basis:
x × y= (x2y3 - x3y2)e1 + (x3y1 - x1y3)e2 + (x1y2 - x2y1)e3

The result of a cross product is not truly a vector, and


its definition depends on the orientation or
handedness of a basis.
Vector (Cross) Product
The cross product of two parallel vectors is zero. For
two non-parallel vectors, x and y , the cross-product
x × y is perpendicular to both x and y . In particular,
if E is a righthanded orthonormal basis in 3-D, then

e 1 × e2 = e3
e2 × e 3 = e 1
e3 × e 1 = e 2
Vector (Cross) Product
Cross Product: The cross product P1 × P2 is a vector
whose magnitude is
|P1 × P2| = |P1||P2| sinθ

(where again θ is the angle between P1 and P2), and


whose direction is mutually perpendicular to P1 and P2
with a sense defined by the right hand rule as follows.
Point your fingers in the direction of P1 and orient your
hand such that when you close your fist your fingers
pass through the direction of P2. Then your right
thumb points in the sense of P1 × P2.
Vector (Cross) Product
From this basic definition, one can verify that
P1 × P2 = −P2 × P1,
i×j=k , j×k=i , k×i=j
j × i = −k , k × j = −i , i × k = −j .
Since the cross product obeys the distributive law
P1 × (P2 + P3) = P1 × P2 + P1 × P3,
we can derive the important relation
Cross Product, Area of a Triangle
Cross products have many important uses. For
example, finding a vector which is perpendicular to
two other vectors. Also, the cross product provides a
method for finding the area of a triangle which is
defined by three points P1, P2, P3 in space.

P2

Area
P1 P3
Cross Product, Area of a Triangle
For example, the area of a triangle with vertices
P1 = (1, 1, 1), P2 = (2, 4, 5), P3 = (3, 2, 6) is

P2

Area
P1 P3
Parametric equation of Line
A line can be defined using either a parametric
equation or an implicit equation.

Parametric equations of lines


Linear parametric equation. A line can be written in
parametric form as follows:
x = a0 + a1t; y = b0 + b1t

In vector form,
Parametric equation of Line
In this equation, A0 is a point on the line and
A1 is the direction of the line.

Line given by A0 + A1t

Affine parametric equation of a line (between P0 , P1 ).


A straight line can also be expressed by P0 , P1 .
Parametric equation of Line
where P0 and P1 are two points on the line and t0 and t1
are any parameter values. Note that
P(t0) = P0 and P(t1) = P1.
Note in Figure that the line segment P0–P1 is defined
by restricting the parameter: t0 ≤ t ≤ t1.
(t1- t)/(t1- t0) (t- t0)/(t1- t0)
1

Line given by P(t) 0


P(t0) P(t) P(t1)
P0 P1
Linear interpolation
Parametric equation of Line
Sometimes this is expressed by saying that the line
segment is the portion of the line in the parameter
interval or domain [t0 ,t1]. We will soon see that the line
in Figure is actually a degree one Bezier curve. Most
commonly, we have t0 = 0 and t1 = 1 in which case
P(t) = (1 − t)P0 + tP1.
(1- t) t
1

0
P(t0=0) P(t) P(t1=1)
P0 P1
Linear interpolation
Line
(Combinations of Points) t (P2 - P1) P P2
• Let P1 and P2 be points in space. P1+ t (P2 - P1)
• if 0 ≤ t ≤ 1 then P is somewhere P1
on the line segment joining P1 and P2 .
• We may utilize the following notation
t 1 α2= t
P = P(t) = (1 - t) P1+ t P2 1
t α1= 1- t
• We can then define a combination t0 0
of two points P1 and P2 to be P1 Linear P2
P = α1 P1+ α2 P2 where α1 + α2 = 1 interpolation
• derive the transformation by setting α2 = t
Linear Parametric Plane Surface
We can generalize the line to define
a combination of an arbitrary number of points. 1 P2
P = α1 P1+ α2 P2 + α3 P3 P4
α3 (P3 - P1)
where α1 + α2 + α3 = 1
0 ≤ α 1 , α2 , α 3 ≤ 1 α2 (P2 - P1)
Illustration shows the α2
point P generated when
α2 = 1/4 , α3 = 1/2 ,
0 P
P1 0 α
α1 = 1 - α2 - α3 = 1/4 . 3
1 P3
Then, each vertex of our triangle could be
described in terms of its respective distance
from the two walls containing the origin (P1) and from the floor.
P = P1+ α2 (P2 - P1) + α3 (P3 - P1) P(u,v) = (1- u -v) P1+ u P2 + v P3
Convexity
A convex object is one for which any point
lying on the line segment connecting any
two points in the object is also in the object

P = α1 R+ α 2 Q & α1+α 2 = 1

More general form


P = α1P1+α2P2 +... +αnPn
where
α1+α2 +... +αn= 1
&
αi ≥ 0 , i = 1, 2, ....,n
Parametric Plane
Let P, Q, R are points defining
a plane in an affine space
S(α) = α P + (1- α)Q , 0≤ α ≤ 1
T(β) = β S + (1 - β) R , 0≤ β ≤ 1
using a substitution
T(α,β) = β [α P + (1- α)Q ] + ( 1 - β) R ,
0 ≤ α ≤ 1 & 0≤ β ≤ 1
T(α,β) = P + β (1 - α )( Q – P ) + (1 - β) (R – P)

Plane given by a point P0 and vectors u, v


T(α,β) = P0 + α u + β v & 0≤ α , β ≤ 1
Linear Transformations

• .
Combining Transformations
Example: Transformation of the House
Original House: Goal:

Transformation Composition:
Rotation about a fixed point
Transformations
For rotation – implicit point
– origin
– 2D – simple
– 3D – complicated
Transformation
– rigid-body
– non-rigid-body Right Handed System
Z axis represents depth
When looking “down”
at the origin,
Positive rotation
is CCW.
Homogeneous
Transformations Matrix
Combining
Transformations

Using homogeneous transformation matrix allows us


use matrix multiplication to calculate all kind of
transformations, so combine all in one matrix.
Scale P′ = S.P , Translation P′=P+d => P′ = T.P ,
Rotation P′=R.P Combined P′=T.R.S.T-1.P
1 0 dx 
0 1 dy 
Homogenous 
0 0 1 
Transformations 1 0 dx   x  1* x + 0 * y + dx *1  x + dx 
0 1 dy  ×  y  = 0 * x + 1* y + dy *1 =  y + dy 
Homogenous        
0 0 1  1   0 * x + 0 * y + 1*1   1 
transformations
for 2D space requires
3D vectors & matrices. sx 0 0   x   sx × x  Sx
 0 sy 0  ×  y  =  sy × y  : v ' = S ( sx , sy ) v
      Sy
Homogenous  0 0 1 1   1 
transformations
for 3D space requires
4D vectors & matrices.

P = [x, y, z, 1]T
Homogeneous 3D Translation Matrix
y
Translation x′= x + t x
t=(tx , ty , tz) P′=P+t
y′= y + t y P′=T.P
( x′, y′, z′ ) z ′= z + t z
t
( x, y , z )
 x′  1 0 0 tx   x 
z x  y′ 0
 1 0 t y   y 
= ⋅
 z′  0 0 1 tz   z 
     
1 0 0 0 1  1 
Translation of a Curve

 x' 1 0 0 tx   x
 y ' 0 1 0 t y   y 
 = ⋅
3D Homogenous translation  z '  0 0 1 tz  z 

     
 1  0 0 0 1  1 
3D Transformations: Scale & Translate
Scale, Parameters
for each axis direction
P′ = S.P
Translation
P′ = T.P
P = [x, y, z, 1]T
P′ = P + d
2D homegenous Translation
Scaling
.
Scaling

.
Homogenous 3D Scaling matrix
y y
x′= x ⋅ S x

y′= y ⋅ S y

z ′= x ⋅ S z

z x z x
Enlarging object also moves it from origin
 x′   S x 0 0 0  x 
 y′  0 Sy 0 0   y 
P′ = =  ⋅ =⋅
S P
 z′   0 0 Sz 0 z  
     
1  0 0 0 1  1 
Scaling with respect to a fixed point
(not necessarily of object)
y y y

(x f , yf , zf ) (x f , yf , zf ) (x f , yf , zf )
z x z x z x
y Sx 0 0 (1 − S x ) x f 
 
T ⋅ S ⋅ T−1 = 0 Sy 0 (1 − S y ) y f 

0 0 Sz (1 − S z ) z f 
 0 
(x f , yf , zf ) 0 0 1

z x
Rotation of a point about z axis
.
cos θ − sin θ 0  x  cos θ × x − sin θ × y 
2D Rotation  sin θ
 cos θ 0 ×  y  = sin θ × x + cos θ × y  : v' = R (θ )v
 0 0 1 1   1 

3D Rotation about a major axis P′=R∙P


 x' 1 0 0 0  x  y
 y ' 0 cosθ − sin θ 0  y 
 = ⋅
 z '  0 sin θ cosθ 0  z 
     
 1  0 0 0 1  1  z x
 x'  cosθ 0 sin θ 0  x  y
 y '  0 1 0 0  y 
 = ⋅
 z '  − sin θ 0 cosθ 0  z 
     
1  0 0 0 1  1  z x
 x' cosθ − sin θ 0 0  x  y
 y '  sin θ cosθ 0 0  y 
 = ⋅
 z'  0 0 1 0 z

     
1  0 0 0 1  1  z x
2D Inverse Transformations
Transformations can easily be reversed using inverse
transformations
1 0 − dx  1 
−1   s 0 0
T = 0 1 − dy 
 x 
0 0 1  S =0
−1 1 
0
 sy 
 cos θ sin θ 0 0 0 1
   
R = − sin θ cos θ 0
−1
 
 0 0 1
3D inverse Transformations
Translation Inversion operations:

T-1 = T ( -αx , -αy , -αz )

Scaling

S-1 = S ( 1/βx , 1/β y , 1/β z )


Composite translations
= 2x 2y ) ⋅ P} {T ( t , t ) ⋅ T ( t
P′ T ( t , t ) {T ( t , t = 1x 1y 2x 2y 1x }
, t1 y ) ⋅ P

1 0 t2 x  1 0 t1x  1 0 t1x + t2 x 
0 1 t  ⋅ 0 1 t  =0 1 t + t 
 2y   1y   1y 2y 

0 0 1  0 0 1  0 0 1 

T ( t2 x , t2 y ) ⋅ T ( t1x , t1 y ) =T ( t1x + t2 x , t1 y + t2 y )

Composite Rotations:
P′ R (θ 2 ) {R (θ1 ) ⋅ =
= P} {R (θ ) ⋅ R (θ )} ⋅ P
2 1

R (θ 2 ) ⋅ R (θ1 ) =R (θ1 + θ 2 )

P′= R (θ1 + θ 2 ) ⋅ P
Combining Transformations
The three transformation matrices are combined as
follows
1 0 − dx  cos θ − sin θ 0 1 0 dx   x 
0 1 − dy  ×  sin θ cos θ 0 × 0 1 dy  ×  y 
       
0 0 1   0 0 1 0 0 1  1 

v' = T (−dx,−dy ) R(θ )T (dx, dy )v


Matrix multiplication is not commutative so order
matters
P ′ = M 2 ( M 1 ⋅ P ) = ( M 2 ⋅ M1 ) ⋅ P = M ⋅ P
Rotation about an arbitrary axis n (nx ,ny ,nz)

y
θ
n
z
x
Rotation about an axis n (nx ,ny ,nz) by angle θ

.
Rotation around an Arbitrary Axis
.
CAD CAM -
Ibrahim Zeid ,
p. 495 & 496

0
Rotation around
an Arbitrary Axis
.

CAD CAM -
Ibrahim Zeid ,
p. 495 & 496
u’z
y u’y
Other rotations z u’x
x
What if the axis of rotation
does not pass through the origin?

Similar process as in 2D, translate


to the origin, rotate as normal, translate back.

We just need to know a point on the axis that we can


translate to the origin.

Only way to specify such a rotation is to give two points on


the line or one point and a direction, so the requirement
is easily satisfied.
2D Rotation about a pivot point Pr
y
Translate pivot point Pr to the origin,
P′ rotate as normal, translate back.

θ Rotation in angle θ about a


yr P
Pr x pivot (rotation) point ( xr , yr ) .
xr
x′ = xr + ( x − xr ) cos θ − ( y − yr ) sin θ
P′ ( x′, y′ )
y
y′ = yr + ( x − xr ) sin θ + ( y − yr ) cos θ

P ( x, y ) P′ = Pr + R ⋅ ( P − Pr )
θ
cos θ − sin θ 
Pr ( xr , yr ) x R=
 sin θ cos θ 
Rotation about a fixed point, M=T.R.T-1
Move to origin Rotate Move back

( xr , yr )

Translate the fixed 1 0 xr  cos θ − sin θ 0  1 0 − xr 


0 1 yr  ⋅  sin θ cos θ 0  ⋅ 0 1 − yr  =
point to origin, 
Rotate as normal, 0 0 1   0 0 1  0 0 1 
Translate back.
cos θ − sin θ xr (1 − cos θ ) + yr sin θ 
 
 sin θ cos θ yr (1 − cos θ ) − xr sin θ 
 0 0 1 
Example: Composition
of 3D Transformations
Goal: Transform the local coordinate
system Rx, Ry, Rz to align with the origin x,y,z
Process
1. Translate P1 to (0,0,0)
2. Rotate about y
3. Rotate about x
4. Rotate about z
(1) (2-3) (4)
Translate the fixed point to origin,
Rotate about z axis, Translate back.
Rotation About a Fixed Point

M = T(pf ) Rz(θ ) T(- pf )

Transformation is defined by the


instance transformation M

M=TRS
(order is substantial!)
Composite Rotations in E3
• .

Rz Rx

Cube can be rotated about all
x, y, z axis
In our case the transformation
matrix is defined
M = Ry Rx Rz= Rzx Ryz Rxy

Ry
Rotations About an Arbitrary Axis
Given:
• points p1 , p2 and rotation angle θ
• objects to be rotated

Define vectors
u = p1 - p2
and v = u / |u| – normalized
v = [ αx , αy , αz ]T
αx2 + αy2 + αz2 = 1 – directional cosines
cos( ϕx ) = αx , cos( ϕy ) = αy , cos( ϕz ) = αz
cos2( ϕx ) + cos2( ϕy ) + cos2 ( ϕz ) = 1
⇒ only two directions angles are independent !!
Rotations About an Arbitrary Axis

Transformation (rotation about origin)


R = Rx(-θx) Ry(-θy) Rz(θ) Ry(θy) Rx(θx)

Complete transformation (include translations)


M = T(p0) Rx(-θx) Ry(-θy) Rz(θ) Ry(θy) Rx(θx) T(-p0)
y
P2
θ
General 3D Rotation P1
x
1. Translate the object such that rotation
z
axis passes through the origin.
1. Rotate the object such that rotation axis coincides
with one of Cartesian axes.
2. Perform specified rotation about the Cartesian axis.
3. Apply inverse rotation to return rotation axis to
original direction.
4. Apply inverse translation to return rotation axis to
original position.
R (θ ) =
T−1 ⋅ R −x 1 (α ) ⋅ R −y1 ( β ) ⋅ R z (θ ) ⋅ R y ( β ) ⋅ R x (α ) ⋅ T
T−1 ⋅ R −x 1 (α ) ⋅ R −y1 ( β ) ⋅ R z (θ ) ⋅ R y ( β ) ⋅ R x (α ) ⋅ T
R (θ ) =

General 3D Rotation
Translate to origin. Rotate on Cartesian axes.
y y y
P2
P2′
θ
P1
P1′ P1′
x x x
P2′′
z z z
Rotation about the axis. Apply inverse translations.
y y y
P2′ P2

P1′ P1′ P1

P2′′ x x x
θ
z z z
T−1 ⋅ R −x 1 (α ) ⋅ R −y1 ( β ) ⋅ R z (θ ) ⋅ R y ( β ) ⋅ R x (α ) ⋅ T
R (θ ) = y
P2
1 0 0 − x1 
Translate the object to origin. 0 1 0 − y1  P1
T=
.The vector from P to P is: 0 0 1 − z1  x
1 2  
0 0 0 1  z
V = P2 − P1 = ( x2 − x1 , y2 − y1 , z2 − z1 )
y
P2′

=
Unit rotation vector: u V=
|V| ( a, b, c ) P1′
x
= ( x2 − x1 ) y
a |V| u = ( a , b, c ) z y
=
b ( y2 − y1 ) |V|

=
c ( z2 − z1 ) |V| x P1′
P2′′ x
a 2 + b2 + c2 =
1 z
z
Rotating u to coincide with z axis

First rotate u around x axis to lay in x − z plane.

Equivqlent to rotation u 's projection on y − z plane around x axis.

α c
cos= b 2 + c=
2
α b d.
c d , sin =

We obtained a unit vector=


w ( a, 0, b 2 += )
c 2 d in x − z plane.
1 0 0 0 y u = ( a , b, c )
0 c d −b d 0  u′
R x (α ) =  d
0 b d c d 0 1
  α
0 0 0 1 x
α
d 1
z
w = ( a, 0, d )
Rotate w counterclockwise around y axis.

w is a unit vector whose x − component is a, y − component is 0,

hence z − component is b 2 + c 2 =
d. cos β = d , sin β = −a
y
d 0 a 0 u = ( a , b, c )
0 1 0 0 
Ry (β ) =  d
 −a 0 d 0 1
 
0 0 0 1 α x
β 1
z d
w = ( a, 0, d )
T−1 ⋅ R −x 1 (α ) ⋅ R −y1 ( β ) ⋅ R z (θ ) ⋅ R y ( β ) ⋅ R x (α ) ⋅ T
R (θ ) =
1 0 0 0 d 0 a 0 cos θ − sin θ 0 0 d 0 a 0 1 0 0 0
0  sin θ  0 c d 0 
0 c d −b d  1 0 0  cos θ 0 0 0 1 0 0  −b d
R x (α ) = 
0
R x (α ) =  Ry (β ) =  R z (θ ) =  Ry (β ) = 
0 b d c d 0  −a 0 d 0  0 0 1 0  −a 0 d 0 0 b d c d 0
         
0 0 0 1 0 0 0 1  0 0 0 1
0 0 0 1 0 0 0 1
General 3D Rotation Matrix
y
cos θ − sin θ 0 0 P2
 sin θ cos θ 0 0  θ
R z (θ ) = 
P1
 0 0 1 0 x
 
 0 0 0 1 z
T−1 ⋅ R −x 1 (α ) ⋅ R −y1 ( β ) ⋅ R z (θ ) ⋅ R y ( β ) ⋅ R x (α ) ⋅ T
R (θ ) =
1 0 0 0 d 0 a 0 cos θ − sin θ 0 0 d 0 a 0 1 0 0 0
0   sin θ  0 0 c d 0 
0 c d −b d  1 0 0 cos θ 0 0 1 0 0  −b d
R x (α ) = 
0
R x (α ) =  Ry (β ) =  R z (θ ) =  Ry (β ) = 
0 b d c d 0  −a 0 d 0  0 0 1 0  −a 0 d 0 0 b d c d 0
         
0 0 0 1 0 0 0 1  0 0 0 1
0 0 0 1 0 0 0 1

M R (θ ) =

 a 2 (1 − cos θ ) + cos θ ab (1 − cos θ ) − c sin θ ac (1 − cos θ ) + b sin θ 


 
 ba (1 − cos θ ) + c sin θ b 2
(1 − cos θ ) + cos θ bc (1 − cos θ ) − a sin θ 
 ca (1 − cos θ ) − b sin θ cb (1 − cos θ ) + a sin θ c (1 − cos θ ) + cos θ 
2
 
Linear Transformations

• .
2D Reflections (Mirror)
2D reflection about x, y, (x and y) axis :

y y y

x x

x
1 0 0   −1 0 0   −1 0 0 
0 −1 0   0 1 0  0 −1 0 
     
0 0 1   0 0 1   0 0 1 
3D Reflection (Mirror)
3D Reflection
about x-y plane :

the mirror of P
P* = M P
Complete transformation
M = T(p0) Rx(-θx) Ry(-θy) Fz(-z) Ry(θy) Rx(θx) T(- p0)
3D Transformations: Shear
3D Shear:
(function of z)
Orthographic projection matrices
.
Perspective projection
Figure shows how to project a point on the y axis from
a center of projection v lying on the x axis at x=d. By
similarity of triangles. Thus far we have only used
homogeneous matrices with a last row whose
offdiagonal elements are null. What happens when
they are non-null (–1/d) term. After normalizing the
result, we obtain perspective projection of the object.
Perspective projection
Computing a planar projection
involves matrix multiplication,
followed by normalization and orthographic projection
(z=0 plane). ( r = –1/d )
3D Perspective
In 3-D, the matrix multiplication
provides us the x and y coordinates
of the projection of a point on the xy plane,
from a center of projection on the z axis at z=d.
In 3-D the perspective transformation produces
a deformed 3-D object, which must be projected
orthographically onto the xy plane to generate the
desired 2-D image. Computing a planar projection
involves matrix multiplication, followed by
normalization and orthographic projection.
3D Perspective
.
Parametric Circle
Parametric Circle
.
Other Parametric Curves
.
2D CAD
APT Statements
Circle defined by diameter P1 P2
Circle radius R and center Pc are
Circle passing through three points
Circle center Pc is the
intersection of the
perpendicular lines to
the chords P1P2 , P2P3 ,
P2P1 from their
midpoints P6 , P4 , P5 .
Circle passing through three points
.
Circle passing through three points
.
Circle passing through three points

For 2D case:
Circle tangent to two lines with a given R
The center of the circle is
the intersection point of
two offset parallel lines
with radius R distance.
The parametric vector equations
of parallel lines

Intersection point of two lines


Fillet circle to perpendicular corner

Trim points are


Ellipses
.
Transformations in model. p’ = C * T * p
Forward Kinematics, Skeleton Hierarchy
Each bone position/orientation described relative to
the parent in the hierarchy. Given the skeleton
parameters p (position of the root and the joint angles)
and the position of the point in local coordinates vs,
what is the position of the point in the world
coordinates vw? Just apply transform accumulated
from the root.
Hierarchical modeling, animation
• Hierarchical structure modeling
• Forward and inverse kinematics
• Eyes move with head
• Hands move with arms
• Feet move with legs
• Models can be animated
by specifying the joint angles
as functions of time.
Forward Kinematics
Transformation matrix S for a point vs is a matrix
composition of all joint transformations between the
foot point and the root of the hierarchy.
S is a function of all the joint angles
between foot point and root.
Inverse Kinematics requires solving
for p, given vs and the desired position vw.
Applications in Robotics and Simulation
A robotic manipulator is a kinematic chain, i.e., a
collection of solid bodies—called links—connected at
joints. The most common joints are the revolute joint,
which corresponds to rotational motion between two
links, and the prismatic joint, which corresponds to a
translation. Most of the industrial robot “arms” in use
today have only revolute joints.

Figure shows an idealized robot


with two links and two revolute joints.
Applications in Robotics and Simulation
Stick-figure model for a 2-link robot
Example:
CAD Assemblies & Animation Models
.
References
• CAD/CAM Theory and Practice , Ibrahim Zeid,
McGraw Hill , 1991

• Mathematical Elements for Computer Graphics,


Rogers, D.F., Adams, J.A., McGraw Hill, 1990.

• Computer Aided Geometric Design, Thomas W.


Sederberg, 2003.

You might also like