Computational Geometry

Similar documents
Linear Programming- Manufacturing with

4 Linear Programming. Manufacturing with Molds

Linear Programming in Small Dimensions

CS 372: Computational Geometry Lecture 10 Linear Programming in Fixed Dimension

! Linear programming"! Duality "! Smallest enclosing disk"

Computational Geometry

Line segment intersection. Family of intersection problems

Chapter 4 Concepts from Geometry

CS 532: 3D Computer Vision 14 th Set of Notes

Linear Programming and its Applications

Three Dimensional Geometry. Linear Programming

Math 414 Lecture 2 Everyone have a laptop?

Advanced Operations Research Techniques IE316. Quiz 1 Review. Dr. Ted Ralphs

Chapter 6. Planar Orientations. 6.1 Numberings of Digraphs

Flavor of Computational Geometry. Convex Hull in 2D. Shireen Y. Elhabian Aly A. Farag University of Louisville

Computational Geometry

Math 366 Lecture Notes Section 11.4 Geometry in Three Dimensions

Motion Planning. O Rourke, Chapter 8

Convex Hulls in Three Dimensions. Polyhedra

IMECE DETERMINING MOLDABILITY AND PARTING DIRECTIONS FOR POLYGONS WITH CURVED EDGES

Notes and Answers to Homework Exam 1, Geometric Algorithms, 2017

Voronoi diagram and Delaunay triangulation

Line Arrangement. Chapter 6

Linear programming and duality theory

1/60. Geometric Algorithms. Lecture 1: Introduction. Convex Hulls

Linear Optimization. Andongwisye John. November 17, Linkoping University. Andongwisye John (Linkoping University) November 17, / 25

Example: The following is an example of a polyhedron. Fill the blanks with the appropriate answer. Vertices:

Elementary maths for GMT. Algorithm analysis Part II

Lecture 3: Art Gallery Problems and Polygon Triangulation

15-451/651: Design & Analysis of Algorithms October 11, 2018 Lecture #13: Linear Programming I last changed: October 9, 2018

10. Line Arrangements Lecture on Monday 2 nd November, 2009 by Michael Homann

Graphing Linear Inequalities in Two Variables.

Voronoi diagrams Delaunay Triangulations. Pierre Alliez Inria

Computational Geometry

Preferred directions for resolving the non-uniqueness of Delaunay triangulations

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 29

Applied Integer Programming

Polygon Partitioning. Lecture03

Computational Geometry

16.410/413 Principles of Autonomy and Decision Making

9. Visible-Surface Detection Methods

CS6100: Topics in Design and Analysis of Algorithms

Computational Geometry Lecture Duality of Points and Lines

High-Dimensional Computational Geometry. Jingbo Shang University of Illinois at Urbana-Champaign Mar 5, 2018

R n a T i x = b i} is a Hyperplane.

CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk

Polygon decomposition. Motivation: Art gallery problem

Advanced Algorithm Homework 4 Results and Solutions

Chapter 11. Line Arrangements

Clipping and Intersection

OPERATIONS RESEARCH. Linear Programming Problem

Introduction to Linear Programming

On-Line Computer Graphics Notes CLIPPING

Figure 2.1: An example of a convex set and a nonconvex one.

2D Geometry. Pierre Alliez Inria Sophia Antipolis

Advanced Algorithms Computational Geometry Prof. Karen Daniels. Fall, 2012

Solutions to problem set 1

LP Geometry: outline. A general LP. minimize x c T x s.t. a T i. x b i, i 2 M 1 a T i x = b i, i 2 M 3 x j 0, j 2 N 1. where

Lecture 4: Linear Programming

CSE 5311 Notes 13: Computational Geometry

Design and Analysis of Algorithms (V)

Reconstructing Orthogonal Polyhedra from Putative Vertex Sets

Field: We have been doing geometry eg linear programming. But in computational geometry, key difference in focus: low dimension d

References. Additional lecture notes for 2/18/02.

On the perimeter of k pairwise disjoint convex bodies contained in a convex set in the plane

Chapter 3 Linear Programming: A Geometric Approach

Theoretical Computer Science

We have set up our axioms to deal with the geometry of space but have not yet developed these ideas much. Let s redress that imbalance.

Visible Surface Detection Methods

CS675: Convex and Combinatorial Optimization Spring 2018 The Simplex Algorithm. Instructor: Shaddin Dughmi

Inner Approximation of Polygons and Polyhedra by Unions of Boxes

Trapezoidal Maps. Notes taken from CG lecture notes of Mount (pages 60 69) Course page has a copy

DM545 Linear and Integer Programming. Lecture 2. The Simplex Method. Marco Chiarandini

Linear Programming. Linear Programming. Linear Programming. Example: Profit Maximization (1/4) Iris Hui-Ru Jiang Fall Linear programming

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8!

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

Lesson 17. Geometry and Algebra of Corner Points

Flavor of Computational Geometry. Voronoi Diagrams. Shireen Y. Elhabian Aly A. Farag University of Louisville

A Topologically Convex Vertex-Ununfoldable Polyhedron

Largest Bounding Box, Smallest Diameter, and Related Problems on Imprecise Points

Lecture notes on the simplex method September We will present an algorithm to solve linear programs of the form. maximize.

Parallel Convex Hull using MPI. CSE633 Fall 2012 Alex Vertlieb

Linear Programming Duality and Algorithms

Computational Geometry

7 Voronoi Diagrams. The Post Office Problem

Differential Geometry: Circle Patterns (Part 1) [Discrete Conformal Mappinngs via Circle Patterns. Kharevych, Springborn and Schröder]

4 LINEAR PROGRAMMING (LP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1

3. The Simplex algorithmn The Simplex algorithmn 3.1 Forms of linear programs

Collision handling: detection and response

COMPUTATIONAL GEOMETRY

J Linear Programming Algorithms

Discrete Optimization 2010 Lecture 5 Min-Cost Flows & Total Unimodularity

Collision Detection CS434. Daniel G. Aliaga Department of Computer Science Purdue University

EXTERNAL VISIBILITY. 1. Definitions and notation. The boundary and interior of

Finite Math Linear Programming 1 May / 7

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 24 Solid Modelling

CSE 546, Fall, 2016 Homework 1

AMATH 383 Lecture Notes Linear Programming

CS 532: 3D Computer Vision 11 th Set of Notes

CAD & Computational Geometry Course plan

Transcription:

Casting a polyhedron

CAD/CAM systems CAD/CAM systems allow you to design objects and test how they can be constructed Many objects are constructed used a mold

Casting

Casting A general question: Given an object, can it be made with a particular design process? For casting, can the object be removed from its cast without breaking the cast?

Casting Objects to be made are 3D polyhedra The boundary is like a planar graph, but the coordinates of vertices are 3D We can use a doubly-connected edge list with three coordinates in each vertex object

Casting in 2D First the 2D version: can we remove a 2D polygon from a mold?

Casting in 2D Certain removal directions may be good while others are not

Casting in 2D What top facet should we use? When can we even begin to move the object out? What kind of movements do we allow?

Casting in 2D Assume the top facet is fixed; we can try all Let us consider translations only An edge of the polygon should not directly run into the coinciding mold edge

Casting in 2D Observe: For a given top facet, if the object can be translated over some (small) distance, then it can be translated all the way out Consider a point p that at first translates away from its mold side, but later runs into the mold...

Casting in 2D A polygon can be removed from its cast by a single translation if and only if there is a direction so that every polygon edge does not cross the adjacent mold edge Sequences of translations do not help; we would not be able to construct more shapes than by a single translation

Circle of directions We need a representation of directions in 2D Every polygon edge requires the removal direction to be in a semi-circle compute the common intersection of a set of circular intervals (semi-circles)

Line of directions We only need to represent upward directions: we can use points on the line y = 1 Every polygon edge requires the removal direction to be in a half-line compute the common intersection of a set of half-lines in 1D

Common intersection of half-lines The common intersection of a set of half-lines in 1D: Determine the endpoint p l of the rightmost left-bounded half-line Determine the endpoint p r of the leftmost right-bounded half-line The common intersection is [p l,p r ] (can be empty)

Common intersection of half-lines The algorithm takes only O(n) time for n half-lines Note: we need not sort the endpoints

Casting in 3D Can we do something similar in 3D? Again each facet must not move into the corresponding mold facet

Representing directions in 3D The circle of directions for 2D becomes a sphere of directions for 3D; the line of directions for 2D becomes a plane of directions for 3D: take z = 1 z Which directions represented in the plane does a facet rule out as removal directions? x y

Directions in 3D Consider the outward normal vectors of all facets An allowed removal direction must make an angle of at least π/2 with every facet (except the topmost one) every facet in 3D makes a half-plane in z = 1 invalid

Common intersection of half-planes We get: common intersection of half-planes in the plane The problem of deciding castability of a polyhedron with n facets, with a given top facet, where the polyhedron must be removed from the cast by a single translation, can be solved by computing the common intersection of n 1 half-planes

Common intersection of half-planes Half-planes in the plane: y m x + c y m x + c x c x c

An approach Take the first set: y m x + c Sort by angle, and add incrementally

Incremental common intersection The boundary of the valid region is a polygonal convex chain that is unbounded at both sides The next half-plane has a steeper bounding line and will always contribute to the next valid region

Incremental common intersection Maintain the contributing bounding lines in increasing angular order For the new half-plane, remove any no longer contributing bounding lines from the end Then add the line bounding the new half-plane

Incremental common intersection After sorting on angle, this takes only O(n) time Question: Why? The half-planes bounded from above give a similar chain Intersecting the two chains is simple with a left-to-right scan

Incremental common intersection Half-planes with vertical bounding lines can be added by restricting the region even more This can also be done in linear time

Result Theorem: The common intersection of n half-planes in the plane can be computed in O(nlogn) time The common intersection may be empty, or a convex polygon that can be bounded or unbounded

Back to casting The common intersection of half-planes cannot be computed faster (we are sorting the lines along the boundary) The region we compute represents all mold removal directions...... but to determine castability, we only need one!

Linear programming We will find the lowest point in the common intersection Notice that half-planes are linear constraints Minimize y Subject to y m 1 x + c 1 y m 2 x + c 2. y m i x + c i y m i+1 x + c i+1. y m n x + c n

Linear programming Minimize c 1 x 1 + + c k x k Subject to a 1,1 x 1 + + a k,1 x k b 1 a 1,2 x 1 + + a k,2 x k b 2. a 1,n x 1 + + a k,n x k b n where a 1,1,...,a k,n, b 1,...,b n, c 1,...,c k are given coefficients This is LP with k unknowns (dimensions) and n inequalities Question: Where are the inequalities?

Terminology LP with k unknowns (dimensions) and n inequalities: k-dimensional linear programming The subspace that is the common intersection is the feasible region. If it is empty, the LP is infeasible The vector (c 1,...,c k ) T is the objective vector or cost vector If the LP has solutions with arbitrarily low cost, then the LP is unbounded Note: The feasible region may be unbounded while the LP is bounded

LP for casting LP for determining castability of 3D polyhedra is 2-dimensional linear programming with n constraints We only want to decide feasibility, so we can choose any objective function We will make it ourselves easy

Incremental LP Let h 1,...,h n be the constraints and l 1,...,l n their bounding lines Find any two constraints h 1 and h 2 where l 1 and l 2 are non-parallel Rotate h 1 and h 2 over an angle α around the origin to make l 1 l 2 the optimal solution for the objective function that minimizes y Rotate all other constraints over α too l 1 l 2 l 1 l 2

Incremental LP Solve the LP with the rotated constraints l 1 If the rotated LP is infeasible, then so is the unrotated version If the rotated LP gives an optimal solution (p x,p y ), then rotate it over an angle α around the origin to get the removal direction for the original position of the polyhedron l 2 l 1 l 2

Incremental LP The algorithm adds the constraints h 3,...,h n incrementally and maintains the optimum so far Let H i = {h 1,...,h i } Let v i be the optimum for H i (unless we already have infeasibility)

LP for casting v i 1 The incremental step: suppose we know v i 1 and want to add h i There are two possibilities: l i h i If v i 1 h i, then v i = v i 1 If v i 1 h i, then either the LP is infeasible, or v i lies on l i l i h i v i 1

Incremental LP h i l i h i l i h i l i v i 1 v i 1 v i 1

LP for casting Algorithm LPforCasting(H) 1. Let h 1, h 2, and v 2 be as chosen 2. for i 3 to n 3. do if v i 1 h i 4. then v i v i 1 5. else v i the point p on l i that minimizes y, subject to the constraints in H i 1. 6. if p does not exist 7. then Report that the LP is infeasible, and quit. 8. return v n

LP for casting If v i 1 h i, how do we find the point p on l i? h i l i l i l i v i 1

Efficiency If v i 1 h i, then the incremental step takes only O(1) time If v i 1 h i, then the incremental step takes O(i) time The LP-for-casting algorithm takes O(n 2 ) time in the worst case v n v 5 v 4 v 3 v 2

Efficiency l n l 3 l 5 v n l n 2 v 3 l 4 l 3 v 5 v 4 l n 1 l n v 2 v 3 v 2

Randomized algorithm Algorithm RandomizedLPforCasting(H) 1. Let h 1, h 2, and v 2 be as chosen 2. Let h 3,h 4,...,h n be in a random order 3. for i 3 to n 4. do if v i 1 h i 5. then v i v i 1 6. else v i the point p on l i that minimizes y, subject to the constraints in H i 1. 7. if p does not exist 8. then Report that the LP is infeasible, and quit. 9. return v n

Putting in random order The constraints may be given in any order, the algorithm will just reorder them Let j be a random integer in [3,n] Swap h j and h n Recursively shuffle h 3,...,h n 1 Putting in random order takes O(n) time

Expected running time Every one of the (n 2)! orders is equally likely The expected time taken by the algorithm is the average time over all orders 1 (n 2)! time if the random order is Π Π permutation

Expected running time If the order of the constraints h 3,...,h n is random, what is the probability that v i 1 h i? We use backwards analysis: consider the situation after h i is inserted, and v i is computed (either by v i = v i 1, or somewhere on l i )

Expected running time v i v i v i Only if one of the dashed lines was l i, the last step where h i was added was expensive and took Θ(i) time

Expected running time v i If h i does not bound the feasible region, or not at v i, then the addition step was cheap and took Θ(1) time

Expected running time There are i half-planes that could have been one of the lines defining v i, and i 2 of these are in random order Since the order was random, each of the i 2 half-planes has the same probability to be the last one added, and only 2 of these caused the expensive step 2 out of i 2 cases: expensive step; Θ(i) time for i-th addition i 4 out of i 2 cases: cheap step; Θ(1) time for i-th addition

Expected running time Expected time for i-th addition at most: i 4 i 2 Θ(1) + 2 Θ(i) = Θ(1) i 2 Total running time: Θ(n) + n i=3 Θ(1) = Θ(n) expected time

Degenerate cases The optimal solution may not be unique, if the feasible region is bounded from below by a horizontal line. How to solve it? There may be many lines from l 3,...,l i passing through v i ; how does this affect the probability of an expensive step?

Degenerate cases v i

Degenerate cases In degenerate cases, the probability that the last addition was expensive is even smaller: 1/(i 2), or 0 Without any adaptations, the running time holds

Result Theorem: Castability of a simple polyhedron with n facets, given a top facet, can be decided in O(n) expected time Theorem: 2-dimensional linear programming with n constraints can be solved in O(n) expected time Question: What does expected time mean? Expectation over what?

Higher dimensions? Question: Can you imagine whether we can also solve 3-dimensional linear programming efficiently?