Duality Transformation and its Applications to Computational Geometry

209
Introduction Definitions Hull Arrangement Triangle Nearest Neighbor Duality Transformation and its Applications to Computational Geometry Partha P. Goswami University of Kalyani Kalyani, West Bengal, India.

Transcript of Duality Transformation and its Applications to Computational Geometry

Page 1: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Duality Transformation and its Applications toComputational Geometry

Partha P. Goswami

University of KalyaniKalyani, West Bengal, India.

Page 2: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Outline

1 Introduction

2 Definition and Properties

3 Convex Hull

4 Arrangement of Lines

5 Smallest Area Triangle

6 Nearest Neighbor of a Line

Page 3: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Introduction

In the Cartesian plane, a point has two parameters (x- andy -coordinates) and a (non-vertical) line also has twoparameters (slope and y -intercept). We can thus map a set ofpoints to a set of lines, and vice versa, in an one-to-onemanner.

This natural duality between points and lines in the Cartesianplane has long been known to geometers.

The concept of duality is a powerful tool for the description,analysis, and construction of algorithms.

In this lecture we explore how geometric duality can be usedto design efficient algorithms for a number of importantproblems in computational geometry.

Page 4: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Introduction

In the Cartesian plane, a point has two parameters (x- andy -coordinates) and a (non-vertical) line also has twoparameters (slope and y -intercept). We can thus map a set ofpoints to a set of lines, and vice versa, in an one-to-onemanner.

This natural duality between points and lines in the Cartesianplane has long been known to geometers.

The concept of duality is a powerful tool for the description,analysis, and construction of algorithms.

In this lecture we explore how geometric duality can be usedto design efficient algorithms for a number of importantproblems in computational geometry.

Page 5: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Introduction

In the Cartesian plane, a point has two parameters (x- andy -coordinates) and a (non-vertical) line also has twoparameters (slope and y -intercept). We can thus map a set ofpoints to a set of lines, and vice versa, in an one-to-onemanner.

This natural duality between points and lines in the Cartesianplane has long been known to geometers.

The concept of duality is a powerful tool for the description,analysis, and construction of algorithms.

In this lecture we explore how geometric duality can be usedto design efficient algorithms for a number of importantproblems in computational geometry.

Page 6: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Introduction

In the Cartesian plane, a point has two parameters (x- andy -coordinates) and a (non-vertical) line also has twoparameters (slope and y -intercept). We can thus map a set ofpoints to a set of lines, and vice versa, in an one-to-onemanner.

This natural duality between points and lines in the Cartesianplane has long been known to geometers.

The concept of duality is a powerful tool for the description,analysis, and construction of algorithms.

In this lecture we explore how geometric duality can be usedto design efficient algorithms for a number of importantproblems in computational geometry.

Page 7: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Introduction

There are many different point-line duality mappings possible,depending on the conventions of the standard representationsof a line.

Each such mapping has its advantages and disadvantages inparticular contexts.

Page 8: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Introduction

There are many different point-line duality mappings possible,depending on the conventions of the standard representationsof a line.

Each such mapping has its advantages and disadvantages inparticular contexts.

Page 9: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Outline

1 Introduction

2 Definition and Properties

3 Convex Hull

4 Arrangement of Lines

5 Smallest Area Triangle

6 Nearest Neighbor of a Line

Page 10: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Let D be the duality transformation.

Definition

A point p(a, b) is transformed to the lineDp(y = ax − b).

Definition

A line l(y = cx + d) is transformed to thepoint Dl(c ,−d).

primal

dual

pD

p

lD

l

Page 11: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Let D be the duality transformation.

Definition

A point p(a, b) is transformed to the lineDp(y = ax − b).

Definition

A line l(y = cx + d) is transformed to thepoint Dl(c ,−d).

primal

dual

pD

p

lD

l

Page 12: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Let D be the duality transformation.

Definition

A point p(a, b) is transformed to the lineDp(y = ax − b).

Definition

A line l(y = cx + d) is transformed to thepoint Dl(c ,−d).

primal

dual

pD

p

lD

l

Page 13: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Properties

Lemma

D is its own inverse, that is, DDp = p and DDl = l .

Lemma

D is not defined for vertical lines since vertical lines can not berepresented in the form y = mx + c.

However this is not a problem in general. Because we can alwaysrotate the problem space slightly so that none is vertical.

Page 14: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Properties

Lemma

D is its own inverse, that is, DDp = p and DDl = l .

Lemma

D is not defined for vertical lines since vertical lines can not berepresented in the form y = mx + c.

However this is not a problem in general. Because we can alwaysrotate the problem space slightly so that none is vertical.

Page 15: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Properties

Lemma

D is its own inverse, that is, DDp = p and DDl = l .

Lemma

D is not defined for vertical lines since vertical lines can not berepresented in the form y = mx + c.

However this is not a problem in general. Because we can alwaysrotate the problem space slightly so that none is vertical.

Page 16: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Properties

Incidence preserving

Lemma

A point p(a, b) is incident to the linel(y = cx + d) in the primal plane iff pointDl(c ,−d) is incident to the lineDp(y = ax − b) in the dual plane.

primal

dual

pD

Dl

p

l

Page 17: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Properties

Incidence preserving

Lemma

A point p(a, b) is incident to the linel(y = cx + d) in the primal plane iff pointDl(c ,−d) is incident to the lineDp(y = ax − b) in the dual plane.

primal

dual

pD

Dl

p

l

Page 18: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Properties

Order preserving

Lemma

A point p(a, b) is above (below) the linel(y = cx + d) in the primal plane iff lineDp(y = ax − b) is below (above) the pointDl(c ,−d) in the dual plane.

primal

dual

Dl

pD

lp

Page 19: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Properties

Order preserving

Lemma

A point p(a, b) is above (below) the linel(y = cx + d) in the primal plane iff lineDp(y = ax − b) is below (above) the pointDl(c ,−d) in the dual plane.

primal

dual

Dl

pD

lp

Page 20: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Alternative Definition

The duality transformation we have described so far is oftencalled m-c duality.

An alternative definition, called polar duality, is also used.

Page 21: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Alternative Definition

The duality transformation we have described so far is oftencalled m-c duality.

An alternative definition, called polar duality, is also used.

Page 22: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Polar Duality

Definition

A point p with coordinates (a, b) in the primal plane correspondsto a line Tp with equation ax + by + 1 = 0 in the dual plane andvice versa.

Geometrically this means if d is thedistance from the origin to the point p,The dual Tp of p is the line perpendicularto Op at distance 1/d from O and placedon the other side of O.

Page 23: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Polar Duality

Definition

A point p with coordinates (a, b) in the primal plane correspondsto a line Tp with equation ax + by + 1 = 0 in the dual plane andvice versa.

Geometrically this means if d is thedistance from the origin to the point p,The dual Tp of p is the line perpendicularto Op at distance 1/d from O and placedon the other side of O.

Page 24: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Polar Duality

Definition

A point p with coordinates (a, b) in the primal plane correspondsto a line Tp with equation ax + by + 1 = 0 in the dual plane andvice versa.

Geometrically this means if d is thedistance from the origin to the point p,The dual Tp of p is the line perpendicularto Op at distance 1/d from O and placedon the other side of O.

O

p

Tp

1/d

1

d

Page 25: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Outline

1 Introduction

2 Definition and Properties

3 Convex Hull

4 Arrangement of Lines

5 Smallest Area Triangle

6 Nearest Neighbor of a Line

Page 26: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Convex Hull

Let P be a set of points in the plane.

Definition

Convex hull of P, denoted by CH(P), is thesmallest convex set containing P.

Informally, an elastic band stretchedopen to encompass the given set,when released, assumes the shape ofthe convex hull.

Page 27: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Convex Hull

Let P be a set of points in the plane.

Definition

Convex hull of P, denoted by CH(P), is thesmallest convex set containing P.

Informally, an elastic band stretchedopen to encompass the given set,when released, assumes the shape ofthe convex hull.

Page 28: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Convex Hull

Let P be a set of points in the plane.

Definition

Convex hull of P, denoted by CH(P), is thesmallest convex set containing P.

Informally, an elastic band stretchedopen to encompass the given set,when released, assumes the shape ofthe convex hull.

Page 29: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Convex Hull

Let P be a set of points in the plane.

Definition

Convex hull of P, denoted by CH(P), is thesmallest convex set containing P.

Informally, an elastic band stretchedopen to encompass the given set,when released, assumes the shape ofthe convex hull.

Page 30: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Convex Hull Problem

Problem

Given a set of points P in the plane, compute the convex hullCH(P) of the set P.

To compute the convex hull of a point set is a well known andfundamental problem in computational geometry.

Page 31: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Convex Hull Problem

Problem

Given a set of points P in the plane, compute the convex hullCH(P) of the set P.

To compute the convex hull of a point set is a well known andfundamental problem in computational geometry.

Page 32: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

A Naive Algorithm

input: a set S of n points in the plane

for each triple (u,v,w) of S{remove all the points of S contained in Tr(u,v,w)

}Order the remaining points of S andoutput the ordered list

Page 33: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

A Naive Algorithm

input: a set S of n points in the planefor each triple (u,v,w) of S{

remove all the points of S contained in Tr(u,v,w)

}

Order the remaining points of S andoutput the ordered list

Page 34: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

A Naive Algorithm

input: a set S of n points in the planefor each triple (u,v,w) of S{

remove all the points of S contained in Tr(u,v,w)}

Order the remaining points of S andoutput the ordered list

Page 35: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

A Naive Algorithm

input: a set S of n points in the planefor each triple (u,v,w) of S{

remove all the points of S contained in Tr(u,v,w)}Order the remaining points of S andoutput the ordered list

Page 36: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 37: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 38: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 39: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 40: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 41: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 42: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 43: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 44: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 45: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

Page 46: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

There are O(n3) triangles and it takes O(n) time for each triangle.So processing time for all triangles is O(n4).The sorting step requires O(n log n) time.Final reporting takes O(n) time.

Result

The naive algorithm takes O(n4) time and O(n) space to computethe convex hull of a set of n points.

Page 47: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

There are O(n3) triangles and it takes O(n) time for each triangle.So processing time for all triangles is O(n4).The sorting step requires O(n log n) time.Final reporting takes O(n) time.

Result

The naive algorithm takes O(n4) time and O(n) space to computethe convex hull of a set of n points.

Page 48: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Optimal Algorithms

The worst case computational complexity of the problem hasbeen shown to be O(n log n), where n is the size of the givenpoint set.

A number of optimal algorithms have been devised for theconvex hull problem.

Page 49: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Optimal Algorithms

The worst case computational complexity of the problem hasbeen shown to be O(n log n), where n is the size of the givenpoint set.

A number of optimal algorithms have been devised for theconvex hull problem.

Page 50: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Optimal Algorithms

Grahams scan, time complexity O(nlogn).(Graham, R.L., 1972)

Divide and conquer algorithm, time complexity O(nlogn).(Preparata, F. P. and Hong, S. J., 1977)

Jarvis’s march or gift wrapping algorithm, time complexityO(nh) where h number of vertices of the convex hull.(Jarvis, R. A., 1973)

Most efficient algorithm to date is based on the idea ofJarvis’s march, time complexity O(nlogh).T. M. Chan (1996)

Page 51: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definitions

Let P be the given set of n points in theplane. Let pa ∈ P be the point having smallestx-coordinate and pd ∈ P be the point withlargest x-coordinate. Obviously, both pa andpd belongs to CH(P).

Definition

The c-wise polygonal chain pa, . . . , pd alongthe hull is called the upper hull.

Definition

The cc-wise polygonal chain pa, . . . , pd alongthe hull is called the lower hull.

pa

pb

pc

pd

xp

Page 52: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definitions

Let P be the given set of n points in theplane. Let pa ∈ P be the point having smallestx-coordinate and pd ∈ P be the point withlargest x-coordinate. Obviously, both pa andpd belongs to CH(P).

Definition

The c-wise polygonal chain pa, . . . , pd alongthe hull is called the upper hull.

Definition

The cc-wise polygonal chain pa, . . . , pd alongthe hull is called the lower hull.

pa

pb

pc

pd

xp

Page 53: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definitions

Let P be the given set of n points in theplane. Let pa ∈ P be the point having smallestx-coordinate and pd ∈ P be the point withlargest x-coordinate. Obviously, both pa andpd belongs to CH(P).

Definition

The c-wise polygonal chain pa, . . . , pd alongthe hull is called the upper hull.

Definition

The cc-wise polygonal chain pa, . . . , pd alongthe hull is called the lower hull.

pa

pb

pc

pd

xp

Page 54: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definitions

Let L be a set of lines in the plane.

Definition

The upper envelope is a polygoal chain Eu

such that no line l ∈ L is above Eu.

Definition

The lower envelope is a polygoal chain El suchthat no line l ∈ L is below El .

upper envelope

low

er e

nvel

ope

Page 55: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definitions

Let L be a set of lines in the plane.

Definition

The upper envelope is a polygoal chain Eu

such that no line l ∈ L is above Eu.

Definition

The lower envelope is a polygoal chain El suchthat no line l ∈ L is below El .

upper envelope

low

er e

nvel

ope

Page 56: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definitions

Let L be a set of lines in the plane.

Definition

The upper envelope is a polygoal chain Eu

such that no line l ∈ L is above Eu.

Definition

The lower envelope is a polygoal chain El suchthat no line l ∈ L is below El .

upper envelope

low

er e

nvel

ope

Page 57: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Connection Between Hull and Envelope

ly

la

lb

lc

pc

pb

px

lx

ap p

s

pd

Dl c

Dl y

Dl x

Dl a

Dl b

Dps

Page 58: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Connection Between Hull and Envelope

ly

la

lb

lc

pc

pb

px

lx

ap p

s

pd

Dl c

Dl y

Dl x

Dl a

Dl b

Dps

Page 59: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Connection Between Hull and Envelope

ly

la

lb

lc

pc

pb

px

lx

ap p

s

pd

Dl c

Dl y

Dl x

Dl a

Dl b

Dps

Page 60: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Connection Between Hull and Envelope

ly

la

lb

lc

pc

pb

px

lx

ap p

s

pd

Dl c

Dl y

Dl x

Dl a

Dl b

Dps

Page 61: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Connection Between Hull and Envelope

Conclusion

Upper hull (lower hull) in primal plane corresponds to the lowerenvelope (upper envelope) in the dual plane.

Thus the problem of computing convex hull of a point set in theprimal plane reduces to the problem of computing upper and lowerenvelopes of the line set in the dual plane.

Page 62: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Connection Between Hull and Envelope

Conclusion

Upper hull (lower hull) in primal plane corresponds to the lowerenvelope (upper envelope) in the dual plane.

Thus the problem of computing convex hull of a point set in theprimal plane reduces to the problem of computing upper and lowerenvelopes of the line set in the dual plane.

Page 63: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: I = (L1, L2, ..., Ln) is the list of dual linesin the increasing order of slopes.

Output: O = (L1, L2, ..., Lk is the polygonal chainrepresenting the upper hull.

O = (L1);for i = 2 to n do{L = last line in O;while(the line segment L in O does not intersect Li)remove L from O and replace L with its predecessor;

insert the line Li at the tail of the list O;}

Page 64: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: I = (L1, L2, ..., Ln) is the list of dual linesin the increasing order of slopes.

Output: O = (L1, L2, ..., Lk is the polygonal chainrepresenting the upper hull.

O = (L1);for i = 2 to n do{L = last line in O;while(the line segment L in O does not intersect Li)remove L from O and replace L with its predecessor;

insert the line Li at the tail of the list O;}

Page 65: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: I = (L1, L2, ..., Ln) is the list of dual linesin the increasing order of slopes.

Output: O = (L1, L2, ..., Lk is the polygonal chainrepresenting the upper hull.

O = (L1);

for i = 2 to n do{L = last line in O;while(the line segment L in O does not intersect Li)remove L from O and replace L with its predecessor;

insert the line Li at the tail of the list O;}

Page 66: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: I = (L1, L2, ..., Ln) is the list of dual linesin the increasing order of slopes.

Output: O = (L1, L2, ..., Lk is the polygonal chainrepresenting the upper hull.

O = (L1);for i = 2 to n do{

L = last line in O;while(the line segment L in O does not intersect Li)remove L from O and replace L with its predecessor;

insert the line Li at the tail of the list O;

}

Page 67: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: I = (L1, L2, ..., Ln) is the list of dual linesin the increasing order of slopes.

Output: O = (L1, L2, ..., Lk is the polygonal chainrepresenting the upper hull.

O = (L1);for i = 2 to n do{L = last line in O;

while(the line segment L in O does not intersect Li)remove L from O and replace L with its predecessor;

insert the line Li at the tail of the list O;

}

Page 68: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: I = (L1, L2, ..., Ln) is the list of dual linesin the increasing order of slopes.

Output: O = (L1, L2, ..., Lk is the polygonal chainrepresenting the upper hull.

O = (L1);for i = 2 to n do{L = last line in O;while(the line segment L in O does not intersect Li)

remove L from O and replace L with its predecessor;insert the line Li at the tail of the list O;

}

Page 69: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: I = (L1, L2, ..., Ln) is the list of dual linesin the increasing order of slopes.

Output: O = (L1, L2, ..., Lk is the polygonal chainrepresenting the upper hull.

O = (L1);for i = 2 to n do{L = last line in O;while(the line segment L in O does not intersect Li)remove L from O and replace L with its predecessor;

insert the line Li at the tail of the list O;

}

Page 70: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: I = (L1, L2, ..., Ln) is the list of dual linesin the increasing order of slopes.

Output: O = (L1, L2, ..., Lk is the polygonal chainrepresenting the upper hull.

O = (L1);for i = 2 to n do{L = last line in O;while(the line segment L in O does not intersect Li)remove L from O and replace L with its predecessor;

insert the line Li at the tail of the list O;}

Page 71: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

L1

L2

L3

L4

L5

L6

L1

L2

L3

L4

L5

L6

Page 72: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

L1

L2

L3

L4

L5

L6 L1

L2

L3

L4

L5

L6

Page 73: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

L1

L2

L3

L4

L5

L6 L1

L2

L3

L4

L5

L6

Page 74: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

L1

L2

L3

L4

L5

L6 L1

L2

L3

L4

L5

L6

Page 75: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

L1

L2

L3

L4

L5

L6 L1

L2

L3

L4

L5

L6

Page 76: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

L1

L2

L3

L4

L5

L6 L1

L2

L3

L4

L5

L6

Page 77: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

L1

L2

L3

L4

L5

L6 L1

L2

L3

L4

L5

L6

Page 78: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

L1

L2

L3

L4

L5

L6 L1

L2

L3

L4

L5

L6

Page 79: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Result

Lemma

After sorting n lines by their slopes in O(nlogn) time, the upperenvelope can be obtained in O(n) time.

Proof.

It may check more than one line segment when inserting a new line,but those ones checked are all removed except the last one.

Page 80: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Result

Lemma

After sorting n lines by their slopes in O(nlogn) time, the upperenvelope can be obtained in O(n) time.

Proof.

It may check more than one line segment when inserting a new line,but those ones checked are all removed except the last one.

Page 81: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Result

Result

Given a set P of n points in the plane, CH(P) can be computed inO(n log n) time using n space.

Page 82: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Outline

1 Introduction

2 Definition and Properties

3 Convex Hull

4 Arrangement of Lines

5 Smallest Area Triangle

6 Nearest Neighbor of a Line

Page 83: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Let L be a set of n lines in the plane. Theembedding of L in the plane induces aplanner subdivision that consists ofvertices, edges, and faces where some ofthe edges and faces are unbounded. Thissubdivision is referred to as arrangementinduced by L, and is denoted by A(L).

An arrangement is called simple if nothree lines passes through the same pointand no two lines are parallel.

The (combinatorial) complexity of anarrangement is the total number ofvertices, edges, and faces. Observe thatworst case complexity occurs when anarrangement is simple.

face

edge

vertex

Page 84: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Let L be a set of n lines in the plane. Theembedding of L in the plane induces aplanner subdivision that consists ofvertices, edges, and faces where some ofthe edges and faces are unbounded. Thissubdivision is referred to as arrangementinduced by L, and is denoted by A(L).

An arrangement is called simple if nothree lines passes through the same pointand no two lines are parallel.

The (combinatorial) complexity of anarrangement is the total number ofvertices, edges, and faces. Observe thatworst case complexity occurs when anarrangement is simple.

face

edge

vertex

Page 85: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Let L be a set of n lines in the plane. Theembedding of L in the plane induces aplanner subdivision that consists ofvertices, edges, and faces where some ofthe edges and faces are unbounded. Thissubdivision is referred to as arrangementinduced by L, and is denoted by A(L).

An arrangement is called simple if nothree lines passes through the same pointand no two lines are parallel.

The (combinatorial) complexity of anarrangement is the total number ofvertices, edges, and faces. Observe thatworst case complexity occurs when anarrangement is simple.

face

edge

vertex

Page 86: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Let L be a set of n lines in the plane. Theembedding of L in the plane induces aplanner subdivision that consists ofvertices, edges, and faces where some ofthe edges and faces are unbounded. Thissubdivision is referred to as arrangementinduced by L, and is denoted by A(L).

An arrangement is called simple if nothree lines passes through the same pointand no two lines are parallel.

The (combinatorial) complexity of anarrangement is the total number ofvertices, edges, and faces. Observe thatworst case complexity occurs when anarrangement is simple.

face

edge

vertex

Page 87: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Let L be a set of n lines in the plane. Theembedding of L in the plane induces aplanner subdivision that consists ofvertices, edges, and faces where some ofthe edges and faces are unbounded. Thissubdivision is referred to as arrangementinduced by L, and is denoted by A(L).

An arrangement is called simple if nothree lines passes through the same pointand no two lines are parallel.

The (combinatorial) complexity of anarrangement is the total number ofvertices, edges, and faces. Observe thatworst case complexity occurs when anarrangement is simple.

face

edge

vertex

Page 88: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Result

Theorem

Let L be the set of n lines in the plane, and let A(L) be thearrangement induced by L.

(i) The number of vertices of A(L) is at mostn(n − 1)/2.

(ii) The number of edges of A(L) is at most n2.

(iii) The number of faces of A(L) is at mostn2/2 + n/2 + 1.

Equality holds in these three statements iff A(L) is simple.

Can be proved easily by using Euler’s formula:For any connected planner embedded graph with mv nodes, me

arcs, and mf faces the following relation holds

mv −me + mf = 2.

Page 89: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Result

Theorem

Let L be the set of n lines in the plane, and let A(L) be thearrangement induced by L.

(i) The number of vertices of A(L) is at mostn(n − 1)/2.

(ii) The number of edges of A(L) is at most n2.

(iii) The number of faces of A(L) is at mostn2/2 + n/2 + 1.

Equality holds in these three statements iff A(L) is simple.

Can be proved easily by using Euler’s formula:For any connected planner embedded graph with mv nodes, me

arcs, and mf faces the following relation holds

mv −me + mf = 2.

Page 90: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

One of the fundamental problems in computational geometryis constructing arrangements of lines, that is, explicitlybuilding the regions formed by the intersections of a set of nlines.

Algorithms for a surprising number of problems are based onconstructing and analyzing the arrangement of a specific setof lines.

A variety of data structures have been proposed for thispurpose.

Page 91: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

One of the fundamental problems in computational geometryis constructing arrangements of lines, that is, explicitlybuilding the regions formed by the intersections of a set of nlines.

Algorithms for a surprising number of problems are based onconstructing and analyzing the arrangement of a specific setof lines.

A variety of data structures have been proposed for thispurpose.

Page 92: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

One of the fundamental problems in computational geometryis constructing arrangements of lines, that is, explicitlybuilding the regions formed by the intersections of a set of nlines.

Algorithms for a surprising number of problems are based onconstructing and analyzing the arrangement of a specific setof lines.

A variety of data structures have been proposed for thispurpose.

Page 93: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

Algorithms for constructing arrangementsare usually incremental. Beginning withan arrangement of one or two lines,subsequent lines are inserted into thearrangement one at a time, therebybuilding larger and larger arrangements.

To insert a new line, we start on theleftmost cell containing the line and walkover the arrangement to the right, movingfrom cell to neighboring cell and splittinginto two pieces those cells that containthe new line.

Page 94: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

Algorithms for constructing arrangementsare usually incremental. Beginning withan arrangement of one or two lines,subsequent lines are inserted into thearrangement one at a time, therebybuilding larger and larger arrangements.

To insert a new line, we start on theleftmost cell containing the line and walkover the arrangement to the right, movingfrom cell to neighboring cell and splittinginto two pieces those cells that containthe new line.

Page 95: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

Algorithms for constructing arrangementsare usually incremental. Beginning withan arrangement of one or two lines,subsequent lines are inserted into thearrangement one at a time, therebybuilding larger and larger arrangements.

To insert a new line, we start on theleftmost cell containing the line and walkover the arrangement to the right, movingfrom cell to neighboring cell and splittinginto two pieces those cells that containthe new line.

Page 96: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

A geometric fact called the zone theorem implies that thek-th line inserted cuts through k cells of the arrangement and,moreover, O(k) total edges form the boundary of these cells.

We can thus scan through each edge of every cell encounteredon our insertion walk in linear time.

The total time to insert all n lines in constructing the fullarrangement is O(n2).

Page 97: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

A geometric fact called the zone theorem implies that thek-th line inserted cuts through k cells of the arrangement and,moreover, O(k) total edges form the boundary of these cells.

We can thus scan through each edge of every cell encounteredon our insertion walk in linear time.

The total time to insert all n lines in constructing the fullarrangement is O(n2).

Page 98: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computation of Arrangement

A geometric fact called the zone theorem implies that thek-th line inserted cuts through k cells of the arrangement and,moreover, O(k) total edges form the boundary of these cells.

We can thus scan through each edge of every cell encounteredon our insertion walk in linear time.

The total time to insert all n lines in constructing the fullarrangement is O(n2).

Page 99: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Levels

We consider an alternative concept, called levels, forstructuring an arrangement of lines.

It is simple both from understanding and implementationspoint of view.

Page 100: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Levels

We consider an alternative concept, called levels, forstructuring an arrangement of lines.

It is simple both from understanding and implementationspoint of view.

Page 101: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Definition

Definition

Let L be a set on n lines in the plane inducing an arrangementA(L). A point π in the plane is at level θ (0 ≤ θ ≤ n) if there areexactly θ lines in L that lie strictly below π. The θ-level of A(L) isthe closure of a set of points on the lines of L whose levels areexactly θ in A(L), and is denoted as λθ.

Page 102: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

definition

Clearly, the edges of λθ form a monotonepolychain from x = −∞ to x = ∞. Eachvertex of the arrangement A(L) appearsin two consecutive levels, and each edgeof A(L) appears in exactly one level.

We can thus store each level simply as anarray of segments.

Observe that the upper and the lowerenvelops mentioned earlier, are simply then-th and 0-th levels respectively.

level 0

level 1

level 2

level 3

level 4

level 5level 6

Page 103: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

definition

Clearly, the edges of λθ form a monotonepolychain from x = −∞ to x = ∞. Eachvertex of the arrangement A(L) appearsin two consecutive levels, and each edgeof A(L) appears in exactly one level.

We can thus store each level simply as anarray of segments.

Observe that the upper and the lowerenvelops mentioned earlier, are simply then-th and 0-th levels respectively.

level 0

level 1

level 2

level 3

level 4

level 5level 6

Page 104: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

definition

Clearly, the edges of λθ form a monotonepolychain from x = −∞ to x = ∞. Eachvertex of the arrangement A(L) appearsin two consecutive levels, and each edgeof A(L) appears in exactly one level.

We can thus store each level simply as anarray of segments.

Observe that the upper and the lowerenvelops mentioned earlier, are simply then-th and 0-th levels respectively.

level 0

level 1

level 2

level 3

level 4

level 5level 6

Page 105: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

definition

Clearly, the edges of λθ form a monotonepolychain from x = −∞ to x = ∞. Eachvertex of the arrangement A(L) appearsin two consecutive levels, and each edgeof A(L) appears in exactly one level.

We can thus store each level simply as anarray of segments.

Observe that the upper and the lowerenvelops mentioned earlier, are simply then-th and 0-th levels respectively.

level 0

level 1

level 2

level 3

level 4

level 5level 6

Page 106: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

definition

Clearly, the edges of λθ form a monotonepolychain from x = −∞ to x = ∞. Eachvertex of the arrangement A(L) appearsin two consecutive levels, and each edgeof A(L) appears in exactly one level.

We can thus store each level simply as anarray of segments.

Observe that the upper and the lowerenvelops mentioned earlier, are simply then-th and 0-th levels respectively.

level 0

level 1

level 2

level 3

level 4

level 5level 6

Page 107: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computing Levels

Once an arrangement is computed using traditional datastructures mentioned earlier, levels of an arrangement can becomputed in optimal O(n2) time.

Here we consider an alternative method using plane sweepparadigm.

The method was first introduced by Bentley and Ottmann(1979) in the context of solving the problem of line segmentintersections.

Page 108: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computing Levels

Once an arrangement is computed using traditional datastructures mentioned earlier, levels of an arrangement can becomputed in optimal O(n2) time.

Here we consider an alternative method using plane sweepparadigm.

The method was first introduced by Bentley and Ottmann(1979) in the context of solving the problem of line segmentintersections.

Page 109: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Computing Levels

Once an arrangement is computed using traditional datastructures mentioned earlier, levels of an arrangement can becomputed in optimal O(n2) time.

Here we consider an alternative method using plane sweepparadigm.

The method was first introduced by Bentley and Ottmann(1979) in the context of solving the problem of line segmentintersections.

Page 110: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Plane Sweep Method

Basic method consists of:

A vertical line l , called the sweep line, sweeps over the planefrom x = −∞ to x = ∞.

The status of the sweep line at any instant is the set of linesintersecting it.

The status changes only when the sweep line reaches someparticular points, called event points.

The algorithm performs some computational steps when thesweep line reaches event points.

Page 111: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Plane Sweep Method

Basic method consists of:

A vertical line l , called the sweep line, sweeps over the planefrom x = −∞ to x = ∞.

The status of the sweep line at any instant is the set of linesintersecting it.

The status changes only when the sweep line reaches someparticular points, called event points.

The algorithm performs some computational steps when thesweep line reaches event points.

Page 112: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Plane Sweep Method

Basic method consists of:

A vertical line l , called the sweep line, sweeps over the planefrom x = −∞ to x = ∞.

The status of the sweep line at any instant is the set of linesintersecting it.

The status changes only when the sweep line reaches someparticular points, called event points.

The algorithm performs some computational steps when thesweep line reaches event points.

Page 113: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Plane Sweep Method

Basic method consists of:

A vertical line l , called the sweep line, sweeps over the planefrom x = −∞ to x = ∞.

The status of the sweep line at any instant is the set of linesintersecting it.

The status changes only when the sweep line reaches someparticular points, called event points.

The algorithm performs some computational steps when thesweep line reaches event points.

Page 114: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Data structure

In our case, events are the points of intersection of the lines.Apart from storing the events, we also need to insert newevents and extract the event nearest to the sweep line on itsright. Clearly, a queue is a suitable data structure for this.

At every instant, the sweep line intersects each element of L.Order the lines from bottom to top according to theirintersection points with the sweep line. Data structure we usefor maintaining the sweep line status are arrays storing thelevels. At an instant, portion of the line at the i-th position,0 ≤ i ≤ n, is part of the i-th level.

Page 115: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Data structure

In our case, events are the points of intersection of the lines.Apart from storing the events, we also need to insert newevents and extract the event nearest to the sweep line on itsright. Clearly, a queue is a suitable data structure for this.

At every instant, the sweep line intersects each element of L.Order the lines from bottom to top according to theirintersection points with the sweep line. Data structure we usefor maintaining the sweep line status are arrays storing thelevels. At an instant, portion of the line at the i-th position,0 ≤ i ≤ n, is part of the i-th level.

Page 116: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Processing

Let the next event be the intersection point of the linescurrently at i-th and (i + 1)-th positions respectively.Processing steps to be performed at this event point are asfollows.

Portion of the line at the i-th position before the event pointwill become part of the (i + 1)-th level after the event point.Similarly, portion of the line at the (i + 1)-th position beforethe event point will become part of the i-th level after theevent point.

If the line at the (i + 1)-th position after the event pointintersect the line at the (i + 2)-th position on the right of thesweep line, then insert the intersection point as a future eventpoint. Similarly, if the line at the i-th position after the eventpoint intersect the line at the (i − 1)-th position on the rightof the sweep line, then insert the intersection point as a futureevent point.

Page 117: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Processing

Let the next event be the intersection point of the linescurrently at i-th and (i + 1)-th positions respectively.Processing steps to be performed at this event point are asfollows.

Portion of the line at the i-th position before the event pointwill become part of the (i + 1)-th level after the event point.Similarly, portion of the line at the (i + 1)-th position beforethe event point will become part of the i-th level after theevent point.

If the line at the (i + 1)-th position after the event pointintersect the line at the (i + 2)-th position on the right of thesweep line, then insert the intersection point as a future eventpoint. Similarly, if the line at the i-th position after the eventpoint intersect the line at the (i − 1)-th position on the rightof the sweep line, then insert the intersection point as a futureevent point.

Page 118: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Processing

Let the next event be the intersection point of the linescurrently at i-th and (i + 1)-th positions respectively.Processing steps to be performed at this event point are asfollows.

Portion of the line at the i-th position before the event pointwill become part of the (i + 1)-th level after the event point.Similarly, portion of the line at the (i + 1)-th position beforethe event point will become part of the i-th level after theevent point.

If the line at the (i + 1)-th position after the event pointintersect the line at the (i + 2)-th position on the right of thesweep line, then insert the intersection point as a future eventpoint. Similarly, if the line at the i-th position after the eventpoint intersect the line at the (i − 1)-th position on the rightof the sweep line, then insert the intersection point as a futureevent point.

Page 119: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Initialization

Compute the left most intersection point. Position the sweepline before this intersection point.

Compute the intersection points of the lines with the sweepline and order the lines from bottom to top according to theorder of the intersection points.

Initialize the level arrays with the lines according to theirposition on the sweep line.

Check each pair of lines from bottom to top if they insert onthe right of the sweep line. If yes, insert these intersectionpoints in the queue as an event point.

Page 120: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Initialization

Compute the left most intersection point. Position the sweepline before this intersection point.

Compute the intersection points of the lines with the sweepline and order the lines from bottom to top according to theorder of the intersection points.

Initialize the level arrays with the lines according to theirposition on the sweep line.

Check each pair of lines from bottom to top if they insert onthe right of the sweep line. If yes, insert these intersectionpoints in the queue as an event point.

Page 121: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Initialization

Compute the left most intersection point. Position the sweepline before this intersection point.

Compute the intersection points of the lines with the sweepline and order the lines from bottom to top according to theorder of the intersection points.

Initialize the level arrays with the lines according to theirposition on the sweep line.

Check each pair of lines from bottom to top if they insert onthe right of the sweep line. If yes, insert these intersectionpoints in the queue as an event point.

Page 122: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Initialization

Compute the left most intersection point. Position the sweepline before this intersection point.

Compute the intersection points of the lines with the sweepline and order the lines from bottom to top according to theorder of the intersection points.

Initialize the level arrays with the lines according to theirposition on the sweep line.

Check each pair of lines from bottom to top if they insert onthe right of the sweep line. If yes, insert these intersectionpoints in the queue as an event point.

Page 123: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: A set L of n lines in the plane

Compute initial position of the sweep line. Initializeevent queue Q and level arrays LA[i], 0 <= i <= n.

while Q is not empty doretrieve the next event point from Q and delete it.process the event point.

Page 124: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: A set L of n lines in the planeCompute initial position of the sweep line. Initializeevent queue Q and level arrays LA[i], 0 <= i <= n.

while Q is not empty doretrieve the next event point from Q and delete it.process the event point.

Page 125: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: A set L of n lines in the planeCompute initial position of the sweep line. Initializeevent queue Q and level arrays LA[i], 0 <= i <= n.

while Q is not empty do

retrieve the next event point from Q and delete it.process the event point.

Page 126: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: A set L of n lines in the planeCompute initial position of the sweep line. Initializeevent queue Q and level arrays LA[i], 0 <= i <= n.

while Q is not empty doretrieve the next event point from Q and delete it.

process the event point.

Page 127: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

Input: A set L of n lines in the planeCompute initial position of the sweep line. Initializeevent queue Q and level arrays LA[i], 0 <= i <= n.

while Q is not empty doretrieve the next event point from Q and delete it.process the event point.

Page 128: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 129: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 130: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 131: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 132: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 133: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 134: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 135: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 136: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 137: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 138: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 139: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 140: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Example

level1

level2

level3

level4

level5

level0

Page 141: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Initialization step requires O(n2) time.

At each event point, processing requires O(log n) time.

Since there are O(n2) event points, overall time complexity isO(n2 log n).

Space complexity is O(n2).

Page 142: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Initialization step requires O(n2) time.

At each event point, processing requires O(log n) time.

Since there are O(n2) event points, overall time complexity isO(n2 log n).

Space complexity is O(n2).

Page 143: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Initialization step requires O(n2) time.

At each event point, processing requires O(log n) time.

Since there are O(n2) event points, overall time complexity isO(n2 log n).

Space complexity is O(n2).

Page 144: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Initialization step requires O(n2) time.

At each event point, processing requires O(log n) time.

Since there are O(n2) event points, overall time complexity isO(n2 log n).

Space complexity is O(n2).

Page 145: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Result

Theorem

Using plane sweep, levels of an arrangement of n lines can becomputed in O(n2 log n) time using O(n2) space.

Page 146: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Outline

1 Introduction

2 Definition and Properties

3 Convex Hull

4 Arrangement of Lines

5 Smallest Area Triangle

6 Nearest Neighbor of a Line

Page 147: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Smallest Area Triangle Problem

Problem

Let P be a set of n points in the plane. The problem is todetermine which of the

(n3

)triangles with vertices in P has the

smallest area.

The solution of the above problem allows us to solve the followingproblem also.

Problem

Let P be a set of n points in the plane. The problem is todetermine whether three points in P are collinear.

Page 148: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Smallest Area Triangle Problem

Problem

Let P be a set of n points in the plane. The problem is todetermine which of the

(n3

)triangles with vertices in P has the

smallest area.

The solution of the above problem allows us to solve the followingproblem also.

Problem

Let P be a set of n points in the plane. The problem is todetermine whether three points in P are collinear.

Page 149: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Smallest Area Triangle Problem

Problem

Let P be a set of n points in the plane. The problem is todetermine which of the

(n3

)triangles with vertices in P has the

smallest area.

The solution of the above problem allows us to solve the followingproblem also.

Problem

Let P be a set of n points in the plane. The problem is todetermine whether three points in P are collinear.

Page 150: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Smallest Area Triangle Problem

The difficulty of the problem arises fromthe fact that the vertices of the smallesttriangle can be arbitrarily apart (i.e.,absence of locality).

The best known algorithm, without usingduality, for this problem has time andspace complexities O(n2 log n) and O(n)respectively.(Edelsbrunner and Welzl, 1982).

Using duality, it is possible to improveupon the complexity.

Page 151: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Smallest Area Triangle Problem

The difficulty of the problem arises fromthe fact that the vertices of the smallesttriangle can be arbitrarily apart (i.e.,absence of locality).

The best known algorithm, without usingduality, for this problem has time andspace complexities O(n2 log n) and O(n)respectively.(Edelsbrunner and Welzl, 1982).

Using duality, it is possible to improveupon the complexity.

Page 152: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Smallest Area Triangle Problem

The difficulty of the problem arises fromthe fact that the vertices of the smallesttriangle can be arbitrarily apart (i.e.,absence of locality).

The best known algorithm, without usingduality, for this problem has time andspace complexities O(n2 log n) and O(n)respectively.(Edelsbrunner and Welzl, 1982).

Using duality, it is possible to improveupon the complexity.

Page 153: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Assumption

The definition of duality implies that if two points pi and pj inthe primal plane have same x-coordinate values, thencorresponding duals Dpi and Dpj are parallel in the dual plane.

To avoid this we assume that no two points in P have samex-coordinates. This may possibly require rotating the axes bya small angle which can be determined in O(n log n) time.

Page 154: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Assumption

The definition of duality implies that if two points pi and pj inthe primal plane have same x-coordinate values, thencorresponding duals Dpi and Dpj are parallel in the dual plane.

To avoid this we assume that no two points in P have samex-coordinates. This may possibly require rotating the axes bya small angle which can be determined in O(n log n) time.

Page 155: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Sketch of the solution

Let h(i , j , k) be the perpendiculardistance from the point pk to the segmentpipj and let the line through pk that isparallel to pipj is l(i , j , k).

Smallest area triangle with pipj as anedge minimizes h(i , j , k) for all k 6= i , j ;1 ≤ k ≤ n.

Straight forward use of this scheme leadsto an O(n3) time algorithm.

However, when taken to dual plane, thisleads to efficient algorithm.

p_ip_j

p_k

h(i,j,k)

Page 156: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Sketch of the solution

Let h(i , j , k) be the perpendiculardistance from the point pk to the segmentpipj and let the line through pk that isparallel to pipj is l(i , j , k).

Smallest area triangle with pipj as anedge minimizes h(i , j , k) for all k 6= i , j ;1 ≤ k ≤ n.

Straight forward use of this scheme leadsto an O(n3) time algorithm.

However, when taken to dual plane, thisleads to efficient algorithm.

p_ip_j

p_k

h(i,j,k)

Page 157: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Sketch of the solution

Let h(i , j , k) be the perpendiculardistance from the point pk to the segmentpipj and let the line through pk that isparallel to pipj is l(i , j , k).

Smallest area triangle with pipj as anedge minimizes h(i , j , k) for all k 6= i , j ;1 ≤ k ≤ n.

Straight forward use of this scheme leadsto an O(n3) time algorithm.

However, when taken to dual plane, thisleads to efficient algorithm.

p_ip_j

p_k

h(i,j,k)

Page 158: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Sketch of the solution

Let h(i , j , k) be the perpendiculardistance from the point pk to the segmentpipj and let the line through pk that isparallel to pipj is l(i , j , k).

Smallest area triangle with pipj as anedge minimizes h(i , j , k) for all k 6= i , j ;1 ≤ k ≤ n.

Straight forward use of this scheme leadsto an O(n3) time algorithm.

However, when taken to dual plane, thisleads to efficient algorithm.

p_ip_j

p_k

h(i,j,k)

Page 159: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Dualization

In the dual plane, the edge pipj becomesthe intersection point I of Dpi and Dpj .

The line l(i , j , k) becomes the point onDpk

having same x-coordinate as I .

Expression for the vertical distanceh(i , j , k) between I and Dpk

is

h(i , j , k) = y(pk)+x(pk)[y(pj)− y(pi )] + x(pj)y(pi )− x(pi )y(pj)

x(pi )− x(pj)

Dpi

Dpj

Dpk

I

h(i,j,k)

Page 160: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Dualization

In the dual plane, the edge pipj becomesthe intersection point I of Dpi and Dpj .

The line l(i , j , k) becomes the point onDpk

having same x-coordinate as I .

Expression for the vertical distanceh(i , j , k) between I and Dpk

is

h(i , j , k) = y(pk)+x(pk)[y(pj)− y(pi )] + x(pj)y(pi )− x(pi )y(pj)

x(pi )− x(pj)

Dpi

Dpj

Dpk

I

h(i,j,k)

Page 161: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Dualization

In the dual plane, the edge pipj becomesthe intersection point I of Dpi and Dpj .

The line l(i , j , k) becomes the point onDpk

having same x-coordinate as I .

Expression for the vertical distanceh(i , j , k) between I and Dpk

is

h(i , j , k) = y(pk)+x(pk)[y(pj)− y(pi )] + x(pj)y(pi )− x(pi )y(pj)

x(pi )− x(pj)

Dpi

Dpj

Dpk

I

h(i,j,k)

Page 162: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

We use the plane sweep method. Basicsteps are as follows.

Sweep a vertical line over thearrangement of n lines in the dual plane.

Here event points are the intersectionpoints between pairs of lines.

When sweep line reaches an event point,the intersection point between Dpi andDpj say, compute the vertical distances,along the sweep line, between the eventpoint and the lines just above and belowit.

Let the minimum distance occurs for theline Dpk

. Compute the minimum area ofthe triangle with pipj as base.

Page 163: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

We use the plane sweep method. Basicsteps are as follows.

Sweep a vertical line over thearrangement of n lines in the dual plane.

Here event points are the intersectionpoints between pairs of lines.

When sweep line reaches an event point,the intersection point between Dpi andDpj say, compute the vertical distances,along the sweep line, between the eventpoint and the lines just above and belowit.

Let the minimum distance occurs for theline Dpk

. Compute the minimum area ofthe triangle with pipj as base.

Page 164: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

We use the plane sweep method. Basicsteps are as follows.

Sweep a vertical line over thearrangement of n lines in the dual plane.

Here event points are the intersectionpoints between pairs of lines.

When sweep line reaches an event point,the intersection point between Dpi andDpj say, compute the vertical distances,along the sweep line, between the eventpoint and the lines just above and belowit.

Let the minimum distance occurs for theline Dpk

. Compute the minimum area ofthe triangle with pipj as base.

Page 165: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

We use the plane sweep method. Basicsteps are as follows.

Sweep a vertical line over thearrangement of n lines in the dual plane.

Here event points are the intersectionpoints between pairs of lines.

When sweep line reaches an event point,the intersection point between Dpi andDpj say, compute the vertical distances,along the sweep line, between the eventpoint and the lines just above and belowit.

Let the minimum distance occurs for theline Dpk

. Compute the minimum area ofthe triangle with pipj as base.

habove

hbelow

Page 166: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Algorithm

We use the plane sweep method. Basicsteps are as follows.

Sweep a vertical line over thearrangement of n lines in the dual plane.

Here event points are the intersectionpoints between pairs of lines.

When sweep line reaches an event point,the intersection point between Dpi andDpj say, compute the vertical distances,along the sweep line, between the eventpoint and the lines just above and belowit.

Let the minimum distance occurs for theline Dpk

. Compute the minimum area ofthe triangle with pipj as base.

habove

hbelow

Page 167: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Observe that during sweep we need not store thearrangement. Moreover, at any instance, number of eventpoints stored in the event queue is O(n).

Hence space complexity of the algorithm is O(n).

Time complexity of the algorithm is, clearly, O(n2 log n).

The log n factor in the time complexity can be avoided byusing topological line sweep.(Edelsbrunner, H. and Guibas, L. J., 1989)

Page 168: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Observe that during sweep we need not store thearrangement. Moreover, at any instance, number of eventpoints stored in the event queue is O(n).

Hence space complexity of the algorithm is O(n).

Time complexity of the algorithm is, clearly, O(n2 log n).

The log n factor in the time complexity can be avoided byusing topological line sweep.(Edelsbrunner, H. and Guibas, L. J., 1989)

Page 169: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Observe that during sweep we need not store thearrangement. Moreover, at any instance, number of eventpoints stored in the event queue is O(n).

Hence space complexity of the algorithm is O(n).

Time complexity of the algorithm is, clearly, O(n2 log n).

The log n factor in the time complexity can be avoided byusing topological line sweep.(Edelsbrunner, H. and Guibas, L. J., 1989)

Page 170: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Observe that during sweep we need not store thearrangement. Moreover, at any instance, number of eventpoints stored in the event queue is O(n).

Hence space complexity of the algorithm is O(n).

Time complexity of the algorithm is, clearly, O(n2 log n).

The log n factor in the time complexity can be avoided byusing topological line sweep.(Edelsbrunner, H. and Guibas, L. J., 1989)

Page 171: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Outline

1 Introduction

2 Definition and Properties

3 Convex Hull

4 Arrangement of Lines

5 Smallest Area Triangle

6 Nearest Neighbor of a Line

Page 172: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Problem

Problem

Given a set P of n points in the plane and aquery line l , compute the nearest neighbor (inthe perpendicular distance sense) of the queryline l .

Page 173: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Problem

Problem

Given a set P of n points in the plane and aquery line l , compute the nearest neighbor (inthe perpendicular distance sense) of the queryline l .

l

Page 174: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Multi-shot Query

For a single query line, the problem can be solved in optimalO(n) time.

We are interested in multi-shot query version.

Here we are allowed to preprocess the point set so that eachquery can be answered efficiently.

Page 175: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Multi-shot Query

For a single query line, the problem can be solved in optimalO(n) time.

We are interested in multi-shot query version.

Here we are allowed to preprocess the point set so that eachquery can be answered efficiently.

Page 176: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Multi-shot Query

For a single query line, the problem can be solved in optimalO(n) time.

We are interested in multi-shot query version.

Here we are allowed to preprocess the point set so that eachquery can be answered efficiently.

Page 177: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Strategy

We use duality to solve the problem.

Since our definition of duality does not allow vertical line, weneed to have separate algorithm for handling vertical querylines.

Page 178: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Strategy

We use duality to solve the problem.

Since our definition of duality does not allow vertical line, weneed to have separate algorithm for handling vertical querylines.

Page 179: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Nearest Neighbor Query Vertical Line

Sort the points of the given set P on theirx-coordinates. This can be done inO(n log n) time using O(n) space.

Using binary search find the position ofthe query vertical line x = α in the sortedarray. This will take O(log n) time.

Then a pair of scan from α towards leftand right determine the nearest neighborin constant time.

x = α

Page 180: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Nearest Neighbor Query Vertical Line

Sort the points of the given set P on theirx-coordinates. This can be done inO(n log n) time using O(n) space.

Using binary search find the position ofthe query vertical line x = α in the sortedarray. This will take O(log n) time.

Then a pair of scan from α towards leftand right determine the nearest neighborin constant time.

x = α

Page 181: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Nearest Neighbor Query Vertical Line

Sort the points of the given set P on theirx-coordinates. This can be done inO(n log n) time using O(n) space.

Using binary search find the position ofthe query vertical line x = α in the sortedarray. This will take O(log n) time.

Then a pair of scan from α towards leftand right determine the nearest neighborin constant time.

x = α

Page 182: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Nearest Neighbor Query Vertical Line

Sort the points of the given set P on theirx-coordinates. This can be done inO(n log n) time using O(n) space.

Using binary search find the position ofthe query vertical line x = α in the sortedarray. This will take O(log n) time.

Then a pair of scan from α towards leftand right determine the nearest neighborin constant time.

x = α

Page 183: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor Vertical Query Line

Same scheme can also be used fordetermining the farthest neighbor of aquery vertical line.

Here a pair of scan from the end points ofthe array will determine the farthestneighbor of the query vertical line x = α.

x = α

Page 184: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor Vertical Query Line

Same scheme can also be used fordetermining the farthest neighbor of aquery vertical line.

Here a pair of scan from the end points ofthe array will determine the farthestneighbor of the query vertical line x = α.

x = α

Page 185: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor Vertical Query Line

Same scheme can also be used fordetermining the farthest neighbor of aquery vertical line.

Here a pair of scan from the end points ofthe array will determine the farthestneighbor of the query vertical line x = α.

x = α

Page 186: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor Vertical Query Line

Same scheme can also be used fordetermining the farthest neighbor of aquery vertical line.

Here a pair of scan from the end points ofthe array will determine the farthestneighbor of the query vertical line x = α.

x = α

Page 187: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Result

Lemma

With O(n log n) preprocessing time using O(n) space, nearest andfarthest neighbors of a query vertical line can be found in O(log n)time.

Page 188: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor of a Non-Vertical Query Line

Suppose the problem is to report the farthest neighbor of agiven query line which is non-vertical.

As the preprocessing step, compute the upper envelope andthe lower envelope of the set of lines dual to the given set ofpoints P. This can be done in in O(n log n) time using O(n)space as mentioned previously.

Page 189: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor of a Non-Vertical Query Line

Suppose the problem is to report the farthest neighbor of agiven query line which is non-vertical.

As the preprocessing step, compute the upper envelope andthe lower envelope of the set of lines dual to the given set ofpoints P. This can be done in in O(n log n) time using O(n)space as mentioned previously.

Page 190: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor of a Non-Vertical Query Line

Let Eu and El are the arrays storing theupper and the lower envelops respectively.

Given a query line l , shoot a vertical rayfrom the point Dl in upward anddownward direction and find theintersection points with the upper and thelower envelope respectively.

This can be done in O(log n) time byusing two binary searches on the arrays Eu

and El holding the envelopes.

Page 191: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor of a Non-Vertical Query Line

Let Eu and El are the arrays storing theupper and the lower envelops respectively.

Given a query line l , shoot a vertical rayfrom the point Dl in upward anddownward direction and find theintersection points with the upper and thelower envelope respectively.

This can be done in O(log n) time byusing two binary searches on the arrays Eu

and El holding the envelopes.

Page 192: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Farthest Neighbor of a Non-Vertical Query Line

Let Eu and El are the arrays storing theupper and the lower envelops respectively.

Given a query line l , shoot a vertical rayfrom the point Dl in upward anddownward direction and find theintersection points with the upper and thelower envelope respectively.

This can be done in O(log n) time byusing two binary searches on the arrays Eu

and El holding the envelopes.

Page 193: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Result

Lemma

With O(n log n) preprocessing time using O(n) space, farthestneighbors of a query non-vertical line can be found in O(log n)time.

Page 194: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Nearest Neighbor of a Query Non-vertical Line

Let L be the set of lines which are dual tothe points of the given set P. Also let Dl

be the point dual to to the querynon-vertical line l .

Let A(L) be the arrangement of lines ofthe set L.

Let f be the cell of the arrangement A(L)containing Dl .

Then one of the points corresponding tothe lines just above Dl is the nearestneighbor of l in the primal plane.

Page 195: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Nearest Neighbor of a Query Non-vertical Line

Let L be the set of lines which are dual tothe points of the given set P. Also let Dl

be the point dual to to the querynon-vertical line l .

Let A(L) be the arrangement of lines ofthe set L.

Let f be the cell of the arrangement A(L)containing Dl .

Then one of the points corresponding tothe lines just above Dl is the nearestneighbor of l in the primal plane.

Page 196: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Nearest Neighbor of a Query Non-vertical Line

Let L be the set of lines which are dual tothe points of the given set P. Also let Dl

be the point dual to to the querynon-vertical line l .

Let A(L) be the arrangement of lines ofthe set L.

Let f be the cell of the arrangement A(L)containing Dl .

Then one of the points corresponding tothe lines just above Dl is the nearestneighbor of l in the primal plane.

Page 197: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Nearest Neighbor of a Query Non-vertical Line

Let L be the set of lines which are dual tothe points of the given set P. Also let Dl

be the point dual to to the querynon-vertical line l .

Let A(L) be the arrangement of lines ofthe set L.

Let f be the cell of the arrangement A(L)containing Dl .

Then one of the points corresponding tothe lines just above Dl is the nearestneighbor of l in the primal plane.

Dl

Page 198: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Problem

Given an arrangement of lines A(L), the problem of findingthe component of A(L) containing a given query point p isknown as point location problem in computational geometry.

With standard data structure for storing an arrangement oflines, point location problem can be solved in optimalO(log n) time.

So with standard data structure, nearest neighbors of anon-vertical query line can be determined in O(log n) time.The reqired preprocessing time and space is O(n2).

Here we describe an algorithm for point location using levelsof arrangement.

Page 199: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Problem

Given an arrangement of lines A(L), the problem of findingthe component of A(L) containing a given query point p isknown as point location problem in computational geometry.

With standard data structure for storing an arrangement oflines, point location problem can be solved in optimalO(log n) time.

So with standard data structure, nearest neighbors of anon-vertical query line can be determined in O(log n) time.The reqired preprocessing time and space is O(n2).

Here we describe an algorithm for point location using levelsof arrangement.

Page 200: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Problem

Given an arrangement of lines A(L), the problem of findingthe component of A(L) containing a given query point p isknown as point location problem in computational geometry.

With standard data structure for storing an arrangement oflines, point location problem can be solved in optimalO(log n) time.

So with standard data structure, nearest neighbors of anon-vertical query line can be determined in O(log n) time.The reqired preprocessing time and space is O(n2).

Here we describe an algorithm for point location using levelsof arrangement.

Page 201: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Problem

Given an arrangement of lines A(L), the problem of findingthe component of A(L) containing a given query point p isknown as point location problem in computational geometry.

With standard data structure for storing an arrangement oflines, point location problem can be solved in optimalO(log n) time.

So with standard data structure, nearest neighbors of anon-vertical query line can be determined in O(log n) time.The reqired preprocessing time and space is O(n2).

Here we describe an algorithm for point location using levelsof arrangement.

Page 202: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Using Level Structure

First compute the levels of thearrangement A(L) in O(n2 log n) timeusing O(n2) space.

Let λθ be the linear array containingvertices and edges of level θ,θ = 0, 1, . . . , n, of the arrangement A(L).

Create a balanced binary search tree T ,called the primary structure, whose nodescorrespond to the levels θ, 0 ≤ θ ≤ n.Each node of T , representing a level θ, isattached with the corresponding array λθ,called the secondary structure. Thisrequires O(n log n) time and O(n) space.

λ 0

λ 1

λ 2

λ 3

λ 4λ 5

T

Page 203: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Using Level Structure

First compute the levels of thearrangement A(L) in O(n2 log n) timeusing O(n2) space.

Let λθ be the linear array containingvertices and edges of level θ,θ = 0, 1, . . . , n, of the arrangement A(L).

Create a balanced binary search tree T ,called the primary structure, whose nodescorrespond to the levels θ, 0 ≤ θ ≤ n.Each node of T , representing a level θ, isattached with the corresponding array λθ,called the secondary structure. Thisrequires O(n log n) time and O(n) space.

λ 0

λ 1

λ 2

λ 3

λ 4λ 5

T

Page 204: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Using Level Structure

Given the query line l , we perform twolevel binary search on the tree T with thepoint Dl .

This will enable us to locate the twoedges just above and below Dl .

Time complexity for performing this pointlocation is O(log2 n).

λ 0

λ 1

λ 2

λ 3

λ 4λ 5

T

Page 205: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Using Level Structure

Given the query line l , we perform twolevel binary search on the tree T with thepoint Dl .

This will enable us to locate the twoedges just above and below Dl .

Time complexity for performing this pointlocation is O(log2 n).

λ 0

λ 1

λ 2

λ 3

λ 4λ 5

T

Page 206: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Point Location Using Level Structure

Given the query line l , we perform twolevel binary search on the tree T with thepoint Dl .

This will enable us to locate the twoedges just above and below Dl .

Time complexity for performing this pointlocation is O(log2 n).

λ 0

λ 1

λ 2

λ 3

λ 4λ 5

T

Page 207: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Lemma

With O(n2 log n) preprocessing time and O(n2) space, nearestneighbor of a non-vertical query line can be determined inO(log2 n) time.

It may be mentioned that the query time complexity can bereduced to O(log n), by using a data structuring technique,called fractional cascading.(Lueker, G. S., 1978)

Page 208: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Complexity

Lemma

With O(n2 log n) preprocessing time and O(n2) space, nearestneighbor of a non-vertical query line can be determined inO(log2 n) time.

It may be mentioned that the query time complexity can bereduced to O(log n), by using a data structuring technique,called fractional cascading.(Lueker, G. S., 1978)

Page 209: Duality Transformation and its Applications to Computational Geometry

Introduction Definitions Hull Arrangement Triangle Nearest Neighbor

Thank you!