HAL Id: inria-00000569
https://hal.inria.fr/inria-00000569
Submitted on 3 Nov 2005
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.
Maintaining Visibility Information of Planar Point Sets with a Moving Viewpoint
Olivier Devillers, Vida Dujmovic, Hazel Everett, Samuel Hornus, Steve Wismath, Sue Whitesides
To cite this version:
Olivier Devillers, Vida Dujmovic, Hazel Everett, Samuel Hornus, Steve Wismath, et al.. Maintaining
Visibility Information of Planar Point Sets with a Moving Viewpoint. 17th Canadian Conference on
Computational Geometry - CCCG’2005, Aug 2005, Windsor, Canada. �inria-00000569�
Viewpoint
OlivierDevillers
VidaDujmovi y
HazelEverett z
SamuelHornus x
SueWhitesides {
SteveWismath k
Abstrat
Given a set of n points in the plane, we onsider the
problemofomputingtheirularorderingofthepoints
aboutaviewpointqandeÆientlymaintainingthisor-
deringinformationasqmoves.
1 Introdution
Let P = fp
0
;p
1
;:::;p
n 1
g be a set of points in the
plane. Apointpisvisiblefromaviewpointqiftheline
segmentpqontainsnootherpointofP. Ifpoinides
withqthenpisnotvisible. TheviewofP fromaview-
pointqisthelokwiseirularorderingofallpointsin
P that arevisiblefrom q. Given P, theviewfromq is
easilyomputedinO(nlogn)time.
In this paper we are interested in maintaining the
viewwhenqmoves. Morepreisely,wewouldliketoan-
swerthefollowingmoving viewpoint querieseÆiently:
Given a trajetory , report, as q movesalong , all
of the dierent views in the order that they are seen
by q. We assume that is given on-line. We don't
knowaheadoftimetheentiretrajetory;wewouldlike
to ompute the new views as the trajetory beomes
knowntous. Forsimpliity,hereweassumethetraje-
tory isasinglesegment, that doesnotpass through
any points of P, and we assumeno three points of P
areollinear.
This problem is motivated by the graphis problem
of maintaining the view during an interative walk-
throughofa3Dsene. HerewegiveaneÆientsolution
fora2Dseneonsistingofpoints.
Ourmainresultis:
Theorem1 LetPbeasetofnpointsintheplane. Af-
terO(nlogn)preproessingtimeandusingO(n)spae,
moving viewpoint queries along a speied line seg-
ment anbe answered inO(klogn+s)amortizedor
O(klog 2
n+s) worst-asetime where k is the number
INRIASophia-Antipolis,Olivier.Devillerssophia .in ria. fr
y
CarletonUniversity,vidass.arleton.a
z
LORIAUniversityNany2,everettloria.fr
x
INRIARh^one-Alpes,Samuel.Hornusinria.fr
{
MGillUniversity,sues.mgill.a
k
UniversityofLethbridge,wismaths.uleth.a
of dierent views seen from and s is the size of the
output.
Notiethat, ifeah timetheviewhangestheentire
view is output, then s = (kn); if the output is re-
strited to the twopointsthat must be swapped then
s=(k).
Similarproblemshavebeenonsideredinbothon-line
and o-line mode forobjetsother thanpoints. Ghali
and Stewart [3, 4℄ developed an on-line algorithm for
maintainingtheviewof aset oflinesegments. Pohi-
ola[7℄presentedasolutiontotheo-lineversionofthe
problem for a set of n objets. Roughly speaking, if
these tworesults aresaled down to npoints thenthe
spaerequirementsareO(n 2
)sinetheyonentrateon
ases with many olusions among the given objets.
ThealgorithmofGhaliandStewart[3℄ishoweversim-
ilarto oursandthey haveimplementedthe algorithm.
See[5℄foranoverviewofotherrelatedresults.
2 Preliminaries
Westartwithsomesimplepropertiespertainingtothe
viewofamovingpoint.
Lemma2 Letqandq 0
betwopointssuhthatsegment
qq 0
intersetslineab,a;b2P,andnootherlinethrough
two points of P. If segment qq 0
intersets segment ab
then the view from q is the same as the view from q 0
.
Otherwise the views are the same exept that a and b
areinverted. (Refer toFigure 1.)
The hipped line through two points a and b is the
linedened byaandb minusthe(losed)linesegment
ab. Thepointsaandbarenotonthehippedline. The
followingobservation states that if q movesarossthe
lineabthentheviewhangesifonlyifqdoesnotross
segmentab.
The CL-arrangement indued by a set of points is
onstrutedbydrawingahippedlinethrougheahpair
of points. The ells of this arrangement are verties,
openedgesandopenfaes. SeeFigure2. Thefollowing
lemmafollowsfromLemma 2.
Lemma3 Any two points in the same ell of a CL-
arrangement havethe sameview.
a
b c
d
e
f
q q’
w w’
Figure1: Theviewfromqandq 0
is(a;e;f;b;d;)from
witis(e;f;a;b;d;)andfrom w 0
itis(e;f;b;a;d;).
Figure2: ACL-arrangement
Lemma 3 leads to the following straightforward so-
lution to our problem. In a preproessing step, om-
pute the CL-arrangementof P. There are O(n 4
) ells
in this arrangementwhih an be omputed in O(n 4
)
time[2℄. Preproessthearrangementforpointloation
queries. Toansweramovingviewpointqueryforaseg-
ment =qr, rstomputetheviewfromq bysorting
the points aroundq. Find the ellC ontaining q us-
ing the point loation struture. Shoot a ray from q
along qr to nd the rst intersetion point of qr with
C; sayqr intersets C at q 0
on anedge dened bythe
linethroughd. Computetheviewfromthispointq 0
by
removingallthepointsonline dexeptfor thosevis-
ible to theviewpoint. Compute theviewfrom apoint
in the neighboring ell of C into whih the viewpoint
moves. Repeatthis proess until theviewpoint arrives
Clearlytheproblemwith thisapproahistheO(n 4
)
spae and preproessing time needed to ompute the
CL-arrangement. We show how to redue this signi-
antlyinsetion3.
Another, less naive approah to solve the moving
viewpoint query proeeds as follows: Reall that our
goalis to maintainthe irularly orderedset of points
around q. Theidea is to sort them rst (as a prepro-
ess), then, for eah of the n pairs of irularly on-
seutivepoints, insertaneventin an event-queuethat
tellswhentheswappingof2onseutivepointsshould
happen (if ever). The update is as follows: (A) Pop
an event. (B) Update the irular ordering by swap-
pingtwoonseutiveelements. (C)Insert upto3new
eventsinthequeue,whiledeleting2oldevents. Speial
areisrequiredwhentheviewpointqmovesoutofthe
onvexhull of P, but this does not inreasethe om-
plexity. Overall,foragivenlinesegmenttrajetory,the
omplexity is O(nlogn) preproessing time, and then
O(nlogn+klogn+s) time. The O(nlogn) term is
requiredbeause,asthe newtrajetoryis known, it is
neessarytoemptytheevent-queue,omputetheevent
times for n pairs of points, and insert O(n) events in
thequeue.
In the next setion, we show how to remove this
O(nlogn)term.
3 Proofof Theorem1
Ratherthanomputingtheentirearrangement,wewill
omputetheellsofthearrangementonlywhenweneed
them. SinethesizeofeahellisO(n),itistheability
to perform updates eÆiently without omputing the
entireCL-arrangementthatisritial.
It will be onvenient to rid ourselves of the non-
onvexells of the CL-arrangement whih, as the fol-
lowing lemmaindiates, anbe doneby addingto the
arrangementtheedgesoftheonvexhullofP. Forex-
ampleray shootingis moreeasilyperformedin onvex
regions.
Lemma4 A vertex of a CL-arrangement is reex in
someellifandonly ifitisapointonthe onvexhull.
Proof. Firstnotiethatareexvertexmustbeoneof
thenpoints;indeed, allotherarrangementvertiesare
atintersetionsoflines. Letpbeapointorresponding
toareexvertex. Now,sinepisreexinsomeell,all
ofthen 1raysemanatingfromplieononehalf-plane
dened by a line through p and thus all of the other
n 1other points lie in the other half-plane whih is
exatlytheonditionforptobeontheonvexhull.
In the following, we assume that the algorithm is
operating in theCL-arrangementwhih has been aug-
mentedtoinludetheedgesoftheonvexhullofp.
putingaellgivenaview.
Lemma5 The edges of a fully-dimensional ell C
of the CL-arrangement are determined by onseutive
pointsofthe view fromany pointqin C.
Proof. LetsbeapointonanedgeofCandletaandb
bethepointsgeneratingthelineontainings. Wewill
distinguish theaseswhere s ison ahipped line ora
onvexhulledge.
Case 1: Chipped line.
Without loss of generality, say s is on the ray em-
anating from b. It suÆes to show that a and b are
onseutivepointsoftheviewofq. Supposenot. Then
thereisapointxofP inthewedgeaqb. Werstshow
thatxisnotintriangleaqb. SeeFigure3. Ifitwasthen
therayemanatingfromx indiretionaxintersetsthe
segmentqs,whihis entirelyinside C byonvexity, at
apoint p. Butthen thepointsb, x and aare ordered
around any point on the segment qp in the order bxa
and about any point on segment ps in the order bax
whihontraditsLemma3. Similarly,thereisnopoint
xanywhereelseinthewedgeaqbsinethentherayem-
anating from x in diretion xb intersets the segment
qs. SeeFigure 4.
Case 2: Convexhull edge.
Thensisonthesegmentab. Firstifqisinsidetheon-
vexhulland if aand b arenot onseutivethen there
isapointx inthewedge,andsineabis aonvexhull
edge, x belongs to triangleaqb. A ray from x rosses
segment qs whih should be inside C givinga ontra-
dition;thisrayisissuedeitherfrombasinFigure5or
from a depending on theloation of x with respet to
segmentqs. Ifq isoutsidetheonvexhull,then either
allthepointsareinthewedgeaqb(outsidethetriangle)
and aand b areonseutive,orarayfrom b separates
q andagivingaontradition asin Figure 6(oraray
fromaseparatesqfrom b).
Lemma 5 implies that, in order to ompute a ell
it suÆes to know the view from a point in that ell;
eahpairof onseutivepoints intheirular ordering
ontributesahalf-plane,theintersetionofwhih gives
theell. NowfromLemma 2weknowthattoompute
a ellfrom a neighboring ell, it suÆes to delete two
half-planes andinsert twonew ones. These operations
anbeaomplishedinO(logn)amortizedorO(log 2
n)
worst-asetime[1,6℄.
Thealgorithm,whih impliesTheorem1,isgivenin
Figure 7. Theinput to thealgorithm is apointset P
andaquerysegmentqr. Thealgorithmissimilartothe
less eÆient version suggestedin theprevious setion,
howevernotethatthespaerequirementsareontained
toO(n)asthepointq 0
movesfromqto renountering
theellsoftheCL-arrangementwithoutrstomputing
thearrangement.
q
s
b x
a C p
Figure 3: If point s is on hipped line ab, there is no
pointintriangleaqb.
q
s
b
a
x
C p
Figure 4: If point s is on hipped line ab, there is no
pointinwedgeaqb.
q
s b x
a C
Figure 5: If point sis ononvexhulledge ab,there is
nopointintriangleaqb.
4 Extensions
Thesameapproahworkswhenthetrajetory isnot
alinesegment,theonlydierenebeingintheresulting
omplexity.
Theorem6 Let P be a set of n points in the plane.
After O(nlogn) preproessing time, moving viewpoint
queries along a speied urve an be answered in
O(f(n)+klogn+s)amortizedorO(f(n)+klog 2
n+s)
worst-asetime,wherekisthenumberofdierentviews
seen from,sisthesizeofthe output,andf(n)isthe
q
b x
a C
Figure 6: If point sis ononvexhulledge ab, there is
nopointoutsidewedgeaqb.
Algorithm: Moving Point Query (P, qr)
1. Setq 0
:=q.
2. Construttheviewaroundq. {O(nlogn).
3. ConstruttheellC ontainingq. {O(nlogn).
4. Whileq 0
<rdo
Shootarayfromq 0
inthediretionqrhitting
Cat pointq 00
. {O(logn).
q 0
:=q 00
Updateandoutputtheviewatq 0
. {O(logn).
UpdatetheellC. {O(logn)orO(log 2
n).
Figure7: Thealgorithmandanalysis
timerequiredtoperformray-shootinginaonvexn-gon
along urvesof the sametypeas.
Suppose as q moves from s to t along segment st,
the view at s is known, and that only the view at t
is required, andnot theintermediate views. The view
at t anbeomputed byrunning ouralgorithm and a
sortingalgorithminparallel.Thenthetimetoompute
theviewattisminfO(nlogn);O(mlogn)gwheremis
thenumberofellsthataretraversed.
Finally,ifP isthesetofendpointsofasetofdisjoint
linesegments,thentheatualviewofthesegmentsan
beobtainedeasilyfromtheviewofthepointsinlinear
time,thusmakingouralgorithmusefulintheasewhen
fewsegmentsareoluded.
Distane-sort maintenane. Interestingly, the same
algorithm an be used to maintain the set of points
in P sorted aording to their distane to a mov-
ing query point q. In this ordering, two onseutive
pointsareswappedwhenqrossestheirbisetor. Thus,
the CL-arrangementis replaed by an arrangementof
present only a ritial lemma to support our laim.
b a
c r
V C L
Lemma7 Eahedgeofa
ell in the B-arrangement
is supported by the bi-
setor of two onseutive
points in the distane-
ordering.
Proof. Let line L be the
bisetordened bypointsaandb supportingone edge
ofaellContainingthequerypointv. Assumethat,in
thedistane-ordering,there isapointrbetweenaand
b. Thentheirumirleof a,bandrhasenter ,the
pointof intersetionof the3bisetorsdened by(a,b)
(b,r)and(r,a). Wehavevb<vr<va. Thereforevlies
in the yellow shaded region. Hene the line L annot
supportanedgeofC,whih isaontradition.
Byredeningtheviewpointqueryoftheorem1toreport
hanges in the distane-ordering, we obtain the same
omplexityresult.
5 Conlusion
Wepresentheretherst solutionto the movingview-
pointqueryproblemamongpointsin2Dwithprovable
worst-aseandamortizedomplexity. Solvingtheprob-
lemin 3DremainsadiÆultopenproblem.
Referenes
[1℄ G.BrodalandR.Jaob, Dynamiplanaronvexhull,
Pro.43rdAnnualSymposiumonFoundationsofCom-
puterSiene,2002,617-626.
[2℄ H.EdelsbrunnerandL.Guibas.TopologiallySweeping
anarrangement, J.of Computer andSystem Sienes
38,165-194,1989
[3℄ S. Ghali and J. Stewart. Inremental Update of the
VisibilityMapasSeenbyaMovingViewpointinTwo
Dimensions, Eurographis7thWorkshopon Computer
AnimationandSimulation,1996.
[4℄ S. Ghali and J. Stewart. Maintenane of the Set of
SegmentsVisiblefromaMovingViewpointinTwoDi-
mensions,Pro.ofACMSymposiumonComputational
Geometry,V3{V4,May1996.
[5℄ O. Hall-Holt. Kineti Visibility. PhD Dissertation,
StanfordUniversity,2002.
[6℄ M.OvermarsandJ.vanLeeuwen.Maintenaneofon-
gurationsintheplane. J.Comput.Syst.Si.,23:166-
204,1981.
[7℄ M.Pohiola.GraphisinFlatlandrevisited.Pro.2nd
Sand. Workshop Algorithm Theory, LNCS Vol 447,
Springer-Verlag85{96,1990.