Upload
sathishjey
View
214
Download
0
Embed Size (px)
Citation preview
8/13/2019 Lec5 Editing and Transformation
1/28
Editing and Transformation
8/13/2019 Lec5 Editing and Transformation
2/28
Modeling
combination of entities that haven i .
2D: circle, arc, line, ellipse
3D: primitive bodies, extrusion and revolved of a profile
Beforeediting
Afterediting
Beforeediting
Afterediting
(a)
8/13/2019 Lec5 Editing and Transformation
3/28
Editing: surface and solid
Surface 1Surface 2 Surface 1
Surface 2
Part to be edited
Editing on surfaces
Before After
A BB - AA BCutting of
Solid modell
8/13/2019 Lec5 Editing and Transformation
4/28
Differences: 2D and 3D editing(X cos - Y sin , x sin + Y cos)A
(X,Y)A
Axis
Plane
Center ofrotation
(0,0) 2D: axis3D: lane
2D: point3D: axis Z
YPlane XY
Plane YZ
Center of
rotation
Rotation axis
X
ane
8/13/2019 Lec5 Editing and Transformation
5/28
Editing
Fillet TranslationChamfer Rotation
Trim Copy
Scale Array
3D: Boolean Operation
Some editing preserves it original shape
suc eng an ang e an some on . 2D editing is similar to 3D editing.
Understandin CS is ver im ortant to findthe relationship.
8/13/2019 Lec5 Editing and Transformation
6/28
Example editing
Circle SplineLine
A
Y
Surface 3D ine
Y
Z XA
Array 2D and 3D
Paksi Z
Z
X
Y
Paksi X Paksi Y
8/13/2019 Lec5 Editing and Transformation
7/28
Geometric Transformation
a cu a es e new coor na es w entransformation is applied to the
.model can be wireframe, surface and
.
Editing commands are in fact
. , ,move.
8/13/2019 Lec5 Editing and Transformation
8/28
Editing and transformation:relationship
OBA
(XA+X, YA+Y)
Line is extended from OA 2x
x A
Scaling points ABCD on point O
C D
(XB+X, YB+Y)
(XA, YA)
X
(XC, Y
C)
C , C
Y
Y
(a)
O
(b)
O
A
A B
(XB, Y
B)
X
(c)
DC
CD
O
8/13/2019 Lec5 Editing and Transformation
9/28
Model Representation
geometrical properties of the entities must berepresented as matrices in its homogeneouscoordinates in 2D or 3D.
1
1
22
11
yx
yxRectangle
0,0 10,0 10,10 0,10
1010
100
1nn yx
1100
1
1
222
111
zyx
zyx
10010
1000Cube
(0,0, 0) (10,0,0)
1nnn zyx
1101010
(10,10, 10)
8/13/2019 Lec5 Editing and Transformation
10/28
Convert to their homogeneousrepresentation
30 30,
(0,1,1)
1 1 1
(10,20) (20,20)
(A)
Y
(0,10,0)
(0,0,1)
0 1 0XZ
(10,0,0)(0,0,10)
(1,1,0)
(0,0,0)
ZY
(C)(1,0,0)
8/13/2019 Lec5 Editing and Transformation
11/28
Applying transformation matrices
''
[ ]Dyx
yx
yx2
22
11
'' 1122
11
=
nn yxyx
nn
''11
zyxzyx 111'''
'''11
111
[ ]D
x
zyx
x
zyx3
222
'''11
222
=
nnnnnn
8/13/2019 Lec5 Editing and Transformation
12/28
Translation
[ ]
= 010
001
TR
2D Translation
yx
0001
Component-wise addition ofvectors
[ ]
=
1
0100
0010
zx
TR
x = x + dxy = y + dyz = z + dz
To move polygons: translate
vertices (vectors) and redrawlines between themPreserves lengths and anglesDoes not require referencepoint
8/13/2019 Lec5 Editing and Transformation
13/28
Rotation
[ ]
=
100
0cossin
s ncos
RRotation 2D
Rotation of vectors through anangle
x=x cos y sin =
(X,Y)A
(X cos - Y sin , x sin + Y cos)A
Preserves lengths and anglesPoint of rotation point (0,0)
Center of
rotation
(0,0)
8/13/2019 Lec5 Editing and Transformation
14/28
Rotation at other point than originpoint
e say a e cen er o ro a on s x , y .
Translation has to be carried before and after rotation
Procedure1. Convert the (x1, y1) to (0,0) by applying translation
x = -x1 and y= -y1.
2. Apply the rotation matrix. , ,applying translation x = x1 and y = y1.
11''
xx
[ ]
=
010
00101000111 22
''
22
11
yxyxR
11
''yxyx nnnn
8/13/2019 Lec5 Editing and Transformation
15/28
3D Rotation 0001 0sin0cos
[ ]
=
1000
0cossin0
0sincos0
XR [ ]
= 0cos0sin
0010
YR
00sincos
Axis of rotation: x Axis of rotation: y
[ ]
=
1000
0100
00cossin ZR
Axis of rotation: z
If axis of rotation other than specified axis: apply translationbefore and after 3D rotation is applied
8/13/2019 Lec5 Editing and Transformation
16/28
Scaling 2D and 3D
[ ]
=000000
Z
y
x
SS
S[ ]
=100
00 y
y
R S
Line is extended from OA 2x
Scaling points ABCD on point
O
OBA
C D
Component-wise scalarmulti lication of vectors
(a)
OA
(b)
O
x AA
x = Sxxy = Syy
Does not preserve lengthsDoes not reserve an les exce t
(c)
A
D
B
CC
D
O
when scaling is uniform)Point of reference for scaling is(0,0) 2D and (0,0,0) 3D
Scaling at other than (0,0) or (0,0,0), apply translation beforeand after applying scaling transformation
8/13/2019 Lec5 Editing and Transformation
17/28
Foundation of transformations
other transformation such as shear,
Important, if the transformation
re uires oint 2D axis 2D & 3Dand plane (3D) at the origin CS.Translation must be applied before
r y r vtransformation.
8/13/2019 Lec5 Editing and Transformation
18/28
Applying transformation compositematrices
1. Draw rectangle any size
2. Translate dx = 6
3. Rotate it by 450
1. The same rectangle2. Rotate it 450
3. Translate dx = 6
Q: Do both rectangles overlapping each other? Why?
8/13/2019 Lec5 Editing and Transformation
19/28
Y
ompos e rans orma ons
2
3
4
5
X0
1
1
2 3 4 5 6 7 8 9 10
TranslationRotation
Y
4
5
6
X0
1
1
2
2
3 4 5 6 7 8 9 10
RotationTranslation
8/13/2019 Lec5 Editing and Transformation
20/28
Composite Transformation
[ ] [ ][ ][ ] [ ]nC = 321 ...
[ ] [ ][ ]CXX ='
Composite Transformation:
om na on o mu p e rans orma onsmust be in sequence.
8/13/2019 Lec5 Editing and Transformation
21/28
Mapping
= 0
0
322212
312111
aaa
aaa
=
02111 aa
1
0332313
zyx
aaaMP
1yx
YY
X
P
Mapping combines the rotation andtranslation.
Y
X
(X1,Y1)
X
mapp ng:a11 to a22: TR
3D mapping - , - -
8/13/2019 Lec5 Editing and Transformation
22/28
Mapping: example
Write the composite transformation for mirroring square ABCD
using axis ( 300 slope line through (0,2))
Axis
CD
(0,2)
A B
8/13/2019 Lec5 Editing and Transformation
23/28
Solution 1Y
Y
Y
X
CD(0,0)
Y
X
CD(0,0)
1. Translation2. Rotation3. Mirror
X
A B
X
A B
(a) Translation (b) RotationB
. o a on5. Translation
A
B
C
A
B
CA
D
C
Y
XC
(0,0)
D
D
Y
X
C(0,0)
D
D
A
D
B
C
Y
A B
(d) Rotation
A B
(c) Mirror
X(0,0)
(e) Translation
8/13/2019 Lec5 Editing and Transformation
24/28
Solution 1 Matrices
=
0)30sin()30cos(001 00
2211 TRRTR
[ ] [ ]
=
=
120
0)30cos()30sin(,
120
010 0011 RTR
[ ] [ ]
=
= ,
120
0)30cos()30sin(
0)30sin()30cos(
,
100
010
00100
2RMR
[ ]
= 010
001
2TR
120
8/13/2019 Lec5 Editing and Transformation
25/28
Solution 2
B
. app ng
2. Mirror 3. Mapping 2
A
B
C
A
D
C
D
D
Y
X
CD
Y
X
20
A B
CD
YY
A B
Y
(0,0)X
XA B
Y
X
X
(0,0)
X(0,0)
(c) Mapping 2
(a) Mapping 1 (b) Mirror
8/13/2019 Lec5 Editing and Transformation
26/28
Solution 2 Matrices
=
0010)30sin()30cos( 00
21 MPMRMP
[ ] [ ]
=
=
100
010,
1)60sin(2)60cos(2
0)30cos()30sin(00
00
1 MRMP
[ ]
=
160sin260cos2
0)30cos()30sin(
0)30sin()30cos(
00
00
2MP
8/13/2019 Lec5 Editing and Transformation
27/28
Discuss the following problem
, , , , ,
D(10,20)
without mathematically solving them to
establish the following transformation. X axis ( Y = 0)
Y = -10
-
Y = -X -5
8/13/2019 Lec5 Editing and Transformation
28/28
Application of transformation
Modeling Head
composition decomposition
Shaft
Point
Aids realism in computer graphic: projection