# flipflopx

Software and s/w Development

Dec 2, 2013 (4 years and 5 months ago)

178 views

:
Convex Hull construction
via
Star
-
Shaped

Polyhedron in 3D

Mingcen Gao

Thanh
-
Tung Cao

Tiow
-
Seng

Tan

Zhiyong

Huang

Flip
-

Flop

2

Outline

Flips on 3D polyhedron

Flip
-
Flop: a novel flip algorithm

ffHull
: 3D convex hull algorithm

Experiments

Flips on 3D polyhedron

3

1

Convex Hull in 3D

Convex Hull

Fundamental problem in CG

Collision detection

Path planning

CGAL (CPU)

qHull

(CPU)

gHull (GPU) [Gao et al. 2012]

Flips on 3D polyhedron

4

1

Flips ?

Compute CH by flips

non
-
extreme points

reflex edges

3
-
1 Edge

2
-
2 Edge

3
-
1 flip

2
-
2 flip

Flips on 3D polyhedron

5

1

Difficulty 1: Avoiding
self
-
intersection

Avoid self
-
intersection

2D illustration

one flip

Solution:
star
-
shaped polyhedron

Flips on 3D polyhedron

6

1

Star
-
shaped polyhedron

s

2D

3D

In star
-
shaped polyhedron, checking whether a flip creates self
-
intersection is a
local operation
.

Avoid self
-
intersection

Flips on 3D polyhedron

7

1

Difficulty 2: Getting
stuck
by Lawson’s flip algorithm

Break the stuck case

Flipping any reflex edges creates self
-
intersection.

Solution:
Flip
-
Flop
(for star
-
shaped polyhedron)

8

Flips on 3D polyhedron

Flip
-
Flop: a novel flip algorithm

ffHull
: 3D convex hull algorithm

Experiments

Outline

Flip
-
Flop:
a novel flip algorithm

9

2

An example

a

b

e

d

c

p

f

a

b

e

d

c

p

f

a

b

e

d

c

p

f

a

b

e

d

c

p

f

a

b

e

d

c

p

f

non
-
extreme point

Flip
-
Flop:
a novel flip algorithm

10

2

An example

Flips

Volume

Local optimum

Convex hull

Lawson’s flip

Flip
-
Flop

flip

flop

Flip
-
Flop:
a novel flip algorithm

11

2

Concepts

Flip
-
Flop

Increase the volume

Finding non
-
extreme points

Remove non
-
extreme points

Star
-
shaped

Polyhedron

Convex hull

Flip
-
Flop:
a novel flip algorithm

12

2

Finding non
-
extreme points

a

b

c

d

s

b (or a)

lies inside the

tetrahedron
sacd

(or
sbcd
)

ab

is a 2
-
2 edge that is

reflex and unflippable

b (or a)

is non
-
extreme

Flip
-
Flop:
a novel flip algorithm

13

2

Flipping criteria

V
-
Criterion

Increases the
olume of the polyhedron by flipping
reflex edges. (Used in Lawson’s flip algorithm)

D
-
Criterion

Decreases the
egree of the non
-
extreme (NE)
vertices by flipping the edges incident to them

degree(v)=5

degree(v)=4

degree(v)=3

degree(v)=0

For any non
-
extreme point, there is a 2
-
2 flippable edge incident to it!

Flip
-
Flop:
a novel flip algorithm

14

2

Flipping criteria

a

b

c

d

Combination of V
-

and D
-

criterion

Otherwise flip the edge

if it is reflex (V
-
criterion).

If a or b is known non
-
extreme,

flip

the edge (D
-
criterion).

If c or d is known non
-
extreme,

keep

the edge (D
-
criterion).

Use the index of the points to avoid flipping back and forth

Flip
-
Flop:
a novel flip algorithm

15

2

GPU implementation

while it is not
convex hull

1. identify and label the non
-
extreme points.

2. If no edge need be flipped, stop the thread.

Flip the edge if the triangles in the flip is

use atomic minimum operation to label the
triangles in the flip

16

Flips on 3D polyhedron

Flip
-
Flop: a novel flip algorithm

ffHull
: 3D convex hull algorithm

Experiments

Outline

ffHull
:
3D convex hull algorithm

17

3

Algorithm

Point
set

s

s

s

s

Construct
initial tetrahedron
using 4 extreme points,

and use its center as
the kernel

Apply
Flip
-
Flop

Insert the
furthest point
to grow
the polyhedron and keep the
star
-
shaped property
.

ffHull
:
3D convex hull algorithm

18

2

GPU implementation

while it is not
convex hull

If the triangle are associated with some points, insert the furthest one.

Update the associated triangle of the point if needed.

ffHull
:
3D convex hull algorithm

19

3

Extensions

ffRT
: 2D regular triangulation algorithm

Compute many convex hulls concurrently

Point
set

Lift points by
z=x
2
+y
2
-
w

Compute
lower hull

Point
set
1

Point
set
n

Tetrahedron

Apply
ffHull

on all groups

20

Flips on 3D polyhedron

Flip
-
Flop: a novel flip algorithm

ffHull
: 3D convex hull algorithm

Experiments

Outline

Experiments

21

4

Machine:

Intel i7 2600K 3.4GHz CPU

16GB of DDR3 RAM

Nvidia

GTX 580 Fermi graphics with 3GB of video memory

Experiments

22

4

Convex hull

1.4x↑
v.s
. gHull

20x↑

v.s
.
qHull

81x↑

v.s
. CGAL

Cube

2.4x↑
v.s
. gHull

18x↑
v.s
.
qHull

66x↑
v.s
. CGAL

Box (thickness 0.01)

3.2x↑
v.s
. gHull

23x↑
v.s
.
qHull

75x↑

v.s
. CGAL

Sphere (thickness 0.01)

1.3x↑
v.s
. gHull

30x↑

v.s
.
qHull

110x↑

v.s
. CGAL

Experiments

23

4

Convex hull

Thai statue

1.4x↑
v.s
. gHull

5.5x↑

v.s
.
qHull

12x↑

v.s
. CGAL

Lucy

1.1x↑
v.s
. gHull

7.2x↑

v.s
.
qHull

17x↑

v.s
. CGAL

Conclusions

24

5

is provably correct

uses only local operations

works for any star
-
shaped polyhedron

allows any order of flips

Flip
-
Flop

GPU friendly

ffHull

GPU friendly

ffRT

GPU friendly

Thank you!

http://www.comp.nus.edu.sg/~tants/flipflop.html

mingcen@comp.nus.edu.sg

Flips on 3D polyhedron

26

1

Convex Edge

outside

inside

a

b

c

d

< 180
°

Reflex Edge

inside

outside

a

b

c

d

> 180
°

one flip

Compute CH by flips

Flips on 3D polyhedron

27

1

Star
-
shaped polyhedron

The
cone

of
abc

w.r.t
.
s

A polyhedron is
star
-
shaped

w.r.t
.
s

if the cones of all its triangles do
not overlap.

s

Flips on 3D polyhedron

28

1

Star
-
shaped polyhedron

Edge
ab

is
reflex

if
d

and
s

lie on
different sides of
abc
.

Otherwise
ab

it is
convex
.

a

b

c

d

a

b

c

d

s

s

Flips on 3D polyhedron

29

1

Star
-
shaped polyhedron

Edge
ab

is
flippable

w.r.t
.
s

if

1.
Point
s

remains inside after flipping
.

2.
The union of the cones included in the flip is convex.

Flipping a flippable edge results in a star
-
shaped polyhedron
w.r.t
.
s
.

a

b

c

d

s

ab

is unflippable

a

b

c

d

s

ab

is flippable

a

b

c

d

s

(1)

(2)

Flip
-
Flop:
a novel flip algorithm

30

2

Algorithm

Initial
polyhedron

Queue of
edges

all edges

Outdated?

pop
ab

c
,
d
}

yes

Flippable?

no

yes

no

Apply

V
-
criterion

Flip
-
Flop

x

{
a
,
b
,
c
,
d
} is the NE point

with the minimum index

Reflex?

Label

NE point

yes

x

exists?

Apply

D
-
criterion

no

yes

Push edges

no

Flip
-
Flop:
a novel flip algorithm

31

2

Correctness

2
-
2 reflex and unflippable edge

a non
-
extreme point

v is non
-
extreme

v is
locally covered

v is non
-
extreme with degree > 3

an incident edge is 2
-
2 flippable

v is non
-
extreme with degree 3

3
-
1 flippable edge

correctness of Flip
-
Flop

3
-
1 reflex edge

flippable

Flip
-
Flop:
a novel flip algorithm

32

2

Correctness

3
-
1 reflex edge

flippable

Edge
ab

is a 3
-
1 edge that is reflex, then the polyhedron
is star
-
shaped
w.r.t
.
s

after flipping
ab.

a

d

s

b

c

Flip
-
Flop:
a novel flip algorithm

33

2

Correctness

2
-
2 reflex and
unflippable

edge

a non
-
extreme point

a

b

c

d

s

b (or a)

lies inside the

tetrahedron
sacd

(or
sbcd
)

ab

is a 2
-
2 edge that is

reflex and unflippable

b (or a)

is non
-
extreme

Flip
-
Flop:
a novel flip algorithm

34

2

Correctness

v

is
locally covered
by
b
,
e

and
f

since
it lies inside the cone of
sb
,
se

and
sf
.

v

is not
locally covered
.

C
s
(

a

c潶敲

Flip
-
Flop:
a novel flip algorithm

35

2

Correctness

v is non
-
extreme

v is
locally covered

Assume
v

is not locally covered

t
1

and
t
2

are two triangles on
C

intersecting with
vs.

(
t
1

is nearer to
s

and
v

than
t
2
)

H

passes
s

and is parallel
t
1
.

R
T

is the half
-
space by
H

containing
C

v

and
s

must lie on the same side of
C

by assumption

Construct convex hull
C

v.

Any vertex
p

other than
v

must lie
inside
R
T
, otherwise the polyhedron
is not star
-
shaped

v

is an extreme point,

Flip
-
Flop:
a novel flip algorithm

36

2

Correctness

v is non
-
extreme with degree 3

3
-
1 flippable edge

Assume
va

is unflippable

s

is inside the tetrahedron
vabc

v

is not locally covered

v

is an extreme point,

Flip
-
Flop:
a novel flip algorithm

37

2

Correctness

v is non
-
extreme with degree > 3

an incident edge is 2
-
2 flippable

v

Let
C
s
(

abc
)
be a cover of
v

such
that
a
,
b

and
c

v

p

is inside
C
s
(

abc
)
, use
p

to replace one of

{
a
,

b
,

c
} and get a smaller cover

Any vertex
q

other than
v

must lie
outside
C
s
(

abc
)
, otherwise the
polyhedron is not star
-
shaped

Flip
-
Flop:
a novel flip algorithm

38

2

Correctness

v is non
-
extreme with degree > 3

an incident edge is 2
-
2 flippable

-
2 flippable edge incident to
v

a
,
b

and
c

v

into three

chains of vertices:
L
ab
,
L
bc

and
L
ca
.

W.l.o.g
. let
L
ab

be (
a,p1,p2
,…,
pn,b
),
n
>1.

Let
D
sva

be the half
-
plane through
v
,
s
,
a

defined by line
vs
, similar for
D
svc

and
D
svb
.

Let
R
ab

be the region bounded by
D
sva

and

D
svb

and containing the edge
ab
.

Goal: there exists a vertex
p
m

in
L
ab

so that
so that edge
vp
m

is 2
-
2 flippable

Flip
-
Flop:
a novel flip algorithm

39

2

Correctness

v is non
-
extreme with degree > 3

an incident edge is 2
-
2 flippable

-
2 flippable edge incident to
v

L
ab

cannot intersect with
D
sva
,
D
svb

and
D
svc

for the star
-
shaped polyhedron.

L
ab

lies totally
inside
R
ab

L
ab

lies outside
C
s
(

abc
)

In the convex hull of {
sv
,
sa
,
sp
1
, …
sp
n
,
s
b
},
there must be a vertex
p
m

on its boundary.

Edge

vp
m

is 2
-
2 flippable

ffHull
:
3D convex hull algorithm

40

3

Implementation tips

Maintain the orientation of each triangle so that the kernel point
s

is always
beneath it.

Use orientation determinants when finding the furthest point.

Adapt the exact 3D orientation predicate [
Shewchuk

97’] and
SoS

technique
[
Edelsbrunner

90’] to promise the robustness.

In GPU, find an almost furthest point without using atomic operations

In GPU, separate the kernels for fast and exact predicates.

Experiments

41

4

Convex hull

Cube

Ball

Sphere

Box

Running time of
ffHull

compared to gHull, CGAL (on the CPU)

and gHull (on the GPU).

Experiments

42

4

Convex hull

Points on a thin sphere of different thicknesses.

Experiments

43

4

Convex hull

The number of flips performed by
ffHull

on the CPU.

Thank you!

http://www.comp.nus.edu.sg/~tants/flipflop.html

mingcen@comp.nus.edu.sg