3D Delaunay Triangula.on Libin Lu, Weijing Liu, Zhuoheng Yang - - PowerPoint PPT Presentation

3d delaunay triangula on
SMART_READER_LITE
LIVE PREVIEW

3D Delaunay Triangula.on Libin Lu, Weijing Liu, Zhuoheng Yang - - PowerPoint PPT Presentation

3D Delaunay Triangula.on Libin Lu, Weijing Liu, Zhuoheng Yang Delaunay Triangula.on In 2-D, a Delaunay triangula.on for a set P of points in a


slide-1
SLIDE 1

3D ¡Delaunay ¡Triangula.on

Libin ¡Lu, ¡Weijing ¡Liu, ¡Zhuoheng ¡Yang

slide-2
SLIDE 2

Delaunay ¡Triangula.on

In ¡2-­‑D, ¡a ¡Delaunay ¡triangula.on ¡for ¡a ¡set ¡P ¡of ¡points ¡in ¡a ¡plane ¡is ¡a ¡triangula.on ¡ DT(P) ¡such ¡that ¡no ¡point ¡in ¡P ¡is ¡inside ¡the ¡circumcircle ¡of ¡any ¡triangle ¡in ¡DT(P).[1] ¡

¡

In ¡3-­‑D, ¡a ¡Delaunay ¡triangula.on ¡for ¡a ¡set ¡P ¡of ¡points ¡in ¡space ¡is ¡a ¡triangula.on ¡ DT(P) ¡such ¡that ¡no ¡point ¡in ¡P ¡is ¡inside ¡the ¡circumsphere ¡of ¡any ¡tetrahedron ¡in ¡ DT(P). [1] ¡hIp://en.wikipedia.org/wiki/Delaunay_triangula.on

slide-3
SLIDE 3

Bowyer–Watson ¡Algorithm

The ¡Bowyer–Watson ¡algorithm ¡is ¡an ¡incremental ¡algorithm. ¡It ¡works ¡by ¡ adding ¡points, ¡one ¡at ¡a ¡.me, ¡to ¡a ¡valid ¡Delaunay ¡triangula.on ¡of ¡a ¡subset ¡of ¡ the ¡desired ¡points. ¡ASer ¡every ¡inser.on, ¡any ¡triangles ¡whose ¡circumcircles ¡ contain ¡the ¡new ¡point ¡are ¡deleted, ¡leaving ¡a ¡star-­‑shaped ¡polygonal ¡hole ¡which ¡ is ¡then ¡re-­‑triangulated ¡using ¡the ¡new ¡point. ¡[2] [2] ¡hIp://en.wikipedia.org/wiki/Bowyer%E2%80%93Watson_algorithm

slide-4
SLIDE 4

Bowyer–Watson ¡Algorithm

The ¡Bowyer–Watson ¡algorithm ¡is ¡an ¡incremental ¡algorithm. ¡It ¡works ¡by ¡ adding ¡points, ¡one ¡at ¡a ¡.me, ¡to ¡a ¡valid ¡Delaunay ¡triangula.on ¡of ¡a ¡subset ¡of ¡ the ¡desired ¡points. ¡ASer ¡every ¡inser.on, ¡any ¡triangles ¡whose ¡circumcircles ¡ contain ¡the ¡new ¡point ¡are ¡deleted, ¡leaving ¡a ¡star-­‑shaped ¡polygonal ¡hole ¡which ¡ is ¡then ¡re-­‑triangulated ¡using ¡the ¡new ¡point. ¡[2] [2] ¡hIp://en.wikipedia.org/wiki/Bowyer%E2%80%93Watson_algorithm

slide-5
SLIDE 5

Bowyer–Watson ¡Algorithm

The ¡Bowyer–Watson ¡algorithm ¡is ¡an ¡incremental ¡algorithm. ¡It ¡works ¡by ¡ adding ¡points, ¡one ¡at ¡a ¡.me, ¡to ¡a ¡valid ¡Delaunay ¡triangula.on ¡of ¡a ¡subset ¡of ¡ the ¡desired ¡points. ¡ASer ¡every ¡inser.on, ¡any ¡triangles ¡whose ¡circumcircles ¡ contain ¡the ¡new ¡point ¡are ¡deleted, ¡leaving ¡a ¡star-­‑shaped ¡polygonal ¡hole ¡which ¡ is ¡then ¡re-­‑triangulated ¡using ¡the ¡new ¡point. ¡[2] [2] ¡hIp://en.wikipedia.org/wiki/Bowyer%E2%80%93Watson_algorithm

slide-6
SLIDE 6

Bowyer–Watson ¡Algorithm

The ¡Bowyer–Watson ¡algorithm ¡is ¡an ¡incremental ¡algorithm. ¡It ¡works ¡by ¡ adding ¡points, ¡one ¡at ¡a ¡.me, ¡to ¡a ¡valid ¡Delaunay ¡triangula.on ¡of ¡a ¡subset ¡of ¡ the ¡desired ¡points. ¡ASer ¡every ¡inser.on, ¡any ¡triangles ¡whose ¡circumcircles ¡ contain ¡the ¡new ¡point ¡are ¡deleted, ¡leaving ¡a ¡star-­‑shaped ¡polygonal ¡hole ¡which ¡ is ¡then ¡re-­‑triangulated ¡using ¡the ¡new ¡point. ¡[2] [2] ¡hIp://en.wikipedia.org/wiki/Bowyer%E2%80%93Watson_algorithm

slide-7
SLIDE 7

Bowyer–Watson ¡Algorithm

The ¡Bowyer–Watson ¡algorithm ¡is ¡an ¡incremental ¡algorithm. ¡It ¡works ¡by ¡ adding ¡points, ¡one ¡at ¡a ¡.me, ¡to ¡a ¡valid ¡Delaunay ¡triangula.on ¡of ¡a ¡subset ¡of ¡ the ¡desired ¡points. ¡ASer ¡every ¡inser.on, ¡any ¡triangles ¡whose ¡circumcircles ¡ contain ¡the ¡new ¡point ¡are ¡deleted, ¡leaving ¡a ¡star-­‑shaped ¡polygonal ¡hole ¡which ¡ is ¡then ¡re-­‑triangulated ¡using ¡the ¡new ¡point. ¡[2] [2] ¡hIp://en.wikipedia.org/wiki/Bowyer%E2%80%93Watson_algorithm

slide-8
SLIDE 8

Parallelism

  • 1. Each ¡task ¡represents ¡a ¡triangle ¡in ¡plane ¡containing ¡some ¡points. ¡
  • 2. Each ¡thread ¡tries ¡to ¡get ¡a ¡task ¡and ¡insert ¡points, ¡triangles ¡far ¡from ¡each ¡
  • ther ¡can ¡perform ¡inser.on ¡at ¡the ¡same ¡.me. ¡ ¡
slide-9
SLIDE 9

Task ¡inser.on ¡kernel

Lock ¡the ¡vertex ¡of ¡task ¡triangle.

slide-10
SLIDE 10

Task ¡inser.on ¡kernel

Lock ¡more ¡points, ¡all ¡the ¡vertex ¡of ¡the ¡triangles ¡whose ¡circumcircle ¡contain ¡ the ¡point ¡to ¡insert.

slide-11
SLIDE 11

Task ¡inser.on ¡kernel

Manipulate ¡them, ¡create ¡new ¡triangles

slide-12
SLIDE 12

Task ¡inser.on ¡kernel

Sort ¡remaining ¡points ¡into ¡new ¡triangles, ¡put ¡them ¡into ¡task ¡queue, ¡release ¡ the ¡locks.

slide-13
SLIDE 13

Prevent ¡Deadlocks

Dead ¡lock? ¡ ¡ ¡ ¡-­‑ ¡If ¡lock ¡fail, ¡try ¡again ¡later! ¡ ¡ ¡ ¡-­‑ ¡Why ¡not ¡lock ¡vertex ¡in ¡indexing ¡order? ¡

slide-14
SLIDE 14

Using ¡TBB

Tree ¡style ¡rela.ons ¡between ¡tasks ¡ ¡ ¡ ¡-­‑ ¡Not ¡really ¡

slide-15
SLIDE 15

Using ¡TBB

Tree ¡style ¡rela.ons ¡between ¡tasks ¡ ¡ ¡ ¡-­‑ ¡Not ¡really ¡ Use ¡customized ¡task ¡queue, ¡draw ¡task ¡randomly ¡ from ¡queue. ¡

slide-16
SLIDE 16

Customized ¡Task ¡Queue

Producer-­‑consumer ¡problem

Producer ¡ Consumer ¡

slide-17
SLIDE 17

Customized ¡Task ¡Queue

Fetch ¡a ¡task ¡randomly

Producer ¡ Consumer ¡ Consumer ¡

slide-18
SLIDE 18

Customized ¡Task ¡Queue

Too ¡many ¡conflicts ¡if ¡tasks ¡are ¡highly ¡related. ¡ Starva&on!

Consumer ¡

Try ¡lock ¡fail! ¡

Consumer ¡

Try ¡lock ¡fail! ¡

slide-19
SLIDE 19

Customized ¡Task ¡Queue

Only ¡allow ¡one ¡consumer ¡if ¡there ¡are ¡too ¡few ¡tasks.

Consumer ¡

Locked! ¡J ¡

Consumer ¡

Try ¡lock ¡fail! ¡

slide-20
SLIDE 20

Memory ¡Locality ¡

Goal: ¡ Data ¡associated ¡with ¡an ¡inser.on ¡task ¡should ¡ shares ¡a ¡small ¡number ¡of ¡cache ¡lines, ¡which ¡ improves ¡data ¡locality. ¡ Ideas: ¡

  • 1. Ver.ces ¡that ¡are ¡spa.ally ¡related ¡should ¡also ¡

stay ¡close ¡in ¡memory.(done) ¡

  • 2. Maybe ¡compress ¡data(not ¡yet) ¡
slide-21
SLIDE 21

Spa.al ¡Sort ¡

Algorithm: ¡X-­‑Y-­‑Z ¡Cuts ¡

  • 1. ¡Find ¡which ¡of ¡the ¡x,y,z ¡axes ¡has ¡the ¡greatest ¡
  • diameter. ¡
  • 2. ¡Find ¡the ¡approximate ¡median(M) ¡of ¡D. ¡
  • 3. ¡Par..ons ¡the ¡points ¡using ¡M. ¡
  • 4. ¡Recursively ¡apply ¡X-­‑Y-­‑Z ¡Cuts ¡to ¡one ¡side ¡of ¡

the ¡points ¡first, ¡then ¡the ¡other. ¡

  • (Sounds ¡like ¡Quicksort). ¡
slide-22
SLIDE 22

Spa.al ¡Sort ¡

Algorithm: ¡X-­‑Y-­‑Z ¡Cuts ¡(Example ¡in ¡2D) ¡ ¡

slide-23
SLIDE 23

Spa.al ¡Sort ¡

X-­‑Y-­‑Z ¡Cuts ¡(Before ¡sor&ng) ¡ ¡Red:points[0-­‑9] ¡

Blue:points[10-­‑19] ¡ Green:points[20-­‑29] ¡

slide-24
SLIDE 24

Spa.al ¡Sort ¡

X-­‑Y-­‑Z ¡Cuts ¡(AEer ¡sor&ng) ¡ ¡Red:points[0-­‑9] ¡

Blue:points[10-­‑19] ¡ Green:points[20-­‑29] ¡

slide-25
SLIDE 25

Spa.al ¡Sort ¡

X-­‑Y-­‑Z ¡Cuts ¡Op&miza&on ¡

  • 1. ¡Inplace ¡sor.ng. ¡(minimize ¡temporary ¡memory ¡

alloca.on) ¡

  • 2. ¡Parallel ¡sor.ng. ¡
  • Key: ¡at ¡step ¡#4. ¡
  • Recursively ¡apply ¡X-­‑Y-­‑Z ¡Cuts ¡to ¡one ¡side ¡of ¡the ¡

points ¡first, ¡then ¡the ¡other. ¡

  • Recursively ¡apply ¡X-­‑Y-­‑Z ¡Cuts ¡to ¡both ¡sides ¡of ¡the ¡

points ¡concurrently. ¡

slide-26
SLIDE 26

Performance ¡With ¡Spa.al ¡Sort ¡

0 ¡ 2000 ¡ 4000 ¡ 6000 ¡ 8000 ¡ 10000 ¡ 1 ¡thread ¡ 2 ¡threads ¡ 3 ¡threads ¡ 4 ¡threads ¡

Points/Sec ¡

Original ¡ Using ¡Spa.al ¡Sort ¡

slide-27
SLIDE 27

Conclusion

Difficult ¡to ¡parallel ¡3D ¡Delaunay ¡triangula.on ¡ ¡-­‑ ¡Because ¡of ¡complicated ¡data ¡dependencies ¡ ¡ More ¡difficult ¡to ¡achieve ¡high ¡efficiency ¡ ¡-­‑ ¡hard ¡to ¡distribute ¡irrela.ve ¡tasks ¡to ¡different ¡threads ¡