geometric modeling 91.580.201 mortenson chapter 1 (including some material from farin ch. 2)

36
Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Post on 21-Dec-2015

226 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Geometric Modeling91.580.201

Mortenson Chapter 1

(including some material from Farin Ch. 2)

Page 2: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Vector Properties

zpypxp 222 p

] [ zyx ppppVector:

zyx ppp 222 pMagnitude:

Direction cosines:

pxp

cosp

ypcos

pzp

cos

1coscoscos 222 b

scalar

(dot)

product:

vector

(cross)

product:

source: Mortensonsource: Mortenson

zyx rrr

Page 3: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Matrix Properties

44434241

34333231

24232221

14131211

aaaa

aaaa

aaaa

aaaa

A

Special square matrices:- Diagonal: 0 elements except on main diagonal- Identity matrix- Symmetric matrix: symmetric about main diagonal- Antisymmetric (skew symmetric): aij = - aji

Transpose: AT

(AAT)T =AATInverse of square matrix: A-1

AA-1 = A-1A=IElements of A-1:

where |A’ji| is determinant of cofactor that deletes row j and column i from A.

A

A jiji

ija')1(

1

Determinant properties: |A|- |A|= |AT|- |AB|= |A||B|

source: Mortensonsource: Mortenson

Page 4: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Matrix Properties (continued)

0p

Eigenvalues and Eigenvectors:- Let p be a point and A be a transformation matrix.- Suppose that scalar exists such that: Ap= p.- Each vector for which Ap= p is true is an eigenvector of A.- Each scalar for which Ap= p is true is an eigenvalue of A corresponding to p.- Characteristic equation ( if ): |A-I|=0. Solutions are eigenvalues of A.- Finding eigenvectors: (see Introduction to Linear Algebra by Krause)

-Theorem: A linear transformation has a diagonal matrix there is a basis of eigenvectors of that matrix.

As we’ll see in Ch. 2 of Farin, a linear transformation preserves linear combinations:

R, ;)( AgAfgfA

Also in Ch. 2 of Farin: Eigenvectors can be used to determine axes of norm ellipse for a 2D set of points whose centroid is at origin. Eigenvalues give lengths of ellipse’s axes. This helps to characterize the point set.

sources: Mortenson, Farinsources: Mortenson, Farin

Page 5: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Matrix Properties (continued)

source: Mortensonsource: Mortenson

Page 6: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Geometric Modeling91.580.201

Farin Chapters 2,3

(including some 91.504 material from O’Rourke)

Page 7: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Points and VectorsBarycentric combination of points:

Note: some ’s may be negative.Example: “center of gravity”

Special case: convex combination of points: ’s must all be positive.

1 , 103

0

njj

n

jj Ebbb

Convex Hull of a set of points is the set of all convex combinations of points in the set.

nonconvex polygonnonconvex polygonconvex hull of a point setconvex hull of a point set

sources: Farin, O’Rourkesources: Farin, O’Rourke

Page 8: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Barycentric Coordinates in the Plane

source: Farin source: Farin

Page 9: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Linear Interpolation

. and between is point 10For baxt

Rbaxx tttt ;)1()(

source: Farin source: Farin

Page 10: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Affine Maps

• A map that maps E3 into itself is an affine map if it leaves barycentric combinations invariant.

• So, if

and is an affine map, then

• Formulation for a point x in a coordinate system with a 3x3 matrix A and vector from R3:

1 , 103

0

njj

n

jj Ebbb

,, 3

0

Ebxbb

jj

n

jj

vAxx

source: Farin source: Farin

Page 11: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Affine Maps (continued)• Examples of affine transformations (can be

composed using matrix multiplication to form chains of transformations) – Identity: A = I and v = 0. x is unchanged.

– Translation: A = I and v = translation vector. x is shifted by v.

– Scaling: A is a diagonal matrix and v = 0. x is “stretched”.

– Rotation: A is a rotation matrix (for rotation about an axis) and v = 0. x is rotated about the associated axis.

– Shear: A is I with some 0 elements replaced by non-0 value(s). v = 0. Effect on x is like “tilting” an axis.

– Parallel projection: center of projection is at infinity, so that there is a single viewing direction. Primary types are oblique and orthographic.

• Rigid Body Motions preserve lengths and angles. ATA = I.– Translations and Rotations are examples.

vAxx

source: Farin source: Farin

Page 12: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Linear Interpolation

• Linear interpolation is affinely invariant:

babax tttt )1())1((

Rbaxx tttt ;)1()(

source: Farin source: Farin

Page 13: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

More on Affine Maps…

• Every map that takes straight lines to straight lines and is ratio preserving is an affine map.– For 3 collinear points: a, b, c:

where vol1 denotes one-dimensional volume.

),(vol

),(vol),,(ratio

1

1

cb

bacba

),(vol

),(vol),,(ratio

1

1

cb

bacba

source: Farin source: Farin

Page 14: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Function Spaces

• This material will simplify notation later.• Let C[a,b] be set of all real-valued continuous functions

defined over [a,b ].• C[a,b] forms a linear space over the reals if

– For

• n functions are linearly independent if

],[, baCgf ][ )()())(( a,bttgtftgf

],[,,, 21 baCfff n

0],[ 0 21 nii cccbatfc

source: Farin source: Farin

Page 15: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Function Spaces (continued)• Some useful subspaces of C[a,b]:

– Polynomials of degree n:– Monomials are linearly independent and form a basis for

the polynomials.– A linear transformation preserves linear combinations:

– Piecewise linear functions over a fixed partition of [a,b]. Hat functions form a basis.

R, ;)( AgAfgfA

bttta n 10

],[ )( 10 battataatp nn

n

,,,,1 2 nttt

jitH

tH

ji

ii

if 0)(

1)(:functionHat

n

jjj tHftf

0

)()(

210 23 HHHf

source: Farin source: Farin

Page 16: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Variation Diminishing Property

source: Farin source: Farin

Page 17: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Menelaos’ Theorem

210 )]1()1[()1)(1(],[],[ bbbbb stststststts

10)1(],0[ bbb ttt

],1[],0[)1(],[ ststts bbb

useful in proof of many algorithms

],1[],0[)1(],[ tstsst bbb

21)1(],1[ bbb sss 21)1(],1[ bbb ttt

10)1(],0[ bbb sss

source: Farin source: Farin

Page 18: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Blossoms210 )]1()1[()1)(1(],[],[ bbbbb stststststts

1 ,*];[,*][),*][( srsr bbb

][],,[ nttt bb

Example of a blossom:

In general, a blossom is an n-variate function b[t1,…, tn] from Rn to E2 or E3 with properties:-Symmetry:

-Multiaffinity:

-Diagonality:

where denotes permutation)],,([],,[ 11 nn tttt bb

],[])[(0

iniini

n

i

n sri

nsr bb

where indicates same arguments on both sides

This determines a polynomial curve.

Special case has Leibniz formula:

where argument is repeated n times

source: Farin source: Farin

Page 19: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Common Computational Geometry Structures

Voronoi DiagramVoronoi DiagramConvex HullConvex Hull

New PointNew Point

source: O’Rourke, Computational Geometry in Csource: O’Rourke, Computational Geometry in C

Delaunay TriangulationDelaunay Triangulation

Page 20: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Geometric Modeling91.580.201

OpenGL

Page 21: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

OpenGL Overview

• Open-Source Graphics API Specification– Hardware-independent– Operating system independent– Vendor-neutral– Bindings for C and some other languages– Client/server paradigm

• Managed by OpenGL Architecture Review Board

source:http://web.cs.wpi.edu/~matt/courses/cs563/talks/OpenGL_Presentation/OpenGL_Presentation.htmlsource:http://web.cs.wpi.edu/~matt/courses/cs563/talks/OpenGL_Presentation/OpenGL_Presentation.html

Page 22: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

OpenGL Graphics Pipeline

source:http://web.cs.wpi.edu/~matt/courses/cs563/talks/OpenGL_Presentation/OpenGL_Presentation.htmlsource:http://web.cs.wpi.edu/~matt/courses/cs563/talks/OpenGL_Presentation/OpenGL_Presentation.html

store commands for later use

evaluate polynomial functions

transformation,lighting, clipping, projection, viewport selection

produce fragments (series of framebuffer addresses and values)

hidden surface removal via depth (z)-buffering

stores pixel values for bit planes

Page 23: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Window and Viewport

source: Hill / Kelleysource: Hill / Kelley

Page 24: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

OpenGL Overview

• State-Based: stacks maintain state– Push saves current state– Pop restores previous state– Matrix stack for transformations– Attribute stack for properties such as color

source:http://web.cs.wpi.edu/~matt/courses/cs563/talks/OpenGL_Presentation/OpenGL_Presentation.htmlsource:http://web.cs.wpi.edu/~matt/courses/cs563/talks/OpenGL_Presentation/OpenGL_Presentation.html

Page 25: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

OpenGL Geometric Primitives

source:on-line OpenGL Programming Guide (see course web site for link)source:on-line OpenGL Programming Guide (see course web site for link)

Page 26: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

OpenGL GLU Evaluators for Curves and Surfaces

source:http://hal.chem.uwm.edu/library/SGI_bookshelves/SGI_Developer/books/OpenGL_PG/sgi_html/ch13.htmlsource:http://hal.chem.uwm.edu/library/SGI_bookshelves/SGI_Developer/books/OpenGL_PG/sgi_html/ch13.html

Bezier curve with 4 control points

wireframe Bezier surface

lit, shaded Bezier surface using mesh

NURBS surface

Page 27: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

GL Utility Toolkit (GLUT)

• Event-driven, interactive windowing support– call-back functions

Page 28: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

source:http://www.avl.iu.edu/~ewernert/b581/lectures/12.1/index.htmlsource:http://www.avl.iu.edu/~ewernert/b581/lectures/12.1/index.html

Page 29: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

OpenGL and GLUT part of HW#1

• Starting point: articulated robot by Michelle Daniels

Page 30: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

OpenGL and GLUT part of HW#1• Add some GLUT objects to the scene.

Page 31: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Geometric Modeling91.580.201

Polyhedra

source: O’Rourke, Computational Geometry in Csource: O’Rourke, Computational Geometry in C

Page 32: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Polyhedra: What are they?• Polyhedron generalizes 2D polygon to 3D• Consists of flat polygonal faces• Boundary/surface contains

– 0D vertices 1D edges 2D faces• Components intersect “properly.” Each face pair:

– disjoint or have vertex in common or have vertex/edge/vertex in common

• Local topology is “proper”– at every point neighborhood is homeomorphic to disk

• Global topology is “proper”– connected, closed, bounded – may have holes

notnot polyhedra! polyhedra!

polyhedrapolyhedra

for more examples, seefor more examples, see http://www.ScienceU.com/geometry/facts/solids/handson.html http://www.ScienceU.com/geometry/facts/solids/handson.html

Page 33: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Polyhedra: Regular Polytopes

• Convex polyhedra are polytopes

• Regular polyhedra are polytopes that have: – regular faces, = faces, = solid (dihedral) angles

• There are exactly 5 regular polytopes

Excellent math references by H.S.M. Coxeter:Excellent math references by H.S.M. Coxeter:- - Introduction to GeometryIntroduction to Geometry (2nd edition), Wiley &Sons, 1969 (2nd edition), Wiley &Sons, 1969- - Regular PolytopesRegular Polytopes, Dover Publications, 1973, Dover Publications, 1973

p v (p-2)(v-2) Name Description 3 3 1 Tetrahedron 3 triangles at each vertex 4 3 2 Cube 3 squares at each vertex 3 4 2 Octahedron 4 triangles at each vertex 5 3 3 Dodecahedron 3 pentagons at each vertex 3 5 3 Icosahedron 5 triangles at each vertex

Page 34: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Polyhedra: Euler’s Formula

Proof has 3 parts:

1) Convert polyhedron surface to planar graph

2) Tree theorem

3) Proof by induction

V - E + F = 2V - E + F = 2

Page 35: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Polyhedral Boundary Representations

winged edgewinged edge

ff00

ff11ee

ee11++

ee11--

ee00++

ee00--

vv11

vv00

twin edge twin edge [[DCEL: doubly connected edge listDCEL: doubly connected edge list]]

ff00

ff11ee

ee4,04,0

vv11

vv00

- focus is on edgefocus is on edge

- edge orientation is arbitraryedge orientation is arbitrary

- represent edge as 2 halvesrepresent edge as 2 halves- lists: vertex, face, edge/twinlists: vertex, face, edge/twin- more storage space more storage space - facilitates face traversalfacilitates face traversal- can represent holes with face can represent holes with face inner/outer edge pointerinner/outer edge pointer

e’s e’s twintwin

vv22

vv77

vv66

vv55

vv33

vv44

ee0,10,1

Page 36: Geometric Modeling 91.580.201 Mortenson Chapter 1 (including some material from Farin Ch. 2)

Polyhedral Boundary Representations: Quad-Edge

- general: subdivision of oriented 2D general: subdivision of oriented 2D manifoldmanifold- edge record is part of:edge record is part of:

- endpoint 1 listendpoint 1 list- endpoint 2 listendpoint 2 list- face A listface A list- face B listface B list

ee0,10,1ff00

ff11

ee4,04,0

vv11

vv00

vv22

vv77

vv66

vv55

vv33

vv44

ee0,10,1

twin edge twin edge [DCEL: doubly connected edge list][DCEL: doubly connected edge list]

ee0,00,0

ee1,01,0

ee2,02,0

ee3,03,0ee5,15,1

ee6,16,1

ee7,17,1

ee1,11,1

ee5,15,1

ee6,16,1ee7,17,1

ee1,01,0

ee0,00,0ee2,02,0

ee3,03,0 ee4,04,0

ee1,11,1