counting and representing intersections among triangles in r 3
DESCRIPTION
Counting and Representing Intersections Among Triangles in R 3. Esther Ezra and Micha Sharir. The Problem. C. Given a collection of triangles in R 3 Count efficiently their intersections. Represent in a compact form the overall set of intersections, without reporting them explicitly. - PowerPoint PPT PresentationTRANSCRIPT
Counting and Representing Counting and Representing Intersections Among Triangles Intersections Among Triangles
in in RR33
Esther Ezra and Micha SharirEsther Ezra and Micha Sharir
Running time and storage Running time and storage independent of the number of independent of the number of
intersections.intersections.
The ProblemThe Problem
Given a collection of triangles Given a collection of triangles in in RR33
1.1. Count Count efficientlyefficiently their their intersections.intersections.
2.2. Represent in a Represent in a compactcompact form the overall set of form the overall set of intersections, without intersections, without reporting them explicitly.reporting them explicitly.
|A||A||B||B||C| = |C| = (n(n33)) intersectionsintersections
A
B
C
MotivationMotivation1.1. 3-Dimensional slope selection3-Dimensional slope selection
Select the k-th highest vertex in an Select the k-th highest vertex in an arrangement of arrangement of nn triangles in triangles in RR33..(Reduces via parametric search to:(Reduces via parametric search to:How many vertices lie above a given plane?How many vertices lie above a given plane?))
2.2. Draw a random elementDraw a random element out of the entire out of the entire intersection set, without constructing this set intersection set, without constructing this set explicitly.explicitly.(Used in a randomized solution of 1.)(Used in a randomized solution of 1.)
Known results in Known results in RR22
Problem Running time RefProblem Running time RefCounting intersections Counting intersections O*(nO*(n4/34/3)) Agarwal 91 Agarwal 91(segments)(segments)
Counting intersections Counting intersections O*(nO*(n3/23/2)) Agarwal et al. 93 Agarwal et al. 93(circular arcs)(circular arcs)
Use Use O*(nO*(n)) to denote to denote O(nO(n++εε), for any ), for any εε > 0. > 0.
Known results in Known results in RR33
Problem Running time RefProblem Running time Ref
Reporting all Reporting all pairs of pairs of O*(nO*(n4/5 4/5 4/54/5)) de Berg et al. 99 de Berg et al. 99 intersecting triangles intersecting triangles
Counting all intersecting Counting all intersecting O*(nO*(n8/58/5) ) Agarwal et al.Agarwal et al. 0202pairs (convex polyhedrons)pairs (convex polyhedrons)
No previous work regarding counting intersecting No previous work regarding counting intersecting triplestriples among among nn objects in objects in RR33 ! !
Subquadratic Subquadratic when when << n << n3/23/2
Our resultsOur results1.1. Algorithm that Algorithm that
1.1. Counts all intersecting triples in Counts all intersecting triples in O*(nO*(n22)) time. time.2.2. Constructs a compact representation of the Constructs a compact representation of the
set of all intersections using set of all intersections using O*(nO*(n22)) time time and storage.and storage.
2.2. The problem is 3SUM-hard.The problem is 3SUM-hard.
3.3. Extensions: planar simple shaped objects in Extensions: planar simple shaped objects in RR33: : O*(nO*(n22))
Preliminary stagePreliminary stage(Good for small (Good for small ))
Report all Report all pairs of intersecting pairs of intersecting triangles: triangles: O*(nO*(n8/5 8/5 + + )) (using segment (using segment intersection queries in intersection queries in RR33))
Count on each triangle Count on each triangle tt the number of the number of intersections: intersections: O*(O*( n n1/31/3)) (using planar (using planar segment-intersection counting.)segment-intersection counting.)
Overall running time: Overall running time: O*(nO*(n8/5 8/5 ++ n n1/31/3))
subquadratic when subquadratic when << n << n5/35/3
Ingredients of the algorithm:Ingredients of the algorithm:Curve-sensitive cuttingCurve-sensitive cutting
Input:Input: T = {tT = {t11, …, t, …, tnn}}
For any For any rrnn, there exists a , there exists a (1/r)-cutting(1/r)-cutting ΞΞ for for TT of size of size O*(rO*(r33)), , s.t. the number of s.t. the number of crossingscrossings between the between the edgesedges of the of the triangles in triangles in TT and the and the cellscells of of ΞΞ isis O*(nr) O*(nr) . .
Use Dobkin-Kirkpatrick hierarchical decompositionUse Dobkin-Kirkpatrick hierarchical decomposition(Cannot be extended to other objects in (Cannot be extended to other objects in RR3)3)
In general, use a In general, use a “curve-sensitive” cutting“curve-sensitive” cutting [Koltun-Sharir 03][Koltun-Sharir 03]
O(nrO(nr22)) in a in a standard cutting.standard cutting.
The recursive decompositionThe recursive decompositionConstruct a “curve-sensitive” (1/r)-cutting Construct a “curve-sensitive” (1/r)-cutting ΞΞ , and , and
count the intersecting triples in each cell of count the intersecting triples in each cell of ΞΞ separately.separately.
Definition:Definition:
ΔΔ ΞΞ
t t T T
t is t is longlong in in ΔΔ
ΔΔ ΞΞ
t t TT
t is t is shortshort in in ΔΔ
Classification of intersecting Classification of intersecting triplestriples
1.1. LLLLLL: All three triangles are long in : All three triangles are long in ΔΔ..
2.2. LLSLLS: Two triangles are long, and one is short.: Two triangles are long, and one is short.
3.3. LSSLSS: One triangle is long, and two are short.: One triangle is long, and two are short.
4.4. SSSSSS: All three triangles are short in : All three triangles are short in ΔΔ..
General ideaGeneral ideaUse recursion:Use recursion:
1.1. Compute Compute LLLLLL before recursing. before recursing.
2.2. Compute Compute LLSLLS, , LSSLSS, , SSSSSS at the bottom of at the bottom of recursion.recursion.
3.3. Use the curve-sensitivity of the cutting to Use the curve-sensitivity of the cutting to control the overall performance.control the overall performance.
Counting intersections of type Counting intersections of type LLL (Agarwal-91)LLL (Agarwal-91)
tt
ql1
pl1
l1
ll22 pl2 ql2
Count all intersecting pairs on each clipped triangle Count all intersecting pairs on each clipped triangle tt (within (within ΔΔ ) in ) in O(NO(NLLlog Nlog NLL) ) time.time.
Number of clipped long Number of clipped long triangles in triangles in ΔΔ ..
qql1l1
ppl1l1
ppl2l2 qql2l2InterleavingInterleaving
Overall running timeOverall running timeO(NO(NLL
2 2 log Nlog NLL))
Important!Important!Each Each LLLLLL intersection has to be counted only intersection has to be counted only onceonce.. Count only intersections that involve at least one Count only intersections that involve at least one newnew
long triangle.long triangle.
The running time becomes: The running time becomes:
O(NO(Nss (N(Nss+N+NLL)) log (Nlog (Nss+N+NLL)) ))
A triangle that is short in the A triangle that is short in the parent cell of parent cell of ΔΔ, but long in , but long in ΔΔ . .
Counting intersections of type Counting intersections of type LLSLLS
Use a similar algorithm as in the Use a similar algorithm as in the LLLLLL case. case.
Count all intersecting pairs on each clipped Count all intersecting pairs on each clipped shortshort triangle triangle tt (within (within ΔΔ ) in ) in O(NO(NLLlog Nlog NLL) ) time.time.
Overall running time: Overall running time: O(NO(NSSNNLL log N log NLL))
Number of clipped Number of clipped short triangles in short triangles in ΔΔ ..
Counting intersections of type Counting intersections of type LSS and SSS (Agarwal-91)LSS and SSS (Agarwal-91)
LSSLSS: On each short clipped triangles : On each short clipped triangles tt, count intersecting pairs of long-, count intersecting pairs of long-short segments.short segments.
Passing to the dual plane: Passing to the dual plane: O(NO(NSS
22 + N + NLL log N log NLL).).
Overall: Overall: O(NO(NSS33 + N + NSSNNLL log N log NLL).).
SSSSSS: Brute-force algorithm: : Brute-force algorithm: O(NO(NSS
33))..Overall running time:Overall running time:
O(NO(NSS33 + N + NSS N NLL log N log NLL))..
tt
The overall recursive algorithmThe overall recursive algorithm1.1. Initially Initially 00 = R = R33 :: N NLL=0, N=0, NSS=n=n..
2.2. If If NNSS N NLL½½ (Bottom of recursion)(Bottom of recursion)
Count all Count all LLSLLS, , LSSLSS and and SSSSSS..
3.3. Otherwise, partition Otherwise, partition 00 into smaller into smaller subcellssubcells , using (1/r)-sensitive cutting., using (1/r)-sensitive cutting.
4.4. Count all new Count all new LLLLLL intersections within intersections within each subcell each subcell ofof 00 ..
These intersections These intersections are counted only are counted only once.once.
The overall recursive algorithmThe overall recursive algorithm5.5. Continue to solve each subproblem Continue to solve each subproblem
in in recursively - with some care. recursively - with some care.
Problem:Problem:There are There are O*(rO*(r33)) new subproblems, each containing new subproblems, each containing
NNLL / r / r long triangles and long triangles and NNSS / r / r short ones.short ones.
With no extra care, the running time may With no extra care, the running time may become cubic!become cubic!
The goal of the The goal of the recursion is only to recursion is only to
count efficiently LSS count efficiently LSS and SSSand SSS
Recursion – extra careRecursion – extra care
BUTBUT there are there are O*(N O*(NS S r) r) crossingscrossings in total.in total.
The number of short triangles in most of the The number of short triangles in most of the cells in cells in ΞΞ isis O*(O*(NNSS / r / r22)) . .
There are only There are only o(ro(r33)) cells that are crossed cells that are crossed by by >> N>> NSS / r / r2 2 short triangles.short triangles.
Overall running timeOverall running timeO*(NO*(NSS (N (NSS+N+NLL)) )) ..
Initially,Initially, N NS S = n, N= n, NLL = 0 = 0 ,,
The number of intersecting triples in The number of intersecting triples in TT can be can be counted in time counted in time
min{O*(nmin{O*(n22) , O*(n) , O*(n8/5 8/5 ++ n n1/31/3)) } } ..The The
preliminary preliminary stagestage
The overall The overall recursive recursive algorithmalgorithm
Compact representationCompact representationT = {tT = {t11, …, t, …, tnn} . } . All intersecting triples amongAll intersecting triples among T T can be can be
represented byrepresented by aa 3-uniform hypergraph 3-uniform hypergraph H = (T,E) H = (T,E) ,, E = { {tE = { {tii, t, tjj, t, tkk} | t} | tii, t, t jj, t, tk k T , t T , tii,, t tjj, , t tk k } }
A compact representation forA compact representation for H H is a collectionis a collection = {H= {Hii = (V = (Vii,E,Eii)})}I I of subhypergraphs ofof subhypergraphs of H H,, s.t., s.t.,
1.1. VVii= A= AiiBBiiCCii , , EEii = A = AiiBBiiCCii ((HHii is a complete tripartite 3-uniform hypergraph.)is a complete tripartite 3-uniform hypergraph.)
2.2. E = E = ii E Eii . .3.3. EEi i E Ejj = = , for, for i ij j ..
i i |A|Aii|+|B|+|Bii|+|C|+|Cii|| is the overall storage of this representation.is the overall storage of this representation.
The edges are The edges are now defined now defined
implicitly.implicitly.
Compact representation: Compact representation: ExampleExample
A
B
CH = (AH = (ABBC, AC, ABBC)C)
|A|+|B|+|C| is the overall |A|+|B|+|C| is the overall storage of this representation.storage of this representation.
AlgorithmAlgorithmUse a Use a similar recursive mechanismsimilar recursive mechanism as in the as in the
counting problem. counting problem.
Modify the four simple subroutines (for the planar Modify the four simple subroutines (for the planar case), so they construct a compact case), so they construct a compact representation in similar running times.representation in similar running times.
Modify the preliminary stage, so that it produces Modify the preliminary stage, so that it produces the compact representation.the compact representation. Uses the four Uses the four
modified modified subroutinessubroutines
Compact representation Compact representation subroutinessubroutines
Overall size (and running time)Overall size (and running time)
LLLLLL: : O(NO(Nss (N(Nss+N+NLL)) loglog22(N(Nss+N+NLL)) ))
LLSLLS: : O(NO(Nss NNLL
loglog2 2 NNLL ))
LSSLSS: : O*(NO*(Nss33 + + NNssNNLL))
SSSSSS: : O(NO(Nss33))
Overall storage and running timeOverall storage and running time
Recursive algorithm:Recursive algorithm: O*(N O*(NSS (N (NSS+N+NLL)) ) ) ..
Initially,Initially, N NS S = n, N= n, NLL = 0 = 0 ,,
The overall size of the compact representation:The overall size of the compact representation:min{O*(nmin{O*(n22) , O*() , O*( n n1/31/3)) } .} .
Running time:Running time: min{O*(nmin{O*(n22) , O*(n) , O*(n8/5 8/5 + + n n1/31/3)) } .} .
Counting all intersecting triples is a Counting all intersecting triples is a 3SUM-hard problem3SUM-hard problem
3SUM:3SUM: Given 3 sets of integers Given 3 sets of integers AA, , BB, and , and CC, of total size , of total size nn, , are there are there a a A A, , b b B B, and , and c c C C with with a+b=ca+b=c ? ?
hhcc: z = c: z = c
hhaa: x = a: x = a
hhbb: y = b: y = b
H: z=x+yH: z=x+y
(a,b,c)(a,b,c)HH iff number of iff number of intersections above/belowintersections above/below
H < |A||B||C|H < |A||B||C|
Extensions: Extensions: Planar simply shaped objectsPlanar simply shaped objects
S = {sS = {s11, …, s, …, snn} .} .
s s S S is bounded by a closed curve of is bounded by a closed curve of constant description complexityconstant description complexity..
Algorithm:Algorithm: Use a Use a similar recursive mechanismsimilar recursive mechanism as in the case of as in the case of triangles. triangles.
Modify the four simple subroutines (in the triangle case), Modify the four simple subroutines (in the triangle case), so they count all intersecting triples in similar running so they count all intersecting triples in similar running times.times.
Use Use curve-sensitive curve-sensitive cutting for cutting for SS..
Further researchFurther researchExtend the problem to non-planar (simple) surfaces Extend the problem to non-planar (simple) surfaces
in in RR33..
Higher dimensions:Higher dimensions:Count intersecting k-tuples (Count intersecting k-tuples (2 2 k < d k < d) among ) among nn simplices in simplices in RRdd. ( . ( k=d : O*(nk=d : O*(nd-1d-1). ). Optimal?Optimal? ). ).
Problem: Problem: Endpoints do Endpoints do
NOT interleaveNOT interleave
LLLLLL
Representing LLL (LLS) intersectionsRepresenting LLL (LLS) intersections
Represent compactly all pairsRepresent compactly all pairs {t {tii, t, tjj}},, i ijj, that satisfy, that satisfy ppi i << ppjj < < qqii < < qqjj
tt
pi
qi
li
lljj qj pj
Query with Query with ppjj
v
ppjj qqjj
TT22(v)(v) TT11
The first level structure The first level structure TT11 stores all points stores all points ppii in in
sorted order.sorted order.
TT22(v)(v) stores all the points stores all the points qqii whose matching points whose matching points are stored atare stored at v v..
Use a 2-level tree-like Use a 2-level tree-like structure.structure.
Overall size of Overall size of the output the output graphs:graphs:
O(NO(NSSNNLL log log22NNLL) )
Representing LSS intersectionsRepresenting LSS intersections
IdeaIdea: Construct a (1/r)-cutting : Construct a (1/r)-cutting for for SStt* * and locate the points of and locate the points of LLtt* * in in the cells ofthe cells of . .
Overall size of the representation of all LSS intersections:Overall size of the representation of all LSS intersections:O(NO(NSS
3+ 3+ δδ + N + NSSNNLL1+1+δδ) ) , for any, for any δδ > 0 > 0 . .
t
The set of the The set of the double-wedges double-wedges (dual to short (dual to short segments within segments within tt).).
The set of the points (dual to The set of the points (dual to long segments within long segments within tt).).
Counting all intersecting triples is a Counting all intersecting triples is a 3SUM-hard problem3SUM-hard problem
3SUM’:3SUM’: Given 3 sets of integers Given 3 sets of integers AA, , BB, and , and CC, of total size , of total size nn, , are there are there a a A A, , b b B B, and , and c c C C with with a+b=ca+b=c ? ?
hhcc: z = c: z = c
hhaa: x = a: x = a
hhbb: y = b: y = b
x+y-1/2 x+y-1/2 z z x+y+1/2x+y+1/2
H: z=x+yH: z=x+y