Euclidean Shortest Paths “Beauty on the Path”, a digital painting by Stephen Li (Auckland, New Zealand), September2011,providedasagiftforthisbook. Fajie Li (cid:2) Reinhard Klette Euclidean Shortest Paths Exact or Approximate Algorithms FajieLi ReinhardKlette SchoolofInformationScience Dept.ComputerScience andTechnology UniversityofAuckland HuaqiaoUniversity P.O.Box92019 P.O.Box800 Auckland1142 XiamenFujian NewZealand People’sRepublicofChina [email protected] [email protected] ISBN978-1-4471-2255-5 e-ISBN978-1-4471-2256-2 DOI10.1007/978-1-4471-2256-2 SpringerLondonDordrechtHeidelbergNewYork BritishLibraryCataloguinginPublicationData AcataloguerecordforthisbookisavailablefromtheBritishLibrary LibraryofCongressControlNumber:2011941219 ©Springer-VerlagLondonLimited2011 Apartfromanyfairdealingforthepurposesofresearchorprivatestudy,orcriticismorreview,asper- mittedundertheCopyright,DesignsandPatentsAct1988,thispublicationmayonlybereproduced, storedortransmitted,inanyformorbyanymeans,withthepriorpermissioninwritingofthepublish- ers,orinthecaseofreprographicreproductioninaccordancewiththetermsoflicensesissuedbythe CopyrightLicensingAgency.Enquiriesconcerningreproductionoutsidethosetermsshouldbesentto thepublishers. Theuseofregisterednames,trademarks,etc.,inthispublicationdoesnotimply,evenintheabsenceofa specificstatement,thatsuchnamesareexemptfromtherelevantlawsandregulationsandthereforefree forgeneraluse. Thepublishermakesnorepresentation,expressorimplied,withregardtotheaccuracyoftheinformation containedinthisbookandcannotacceptanylegalresponsibilityorliabilityforanyerrorsoromissions thatmaybemade. Coverdesign:VTeXUAB,Lithuania Printedonacid-freepaper SpringerispartofSpringerScience+BusinessMedia(www.springer.com) To Zhixing Li, and to the two youngest in the KlettefamilyinNewZealand Foreword Theworldiscontinuousthemindisdiscrete. DavidMumford(born1937) Recently, I was confronted with the problem of planning my travel from Israel toNewZealand,homeofthetwoauthorsofthisbook.Whentakingtwoantipodal pointsontheglobe,likeHaifaandQueenstown,thereisaninfinitenumberofshort- estpathsconnectingthesepoints.Still,duetoconstraintslikereachableairportsand airlines,findingtheoptimalsolutionwasalmostimmediate. Throughout the long history of geometry sciences, the problem of finding the shortestpathinvariousscenariosoccupiedthemindsofresearchersinmanyfields. Evenin Euclideanspaces,whichare consideredsimple,theintroductionofobsta- clesleadstochallengingproblemsforwhichefficientcomputationalsolversarehard tofind.Theoptimalpathin3Dspacewithpolyhedralobstacleswasamongthefirst geometricproblemsproventobe,atleastformally,computationallyhardtosolve.It tookalmost20yearsforateamof5programmingexpertstoeventuallyimplement amethodapproximatingthecontinuousDijkstraalgorithmthatisreviewedinthis book.Exactproblemsarehardtosolve,andapproximationsareobviouslyrequired. Mypersonallineofworkwhendealingwithgeometricproblemssomewhatdif- fersfromtheschoolofthoughtpromotedbythisbook.Anumericalapproximation inmyvocabularyinvolvesthenotionofaccuracythatdependsonanunderlyinggrid resolution.Thisgridisdefinedbysamplingthedomainoftheproblemandleadsto thefieldofnumericalgeometryinwhichefficientsolversaresimpletodesign. The alternative computational geometry school of thought describes obstacles as polyhedral structures that allegedly define the “exact” problem. The resulting challengesunderthissettingareextremelydifficulttoovercome.Still,theunifying bridgebetweenthesetwophilosophicalbranchesisdefinedbythegeometricprob- lems.Withoutbeingfamiliarwiththedifficultyinvolvedindesigningapathbetween pointsinaweighteddomain,onecouldnotappreciatetheconceptualsimplicityof numericalEikonalsolvers. This book addresses the type of hard problems in the computational geometry flavorwhileinventingconstraintsthatallowforefficientsolverstobedesigned.For example,thecreativerubberbandmethodsexploredinthisbookrestricttheoptimal vii viii Foreword pathstobandsofboundedwidth,therebyredefiningproblemsandsimplifyingthe challenges,provingyetagainAleksandrPushkin’sobservationthat“inspirationis needed in geometry, just as much as in poetry.” I hope that, like me, the reader wouldfindthegeometricalchallengesintroducedinthisbookfascinatingandalso appreciatetheeleganceoftheproposedsolutions. Haifa,Israel RonKimmel Preface AEuclideanshortestpathconnectsasourcewithadestination,avoidssomeplaces (calledobstacles),visitssomeplaces(calledattractions),possiblyinadefinedor- der,andisofminimumlength.Euclideanshortest-pathproblemsaredefinedinthe EuclideanplaneorinEuclidean3-dimensionalspace.Thecalculationofaconvex hull in the plane is an example for finding a shortest path (around the given set ofplanarobstacles).Polyhedralobstaclesandpolyhedralattractions,astartandan endpointdefineageneralEuclideanshortest-pathproblemin3-dimensionalspace. The book presents selected algorithms (i.e., not aiming at a general overview) for the exact or approximate solution of shortest-path problems. Subjects in the firstchaptersofthebookalsoincludefundamentalalgorithms.Graphtheoryoffers shortest-pathalgorithmsfordiscreteproblems.Convexhulls(andtoalesserextent alsoconstrainedconvexhulls)havebeendiscussedincomputationalgeometry.Sei- del’s triangulation and Chazelle’s triangulation method for a simple polygon, and Mitchell’ssolutionofthecontinuousDijkstraproblemhavealsobeenselectedfora detailedpresentation,justtonamethreeexamplesofimportantworkinthearea. The book also covers a class of algorithms (called rubberband algorithms), whichoriginatedfromaproposalforcalculatingminimum-lengthpolygonalcurves incube-curves;ThomasBülowwasaco-authoroftheinitiatingpublication,andhe coinedthename‘rubberbandalgorithm’in2000forthefirsttimeforthisapproach. Subsequent work between 2000 and now shows that the basic ideas of this al- gorithmgeneralisedforsolvingarangeofproblems.Inasequenceofpublications between2003and2010,we,theauthorsofthisbook,describeaclassofrubberband algorithms with proofs of their correctness and time-efficiency. Those algorithms canbeusedtosolvedifferentEuclideanshortest-path(ESP)problems,suchascal- culatingtheESPinsideofasimplecube-arc(theinitialproblem),insideofasimple polygon,onthesurfaceofaconvexpolytope,orinsideofasimplepolyhedron,but also ESP problems such as touring a finite sequence of polygons, cutting parts, or thesafari,zookeeper,orwatchmanrouteproblems. We aimed at writing a book that might be useful for a second or third-year al- gorithms course at the university level. It should also contain sufficient details for students and researchers in the field who are keen to understand the correctness ix x Preface proofs, the analysis of time complexities and related topics, and not just the algo- rithmsandtheirpseudocodes.Thebookdiscussesselectedsubjectsandalgorithms atsomedepth,includingmathematicalproofsformostofthegivenstatements.(This isdifferentfrombookswhichaimatarepresentativecoverageofareasinalgorithm design.) Each chapter closes with theoreticalor programmingexercises, giving students various opportunities to learn the subject by solving problems or doing their own experiments.Tasksare(intentionally)onlysketchedinthegivenprogrammingexer- cises,notdescribedexactlyinalltheirdetails(say,asitistypicallywhenacostumer specifiesaproblemtoanITconsultant),andidenticalsolutionstosuchvaguelyde- scribedprojectsdonotexist,leavingspaceforthecreativityofthestudent. Theaudienceforthebookcouldbestudentsincomputerscience,IT,mathemat- ics,orengineeringatauniversity,oracademicsbeinginvolvedinresearchorteach- ingofefficientalgorithms.Thebookcouldalsobeusefulforprogrammers,mathe- maticians,orengineerswhichhavetodealwithshortest-pathproblemsinpractical applications, such as in robotics (e.g., when programming an industrial robot), in routing (i.e., when selecting a path in a network), in gene technology (e.g., when studyingstructuresofgenes),oringameprogramming(e.g.,whenoptimisingpaths formovesofplayers)—justtocitefourofsuchapplicationareas. Theauthorsthank(inalphabeticalorder)TetsuoAsano,DonaldBailey,Chander- jitBajaj,ParthaBhowmick,Alfred(Freddy)Bruckstein,ThomasBülow,XiaChen, Yewang Chen, David Coeurjolly, Eduardo Destefanis, Michael J. Dinneen, David Eppstein, Claudia Esteves Jaramillo, David Gauld, Jean-Bernard Hayet, David Kirkpatrick, Wladimir Kovalevski, Norbert Krüger, Jacques-Olivier Lachaud, Joe Mitchell,AkiraNakamura,XiuxiaPan,HenrikG.Petersen,NicolaiPetkov,Fridrich Sloboda, Gerald Sommer, Mutsuhiro Terauchi, Ivan Reilly, the late Azriel Rosen- feld, the late Klaus Voss, Jinlong Wang, and Joviša Žunic´ for discussions or com- mentsthatwereofrelevanceforthisbook. TheauthorsthankChengleHuang(ChingLokWong)fordiscussionsonrubber- band algorithms; he also wrote C++ programs for testing Algorithms 7 and 8. We thank Jinling Zhang and Xinbo Fu for improving C++ programs for testing Algo- rithm 7. The authors acknowledge computer support by Wei Chen, Wenze Chen, Yongqian Du, Wenxian Jiang, Yanmin Luo, Shujuan Peng, Huijuan Pi, Huazhen Wang,andJianYu. ThefirstauthorthanksdeanWeibinChenatHuaqiaoUniversityforsupporting the project of writing this book. The second author thanks José L. Marroquín at CIMATGuanajuatoforaninvitationtothisinstitute,thusprovidingexcellentcon- ditionsforworkingonthisbookproject. PartsofChap.4(onrelativeconvexhulls)areco-authoredbyGiselaKlette,who alsocontributedcomments,ideasandcriticismsthroughoutthebookproject. WearegratefultoGarryTeeforcorrectionsandvaluablecomments,oftenadding importantmathematicalorhistoricdetails. Huaqiao,People’sRepublicofChina FajieLi Auckland,NewZealand ReinhardKlette