geometric objects and transformations geometric entities representation vs. reference system...

67
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Upload: milo-sanders

Post on 22-Dec-2015

223 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Geometric Objects and Transformations

Geometric EntitiesRepresentation vs. Reference SystemGeometric ADT (Abstract Data Types)

Page 2: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Goals Coordinate-free representation of objects Homogeneous coordinates Distinction of an object from its representation

Page 3: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 4: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Geometric View Point: a location in space Scalar: real number Vector: directed line segmentDirected Line Segment That Connects Points

Page 5: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Identical Vectors

Page 6: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Combination of Directed Line Segments

Page 7: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

A Dangerous Representation of a Vector

Page 8: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 9: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Point-Point Subtraction

Page 10: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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;

Page 11: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Use of the Head-to-Tail Axiom

-

-

-

Page 12: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 13: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Line in an Affine Space

vPP 0)(

v

Page 14: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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.

Page 15: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 16: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 17: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 18: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 19: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Cross Product

Right-handed coordinate system

||||

|||sin|

vu

vu

Page 20: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 21: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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.

Page 22: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Primitives in Three Dimensions

Page 23: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 24: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Coordinate Systems

3

,

322110

332211

vvvPP

vvvw

:asuniquely

wrtten be canpoint every and

:asuniquely written be canor every vect frame, a given With

Page 25: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 26: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 27: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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.

Page 28: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Translation of a Basis However, a simple translation of the origin, or

change of frame cannot be represented in this way.

Homogeneous coordinates.

Page 29: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 30: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 31: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 32: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 33: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Camera and World FramesIn OpenGL, the model-view matrix positions the worldframe relative to the camera frame.

1000

100

0010

0001

dA

Page 34: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

One Frame of Cube AnimationTasks:

• Modeling (8 vertices, 12 edges) • Converting to the camera frame • Clipping • Projecting • Removing hidden surfaces • Rasterizing

Page 35: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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

Page 36: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Vertex-List Representation of a Cube

Page 37: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Bilinear Interpolation

10 ;10

)1()(

)1()(

)1()(

5445

3223

1001

CCC

CCC

CCC

Page 38: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Projection of Polygon

A polygon is first projected onto the two-dimensional plane and then filled with colors.

Page 39: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Scan-Line Interpolation

OpenGL Approach

Page 40: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Transformation

Page 41: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Translation

Page 42: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Two-Dimensional Rotation

Page 43: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Rotation About a Fixed Point

Page 44: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Three-Dimensional Rotation

Page 45: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Non-Rigid Body Transformation

Page 46: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Uniform and Non-uniform Scaling

Page 47: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Effect of Scale Factor

Page 48: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Reflection

Page 49: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Shear

Page 50: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Computation of the Shear Matrix

X’, y’

1000

0100

0010

00cot1

)(

'

,'

,cot'

xH

zz

yy

yxx

Page 51: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Application of Pipeline Transformation

Page 52: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Rotation of a Cube About Its Center

Page 53: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Rotation of a Cube About Its Center – Sequence of Transformation –

)()()( fzf pTRpTM

1000

0100

cossin0cossin

sincos0sincos

fff

fff

yxy

yxx

M

Page 54: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Rotation of a Cube About the z Axis

Page 55: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Rotation of a Cube About y Axis

Page 56: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Rotation of a Cube About The x Axis

Page 57: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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.

Page 58: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Instance Transformation

Page 59: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Rotation of a Cube About an Arbitrary Axis

Page 60: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Movement of The Fixed Point to Origin

Page 61: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Sequence of Rotations

Page 62: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Direction Angles

axes. theand

)(or segment line ebetween th angles ,, vzyx

zz

yy

xx

cos

cos

cos

Page 63: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Computation of the x Rotation

Page 64: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Computation of the y Rotation

Page 65: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Current Transformation Matrix (CTM)

Page 66: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

Model-View and Projection Matrices

CTM: current transformation matrix

Page 67: Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)

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.