HAL Id: inria-00510032
https://hal.inria.fr/inria-00510032
Submitted on 17 Aug 2010
HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
A Simple Kinetic Visibility Polygon
Samuel Hornus, Claude Puech
To cite this version:
Samuel Hornus, Claude Puech. A Simple Kinetic Visibility Polygon. 18th European Workshop on
Computational Geometry, 2002, Varsovie, Poland. pp.27-30. �inria-00510032�
A simple kinetic visibility polygon
Samuel Hornus
iMAGIS-GRAVIR/IMAG-INRIA
Samuel.Hornus@imag.fr
Claude Puech
iMAGIS-GRAVIR/IMAG-INRIA
Claude.Puech@imag.fr
ABSTRACT
Givena set of movingobstales inthe plane,we proposea
method for maintaining eÆiently the visibility polygon of
a (possibly moving) viewpoint. We onsider both smooth-
onvex,andsimply-polygonalobstales.
Categories and Subject Descriptors
F.2.2[Theory ofComputation℄: AnalysisofAlgorithms
and Problem Complexity|Non-numerial Algorithms and
Problems
Keywords
kinetidatastruture,visibilitypolygon
1. INTRODUCTION
Visibilityomputationsareentralinmanyomputergraph-
is algorithmsand inrobot motion planning. A veryuse-
fultool is the determination of the objets visible from a
viewpoint. Thus, intheplane, the visibility polygon is an
important visibilitystruture. It is a starshaped polygon
enteredattheviewpoint,whoseedgesarethevisibleparts
oftheobjetsinthesene,andwhoseinteriorintersetsno
objet.
EÆientalgorithmsexisttoomputethevisibility polygon
inthestatiase, butappliationsofthisproblemmayap-
ply to moving objets. Computing the visibility polygon
at various times on a stati \ snapshot " of the sene is
ineÆient, sine we donottake into aount thetemporal
oherenethat arisefromthe ontinuity ofthemovements
oftheobjets(andpossiblytheviewpoint): ifthetimestep
is too small, we will ompute many times the very same
(ombinatorial)visibilitypolygon.
Weusethekinetidatastruture frameworkintroduedby
Guibas[2,1℄toproposeasimple algorithmthat maintains
the visibility polygon of a view point in a 2-dimensional
senewhenallobjetsmaymove.Thestruturemaintained
isinfataweakradialdeompositionofthesene. Setion
2treatstheaseofsmoothonvex obstales. Setion3ex-
aminestheaseofsimple(nonauto-rossing) polygons.
Kinetidatastrutures (KDS)area wayto eÆientlyand
aurately maintain an attribute built on top of ontinu-
ouslymovingitems (e.g. aonvex hull). Inordertomain-
tain anattribute Aovera setof movingitems (itemsare
generallypoints),eahtestintheproofoforretnessofthe
onstrutionof A is analyzed to detetthe time at whih
it willfail. Theidea is thatmaintainingthe validity ofall
thosetests(alledertiates)guaranteesthattheattribute
A ismaintainedalso,sine theertiates provideaproof
oforretness. Certiatesare orderedinapriorityqueue,
aording to their failure time. Whenthe simulation time
passesabovetherstertiate'sfailuretime,theattribute
ismodied,andtheproofisupdated(i.e. someertiates
disappear,othersarereated,andtheirfailuretimeisom-
puted). Thismethodonlyrequires that themotion of the
itemsbeknownintheshortterm. Forshort,oneouldsay
that kineti datastruturesget ridof step-by-stepsimula-
tions,andimplementinfattimesweepalgorithms.
Wenowgetinterestedinmaintainingthevisibilitypolygon
ofasene. Here,intheKDSterminology,theitemsarethe
onvexsmoothobjets,orthepolygons'verties. Wemain-
tain a weak radial deomposition of the sene, thus, the
ertiates weusetakeareofthewellordering(i.e. yli-
allysorted)ofthesegmentsinthedeomposition. Finally
the radial deomposition ofthe sene allows us to quikly
buildthevisibilitypolygon.
2. CONVEX OBSTACLES
Let O be aset of n onvexobstales intheplane. Let F
be the\ freespae ": the omplement ofthe unionof the
obstalesinthe plane. LetV beapoint inF. Weaim at
maintainingthevisibilitypolygonofV whenV andelements
of O move in the plane. We assume we an ompute in
onstanttimethevisibilitytangentsofanobstale,thatare
dened as the two tangents to the objet passingthrough
the viewpointV. LetT =ft0;t1;:::;t2n
1
gthetuple of
thevisibilitytangents,sortedintheounter-lokwiseorder.
Letu2S 1
beadiretion. WedenotebyV(u)theobstale
seenbyV inthediretionu.V(u)anpossiblybethe\blue
sky"thatwedenote1. Oneimportantobservationisthat
V(u)isonstantbetweentwoonseutivevisibilitytangents.
V(t +
i
) = V(t
i+1
) where t
i
is seen as a diretion pointing
awayfromtheviewpointV.
2.1 Kinetic visibility polygon
Thevisibilitypolygon(VP)hangesonlywhentwovisibility
tangents (VT) ross eah other (but two VTs may ross
eahotherwithoutaetingtheVP).Thus,weanmaintain
theVPbydeteting whentwoonseutiveVTswill ross,
then updating the VP aording to the kindof both VT,
andswappingthetwoVTsinvolvedtokeepthemsortedin
ounter-lokwiseorder.
However, having omputed the VPat a given timeis not
suÆienttomaintainiteÆientlywhenobstalesmove. We
needsome additionaldatathat willhave tobemaintained
also: for eahVT t
i
,wemaintainitshit-item,whihisthe
obstale that is hitbythe VT beyondthe tangeny point
(itanbe1). Infat,wemaintainaweakradialdeompo-
sitionofthesene,whereonlythefarobjethitbyaVTis
reordedandnotthenearobjet.
For eah rossing, the update of the visibility polygon is
doneinonstanttime,by distinguishing8ases. First, we
needtoharaterize theVTs. Halfof themwill beLeft if
(seenfrom V), they pass to the left of the obstale. The
otherhalfwillbeRight visibilitytangents.
We explain the namingof the rossingeventswith anex-
ample. Figure1ashowsan b
LR andan b
LLrossingevents
(fromlefttoright,thegurepresentstheobstalesinvolved
intheevent,justbefore,\during"andaftertherossing).
b
L RmeansthattherstVT(inounter-lokwiseorder)is
aLeft tangent,theonseutiveVT isaRight tangent,and
thehaton b
Lmeansthat,whentherossingours,thetan-
genypoint oftheLeft tangentis fartherfromV thanthe
tangenypointoftheRighttangent. Hene,the8asesare
namedL b
L, b
LL, L b
R , b
LR ,R b
L, b
R L,R b
R, b
R R .
(a) (b)
Figure1: (a)exampleofa b
LRevent(up)anda b
LLevent
(down);(b)allevents
NowweneedtoupdatetheVPandthehit-itemswhenthe
b
L Rrossingours,seeFigure2. TheVTsthat rosseah
otherare onseutive inour tuple of ordered VTs. Let t
be the time at whih the rossing ours. Then at times
t and t +
, noother VT an liebetween the two VTs we
rossestheangularsetionE,orhasnointersetionwithit.
Thisensurestheorretnessoftheupdateproess.
FirstwehekifanobjetCexistsbetweenthetwopointsof
tangenyattimet.Todoso,wejustneedtohekwhether
g.hit-item (thehit-itemof the Right tangent of obstale
G)isthesameasd.hit-itemornot. Ifso,thenCdoesnot
exists,else,Cexists. Notethatfg,dg.hit-itemanbe1.
Thisinformationisenoughtoupdatethehit-items.
SeenfromV,theforemostobstaleamongthoseinthegure
is G.Therefore,if thereisa hange inthevisibility for E,
this hangemakesGvisible. Toknowwhether Gbeomes
thevisibleobjetinE,wesimplyhekwhetherthereexists
another obstaleinfront ofGat timet,byomparing the
obstalevisible inEtoCorS(dependingontheexistene
ofC).
ThealgorithmisdesribedinFigure3.
E E
g C
d G
S
D
Figure2: Updateofa b
LRevent,thearrowspointtothe
hit-itemsin theaseCdoes notexists
Thesevenotherasesare proessedinthevery sameway,
byjusthangingtherolesinFigure3.
g.tangent-item == G;
d.tangent-item == D;
---
if ( G.hit-item == S ) f
// C does not exists
g.hit-item = d.tangent-item;
if ( E.vis-item == S )
E.vis-item = g.tangent-item;
g
else f // C exists, C == g.hit-item
if ( E.vis-item == g.hit-item )
E.vis-item = g.tangent-item;
g
Figure3: Proessing an b
LRevent
We know how to maintain the weak radial deomposition
ofoursene. Withoutmorework, weanomputethevis-
ibility polygon only inlinear time, by looking at the visi-
ble itembetween eahvisibility tangent, and \ merging "
thesameonseutivevalues. ThisisnotveryeÆient,but
weeasily removethis problembyperformingarst\ run-
length-enoding "of the onseutive visible items, and by
maintainingthisenodingeahtimetheVPishangedwhen
2.2 Complexity
Weexpresstheomplexityofthiskinetidatastrutureus-
ing termsproposedby Guibasand Bash[2, 1℄. Our data
strutureisoptimalinsizesineitislinearinthesizeofthe
sene(thesetofallobstales). Itisresponsive,meaningthat
theostofproessingaertiatefailureissmall: onstant-
timeinourase. ThisKDSisloal,meaningthatthenum-
berofertiates thatinvolveasingleobjetissmall; itis
O(1)inourase,withmax. 4ertiates perobstale.
However,itisnotoptimalsinewemayhavetoupdatemany
ertiatesinamovewhilenoneoftheseaetthevisibility
polygon. Imaginelotsofsmalldissvertiallyalignedabove
abigdis,andtheviewpointtraversingtheplanehorizon-
tally under the big dis. Using Guibas and Bash termi-
nology,our KDSisnot eÆient, sinethe totalnumberof
eventsproessedmaybeofahigherorderasthenumberof
hangings in the VP. An optimal algorithm wouldupdate
as many ertiates as there are hanges in the visibility
polygon duringthe animation. Hall-holt andRusinkiewiz
[3,4℄proposesuhanalgorithm,butarelimitedto onvex
smoothobstales. Theydoproessonlyoneertiatefail-
ure for eah hange inthe VP, butthe ost of proessing
oneeventisnotonstantintime. However,theoverallost
ofproessing alleventsforasimplemotion(oftheobserver
only)issigniantlybetterintheir algorithm.
3. SIMPLE POLYGONAL OBSTACLES
We now present an adaptation of the method to simple
polygonalobstales. Asimplepolygonanbeonave,but
noneofitsedgesrossoneanother. Weonsiderthatobsta-
les inthe initial setareingeneral position,meaningthat
nopairofvertiesisalignedwiththeobserverV.
Thebasiideaisthesame. Foreahvertexv,wekeeptrak
oftheraystartingatV andpassingthroughv,whihmakes,
byaslightabuseoflanguage,ournewvisibilitytangent. For
eahvertex(orVT,sinevertiesandVTsareinbijetion)
we also keep trak of its hit-item and of the type of the
vertex. Here,thetypeofaVTisabitmoreomplex: Figure
4 shows how we name the type of a vertex depending on
thepositionofbothitsadjaentedgesrelativelytotheVT
passingthroughit.
Left Right Down Up Convex
Concave
Point of view
Figure 4: Varioustypesofverties
Notethat thehit-item ofavertex vanbeirrelevant (and
even wrong) if the part of its VT beyond v goes through
theinterioroftheadjaent polygonofv. It isyetorretly
updatedwhentheVTgetsanewinfreespae.
The ertiates that must stay true are the same as in
ing event when two onseutive verties (whih are kept
sorted in ounter-lokwise order around the view point)
getalignedwiththeobserverV. InSetion2,bothVTsof
the same obstale ould not ross eahother. This is not
theasehere,sinetwoonseutiveverties(onseutivein
theyliorderandonapolygonboundary)angetaligned
withV.
Thus,wehavetwokindsofupdatewhenaertiatefails.
If the ertiate onerns verties onseutive on the bor-
der of a polygon, thenwe have to update their type, and
possibly their hit-items and the VP;this again, isdone in
onstanttime. Inotherases,theupdateissimilartothose
inSetion2,withsomemoreasesbeausewehavetotake
intoaountothertypesforavertex,namelyUpandDown.
Figure 5 shows howthe type of avertex hanges whenV
rosses the supporting line of one of its adjaent edges.
Edges of a polygon are oriented so that the insideof the
polygon liesto theleftof itsedges. Whentherossingo-
urs, one vertex is nearer to V than the other: it will be
said near, and the other, far; one vertex is following the
otheronthepolygon'sboundary: it will besaidnext, and
theother,prev. ThisistheterminologyusedinFigure5to
deidewhihtransitionweshouldtarget.
if convex
if convex
next prev
Left
Down
Up next prev concave far
convex near concave far convex far concave near Right
convex far concave near convex near
Figure 5: Updating avertex'stype. Fatarrowsrepre-
senttransitionswherehit-itemmustbeupdated
Theomplexityofthestrutureforpolygonalobjetsisthe
sameasforonvexsmoothobjets.
Hall-Holtproposesarenementofthismethod,whihpro-
esses exatly as many eventsas thereare hangesin the
VP.Theostof proessing oneeventis larger, butfor the
samemotionofallitems(obstalesandtheviewpoint),his
algorithmislessostlyintimebeauseofarelaxationonthe
onstraintsonthe shapeofthesenedeomposition. How-
ever,hedesignedhisalgorithmonlyforonvexobstales.
ThealgorithmproposedbyHall-Holtaninfatbeadapted
sideredseparatedoftheothers,sothattheradialsegments
would lie\in" thepolygons aswell, and notonlyinfree
spae.
4. CONCLUSION AND FUTURE WORK
Wehavepresentedasimplekinetidatastruturethatmain-
tains the visibility polygon of a moving point in a planar
seneofmovingobstales(onvex-smoothorsimply-polygonal).
Ahange inthe visibility polygon is proessedinonstant
time. Thesizeofthestrutureisoptimal(linearinthesize
ofthesene).Howeveritproessestoomanyevents:among
alltheeventsproessed,lotsanhavenoeetontheVP.
However the numberof eventsproessed remains optimal
ifthe sene is sparse, beause nearly all obstalesbeome
visible.
Thesealgorithmsouldperhapsbeaeleratedbyrepresent-
ingpolygonswithvariouslevelofdetails(perhapsevenag-
gregating polygons that are losed to eah other and far
away fromthe viewpoint), andusingasuÆienyriteria
to inrement or derement the LOD for some (groups of)
polygons.
Wemayalsowanttodesribea3-dimensionalvisibilitypoly-
hedron, and extendit to the KDS framework. This looks
muhmorediÆultthaninthe2dase.
5. REFERENCES
[1℄ J.Bash.KinetiDataStrutures.PhDthesis,Stanford
University,June1999.
[2℄ J.Bash,L.Guibas,andJ.Hershberger.Data
struturesformobiledata.InPro.8thSymposiumon
DisreteAlgorithms(SODA'97),pages747{756,1997.
[3℄ O.Hall-Holt.Kinetivisiblesetmaintenaneinthe
plane.submittedforpubliation,2001.
[4℄ O.Hall-HoltandS.Rusinkiewiz.Visiblezone
maintenaneforreal-timeolusionulling.submitted
forpubliation,2001.