UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001 - PowerPoint PPT Presentation

About This Presentation
Title:

UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001

Description:

UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001 Lecture 1 Course Introduction Start of Part I Material – PowerPoint PPT presentation

Number of Views:423
Avg rating:3.0/5.0
Slides: 55
Provided by: MurrayD2
Learn more at: https://www.cs.uml.edu
Category:

less

Transcript and Presenter's Notes

Title: UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001


1
UMass Lowell Computer Science 91.504 Advanced
AlgorithmsComputational Geometry Prof. Karen
Daniels Spring, 2001
  • Lecture 1
  • Course Introduction
  • Start of Part I Material
  • Makeup for 2/5/01

2
Course Introduction
  • What is
  • Computational Geometry?

3
Advanced AlgorithmsComputational Geometry
91.504
Computer Graphics
Visualization

Design
Analyze
Core Geometric Algorithms
Application-Based Algorithms
Apply
Telecommunications
4
Typical Problems
  • maintaining line arrangements
  • polygon partitioning
  • nearest neighbor search
  • kd-trees
  • bin packing
  • Voronoi diagram
  • simplifying polygons
  • shape similarity
  • convex hull

SOURCE Steve Skienas Algorithm Design Manual
(for problem descriptions, see graphics gallery
at http//www.cs.sunysb.edu/algorith)
5
Common Computational Geometry Structures
6
How are They Related?
  • Project each point upwards onto paraboloid z x2
    y2
  • Construct 3D Convex Hull
  • Discard top faces
  • Project Convex Hull down to form Delaunay
    Triangulation
  • Form dual of the Delaunay Triangulation to obtain
    Voronoi Diagram

7
Sample Tools of the Trade
Algorithm Design Patterns/Techniques binary
search divide-and-conquer duality randomization sw
eep-line derandomization parallelism Algorithm
Analysis Techniques asymptotic analysis Data
Structures winged-edge, quad-edge, range tree,
kd-tree Theoretical Computer Science
principles NP-completeness, hardness
MATH
Sets
Proofs
Geometry
Summations
Linear Algebra
Probability
Growth of Functions
Recurrences
Graph Theory
Combinatorics
8
Computational Geometryin Context
9
Course Introduction
  • My Computational Geometry Research

10
Survey of My Previous Computational Geometry
ResearchSupporting Manufacturing Applications
11
Computational GeometryMy Current Research
12
Course Introduction
  • Course Description

13
Web Page
http//www.cs.uml.edu/kdaniels/courses/cg2001spr
ing.html
14
Nature of the Course
  • Elective graduate Computer Science course
  • Theory and Practice
  • Theory Pencil-and-paper exercises
  • design an algorithm
  • analyze its complexity
  • modify an existing algorithm
  • Practice
  • Programs
  • Real-world examples

15
Course Structure 2 Parts
Advanced Topics Applications Manufacturing Mo
deling/Graphics Wireless Networks Visualizatio
n Techniques (de)Randomization Approximation
Robustness Representations Epsilon-net Deco
mposition tree
  • Basics
  • Polygon Triangulation
  • Partitioning
  • (2D and 3D) Convex Hulls
  • Voronoi Diagrams
  • Arrangements
  • Search/Intersection
  • Motion Planning

16
Textbook
  • Required
  • Computational Geometry in C
  • second edition
  • by Joseph ORourke
  • Cambridge University Press
  • 1998
  • see course web site for ISBN number(s) errata
    list

ordered for UML bookstore
Web Site http//cs.smith.edu/orourke/books/compg
eom.html
17
Textbook Java Demo Applet
  • Code function Chapter pointer directory
  • --------------------------------------------------
    ---
  • Triangulate Chapter 1, Code 1.14 /tri
  • Convex Hull(2D) Chapter 3, Code 3.8 /graham
  • Convex Hull(3D) Chapter 4, Code 4.8 /chull
  • sphere.c Chapter 4, Fig. 4.15 /sphere
  • Delaunay Triang Chapter 5, Code 5.2 /dt
  • SegSegInt Chapter 7, Code 7.2 /segseg
  • Point-in-poly Chapter 7, Code 7.13 /inpoly
  • Point-in-hedron Chapter 7, Code 7.15 /inhedron
  • Int Conv Poly Chapter 7, Code 7.17 /convconv
  • Mink Convolve Chapter 8, Code 8.5 /mink
  • Arm Move Chapter 8, Code 8.7 /arm

http//cs.smith.edu/orourke/books/CompGeom/CompGe
om.html
18
Prerequisites
  • Graduate Algorithms (91.503)
  • Coding experience in C, C or Java
  • Standard CS graduate-level math prerequisites
    high school Euclidean geometry
  • additional helpful math background
  • linear algebra, topology

19
Syllabus (current plan)
Part 1
Part 2
20
Literature for Part II (current plan)
21
Literature for Part II (current plan)(continued)
22
Important Dates
  • Midterm Exam Monday, 3/12
  • Final Exam TBA

If you have conflicts with exam dates, please
notify me as soon as possible.
23
Grading
  • Homework 30
  • Project 25
  • Midterm (ORourke) 20 (open book, notes )
  • Final Exam 25 (open book, notes )

24
Part I
  • ORourke Chapter 1
  • Polygon Triangulation
  • Art Gallery Theorems
  • Triangulation Theory
  • Area of Polygon
  • Implementation Issues
  • Segment Intersection
  • Triangulation Implementation

25
Art Gallery Theorems
  • Polygons
  • The Art Gallery Theorem
  • Fiskes Proof of Sufficiency

26
Art Gallery Theorems Polygons
  • What is a polygon?
  • region of a plane bounded by a finite collection
    of line segments forming a simple closed curve

n5
P
nonconvex
convex
simple
nonsimple
27
Art Gallery Theorems The Theorem
  • How many stationary guards are needed to guard
    the room?
  • Visibility 2p range
  • Empirically
  • n is sufficient (2D)
  • n necessary for small n? 3? 4? 5?
  • Guess in general n/3 necessary

Find G(n) the maximum (over all n-vertex
polygons) of the minimum number of guards needed
to cover the polygon.
28
Art Gallery Theorems Fiskes Proof
  • Given arbitrary n-vertex P
  • Triangulate P using diagonals
  • Form triangulation graph G
  • G can be 3-colored (proof later...)
  • Place a guard at each same-colored vertex of G
  • This covers all of P
  • By pigeon-hole principle n/3 guards

Diagonal line segment between 2 vertices that
are clearly visible to each other (no
grazing contact)
29
Triangulation Theory
  • Existence of a Diagonal
  • Properties of Triangulations
  • Triangulation Dual
  • 3-Coloring Proof

30
Triangulation Theory Existence of a Diagonal
  • Step 1 Every polygon must have gt 1 strictly
    convex vertex (no collinearity)
  • Step 2 Every polygon of n gt 4 vertices has a
    diagonal
  • Conclusion Every n-vertex polygon P may be
    partitioned into triangles by adding (gt0)
    diagonals proof by induction using diagonals

31
Triangulation Theory Properties
  • Every triangulation of an n-vertex polygon P uses
    n-3 diagonals and consists of n-2 triangles.
  • The sum of the internal angles of an n-vertex
    polygon is (n-2)p.

9 vertices 7 triangles 6 diagonals
32
Triangulation Theory Duality
  • The dual of a triangulation is a tree with each
    node of degree at most 3.
  • 2-Ears Theorem every polygon of n gt 4
    vertices has at least 2 nonoverlapping ears.

ear
ear
33
Triangulation Theory 3-Coloring
  • 2-Ears Theorem can be used to easily prove
    3-colorability of triangulation graphs
  • Induction on n
  • Base case n 3
  • For n gt 4
  • 2-ears theorem guarantees that an ear abc exists
  • apply inductive hypothesis to polygon P without
    ear
  • reattaching ear adds back in one vertex
    (w.l.o.g. b)
  • color b whatever color a and c dont use
  • result is a 3-coloring of P

a
b
c
34
Area of Polygon
  • Cross Product
  • Determinant Form
  • Area of a Convex Polygon
  • Area of a Convex Quadrilateral
  • Area of a Nonconvex Quadrilateral
  • Area from an Arbitrary Center
  • Volume in gt 3 Dimensions

35
Area of Polygon Cross Product or Determinant
0 for 2D
36
Area of Polygon Convex Quadrilateral
  • Could find area of polygon via triangulation...but
    we want to avoid this!
  • To see how, first consider triangulation for 2
    easy polygon cases Convex
  • Convex Quadrilateral

37
Area of Polygon (continued)
  • Nonconvex Quadrilateral
  • Arbitrary Center

negative area
more efficient
38
Area of Polygon Volume
  • Determinant area formulation extends to higher
    dimensions.
  • In 3D

y
39
Implementation Issues
  • Representation of a Point
  • Representation of a Polygon
  • Code for Area

Text describes C code. C or Java code available
from texts Web site
40
Implementation Issues Point C code
uppercase constants
X is 0th element of point Y is 1st
define X 0 define Y 1 typedef enum FALSE,
TRUE bool define DIM 2 /
Dimension of points / typedef int tPointiDIM
/ Type integer point /
i for integer
integers to minimize roundoff errors (but
overflow is possible)
lowercase type identifier
41
Implementation Issues Polygon
typedef struct tVertexStructure tsVertex
/ Used only in NEW(). / typedef tsVertex
tVertex struct tVertexStructure
int vnum / Index / tPointi v /
Coordinates / bool ear / TRUE iff an ear
/ tVertex next,prev / Global variable
definitions / tVertex vertices NULL /
"Head" of circular list. / int nvertices
0 / Total number of polygon vertices. /
doubly linked circular list for easy vertex
deletion/insertion
42
Implementation Issues Area Code
/------------------------------------------------
--------------------- Returns twice the signed
area of the triangle determined by a,b,c. The
area is positive if a,b,c are oriented ccw,
negative if cw,and zero if the points are
collinear. ---------------------------------------
------------------------------/ int Area2(
tPointi a, tPointi b, tPointi c )
return (bX - aX) (cY - aY) -
(cX - aX) (bY - aY)
minimizes number of multiplications to help avoid
overflow
43
Segment Intersection
  • Diagonals key triangulation step
  • Left
  • Boolean Intersection
  • Segment Intersection Code

Infinite slopes are problematic, so avoid slopes!
44
Segment Intersection Diagonals
Diagonal line segment between 2 vertices
that are clearly visible to each other
(no grazing contact)
which one is a legal diagonal?
45
Segment Intersection Left
/------------------------------------------------
--------------------- Returns true iff c is
strictly to the left of the directed line through
a to b. ------------------------------------------
---------------------------/ bool Left( tPointi
a, tPointi b, tPointi c ) return
AreaSign( a, b, c ) gt 0
returns sign (,0,-) of area instead of area
value itself
46
Segment Intersection Boolean Intersection
/------------------------------------------------
--------------------- Returns true iff ab
properly intersects cd they share a point
interior to both segments. The properness of
the intersection is ensured by using strict
leftness. ----------------------------------------
-----------------------------/ bool IntersectProp
( tPointi a, tPointi b, tPointi c, tPointi d )
/ Eliminate improper cases. / if (
Collinear(a,b,c) Collinear(a,b,d)
Collinear(c,d,a) Collinear(c,d,b)) return
FALSE return Xor( Left(a,b,c), Left(a,b,d)
) Xor( Left(c,d,a), Left(c,d,b) )
which are proper intersections?
47
Segment Intersection Intersection Code
/------------------------------------------------
--------------------- Returns TRUE iff segments
ab and cd intersect, properly or
improperly. --------------------------------------
-------------------------------/ bool Intersect(
tPointi a, tPointi b, tPointi c, tPointi d )
if ( IntersectProp( a, b, c, d ) )
return TRUE else if (Between( a, b, c )
Between( a, b, d ) Between( c,
d, a ) Between( c, d, b )) return
TRUE else return FALSE
48
Triangulation Implementation
Algorithm TRIANGULATION Initialize the ear tip
status of each vertex. while n gt 3 do Locate
an ear tip v2. Output diagonal v1 v3. Delete
v2. Update the ear tip status of v1 and v3.
  • Diagonals (Internal or External)
  • InCone (distinguish Internal from External)
  • Triangulation by Ear Removal
  • Analysis

49
Triangulation ImplementationDiagonals (Internal
or External)
/------------------------------------------------
--------------------- Returns TRUE iff (a,b) is a
proper internal or external diagonal of P,
ignoring edges incident to a and
b. ----------------------------------------------
-----------------------/ bool Diagonalie(
tVertex a, tVertex b ) tVertex c, c1
/ For each edge (c,c1) of P / c
vertices do c1 c-gtnext /
Skip edges incident to a or b / if ( (
c ! a ) ( c1 ! a ) ( c ! b ) ( c1
! b ) Intersect( a-gtv,
b-gtv, c-gtv, c1-gtv ) ) return
FALSE c c-gtnext while ( c !
vertices ) return TRUE
50
Triangulation Implementation InCone
/------------------------------------------------
--------------------- Returns TRUE iff the
diagonal (a,b) is strictly internal to the
polygon in the neighborhood of the a endpoint.
-------------------------------------------------
--------------------/ bool InCone( tVertex a,
tVertex b ) tVertex a0,a1 / a0,a,a1 are
consecutive vertices. / a1 a-gtnext
a0 a-gtprev / If a is a convex vertex
... / if( LeftOn( a-gtv, a1-gtv, a0-gtv ) )
return Left( a-gtv, b-gtv, a0-gtv )
Left( b-gtv, a-gtv, a1-gtv ) / Else a is
reflex / return !( LeftOn( a-gtv,
b-gtv, a1-gtv ) LeftOn( b-gtv, a-gtv, a0-gtv ) )
51
Triangulation Implementation
/ Prints out n-3 diagonals (as pairs of integer
indices) which form a triangulation of P/ void
Triangulate( void ) tVertex v0, v1, v2,
v3, v4 / five consecutive vertices /
int n nvertices / number of vertices
shrinks to 3. / EarInit() while ( n
gt 3 ) / Inner loop searches for an ear and
removes it. / v2 vertices do
if (v2-gtear) / Ear found. /
v3 v2-gtnext v4 v3-gtnext v1
v2-gtprev v0 v1-gtprev
PrintDiagonal( v1, v3 ) v1-gtear
Diagonal( v0, v3 ) v3-gtear Diagonal( v1, v4
) v1-gtnext v3 v3-gtprev v1 /
Update earity. / vertices v3 / In case
the head was v2. / n--
break / out of inner loop resume outer
loop / / end
if ear found / v2
v2-gtnext while ( v2
! vertices ) / end outer while loop
/ / end Triangulate /
52
Triangulation Implementation Analysis
NaĂŻve Analysis
Tighter Analysis
Algorithm TRIANGULATION Initialize the ear tip
status of each vertex. while n gt 3 do Locate
an ear tip v2. Output diagonal v1 v3. Delete
v2. Update the ear tip status of v1 and v3.
O(n2)
O(n2)


O(n) iterations
O(n) iterations
O(n)
O(n) iterations
O(n)
Total O(n3)
Total O(n2)
53
Homework
HW Assigned Due Content
  • Fri, 2/9 Wed, 2/14 Chapter 1 (ORourke)
  • problems 1 2
  • Extra credit may be turned in any time during
    week of 2/12

54
Machine Accounts
  • Each student has an account on my machine
    minkowski.cs.uml.edu
  • Username is the same as your username on CS
  • Password is your initials followed by the last 5
    digits on the bottom right hand corner of the
    back of your student id card (1 exception)
  • To remotely log in, use a secure shell (e.g. ssh)
  • To transfer files, use a secure FTP (e.g. sftpc)
  • Saturn has an sftpc client
  • Code to use with assignments will be there.
Write a Comment
User Comments (0)
About PowerShow.com