# Snap Rounding by nikeborome

VIEWS: 13 PAGES: 59

• pg 1
```									Snap Rounding
Shai Hirsch
November, 2001

Robustness and Precision in Geometric Computing
Introduction

A rounding scheme for dynamic
segment intersection with finite
precision output
Key terms:
– Segment intersection
– Rounding scheme (finite precision output)

– Dynamization
Intuition
Input       Output
References

   Greene & Yao, 1986
   Hobby, 1997
   Guibas & Marimont, 1995
Outline

   Introduction
   Concepts
   Into Finite Precision
   Algorithms
   Conclusion
Outline

   Introduction
   Concepts
   Into Finite Precision
   Algorithms
   Conclusion
Concepts

   Sweep-line algorithm
   Trapezoidal Decomposition
   Minkowski Sums
Sweep-line
Sweep line                                       a2
b1
b
ab

b2
a

a1

Event Points                     Status
a1 b1 ab b2 a2                 a    b   a    a
b1 b2 b2 a2                         a   b
b2 a2 a2
a2
Trapezoidal
Decomposition

Vertical
Attachments

Bounding Box
Trapezoidal
Decomposition (cont.)
   TDs can be built
– Via sweep-line (statically).
– Segment by segment (incrementally,
randomized)
   TDs can be dynamic
(segments can get removed)
   TDs can serve as point location search
structures
Point Location via TD
a1
C        b1
E                H        a2
b
L        C                ab
D    F           ab
K
I
a                    a2
b2
a
b1           G            a        L
a1    G
J
H
D        b                        b2

E            F            b        K

I        J
Minkowski Sums

For sets P, Q,
the Minkowski Sum is
the set of all sums p+q,
where p  P, q  Q

P  Q = { p+q | p  P, q  Q}
Minkowski Sums (cont.)

        =
Minkowski Sums (cot’d)
Outline

   Introduction
   Concepts
   Into Finite Precision
   Algorithms
   Conclusion
Into Finite Precision

   What’s wrong?
   A naïve solution
   Rounding Scheme Criteria
   Snap Rounding
   Topological Analysis
What’s wrong?

Inifinite-precision model assumed
(Real RAM)
Effects of finite-precision ignored
What’s wrong? (cont.)

Finite precision
causes
Rounding errors
which gives rise to
Topological Inconsistencies
Naïve Solution

 Run ordinary intersection alg.
 Round intersections to nearest grid point

Problems:
–   Spurious Intersections
–   Multiple Iterations
–   Displaced Intersections
–   Drifting lines
–   Topological Inversion
Spurious Intersections
(13,6)
Original              (9,5)
Input

(0,0)             (5.45, 2.52)

(-1,-2)
Spurious Intersections
(cont.)
Rounding to                       (13,6)

integers         (9,5)

(5, 3)

(0,0)

Extraneous
(-1,-2)            Intersections
Multiple Iterations
(13,6)
(9,5)

(5, 3)

(0,0)              Extraneous intersections?

Then iterate algorithm
(-1,-2)
Displaced Intersections

No bound over
distance of displacement
Drifting Lines

a
b1   b2   b3
Topological Inversion
Rounding Scheme Criteria

1.   Perturbed segments should be near
the originals
2.   Preserve topology as much as
possible

3.   Output should be managable using
finite precision
Snap Rounding

Avoid problems in naïve solution -
Treat
points
as
Obstacles
[Greene, Yao, 1986]
Snap Rounding

The Setting:
 Tile plane with unit squares - pixels

 Center unit squares on the points of
the integer grid

For a rounded arrangement
all vertices are perturbed to
integral points
Snap Rounding

Terminology
ursegments – original unrounded
segments
polysegments – the resulting polygonal
lines after perturbation
fragments – line segments making up a
polysegment
Snap Rounding

Hot Pixels – pixels
containing:
– Ursegment
endpoints
– Ursegments
intersection
points
Snap Rounding

   Perturb ursegments ,terminating in a
hot pixel, to terminate at pixel’s
center.
   Perturb ursegments that pass through
a hot pixel, to pass through its center.
Potential
Snap Rounding              mistake
?!

Input           Output
Integers Grid
Hot Pixels      Rounding
Topological Analysis

Lemma 1
Polysegment s’ corresponding to ursegment s is
contained within the Minkowski Sum of s with a
pixel (centered at the origin).
Topological Analysis

   There is an explicit continuous
deformation D, which takes an
arrangement A to its rounded form.
   During D, features of A may collapse,
but they never invert (non penetration
condition).
Topological Analysis

Theorem 1
After snap rounding
a. No fragments
intersect except
at their
endpoints
Topological Analysis
b. Circular ordering of fragments ending at
the same pixel match order of
ursegment.
Topological Analysis
c. If r intersects s and then t, then r’
cannot intersect t’ before s’.
Topological Analysis
d. If a vertical line l through pixel
centers intersects s and then t,
then l cannot intersect t’ before s’.
Outline

   Introduction
   Concepts
   Into Finite Precision
   Algorithms
   Conclusion
Algorithms

1.   Static sweep-line algorithm
2.   Dynamic trapezoidal decomposition
algorithm
sweep-line algorithm

   Use sweep-line algorithm to find the
intersection points (“Pass 1”).
(T - the set of endpoints and intersection points.)
   Compute T , the hot pixel centers.
   Sweep again: bend original segments
to pass through T  (“Pass 2”).
sweep-line algorithm

   How do we find intersection of
segment s with hot pixel in Pass 2 ?

1st solution: Add boundary segments for
each hot pixel and sweep again.
sweep-line algorithm

   Better solution:
– User information from Pass 1; We already
know all intersection points.
– Use special properties of hot pixels
 Vertical edges need no explicit representation
 Horizontal edge come in batches that start
and end together.
sweep-line algorithm

– Batch i – contains all hot pixels
that begin at x = i – ½ and end at
i + ½.
– Hot pixel edges are kept in a
separate list, the hot edge list.
(The status is still maintained.)

i-½   i   i+½
sweep-line algorithm

– Some status segments start or end
at i.
– Hot edges start on x = i – ½ and
end at i + ½.
– No segments start on i – ½ < x < i
or on i < x < i + ½.
The corresponding vertical slabs are
called hammocks.

i-½   i   i+½
sweep-line algorithm

   Pass 2 processes batches one-at-a-
time.
   It resynchronizes the status and hot
edge list when the sweep line reaches
the end of a hammock.
   Each such step is O(Ni log Ni + k`i)
– Ni – # of events (start/end/cross).
– k`i – # of vertices inserted by SR.
sweep-line algorithm

   The algorithm still runs in time

O((n+k) log n)
Trapezoidal
Decomposition
   The overall TD scheme is the same,
but we need to maintain the SR.
   An ursegment is stored with the
fragments that make up its
polysegment.
   A fragment has a sorted list of
ursegments it represents.
TD: Inserting Ursegments

   Requires 3 searches:
– Find new hot pixels created by s
(endpoints, intersections)
– Find existing hot pixels through which s
passes
– Find existing ursegments that pass
through new hot pixels.
TD: Deletions

   To delete ursegment s
– Visit the fragments of its polysegment s`
– Remove s from their list
– When a list becomes empty, delete
fragment.
– Delete each vertex of s` in a hot pixel
that got cold (previously hot only because
of s).
SR Examples:
Triangulation
SR Examples:
Triangulation (Detail)
SR Examples:
Congestion
SR Examples:
Congestion (Detail)
Outline

   Introduction
   Concepts
   Into Finite Precision
   Algorithms
   Conclusion
Conclusion

   We saw:
– A test case which exemplifies robustness
and precision problems (segment
intersection)
– A way to handle such problems via
controlled changes (snap rounding)
Conclusion (cont.)

   We discussed:
– Problems in the naïve solution
– A set of criteria for a good rounding
scheme
– A set of properties of SR which maintain
the objectives and the criteria
Conclusion (cont.)

   Implementations presented:
– Sweep line: Static
– Trapezoidal Decomposition:
 Incremental
 Dynamic
‫-הסוף-‬

```
To top