Upload
milo-sanders
View
232
Download
1
Tags:
Embed Size (px)
Citation preview
Geometric Objects and Transformations
Geometric EntitiesRepresentation vs. Reference SystemGeometric ADT (Abstract Data Types)
Goals Coordinate-free representation of objects Homogeneous coordinates Distinction of an object from its representation
Scalars, Points, and Vectors Geometric View Mathematical View
– Vector– Affine Spaces
Computer-Science View Other issues
– Geometric ADTs– Lines– Affine Sums– Convexity– Dot and Cross Products – Planes
Geometric View Point: a location in space Scalar: real number Vector: directed line segmentDirected Line Segment That Connects Points
Identical Vectors
Combination of Directed Line Segments
A Dangerous Representation of a Vector
Mathematical View Vector space: vectors and scalars Operations
– Scalar-vector multiplication– Vector-vector addition
Affine space: vector space + point– Vector-point addition (or point-point subtraction)
Euclidean space: affine space + measure of size or distance
Point-Point Subtraction
Computer-Science View Scalars, points, and vectors as abstract data types (ADTs) ADT
– Object-oriented– Data and operations
Object declarations
vector u,v;point p,q;scalar a,b;
q = p + a * v;
Use of the Head-to-Tail Axiom
-
-
-
Lines The sum of a point and a vector (or subtraction of
two points) leads to the notion of a line in an affine space.
line. the of form
the form thiscall We of any valuefor
pointa is space, affine an inscalars and vectors,
points,combining for rulesthe enscalar.Giva is and
vector,arbitrary an is poiint,arbitrary an is where
parametric .
)(
,)(
0
0
P
vP
vPP
Line in an Affine Space
vPP 0)(
v
Affine Operations In an affine space, scalar-vector multiplication
vector-vector addition are defined. However, point-point addition and scalar-point multiplication are not.
Affine addition has certain elements of the above two latter operations.
Affine Addition
1)1(;
,
)1()(
;
.
,,
212
21
1 where
thus
that such ,point a
exists always there e,Furthermor of direction
the in from line the on pointsall s decribe
scalar positive vecctor ,point any For
Q Rα
QRQRQP
QRv
R
v
Q
vQP
vQ
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.
Line segment that connects two points
Convex Hull
Geometrically, a convex hull is the set of points that we form by stretching a tight fitting surface over the given set of points – shrink wrapping the points.
ni
PPP
P
PP
i
n
n
n
i
ii
,,2,1,0
1
},,,,{
,
21
21
1
and
and
points ofset a ofhull convex the is where
Dot Product and Projection
.
||/cos||
||||cos
||
.02
vu
vvuu
vu
vu
uuu
vuvu
onto of projection
orthogonal the is e,Furthermor
iforthogonal are and
u
Cross Product
Right-handed coordinate system
||||
|||sin|
vu
vu
Formation of a Plane
Normal vector:
PRvPQu
vuP
PRPQP
RQPT
RSU
QPS
,
,1),1(
,
))(1())(1(
)1(])1([),(
10,)1()(
10,)1()(
21
210
where
plane. the
onpoint arbitrary an is where PPPn
vun
,0)( 0
Three-Dimensional Primitives Three features characterize three-dimensional objects
that fit well with existing graphics hardware and software:– Objects described by surfaces and hollow – 2D primitives
modeling 3D primitives;– Objects can be specified through vertices – efficient
implementation;– The objects either are composed of or can be approximated by
flat convex polygons.
Primitives in Three Dimensions
Vector Derived From Three Basis Vectors
w
.,,
,,
321
321
vvv
w
and basis the torespect
with of components the are and scalars The
3
2
1
3
2
1
,
v
v
v
awa T
Coordinate Systems
3
,
322110
332211
vvvPP
vvvw
:asuniquely
wrtten be canpoint every and
:asuniquely written be canor every vect frame, a given With
Changes of Coordinate Systems
332331
232221
131211
3
2
1
3
2
1
.3332321313
3232221212
3132121111
321321
where,
Therefore,
,
,
bases, twobe },,{ and },,{Let
M
v
v
v
M
u
u
u
vvvu
vvvu
vvvu
vvvuuu
Changes of Coordinate Systems (2)
aMu
v
v
v
u
v
v
v
Ma
v
v
v
bvvv
u
u
u
auuuw
TT
T
T
T
where
,
3
2
1
3
2
1
3
2
1
332211
3
2
1
332211
Rotation and Scaling of a Basis The changes in basis leave the origin unchanged.
We can use them to represent rotation and scaling of a set of basis vectors to derive another basis set.
Translation of a Basis However, a simple translation of the origin, or
change of frame cannot be represented in this way.
Homogeneous coordinates.
Example of Change of Representation
321
3
2
11
3
2
1
1
3
2
1
3
2
1
321321211
321321
321
3321 321
110
011
001
and and
,
111
011
001
:ismatrix ation transformingcorrespond The
,,
have weand },,{ basisanother Consider .32 i.e.,
,},,{ basis therespect to with ]3 2 1[ vector a have weSuppose
uuu
u
u
u
M
v
v
v
w
M
v
v
v
M
u
u
u
M
vvvuvvuvu
uuuvvvw
vvvw T
Homogeneous Coordinates Represent frame change (translation) Avoid point vs. vector confusion
0
3
2
1
3210332211 1
P
v
v
v
PvvvP
0
3
2
1
321332211 0
P
v
v
v
vvvw
Example of Change in Frames
1311
0110
0011
0001
1000
3111
2011
1001
then,32 if
;
1000
0111
0011
0001
, If
.,,Let
).,,,( and ),,,( frames
distinct two:example previoius theof basessimilar Consider
1
32100
00
321321211
03210321
MM
vvvPQ
MQP
vvvuvvuvu
PvvvQuuu
Example (continued)
},,,{0
3
2
1
1
},,,{
},,,{0
3
2
1
1
0
3
2
1
},,,{
03210321
0321
0321
0
3
1
1
0321
0
3
2
1
:as drepresente is which (1,2,3), vector aconsider Again,
1
0
0
0
13211321
1
3
2
1
:is
tionrepresenta whoseframe, original in the (1,2,3),point aConsider
QuuuPvvv
Quuu
Pvvv
Q
u
u
u
Mv
Q
u
u
u
M
P
v
v
v
p
p
Camera and World FramesIn OpenGL, the model-view matrix positions the worldframe relative to the camera frame.
1000
100
0010
0001
dA
One Frame of Cube AnimationTasks:
• Modeling (8 vertices, 12 edges) • Converting to the camera frame • Clipping • Projecting • Removing hidden surfaces • Rasterizing
Traversal of the Edges of a Polygon
Counterclockwise:(0,3,2,1)(3,2,1,0)(2,1,0,3)(1,0,3,2)
Outwardfacing
Vertex-List Representation of a Cube
Bilinear Interpolation
10 ;10
)1()(
)1()(
)1()(
5445
3223
1001
CCC
CCC
CCC
Projection of Polygon
A polygon is first projected onto the two-dimensional plane and then filled with colors.
Scan-Line Interpolation
OpenGL Approach
Transformation
Translation
Two-Dimensional Rotation
Rotation About a Fixed Point
Three-Dimensional Rotation
Non-Rigid Body Transformation
Uniform and Non-uniform Scaling
Effect of Scale Factor
Reflection
Shear
Computation of the Shear Matrix
X’, y’
1000
0100
0010
00cot1
)(
'
,'
,cot'
xH
zz
yy
yxx
Application of Pipeline Transformation
Rotation of a Cube About Its Center
Rotation of a Cube About Its Center – Sequence of Transformation –
)()()( fzf pTRpTM
1000
0100
cossin0cossin
sincos0sincos
fff
fff
yxy
yxx
M
Rotation of a Cube About the z Axis
Rotation of a Cube About y Axis
Rotation of a Cube About The x Axis
Scene of Simple Objects
Instance transformation
Instead of defining each object and its size, position, orientation, we define the object types and create each instance with its size, position, orientation.
Instance Transformation
Rotation of a Cube About an Arbitrary Axis
Movement of The Fixed Point to Origin
Sequence of Rotations
Direction Angles
axes. theand
)(or segment line ebetween th angles ,, vzyx
zz
yy
xx
cos
cos
cos
Computation of the x Rotation
Computation of the y Rotation
Current Transformation Matrix (CTM)
Model-View and Projection Matrices
CTM: current transformation matrix
Symmetric Orientation of Cube Start with a cube centeredat the origin and alignedwith the coordinate axes.Find a rotation matrix thatwill orient the cube symmetrically, as shown here.