Realms

A

Foundation

for

Spatial

Data

Types

in

Database

Ralf

Hartmut

G?ting

Markus

Schneider

Praktische

Informatik

IV

FernUniversit?t

Hagen

Postfach

Hagen

Germany

gueting@fernuni-hagen.de,

schneide@fernuni-hagen.de

Abstract

Spatial

data

types

or

algebras

for

database

systems

should

-LRB-

i

-RRB-

be

fully

general

-LRB-

which

means

closed

under

set

operations

hence

e.g.

a

region

value

can

be

a

set

of

polygons

with

holes

-RRB-

-LRB-

ii

-RRB-

have

formally

defined

semantics

-LRB-

iii

-RRB-

be

defined

in

terms

of

finite

representations

available

in

computers

-LRB-

iv

-RRB-

offer

facilities

to

enforce

geometric

consistency

of

related

spatial

objects

and

-LRB-

v

-RRB-

be

independent

of

a

particular

DBMS

data

model

but

cooperate

with

any

We

offer

such

a

definition

in

two

papers

The

central

idea

introduced

in

this

-LRB-

first

-RRB-

paper

is

to

use

realms

as

geometric

domains

underlying

spatial

data

types

A

realm

as

a

general

database

concept

is

a

finite

dynamic

user-defined

structure

underlying

one

or

more

system

data

types

A

geometric

realm

defined

here

is

a

planar

graph

over

a

finite

resolution

grid

Problems

of

numerical

robustness

and

topological

correctness

are

solved

below

and

within

the

realm

layer

so

that

spatial

algebras

defined

above

a

realm

enjoy

very

nice

algebraic

properties

Realms

also

interact

with

a

DBMS

to

enforce

geometric

consistency

on

object

creation

or

update

This

work

was

supported

by

the

DFG

-LRB-

Deutsche

Forschungsgemeinschaft

-RRB-

under

grant

Gu

Introduction

We

consider

a

spatial

database

system

to

be

a

full-fledged

DBMS

with

additional

capabilities

for

the

representation

and

manipulation

of

geometric

data

As

such

it

provides

the

database

technology

needed

to

support

applications

such

as

geographic

information

systems

The

standard

DBMS

view

for

the

organization

of

spatial

information

is

the

following

A

database

consists

of

several

classes

of

objects

A

spatial

object

is

just

an

object

with

an

associated

value

-LRB-

attribute

-RRB-

of

a

spatial

data

type

such

as

for

example

POINT

LINE

or

REGION

This

is

true

regardless

of

whether

the

DBMS

uses

a

relational

complex

object

object-oriented

or

some

other

data

model

Hence

the

definition

and

implementation

of

spatial

data

types

is

probably

the

most

fundamental

issue

in

the

development

of

spatial

database

systems

Although

spatial

data

types

-LRB-

SDTs

-RRB-

are

used

routinely

in

the

description

of

spatial

query

languages

-LRB-

e.g.

-LSB-

-RSB-

-RRB-

have

been

implemented

in

some

prototype

systems

-LRB-

e.g.

-LSB-

G

-RSB-

-RRB-

and

some

formal

definitions

have

been

given

-LSB-

G

-RSB-

there

is

still

no

completely

satisfactory

solution

available

according

to

the

following

criteria

Generality

The

geometric

objects

used

as

SDT

values

should

be

as

general

as

possible

For

example

a

region

value

should

be

able

to

represent

a

collection

of

disjoint

areas

each

of

which

may

have

holes

More

precisely

this

means

that

the

domains

of

data

types

POINT

LINE

and

REGION

must

be

closed

under

union

intersection

and

difference

of

their

underlying

point

sets

This

allows

for

the

definition

of

powerful

data

type

operations

with

nice

closure

properties

Rigorous

definition

The

semantics

of

SDTs

that

is

the

possible

values

for

the

types

and

the

functions

associated

with

the

operations

must

be

defined

formally

to

avoid

ambiguities

for

the

user

and

the

implementor

Finite

resolution

The

formal

definitions

must

take

into

account

the

finite

representations

available

in

computers

This

has

so

far

been

neglected

in

definitions

of

SDTs

It

is

left

to

the

programmer

to

close

this

gap

between

theory

and

practice

which

leads

rather

inevitably

not

only

to

numerical

but

also

topological

errors

Treatment

of

geometric

consistency

Distinct

spatial

objects

may

be

related

through

geometric

consistency

constraints

-LRB-

e.g.

adjacent

regions

have

a

common

boundary

-RRB-

The

definition

of

SDTs

must

offer

facilities

to

enforce

such

consistency

General

object

model

interface

Spatial

data

types

as

such

are

rather

useless

they

need

to

be

integrated

into

a

DBMS

data

model

and

query

language

However

a

definition

of

SDTs

should

be

valid

regardless

of

a

particular

DBMS

data

model

and

therefore

not

depend

on

it

Instead

the

SDT

definition

should

be

based

on

an

abstract

interface

to

the

DBMS

data

model

which

we

call

the

object

model

interface

The

purpose

of

this

paper

-LRB-

together

with

a

companion

paper

-RRB-

is

to

develop

a

formal

definition

of

spatial

data

types

fulfilling

these

criteria

The

central

idea

is

to

introduce

into

the

DBMS

the

concept

of

a

realm

A

realm

is

in

general

a

finite

user

defined

structure

that

is

used

as

a

basis

for

one

or

more

system

data

types

Realms

are

somewhat

similar

to

enumeration

types

in

programming

languages

A

This

also

holds

for

the

implementation

level

A

spatial

type

extension

package

-LRB-

STEP

-RRB-

should

be

able

to

cooperate

with

any

extensible

DBMS

offering

a

suitable

interface

regardless

of

its

data

model

realm

used

as

a

basis

for

spatial

data

types

is

essentially

a

finite

set

of

points

and

non-intersecting

line

segments

Intuitively

it

describes

the

complete

underlying

geometry

of

an

application

All

points

lines

and

regions

associated

with

objects

-LRB-

from

now

on

called

spatial

attribute

values

-RRB-

can

be

defined

in

terms

of

points

and

line

segments

present

in

the

realm

In

fact

in

a

database

spatial

attribute

values

are

then

never

created

directly

but

only

by

selecting

some

realm

objects

They

are

never

updated

directly

Instead

updates

are

performed

on

the

realm

and

from

there

propagated

to

the

dependent

attribute

values

Hence

all

attribute

values

occurring

in

a

database

are

realm-based

Furthermore

the

algebraic

operations

for

the

spatial

data

types

are

defined

to

construct

only

geometric

objects

that

are

realmbased

as

well

So

the

spatial

algebra

is

closed

with

respect

to

a

given

realm

This

means

in

particular

that

no

two

values

of

spatial

data

types

occurring

in

geometric

computation

have

proper

intersections

of

line

segments

Instead

two

initially

intersecting

segments

have

already

been

split

at

the

intersection

point

when

they

were

entered

into

the

realm

One

could

say

that

any

two

intersecting

SDT

values

-LRB-

say

lines

or

regions

-RRB-

have

become

acquainted

already

when

they

were

entered

into

the

realm

This

is

a

crucial

property

for

the

correct

and

efficient

implementation

of

geometric

operations

Realm

objects

points

and

segments

are

defined

not

in

abstract

Euclidean

space

but

in

terms

of

finite

representations

All

geometric

primitives

and

realm

operations

-LRB-

e.g.

updates

-RRB-

are

defined

in

error-free

integer

arithmetic

For

mapping

an

application?s

set

of

intersecting

line

segments

into

a

realm?s

set

of

non-intersecting

segments

the

concept

of

redrawing

and

finite

resolution

geometry

from

-LSB-

-RSB-

is

used

Although

intersection

points

computed

with

finite

resolution

in

general

move

away

from

their

exact

Euclidean

position

this

concept

ensures

that

the

unavoidable

distortion

of

geometry

-LRB-

that

is

the

numerical

error

-RRB-

remains

bounded

and

very

small

and

that

no

topological

errors

occur

This

means

that

a

programmer

has

a

precise

specification

that

directly

lends

itself

to

a

correct

implementation

It

also

means

that

the

spatial

algebra

obeys

algebraic

laws

precisely

in

theory

as

well

as

in

practice

Furthermore

it

is

rather

obvious

that

realms

also

solve

the

geometric

consistency

problem

Most

closely

related

to

this

work

are

the

formal

definitions

of

spatial

data

types

-LRB-

or

algebras

-RRB-

given

by

G?ting

-LSB-

G

G

-RSB-

Scholl

and

Voisard

-LSB-

-RSB-

and

Gargano

et

al.

-LSB-

-RSB-

All

of

these

proposals

do

not

fulfill

most

of

the

criteria

given

above

In

-LSB-

G

G

-RSB-

data

types

for

points

lines

and

regions

are

available

but

too

restricted

e.g.

a

region

is

a

single

simple

polygon

-LRB-

without

holes

-RRB-

In

-LSB-

-RSB-

general

regions

are

defined

in

Voisard?s

thesis

-LSB-

-RSB-

this

has

been

extended

to

general

types

for

points

and

lines

However

the

definitions

are

unnecessarily

complex

In

-LSB-

-RSB-

there

is

only

a

single

type

for

all

kinds

of

geometric

objects

a

value

is

essentially

a

set

of

sets

of

pixels

We

feel

this

is

not

sufficient

since

many

interesting

spatial

operations

can

not

be

expressed

As

mentioned

all

of

these

proposals

give

formal

definitions

However

those

of

G?ting

and

of

Scholl

and

Voisard

are

not

based

on

finite

resolution

hence

the

numeric

correctness

problems

are

not

addressed

Gargano

et

al.

base

their

definitions

in

principle

on

a

finite

underlying

set

-LRB-

of

pixels

-RRB-

But

this

is

not

practical

since

these

finite

representations

are

far

too

large

to

be

efficiently

manageable

The

geometric

consistency

problem

is

not

solved

in

any

of

these

proposals

there

is

some

weak

support

in

-LSB-

G

-RSB-

through

an

AREA

data

type

but

it

is

not

sufficient

Finally

all

three

proposals

have

connected

their

spatial

types

to

a

fixed

data

model

G?ting

and

Gargano

et

al.

to

the

relational

model

See

the

discussion

in

Sections

and

and

Scholl

and

Voisard

to

a

complex

object

algebra

-LSB-

-RSB-

Only

Scholl

and

Voisard

emphasize

a

clean

interface

between

the

spatial

algebra

and

the

general

object

model

We

shall

extend

their

work

by

offering

an

abstract

interface

not

dependent

on

any

particular

data

model

The

topological

data

model

based

on

simplicial

complexes

suggested

by

Egenhofer

et

al.

-LSB-

-RSB-

has

a

similar

purpose

as

our

concept

of

realms

Essentially

they

offer

an

irregular

triangular

network

partition

of

the

plane

as

a

geometric

domain

over

which

spatial

objects

could

be

defined

However

the

connections

are

missing

to

the

underlying

finite

arithmetic

as

well

as

to

spatial

data

types

based

on

this

model

Also

in

our

view

a

triangular

partition

contains

too

much

information

it

is

sufficient

to

keep

those

points

and

segments

in

a

geometric

domain

that

are

needed

for

spatial

attribute

values

Finally

their

model

is

an

abstract

one

whereas

we

show

realms

within

a

database

context

Our

description

and

formal

development

of

realm-based

spatial

data

types

is

given

in

two

papers

In

this

paper

the

lower

layers

namely

numerically

robust

geometric

primitives

realms

and

their

operations

and

the

structure

of

values

of

the

spatial

data

types

are

defined

In

-LSB-

-RSB-

the

object

model

interface

and

the

spatial

data

types

and

operations

that

is

the

spatial

algebra

are

described

In

the

following

section

we

first

provide

an

informal

overview

of

the

complete

concept

Overview

Realm-Based

Spatial

Data

Types

A

realm

is

a

set

of

points

and

non-intersecting

line

segments

over

a

discrete

domain

that

is

a

grid

as

shown

in

Figure

Values

of

spatial

data

types

can

be

composed

from

the

objects

present

in

a

realm

Figure

shows

some

values

definable

over

the

realm

of

Figure

Our

realm-based

spatial

data

types

are

called

POINTS

LINES

and

REGIONS

hence

A

and

B

represent

REGIONS

values

C

is

a

LINES

value

and

D

a

POINTS

value

The

precise

structure

of

these

values

is

not

yet

relevant

here

One

can

imagine

A

and

B

to

belong

to

two

adjacent

countries

C

to

represent

a

river

and

D

a

city

The

underlying

grid

of

a

realm

arises

simply

from

the

fact

that

numbers

have

a

finite

representation

in

computer

memory

In

practice

these

representations

will

be

of

fixed

length

and

correspond

to

INTEGER

or

REAL

data

types

available

in

programming

languages

Of

course

the

resolution

will

be

much

finer

than

could

be

shown

in

Figure

Figure

The

concept

of

realm

as

a

basis

of

spatial

data

types

serves

the

following

purposes

It

enforces

geometric

consistency

of

related

spatial

objects

For

example

the

common

part

of

the

borders

of

countries

A

and

B

is

exactly

the

same

for

both

objects

It

guarantees

nice

closure

properties

for

the

computation

with

spatial

data

types

above

the

realm

For

example

the

intersection

of

region

B

with

line

C

-LRB-

the

part

of

river

C

lying

within

country

B

-RRB-

is

also

a

realm-based

LINES

value

It

shields

geometric

computation

in

query

processing

from

numeric

correctness

and

robustness

problems

This

is

because

such

problems

arise

essentially

from

the

computation

of

intersection

points

of

line

segments

which

normally

do

not

lie

on

the

grid

With

realmbased

SDTs

there

are

never

any

new

intersection

points

computed

in

query

processing

Instead

the

numeric

problems

are

treated

below

the

realm

level

namely

whenever

updates

are

made

to

a

realm

Additionally

a

data

structure

representing

a

realm

can

be

used

as

an

index

into

the

database

Our

implementation

concept

assumes

that

each

point

and

segment

in

a

realm

has

an

associated

list

of

logical

pointers

to

the

spatial

attribute

values

defined

over

it

in

the

database

Let

us

now

focus

on

the

treatment

of

numeric

correctness

problems

below

and

within

the

realm

level

This

is

necessary

because

geometric

data

coming

from

the

application

are

not

intersection-free

as

required

for

a

realm

Application

data

can

at

the

lowest

level

of

abstraction

be

viewed

as

a

set

of

points

and

intersecting

line

segments

These

need

to

be

transformed

into

a

realm

As

mentioned

before

the

fundamental

problem

is

that

intersection

points

usually

do

not

lie

on

the

grid

In

Figure

the

intersection

point

D

of

line

segments

A

and

B

will

be

moved

to

the

closest

grid

point

D

This

leads

for

example

to

the

following

topological

errors

-LRB-

-RRB-

A

test

whether

D

lies

on

A

or

B

A

B

C

D

Figure

B

A

B

D

A

D

D

Figure

Figure

fails

-LRB-

-RRB-

A

test

whether

D

lies

properly

within

some

area

defined

below

A

and

B

will

incorrectly

yield

true

-LRB-

-RRB-

If

there

is

another

segment

C

between

the

true

intersection

point

and

D

D

will

be

reported

to

lie

on

the

wrong

side

of

C

The

basic

idea

to

avoid

these

errors

is

to

slightly

change

segments

A

and

B

by

transforming

them

into

chains

of

segments

going

through

D

as

shown

in

Figure

However

this

does

not

suffice

since

it

allows

a

segment

to

drift

-LRB-

through

a

series

of

intersections

-RRB-

by

an

arbitrary

distance

from

its

original

position

For

example

a

further

intersection

of

A

with

some

segment

C

-LRB-

Figure

-RRB-

is

resolved

as

shown

in

Figure

where

intersection

point

E

has

already

a

considerable

distance

from

the

true

intersection

point

of

A

and

C.

Note

in

particular

that

segment

A

has

in

Figure

been

moved

to

the

other

side

of

a

grid

point

-LRB-

indicated

by

the

arrow

-RRB-

which

may

later

be

reported

to

lie

on

the

wrong

side

of

A

A

refined

solution

was

proposed

by

Greene

and

Yao

-LSB-

-RSB-

The

idea

is

to

define

for

a

segment

s

an

envelope

E

-LRB-

s

-RRB-

roughly

as

the

collection

of

grid

points

that

are

immediately

above

below

or

on

s

An

intersection

of

s

with

some

other

segment

may

lead

to

a

requirement

that

s

should

pass

through

some

point

P

on

its

envelope

-LRB-

the

grid

point

closest

to

the

true

intersection

point

-RRB-

This

requirement

is

then

fulfilled

by

redrawing

s

by

some

polygonal

line

within

the

envelope

rather

than

by

simply

connecting

P

with

the

start

and

end

points

of

s.

Figure

shows

a

segment

s

-LRB-

drawn

fat

-RRB-

together

with

the

grid

points

of

its

envelope

Slightly

above

s

a

redrawing

of

s

through

P

is

shown

Intuitively

the

process

of

redrawing

can

be

understood

as

follows

Think

of

segment

s

as

a

rubber

band

and

the

points

of

the

envelope

as

nails

on

a

board

Now

grip

s

at

the

true

intersection

point

and

pull

it

around

P

The

resulting

polygonal

path

is

the

redrawing

The

number

of

segments

of

this

path

is

in

the

worst

case

logarithmic

in

the

size

of

the

grid

but

it

seems

that

in

most

cases

only

very

few

segments

are

created

This

approach

guarantees

that

the

polygonal

line

describing

a

segment

always

remains

within

the

envelope

of

the

original

segment

We

adopt

the

technique

for

realms

It

then

means

that

by

redrawing

a

segment

can

never

drift

to

the

other

side

of

a

realm

point

It

might

still

happen

though

that

after

a

redrawing

a

realm

point

is

found

to

lie

on

a

segment

which

it

did

not

originally

C

C

B

A

B

A

D

D

E

E

Figure

Figure

s

P

Figure

The

formal

definition

of

realm-based

SDTs

is

organized

as

a

series

of

layers

Each

layer

defines

its

own

structures

and

primitives

using

the

notions

of

the

layers

below

We

describe

these

layers

bottom-up

in

the

rest

of

this

paper

and

the

companion

paper

-LSB-

-RSB-

Let

us

briefly

provide

an

overview

of

this

development

Robust

geometric

primitives

are

introduced

in

Section

-LRB-

and

an

appendix

-RRB-

This

lowest

layer

defines

a

discrete

space

N

N

where

N

-LCB-

n

-RCB-

is

a

subset

of

the

natural

numbers

The

objects

in

this

space

are

points

and

line

segments

with

coordinates

in

N

called

N-points

and

N-segments

A

number

of

operations

-LRB-

predicates

-RRB-

such

as

whether

an

N-point

lies

on

an

N-segment

or

whether

two

N-segments

intersect

and

which

N-point

is

the

result

of

intersecting

two

N-segments

are

defined

The

crucial

point

is

that

these

definitions

are

given

in

terms

of

error-free

integer

arithmetic

hence

they

are

directly

implementable

In

Section

geometric

realms

are

defined

as

described

above

elements

are

called

R-points

and

R-segments

Basic

operations

on

realms

-LRB-

given

in

Section

-RRB-

are

insertion

and

deletion

of

N-points

and

N-segments

However

to

cooperate

with

a

database

system

a

realm

as

an

abstract

data

type

has

a

more

general

interface

For

example

the

operation

of

inserting

an

N-segment

returns

besides

a

modified

realm

a

redrawing

of

the

inserted

segment

and

a

set

of

redrawings

of

segments

in

the

database

that

need

to

be

modified

together

with

logical

pointers

-LRB-

SCIDs

spatial

component

identifiers

-RRB-

to

database

representations

of

these

segments

The

management

of

identifiers

makes

it

necessary

to

offer

operations

that

register

spatial

attribute

values

in

the

database

with

their

underlying

realm

objects

A

last

group

of

operations

allows

to

get

a

set

of

realm

objects

-LRB-

within

a

rectangular

window

-RRB-

and

to

identify

objects

when

a

close

N-point

is

given

This

makes

it

possible

to

display

parts

of

a

realm

at

a

DBMS

graphical

user

interface

and

to

let

a

user

build

spatial

attribute

values

by

clicking

at

realm

objects

displayed

The

next

layer

-LRB-

Section

-RRB-

defines

certain

structures

present

in

a

realm

that

serve

as

a

basis

for

the

definition

of

SDTs

A

realm

can

be

viewed

as

a

planar

graph

an

R-cycle

is

a

cycle

of

this

graph

An

R-face

is

an

R-cycle

possibly

enclosing

some

other

disjoint

R-cycles

corresponding

to

a

region

with

holes

An

R-unit

is

a

minimal

R-face

These

three

notions

support

the

definition

of

a

REGIONS

data

type

An

R-block

is

a

connected

component

of

the

realm

graph

it

supports

the

definition

of

a

LINES

data

type

For

all

of

these

structures

there

are

also

predicates

defined

to

describe

their

possible

relationships

After

these

preparations

in

the

next

layer

-LRB-

Section

-RRB-

the

domains

of

spatial

data

types

POINTS

LINES

and

REGIONS

are

defined

A

POINTS

value

is

a

set

of

R-points

There

are

two

alternative

views

of

LINES

and

REGIONS

The

first

is

that

a

LINES

value

is

a

set

of

R-segments

and

a

regions

value

a

set

of

R-units

The

other

view

is

equivalent

but

semantically

richer

A

lines

value

is

a

set

of

disjoint

R-blocks

and

a

regions

value

a

set

of

-LRB-

edge

-RRB-

disjoint

R-faces

This

completes

the

scope

of

this

paper

In

the

companion

paper

-LSB-

-RSB-

first

the

notion

of

properties

of

collections

of

values

is

introduced

The

purpose

is

to

support

notions

such

as

a

map

which

is

essentially

a

set

of

objects

whose

REGIONS

attribute

values

are

disjoint

One

would

like

to

identify

such

constraints

and

to

use

them

for

the

definition

of

algebra

operations

e.g.

map

overlay

Next

the

object

model

interface

-LRB-

OMI

-RRB-

is

defined

We

identify

a

number

of

concepts

that

need

to

be

present

in

the

DBMS

data

-LRB-

or

object

-RRB-

model

to

allow

it

to

cooperate

with

our

spatial

algebra

For

example

the

OMI

must

offer

a

function

that

yields

for

a

given

object

an

associated

SDT

value

operations

to

form

aggregates

of

objects

or

to

group

sets

of

objects

by

attribute

values

-LRB-

which

in

connection

with

the

spatial

algebra

allows

to

realize

a

fusion

operation

-LSB-

-RSB-

-RRB-

The

corresponding

idea

at

the

system

level

is

that

any

extensible

database

system

offering

an

OMI

implementation

can

cooperate

with

a

spatial

type

extension

package

-LRB-

STEP

-RRB-

realizing

the

spatial

algebra

Finally

the

spatial

algebra

itself

is

described

the

semantics

of

all

operations

are

formally

defined

Due

to

the

underlying

realms

this

algebra

has

simple

and

powerful

operations

nice

closure

properties

and

observes

a

number

of

algebraic

laws

It

is

straightforward

to

implement

this

algebra

in

such

a

way

that

the

laws

do

also

hold

in

practice

Robust

Geometric

Primitives

The

bottom

layer

of

the

formal

development

introduces

a

finite

discrete

space

points

and

line

segments

over

this

space

and

some

simple

predicates

and

operations

on

them

Let

N

-LCB-

n

-RCB-

N

An

N-point

is

a

pair

-LRB-

x

y

-RRB-

N

N

An

N-segment

is

a

pair

of

distinct

N

points

-LRB-

p

q

-RRB-

PN

denotes

the

set

of

all

N-points

and

SN

the

set

of

all

N-segments

We

introduce

the

primitives

shown

in

Figure

on

N-points

and

N-segments

In

this

graph

representation

undirected

edges

denote

predicates

and

directed

edges

other

operations

-LRB-

here

intersection

takes

two

N-segments

and

returns

an

N-point

-RRB-

In

the

appendix

these

operations

are

defined

in

terms

of

integer

arithmetic

Therefore

they

have

a

straightforward

implementation

free

of

numerical

errors

We

briefly

explain

them

informally

here

Two

N-segments

meet

if

they

have

exactly

one

end

point

in

common

They

overlap

if

they

are

collinear

and

share

a

-LRB-

partial

-RRB-

N-segment

If

they

are

collinear

and

do

not

share

a

-LRB-

partial

-RRB-

N-segment

we

call

them

aligned

If

they

have

exactly

one

common

point

but

do

not

meet

they

intersect

If

they

have

the

same

slope

they

are

parallel

They

are

disjoint

if

they

are

neither

equal

nor

meet

nor

intersect

The

on

primitive

tests

if

an

N-point

lies

on

an

N-segment

the

in

primitive

does

nearly

the

same

but

the

N-point

must

not

coincide

with

one

of

the

end

points

of

the

N-segment

The

intersection

primitive

calculates

the

intersection

point

of

two

N-segments

and

rounds

it

to

the

nearest

N-point

Realms

Given

N

a

realm

over

N

or

N-realm

for

short

is

a

set

R

P

S

such

that

-LRB-

i

-RRB-

P

PN

S

SN

-LRB-

ii

-RRB-

s

S

s

-LRB-

p

q

-RRB-

fi

p

P

q

P

-LRB-

iii

-RRB-

p

P

s

S

-LRB-

p

in

s

-RRB-

-LRB-

iv

-RRB-

s

t

S

-LRB-

s

t

-RRB-

-LRB-

s

and

t

intersect

-RRB-

-LRB-

s

and

t

overlap

-RRB-

N-point

on

in

N-segment

intersection

intersect

parallel

overlap

aligned

meet

disjoint

Figure

The

elements

of

P

and

S

are

called

R-points

and

R-segments

There

is

an

obvious

interpretation

of

a

realm

as

a

spatially

embedded

planar

graph

with

set

of

nodes

P

and

set

of

edges

S.

Operations

on

Realms

The

Realm

Interface

Obviously

the

fundamental

operations

on

realms

are

the

insertion

of

an

N-point

or

N-segment

and

the

deletion

of

an

R-point

or

R-segment

However

the

interface

is

a

bit

more

complex

since

we

study

realms

not

just

as

abstract

entities

but

in

connection

with

spatial

databases

That

means

that

there

are

spatial

attribute

values

in

the

database

depending

on

realm

objects

This

dependency

needs

to

be

modeled

and

treated

by

the

operations

Our

approach

to

implement

the

dependency

is

the

following

We

assume

that

-LRB-

the

geometry

of

-RRB-

a

spatial

attribute

value

of

some

object

is

stored

together

with

the

object

in

the

database

and

there

is

a

logical

pointer

from

each

segment

or

point

describing

the

spatial

value

to

the

underlying

realm

object

Furthermore

associated

with

each

realm

object

-LRB-

point

or

segment

-RRB-

is

a

set

of

logical

pointers

one

pointer

to

each

corresponding

component

of

a

spatial

value

in

the

database

In

other

words

points

and

segments

in

the

database

are

doubly

linked

with

the

corresponding

points

and

segments

in

the

realm

Pointers

from

the

database

into

the

realm

are

realized

by

realm

object

identifiers

from

a

set

ROID

pointers

from

the

realm

into

the

database

by

spatial

component

identifiers

from

a

set

SCID

It

is

assumed

that

each

roid

or

scid

uniquely

identifies

the

corresponding

entity

and

that

the

implementation

guarantees

fast

access

to

these

components

Additionally

a

scid

also

identifies

the

spatial

value

as

a

whole

This

approach

stores

geometries

redundantly

with

a

database

object

and

in

the

realm

One

might

save

some

space

by

representing

attribute

values

just

by

structures

composed

of

pointers

to

realm

objects

However

we

believe

its

crucial

for

efficient

query

processing

and

well

worth

the

extra

space

to

keep

the

geometries

with

the

objects

In

this

way

one

can

directly

apply

SDT

operations

to

spatial

attribute

values

whereas

otherwise

it

would

always

be

necessary

to

access

-LRB-

load

pages

of

-RRB-

the

underlying

realm

Note

that

the

two-way

linking

is

necessary

in

any

case

since

changes

in

the

realm

-LRB-

e.g.

a

new

intersection

point

on

a

segment

-RRB-

need

to

be

propagated

to

the

dependent

spatial

values

We

model

the

management

of

pointers

formally

as

follows

Let

R

be

a

realm

A

representation

of

R

is

a

set

of

triples

-LCB-

-LRB-

r

roid

-LRB-

r

-RRB-

scids

-LRB-

r

-RRB-

-RRB-

r

R

-RCB-

where

roid

is

a

function

giving

for

a

realm

object

its

unique

identifier

in

ROID

and

scids

is

a

function

returning

the

set

of

SCIDs

of

dependent

components

of

spatial

attribute

values

We

also

allow

the

notation

roid

-LRB-

v

-RRB-

to

assign

a

new

ROID

to

a

newly

created

realm

object

v

The

realm

interface

is

described

by

the

following

signature

Slightly

extending

standard

notations

we

allow

operators

to

return

tuples

of

values

and

sets

of

values

the

type

of

a

set

of

X

values

is

denoted

by

X

The

first

group

of

operations

are

those

mentioned

above

sorts

Realm

Point

Segment

RealmObject

ROID

SCID

Rectangle

Bool

Integer

ops

InsertNPoint

Realm

Point

fi

Realm

ROID

-LRB-

SCID

-LRB-

Segment

ROID

-RRB-

-RRB-

InsertNSegment

Realm

Segment

fi

Realm

-LRB-

Segment

ROID

-RRB-

-LRB-

SCID

-LRB-

Segment

ROID

-RRB-

-RRB-

Bool

Delete

Realm

ROID

fi

Realm

Bool

The

sort

-LRB-

type

-RRB-

Realm

refers

to

a

realm

representation

Point

to

the

set

PN

Segment

to

the

set

SN

RealmObject

is

a

union

type

of

Point

and

Segment

we

assume

one

can

recognize

whether

a

given

instance

is

a

point

or

a

segment

ROID

and

SCID

have

been

discussed

above

Rectangle

denotes

the

set

of

axis-parallel

rectangles

definable

over

space

N

N

that

is

N-rectangles

The

update

operations

implement

the

approach

of

Greene

and

Yao

-LSB-

-RSB-

described

in

Section

to

preserve

the

topology

for

a

set

of

intersecting

line

segments

when

they

are

represented

over

a

finite

grid

Greene

and

Yao

do

not

deal

with

collections

of

points

that

are

part

of

our

realms

We

extend

their

approach

by

an

additional

integrity

rule

for

points

and

line

segments

that

are

very

close

to

each

other

In

Section

the

concept

of

an

envelope

was

already

introduced

as

a

set

of

grid

points

adjacent

to

a

segment

-LRB-

formally

defined

in

-LSB-

-RSB-

-RRB-

Let

us

call

the

proper

envelope

the

subset

of

envelope

points

that

are

not

end

points

of

the

segment

-LRB-

denoted

-LRB-

s

-RRB-

for

segment

s

-RRB-

Then

the

rule

is

No

R-point

lies

on

the

proper

envelope

of

any

R-segment

The

intuition

behind

this

is

that

points

that

are

so

close

are

meant

to

lie

on

the

segment

Update

operations

maintain

this

constraint

by

redrawing

the

segment

whenever

a

point

is

discovered

to

lie

on

its

proper

envelope

-LRB-

which

can

happen

on

point

insertion

or

on

segment

insertion

-RRB-

The

operation

InsertNPoint

takes

a

realm

and

an

N-point

It

returns

-LRB-

i

-RRB-

the

modified

realm

-LRB-

ii

-RRB-

an

identifier

for

the

inserted

point

which

could

be

an

old

one

if

the

point

was

in

the

realm

already

and

-LRB-

iii

-RRB-

a

set

of

segments

in

the

database

that

need

to

be

redrawn

which

may

be

empty

A

segment

may

need

redrawing

because

the

point

lies

on

its

proper

envelope

For

each

such

segment

its

address

in

the

database

-LRB-

SCID

-RRB-

together

with

a

list

of

pairs

-LRB-

s

roid

-LRB-

s

-RRB-

-RRB-

-LRB-

where

s

is

a

segment

of

the

redrawing

-RRB-

is

returned

It

is

then

the

task

of

the

DBMS

to

replace

segments

by

their

redrawings

The

operation

InsertNSegment

takes

a

realm

and

an

N-segment

It

returns

-LRB-

i

-RRB-

the

modified

realm

-LRB-

ii

-RRB-

a

list

of

segments

with

their

roids

which

may

contain

either

the

original

segment

as

the

only

element

or

a

redrawing

of

this

segment

-LRB-

iii

-RRB-

a

possibly

empty

set

of

segments

that

need

to

be

redrawn

-LRB-

as

for

InsertNPoint

-RRB-

Here

the

inserted

segment

may

need

redrawing

because

it

or

its

proper

envelope

touches

R-points

or

because

it

intersects

R-segments

The

other

segments

need

redrawing

because

they

are

intersected

by

this

segment

The

last

parameter

-LRB-

iv

-RRB-

indicates

whether

insertion

was

performed

it

was

rejected

if

not

both

end

points

of

the

segment

were

present

in

the

realm

The

operation

Delete

takes

a

realm

and

the

identifier

of

a

realm

object

-LRB-

point

or

segment

-RRB-

and

removes

the

object

from

the

realm

if

this

doesn?t

violate

certain

integrity

constraints

It

returns

-LRB-

i

-RRB-

the

modified

realm

and

-LRB-

ii

-RRB-

an

indication

whether

the

object

was

removed

The

following

conditions

are

checked

A

point

is

only

removed

if

there

is

no

segment

ending

in

the

point

Any

realm

object

is

only

removed

if

its

set

of

scids

-LRB-

dependent

objects

-RRB-

is

empty

The

second

group

of

operations

supports

the

management

of

the

two-way

linking

between

realm

objects

and

components

of

spatial

values

in

the

database

Register

Realm

ROID

SCID

fi

Realm

Unregister

Realm

ROID

SCID

fi

Realm

GetSCIDs

Realm

ROID

fi

SCID

GetRealmObject

Realm

ROID

fi

RealmObject

E

Here

Register

informs

a

realm

object

roid

about

a

spatial

component

scid

depending

on

it

Unregister

removes

such

an

information

GetSCIDs

returns

the

scids

of

spatial

components

depending

on

the

given

roid

GetRealmObject

returns

the

geometry

These

operations

are

to

be

used

for

example

as

follows

A

spatial

attribute

value

is

constructed

by

selecting

a

number

of

realm

objects

in

a

certain

order

-LRB-

this

is

supported

by

the

last

group

of

operations

see

below

-RRB-

After

all

components

have

been

selected

the

representation

of

this

value

is

built

and

stored

in

the

database

Then

all

components

are

registered

with

their

underlying

realm

objects

When

a

spatial

attribute

value

is

deleted

the

registration

is

removed

for

all

objects

GetSCIDs

and

GetRealmObject

are

general

purpose

operations

to

support

query

processing

The

last

group

of

operations

supports

the

selection

of

realm

objects

for

the

construction

of

spatial

values

Window

Realm

Rectangle

fi

-LRB-

RealmObject

ROID

-RRB-

Identify

Realm

Point

Integer

fi

ROID

Bool

Window

returns

all

realm

objects

together

with

their

roid

that

are

inside

or

intersect

a

given

rectangular

window

Identify

tries

to

identify

a

realm

object

close

to

the

N-point

given

as

a

parameter

The

number

given

as

a

third

parameter

controls

the

pick

distance

A

roid

-LRB-

possibly

undefined

-RRB-

is

returned

together

with

an

indication

whether

identification

was

successful

These

two

operations

can

be

used

to

retrieve

a

portion

of

a

realm

in

order

to

define

spatial

attribute

values

over

it

For

example

this

portion

may

be

displayed

at

a

graphical

user

interface

With

a

pointing

device

one

can

select

N-points

which

through

Identify

determine

realm

objects

from

which

the

spatial

values

can

be

built

We

now

define

the

semantics

of

the

realm

operations

InsertNPoint

and

InsertNSegment

All

the

other

operations

are

rather

simple

so

that

their

meaning

should

be

clear

from

the

explanations

above

InsertNPoint

and

InsertNSegment

are

described

by

giving

algorithms

for

them

As

mentioned

before

the

concepts

of

Greene

and

Yao

-LSB-

-RSB-

are

applied

and

extended

some

of

which

need

now

to

be

explained

in

more

detail

In

-LSB-

-RSB-

for

a

set

of

line

segments

redrawings

are

computed

in

two

phases

First

for

each

segment

that

needs

to

be

redrawn

the

set

of

points

on

its

envelope

that

need

to

be

passed

by

the

redrawing

is

computed

These

points

are

attached

to

the

segment

in

the

form

of

hooks

A

hook

is

a

short

directed

line

segment

-LRB-

an

arrow

-RRB-

from

a

point

on

the

segment

to

the

envelope

point

that

needs

to

be

passed

Figure

shows

a

segment

s

with

two

hooks

p

p

and

q

q

Such

a

hooked

segment

is

represented

as

a

list

-LRB-

s

p

p

q

q

-RRB-

The

first

hook

arises

from

the

intersection

of

segments

s

and

t

in

p

when

this

intersection

is

discovered

the

hook

p

p

is

added

to

both

segments

s

and

t.

Let

us

assume

that

the

other

hook

in

Figure

arises

from

the

fact

that

point

q

was

inserted

into

the

realm

u

s

Figure

t

q

q

p

p

since

it

lies

on

the

envelope

of

s

s

should

go

through

q

In

such

a

case

we

take

the

point

on

the

segment

closest

to

the

target

point

-LRB-

in

this

case

q

-RRB-

as

the

start

point

of

the

hook

and

denote

it

as

base

-LRB-

<target>

<segment>

-RRB-

in

this

case

q

base

-LRB-

q

s

-RRB-

Figure

also

illustrates

that

for

each

hook

created

one

generally

needs

to

check

whether

any

segments

are

intersected

by

it

In

the

example

an

intersection

with

segment

u

would

be

discovered

and

a

corresponding

hook

q

q

be

added

to

segment

u

-LRB-

where

q

is

the

intersection

point

of

the

hook

and

u

-RRB-

Only

after

all

hooks

have

been

determined

redrawings

-LRB-

polygonal

lines

within

the

envelope

-RRB-

are

computed

This

can

now

be

done

for

each

hooked

segment

independently

from

all

other

segments

See

-LSB-

-RSB-

for

a

description

of

how

redrawings

are

computed

The

algorithm

InsertNPoint

has

to

treat

the

following

cases

-LRB-

i

-RRB-

the

point

is

already

present

in

the

realm

-LRB-

ii

-RRB-

the

point

is

new

and

does

not

lie

on

any

envelope

and

-LRB-

iii

-RRB-

the

point

falls

on

one

or

more

proper

envelopes

Only

the

last

case

is

a

bit

more

complex

All

segments

whose

envelopes

are

touched

get

a

hook

Later

all

those

segments

are

redrawn

The

description

uses

predicates

ExistsRPoint

and

ExistsRSegment

with

the

obvious

meaning

to

check

whether

a

realm

object

to

be

created

is

present

already

algorithm

InsertNPoint

-LRB-

R

p

R

r

SP

-RRB-

-LCB-

Inputs

are

a

realm

R

P

S

and

an

N-point

p.

Outputs

are

the

modified

realm

R

a

realm

object

identifier

r

for

p

and

a

set

SP

of

spatial

component

identifiers

and

redrawings

for

the

spatial

objects

which

have

to

be

updated

-RCB-

Step

SP

if

q

P

p

q

-LRB-

at

most

one

such

R-point

can

exist

-RRB-

then

r

roid

-LRB-

q

-RRB-

R

R

else

if

s

S

then

r

roid

-LRB-

p

-RRB-

R

R

-LCB-

-LRB-

p

r

-RRB-

-RCB-

else

-LRB-

R-segments

exist

whose

proper

envelopes

contain

p

-RRB-

Srd

-LRB-

a

set

of

R-segments

which

have

to

be

redrawn

-RRB-

r

roid

-LRB-

p

-RRB-

Senv

-LCB-

s

S

-RCB-

for

each

s

in

Senv

do

Insert

a

hook

h

base

-LRB-

p

s

-RRB-

p

on

s

Srd

Srd

-LCB-

s

-RCB-

-LRB-

one

does

not

need

to

check

for

segments

in

S

intersecting

h

because

they

are

already

in

Senv

-RRB-

Step

-LRB-

redraw

hooked

lines

-RRB-

Let

Srd

-LCB-

tn

-RCB-

Let

-LCB-

ti

t

i

ki

-RCB-

be

the

set

of

ki

R-segments

of

the

redrawing

of

ti

through

p.

Let

ti

j

-LRB-

pi

j

qi

j

-RRB-

i

-LCB-

n

-RCB-

j

-LCB-

ki

-RCB-

Step

-LRB-

update

realm

-RRB-

R

R

-LCB-

-LRB-

ti

roid

-LRB-

ti

-RRB-

scids

-LRB-

ti

-RRB-

-RRB-

i

-LCB-

n

-RCB-

-RCB-

-LRB-

Insert

the

end

points

of

the

R-segments

of

the

redrawings

and

the

R-segments

themselves

if

they

do

not

already

exist

in

the

realm

-RRB-

In

-LSB-

-RSB-

all

hooks

arise

from

segment

intersections

p

E

s

-LRB-

-RRB-

p

E

s

-LRB-

-RRB-

for

each

i

in

n

do

for

each

j

in

ki

do

if

not

ExistsRPoint

-LRB-

pi

j

-RRB-

then

R

R

-LCB-

-LRB-

pi

j

roid

-LRB-

pi

j

-RRB-

-RRB-

-RCB-

if

not

ExistsRPoint

-LRB-

qi

j

-RRB-

then

R

R

-LCB-

-LRB-

qi

j

roid

-LRB-

qi

j

-RRB-

-RRB-

-RCB-

if

not

ExistsRSegment

-LRB-

ti

j

-RRB-

then

R

R

-LCB-

-LRB-

ti

j

roid

-LRB-

ti

j

-RRB-

-RRB-

-RCB-

SP

-LCB-

-LRB-

sc

-LCB-

-LRB-

ti

j

roid

-LRB-

ti

j

-RRB-

-RRB-

j

-LCB-

ki

-RCB-

-RCB-

-RRB-

sc

scids

-LRB-

ti

-RRB-

-RCB-

end

InsertNPoint

The

algorithm

InsertNSegment

first

checks

whether

the

end

points

of

the

segment

are

present

in

the

realm

otherwise

it

rejects

insertion

This

agrees

with

the

graph-theoretic

view

of

a

realm

An

edge

can

only

exist

if

its

nodes

are

there

It

implies

that

the

user

of

the

realm

layer

has

to

make

sure

that

the

points

are

present

-LRB-

in

case

of

doubt

just

insert

them

first

this

doesn?t

hurt

-RRB-

Hence

when

a

segment

is

inserted

it

is

known

that

the

end

points

have

already

interacted

properly

with

envelopes

of

other

segments

The

following

cases

are

now

distinguished

-LRB-

i

-RRB-

the

segment

is

in

the

realm

already

-LRB-

ii

-RRB-

the

segment

is

new

and

doesn?t

touch

anything

and

-LRB-

iii

-RRB-

the

segment

may

intersect

some

other

segments

and

or

its

envelope

touches

some

realm

points

algorithm

InsertNSegment

-LRB-

R

s

R

RD

SP

ok

-RRB-

-LCB-

Inputs

are

a

realm

R

P

S

and

an

N-segment

s.

Outputs

are

the

modified

realm

R

a

set

RD

of

pairs

of

R-segments

and

realm

object

identifiers

either

for

s

or

a

redrawing

of

s

a

set

SP

of

spatial

component

identifiers

and

redrawings

for

the

spatial

objects

which

have

to

be

updated

and

a

parameter

ok

which

indicates

whether

the

insertion

was

performed

Insertion

was

rejected

if

the

end

points

of

s

were

not

present

in

the

realm

-RCB-

Step

-LRB-

initializations

-RRB-

SP

Step

-LRB-

check

whether

end

points

of

s

have

already

been

inserted

-RRB-

Let

s

-LRB-

-RRB-

ok

ExistsRPoint

-LRB-

-RRB-

and

ExistsRPoint

-LRB-

-RRB-

if

ok

then

-LRB-

execute

steps

-RRB-

Step

-LRB-

insert

hooks

-RRB-

if

t

S

s

t

-LRB-

at

most

one

such

R-segment

can

exist

-RRB-

then

R

R

RD

-LCB-

-LRB-

s

roid

-LRB-

t

-RRB-

-RRB-

-RCB-

else

if

t

S

s

and

t

are

disjoint

p

P

then

R

R

-LCB-

-LRB-

s

roid

-LRB-

s

-RRB-

-RRB-

-RCB-

RD

-LCB-

-LRB-

s

roid

-LRB-

s

-RRB-

-RRB-

-RCB-

else

-LRB-

s

intersects

R-segments

and/or

there

are

R-points

in

the

proper

envelope

of

s

-RRB-

Srd

-LRB-

the

set

of

R-segments

which

have

to

be

redrawn

-RRB-

-LRB-

Get

all

R-points

lying

in

the

proper

envelope

of

s

except

for

the

end

points

Get

all

R-segments

intersecting

s.

-RRB-

Penv

-LRB-

s

-RRB-

-LCB-

p

P

-RCB-

Sintersect

-LRB-

s

-RRB-

-LCB-

t

S

s

and

t

intersect

-RCB-

for

each

p

in

Penv

-LRB-

s

-RRB-

do

Insert

a

hook

h

base

-LRB-

p

s

-RRB-

p

on

s

for

each

t

in

S

do

if

h

and

t

intersect

at

p

then

Insert

a

hook

h

p

p

on

t

Srd

Srd

-LCB-

t

-RCB-

i

n

p

E

s

-LRB-

-RRB-

p

E

s

-LRB-

-RRB-

for

each

t

in

Sintersect

-LRB-

s

-RRB-

do

Insert

a

hook

h

q

p

both

on

s

and

on

t

from

the

intersection

point

q

of

s

and

t

to

the

closest

grid

point

p

-LRB-

Note

that

p

q

is

possible

if

q

is

a

grid

point

-RRB-

Srd

Srd

-LCB-

t

-RCB-

for

each

v

in

S

do

if

h

and

v

intersect

at

p

then

Insert

a

hook

h

p

p

on

v

Srd

Srd

-LCB-

v

-RCB-

Step

-LRB-

redraw

hooked

lines

-RRB-

Redraw

s.

Let

-LCB-

sm

-RCB-

be

the

R-segments

of

the

redrawing

of

s.

Let

si

-LRB-

pi

qi

-RRB-

i

-LCB-

m

-RCB-

Redraw

all

R-segments

of

Srd

-LCB-

tn

-RCB-

Let

-LCB-

ti

ti

k

-RCB-

be

the

set

of

ki

R-segments

of

the

redrawing

of

ti

Let

ti

j

-LRB-

pi

j

qi

j

-RRB-

i

-LCB-

n

-RCB-

j

-LCB-

ki

-RCB-

Step

-LRB-

update

realm

-RRB-

R

R

-LCB-

-LRB-

ti

roid

-LRB-

ti

-RRB-

scids

-LRB-

ti

-RRB-

-RRB-

i

-LCB-

n

-RCB-

-RCB-

-LRB-

Insert

the

end

points

of

the

R-segments

of

the

redrawings

and

the

R-segments

themselves

if

they

do

not

already

exist

in

the

realm

-RRB-

for

each

i

in

m

do

if

not

ExistsRPoint

-LRB-

pi

-RRB-

then

R

R

-LCB-

-LRB-

pi

roid

-LRB-

pi

-RRB-

-RRB-

-RCB-

if

not

ExistsRPoint

-LRB-

qi

-RRB-

then

R

R

-LCB-

-LRB-

qi

roid

-LRB-

qi

-RRB-

-RRB-

-RCB-

if

not

ExistsRSegment

-LRB-

si

-RRB-

then

R

R

-LCB-

-LRB-

si

roid

-LRB-

si

-RRB-

-RRB-

-RCB-

for

each

i

in

n

do

for

each

j

in

ki

do

if

not

ExistsRPoint

-LRB-

pi

j

-RRB-

then

R

R

-LCB-

-LRB-

pi

j

roid

-LRB-

pi

j

-RRB-

-RRB-

-RCB-

if

not

ExistsRPoint

-LRB-

qi

j

-RRB-

then

R

R

-LCB-

-LRB-

qi

j

roid

-LRB-

qi

j

-RRB-

-RRB-

-RCB-

if

not

ExistsRSegment

-LRB-

ti

j

-RRB-

then

R

R

-LCB-

-LRB-

ti

j

roid

-LRB-

ti

j

-RRB-

-RRB-

-RCB-

RD

-LCB-

-LRB-

si

roid

-LRB-

si

-RRB-

-RRB-

i

-LCB-

m

-RCB-

-RCB-

SP

-LCB-

-LRB-

sc

-LCB-

-LRB-

ti

j

roid

-LRB-

ti

j

-RRB-

-RRB-

j

-LCB-

ki

-RCB-

-RCB-

-RRB-

sc

scids

-LRB-

ti

-RRB-

-RCB-

end

InsertNSegment

Realm-Based

Structures

and

Primitives

We

can

now

assume

that

the

problems

of

numerical

robustness

and

topological

correctness

are

solved

by

the

lower

layers

Given

is

a

realm

which

can

be

viewed

as

a

planar

graph

over

the

grid

N

N.

Within

a

realm

one

can

discover

certain

structures

and

relationships

between

these

structures

useful

for

the

definition

of

spatial

data

types

These

structures

are

called

R-cycle

R-face

R-unit

and

R-block

For

the

relationships

we

will

define

a

number

of

predicates

-LRB-

primitives

-RRB-

An

R-cycle

c

is

just

a

cycle

in

the

graph

interpretation

of

a

realm

defined

by

a

set

of

R-segments

S

-LRB-

c

-RRB-

-LCB-

sm

-RCB-

such

that

-LRB-

i

-RRB-

i

-LCB-

m

-RCB-

si

meets

s

-LRB-

i

-RRB-

mod

m

-LRB-

ii

-RRB-

No

other

pairs

of

segments

in

S

-LRB-

c

-RRB-

meet

Obviously

the

following

relationships

may

exist

between

an

N-point

p

and

an

R-cycle

c

i

n

-LRB-

i

-RRB-

p

on

c

s

S

-LRB-

c

-RRB-

p

on

s

For

p

-LRB-

x

y

-RRB-

let

sp

-LRB-

-LRB-

x

y

-RRB-

-LRB-

x

n

-RRB-

-RRB-

-LRB-

that

is

a

vertical

segment

extending

from

p

upwards

to

the

edge

of

the

grid

-RRB-

Let

Sr

-LRB-

c

-RRB-

be

the

segments

in

S

-LRB-

c

-RRB-

whose

right

end

point

but

not

the

left

one

is

on

sp

Let

Si

-LRB-

c

-RRB-

be

the

segments

in

S

-LRB-

c

-RRB-

that

intersect

sp

Then

-LRB-

ii

-RRB-

p

in

c

p

on

c

Sr

-LRB-

c

-RRB-

Si

-LRB-

c

-RRB-

is

-LRB-

iii

-RRB-

p

out

c

-LRB-

p

on

c

p

in

c

-RRB-

Hence

c

partitions

the

set

PN

into

three

subsets

Pin

-LRB-

c

-RRB-

Pon

-LRB-

c

-RRB-

and

Pout

-LRB-

c

-RRB-

Let

P

-LRB-

c

-RRB-

Pon

-LRB-

c

-RRB-

Pin

-LRB-

c

-RRB-

Cycles

are

interesting

because

they

are

the

basic

entities

for

the

definition

of

regions

over

realms

The

relationships

shown

in

Figure

may

be

distinguished

between

two

R-cycles

and

We

introduce

the

following

terminology

for

these

configurations

is

and

are

-LRB-

area

-RRB-

inside

-LRB-

i

ii

iii

-RRB-

area-disjoint

-LRB-

iv

v

vi

-RRB-

edge-inside

-LRB-

ii

iii

-RRB-

edge-disjoint

-LRB-

v

vi

-RRB-

vertex-inside

-LRB-

iii

-RRB-

-LRB-

vertex

-RRB-

disjoint

-LRB-

vi

-RRB-

The

meaning

is

that

-LRB-

i

-RRB-

is

-LRB-

w.r.t

area

-RRB-

inside

-LRB-

ii

-RRB-

additionally

has

no

common

edges

with

-LRB-

iii

-RRB-

has

not

even

common

vertices

with

Similarly

-LRB-

iv

-RRB-

is

disjoint

w.r.t.

area

with

-LRB-

v

-RRB-

additionally

has

no

common

edges

with

-LRB-

vi

-RRB-

additionally

has

not

even

common

vertices

with

area-inside

is

the

standard

interpretation

of

the

term

inside

vertex-disjoint

the

standard

interpretation

of

the

term

disjoint

Furthermore

there

are

two

positive

notions

and

are

adjacent

if

they

are

area-disjoint

and

have

common

edges

they

meet

if

they

are

area-disjoint

and

have

common

vertices

These

predicates

are

formally

defined

as

follows

-LRB-

area

-RRB-

inside

P

-LRB-

-RRB-

P

-LRB-

-RRB-

edge-inside

area-inside

S

-LRB-

-RRB-

S

-LRB-

-RRB-

vertex-inside

edge-inside

Pon

-LRB-

-RRB-

Pon

-LRB-

-RRB-

and

are

area-disjoint

Pin

-LRB-

-RRB-

P

-LRB-

-RRB-

Pin

-LRB-

-RRB-

P

-LRB-

-RRB-

This

is

a

precise

grid-based

formulation

of

the

well-known

plumbline

algorithm

-LRB-

iii

-RRB-

-LRB-

ii

-RRB-

-LRB-

i

-RRB-

-LRB-

iv

-RRB-

-LRB-

v

-RRB-

-LRB-

vi

-RRB-

Figure

and

are

edge-disjoint

and

are

area-disjoint

S

-LRB-

-RRB-

S

-LRB-

-RRB-

and

are

-LRB-

vertex

-RRB-

disjoint

and

are

edge-disjoint

Pon

-LRB-

-RRB-

Pon

-LRB-

-RRB-

-LRB-

which

is

equivalent

to

saying

that

P

-LRB-

-RRB-

P

-LRB-

-RRB-

-RRB-

and

are

adjacent

and

are

area-disjoint

S

-LRB-

-RRB-

S

-LRB-

-RRB-

and

meet

and

are

edge-disjoint

Pon

-LRB-

-RRB-

Pon

-LRB-

-RRB-

One

can

observe

similar

ways

how

an

R-segment

s

can

lie

within

an

R-cycle

c

For

an

R-point

p

and

an

R-cycle

c

we

have

two

possibilities

Formal

definitions

are

left

to

the

reader

Based

on

the

concept

of

R-cycles

for

the

definition

of

a

spatial

data

type

for

regions

the

notions

R-face

and

R-unit

are

introduced

which

describe

regions

from

two

different

perspectives

and

which

are

used

equivalently

Both

of

them

essentially

define

polygonal

regions

with

holes

An

R-unit

is

a

minimal

R-face

in

the

sense

that

any

R-face

within

the

R-unit

is

equal

to

the

R-unit

Hence

R-units

are

the

smallest

region

entities

that

exist

over

a

realm

We

will

see

that

any

two

R-units

are

area-disjoint

and

that

any

R-face

can

be

described

as

a

set

of

R-units

In

the

next

section

a

region

-LRB-

data

type

-RRB-

will

be

defined

that

can

either

be

viewed

as

a

set

of

R-faces

or

equivalently

as

a

set

of

R-units

The

first

view

emphasizes

a

minimal

representation

of

the

boundary

of

a

region

whereas

the

latter

view

supports

the

definition

of

set

operations

for

regions

We

will

define

operations

to

convert

between

the

two

-LRB-

formal

-RRB-

representations

Let

C

-LRB-

R

-RRB-

denote

the

set

of

all

R-cycles

An

R-face

f

is

a

pair

-LRB-

c

H

-RRB-

where

c

is

an

R-cycle

and

H

-LCB-

hm

-RCB-

is

a

-LRB-

possibly

empty

-RRB-

set

of

R-cycles

such

that

the

following

conditions

hold

-LRB-

let

S

-LRB-

f

-RRB-

denote

the

set

of

all

segments

of

all

cycles

of

f

-RRB-

-LRB-

i

-RRB-

i

-LCB-

m

-RCB-

hi

edge-inside

c

-LRB-

ii

-RRB-

i

j

-LCB-

m

-RCB-

i

j

hi

and

hj

are

edge-disjoint

-LRB-

iii

-RRB-

Each

cycle

in

S

-LRB-

f

-RRB-

is

either

equal

to

c

or

to

one

of

the

cycles

in

H

-LRB-

no

other

cycle

can

be

formed

from

the

segments

of

f

-RRB-

The

last

condition

ensures

uniqueness

of

representation

that

is

there

are

no

two

different

-LRB-

ii

-RRB-

s

-LRB-

area

-RRB-

inside

c

-LRB-

i

ii

iii

-RRB-

s

edge-inside

c

-LRB-

ii

iii

-RRB-

s

vertex-inside

c

-LRB-

iii

-RRB-

Figure

-LRB-

i

-RRB-

-LRB-

iii

-RRB-

-LRB-

i

-RRB-

-LRB-

ii

-RRB-

p

-LRB-

area

-RRB-

inside

c

-LRB-

i

ii

-RRB-

p

vertex-inside

c

-LRB-

ii

-RRB-

Figure

interpretations

of

a

set

of

segments

as

sets

of

faces

For

example

it

guarantees

that

the

configuration

shown

in

Figure

must

be

interpreted

as

two

faces

and

not

as

a

single

face

with

holes

-LRB-

since

under

the

latter

interpretation

the

cycle

drawn

fat

would

violate

condition

-LRB-

iii

-RRB-

-RRB-

With

terms

defined

below

condition

-LRB-

iii

-RRB-

can

be

rephrased

as

an

R-face

can

not

be

decomposed

into

two

or

more

edge-disjoint

R-faces

The

grid

points

belonging

to

an

R-face

f

are

defined

as

P

-LRB-

f

-RRB-

P

-LRB-

c

-RRB-

Let

S

-LRB-

F

-RRB-

denote

the

set

of

all

R-segments

of

a

set

of

R-faces

F

The

possible

relationships

between

an

R-point

p

or

an

R-segment

s

and

an

R-face

f

-LRB-

c

H

-RRB-

are

-LRB-

i

-RRB-

p

-LRB-

area

-RRB-

inside

f

p

area-inside

c

h

H

p

vertex-inside

h

-LRB-

ii

-RRB-

s

-LRB-

area

-RRB-

inside

f

s

area-inside

c

h

H

s

edge-inside

h

The

various

notions

of

inside

and

disjoint

can

be

extended

for

the

comparison

of

two

R-faces

f

-LRB-

-RRB-

and

g

-LRB-

-RRB-

for

example

f

-LRB-

area

-RRB-

inside

g

area-inside

area-disjoint

area-inside

This

definition

is

illustrated

in

Figure

Figure

Pin

hi

-LRB-

-RRB-

i

m

F

G

g

G

g

f

F

g

f

Figure

f

g

f

area-disjoint

g

area-disjoint

area-inside

area-inside

f

edge-disjoint

g

edge-disjoint

edge-inside

edge-inside

The

meaning

of

the

remaining

predicates

edge-inside

vertex-inside

vertex-disjoint

adjacent

meet

should

be

clear

definitions

are

omitted

for

brevity

An

R-unit

as

a

minimal

R-face

is

defined

as

follows

Let

F

-LRB-

R

-RRB-

denote

the

set

of

all

possible

R-faces

Let

f

be

an

R-face

f

is

an

R-unit

g

F

-LRB-

R

-RRB-

g

area-inside

f

fi

g

f

We

also

denote

by

U

-LRB-

R

-RRB-

the

set

of

all

R-units

Our

goal

is

now

to

establish

an

equivalence

between

two

representations

of

a

region

over

a

realm

namely

as

a

set

of

-LRB-

pairwise

-RRB-

edge-disjoint

R-faces

and

as

a

set

of

R-units

First

we

consider

the

conversion

of

a

set

of

faces

into

a

set

of

units

We

need

two

lemmas

whose

proofs

are

technical

and

are

only

sketched

Lemma

Let

f

be

an

R-face

and

u

an

R-unit

Then

either

u

area-inside

f

or

u

area-disjoint

f

The

idea

of

the

proof

is

that

if

this

is

not

the

case

then

one

of

the

cycles

of

f

say

f

must

properly

intersect

one

of

the

cycles

of

u

say

u

But

then

a

part

of

f

lies

within

u

and

forms

a

cycle

there

with

a

part

of

u

Hence

there

would

be

a

face

contained

in

u

different

from

u

which

contradicts

the

definition

of

an

R-unit

Lemma

Let

f

be

an

R-face

and

u

an

R-unit

such

that

u

area-inside

f

Then

subtracting

u

from

f

results

in

a

set

of

R-faces

The

idea

of

the

proof

is

the

following

If

u

is

even

edge-inside

f

then

removing

the

area

of

u

from

f

just

adds

another

hole

to

f

If

u?s

outer

cycle

has

some

adjacent

parts

with

f

s

outer

cycle

then

a

bay

is

formed

in

-LRB-

Figure

-RRB-

If

it

is

adjacent

with

a

hole

in

f

then

will

grow

-LRB-

Figure

-RRB-

If

several

adjacencies

are

present

then

f

may

be

decomposed

into

several

faces

g

G

g

f

F

f

g

G

g

f

F

f

f

u

Figure

f

f

u

Figure

Figure

The

second

lemma

implies

that

the

units

inside

a

face

f

cover

the

area

of

f

completely

For

if

some

area

were

left

it

would

form

its

own

face

which

could

again

be

decomposed

into

units

Therefore

the

following

definition

correctly

decomposes

faces

into

units

Let

F

be

a

set

of

edgedisjoint

R-faces

units

-LRB-

F

-RRB-

-LCB-

u

U

-LRB-

R

-RRB-

f

F

u

area-inside

f

-RCB-

We

now

consider

the

conversion

of

a

set

of

units

into

a

set

of

faces

Given

a

set

of

R-segments

S

we

say

S

describes

a

set

of

pairwise

edge-disjoint

R-faces

there

exists

a

set

of

edge-disjoint

R-faces

F

such

that

S

S

-LRB-

F

-RRB-

Furthermore

let

D

denote

the

operator

for

symmetrical

set

difference

that

is

V

D

W

-LRB-

V

W

-RRB-

-LRB-

W

V

-RRB-

D

forms

the

union

of

two

sets

removing

their

intersection

The

operator

is

associative

and

commutative

The

basis

for

the

conversion

is

the

following

lemma

Lemma

Let

f

and

g

be

two

area-disjoint

R-faces

Then

S

-LRB-

f

-RRB-

D

S

-LRB-

g

-RRB-

describes

a

set

of

edge-disjoint

R-faces

The

basic

idea

is

that

the

D

operator

just

removes

segments

that

are

common

to

both

faces

The

areadisjointness

condition

makes

sure

that

only

boundaries

between

adjacent

areas

are

removed

-LRB-

and

not

boundaries

between

a

covered

region

in

one

face

and

a

hole

in

the

other

face

-RRB-

The

lemma

can

be

extended

to

two

sets

of

faces

Let

F

G

be

two

sets

of

edge-disjoint

R-faces

such

that

the

faces

in

F

G

are

pairwise

area-disjoint

Then

S

-LRB-

F

-RRB-

D

S

-LRB-

G

-RRB-

describes

a

set

of

edge-disjoint

R-faces

Let

the

resulting

set

of

R-faces

be

denoted

as

F

G

Now

the

conversion

from

units

to

faces

can

be

defined

as

follows

Let

U

be

a

set

of

R-units

We

summarise

the

equivalence

in

Theorem

F

F

-LRB-

R

-RRB-

faces

-LRB-

units

-LRB-

F

-RRB-

-RRB-

F

For

the

definition

of

a

spatial

data

type

for

lines

the

notion

of

an

R-block

is

introduced

A

set

S

of

R-segments

is

called

connected

r

t

S

sm

s

i

S

r

t

sm

and

i

-LCB-

m

-RCB-

si

and

si

meet

An

R-block

is

a

connected

set

of

R-segments

Two

R-blocks

and

are

disjoint

S

-LRB-

-RRB-

S

-LRB-

-RRB-

and

are

disjoint

For

an

R-point

p

we

consider

the

angularly

sorted

cyclic

list

Lp

of

R-segments

s

S

-LRB-

-RRB-

S

-LRB-

-RRB-

that

meet

in

p.

p

is

called

a

meeting

point

if

Lp

can

be

subdivided

into

two

sublists

Lp

and

Lp

-LRB-

whose

concatenation

leads

to

Lp

-RRB-

so

that

all

R-segments

of

Lp

are

elements

of

S

-LRB-

-RRB-

and

all

R-segments

of

Lp

are

elements

of

S

-LRB-

-RRB-

or

vice

versa

-LRB-

see

Figure

-RRB-

faces

U

-LRB-

-RRB-

u

-LCB-

-RCB-

u

U

p

p

Figure

p

is

a

meeting

point

p

is

not

a

meeting

point

Two

R-blocks

and

meet

-LRB-

i

-RRB-

s

S

-LRB-

-RRB-

t

S

-LRB-

-RRB-

s

t

-LRB-

ii

-RRB-

s

S

-LRB-

-RRB-

t

S

-LRB-

-RRB-

s

and

t

meet

fi

s

and

t

meet

in

a

meeting

point

Again

we

have

two

equivalent

representations

of

a

lines

value

namely

as

a

set

of

segments

or

as

a

set

of

disjoint

R-blocks

For

a

set

of

segments

S

S

let

blocks

-LRB-

S

-RRB-

denote

its

partition

into

maximal

connected

components

Then

S

-LRB-

blocks

-LRB-

S

-RRB-

-RRB-

S

Realm-Based

Spatial

Data

Types

A

formal

definition

of

realm-based

spatial

data

types

-LRB-

including

operations

-RRB-

is

given

in

the

companion

paper

-LSB-

-RSB-

However

to

conclude

this

paper

we

show

the

connection

between

the

realm-based

structures

of

the

previous

section

and

the

domains

of

the

spatial

data

types

The

basic

types

introduced

are

called

POINTS

LINES

and

REGIONS

There

is

a

flat

and

a

structured

view

of

values

of

these

types

The

flat

view

is

the

following

For

a

given

realm

R

a

value

of

type

POINTS

is

a

set

of

R-points

a

value

of

type

LINES

is

a

set

of

R-segments

and

a

value

of

type

REGIONS

is

a

set

of

R-units

The

structured

view

that

we

shall

assume

as

the

formal

definition

is

as

follows

For

a

given

realm

R

a

value

of

type

POINTS

is

a

set

of

R-points

a

value

of

type

LINES

is

a

set

of

pairwise

disjoint

R-blocks

and

a

REGIONS

value

is

a

set

of

pairwise

edge-disjoint

R-faces

We

have

shown

in

the

previous

section

that

the

two

views

are

equivalent

The

first

view

is

conceptually

very

simple

and

supports

a

direct

understanding

of

set

operations

The

second

view

shows

LINES

and

REGIONS

values

as

consisting

of

a

number

of

components

-LRB-

blocks

or

faces

-RRB-

allows

one

to

express

relationships

between

these

components

and

also

emphasizes

the

representation

of

the

boundary

in

case

of

regions

Figure

illustrates

the

data

types

It

should

be

obvious

now

that

these

data

types

have

very

nice

closure

properties

For

example

the

set

operations

are

defined

as

follows

Let

and

be

two

POINTS

values

and

two

LINES

values

and

two

REGIONS

values

Then

union

-LRB-

-RRB-

union

-LRB-

-RRB-

blocks

-LRB-

S

-LRB-

-RRB-

S

-LRB-

-RRB-

-RRB-

union

-LRB-

-RRB-

faces

-LRB-

units

-LRB-

-RRB-

units

-LRB-

-RRB-

-RRB-

a

POINTS

value

a

LINES

value

a

REGIONS

value

Figure

For

intersection

and

difference

the

definitions

are

analogous

The

primitives

introduced

in

the

previous

sections

offer

a

formal

basis

for

the

definition

of

operations

of

a

spatial

algebra

For

example

one

can

define

what

it

means

for

two

regions

to

be

adjacent

F

and

G

are

adjacent

F

and

G

are

area-disjoint

f

F

g

G

f

and

g

are

adjacent

-LRB-

assuming

area-disjoint

to

be

defined

already

for

regions

-RRB-

Conclusions

In

this

paper

we

have

offered

geometric

realms

as

a

concept

to

solve

several

problems

related

to

spatial

data

types

for

database

systems

In

particular

realms

solve

the

geometric

consistency

problem

as

well

as

problems

of

numeric

robustness

and

topological

correctness

Realm-based

structures

can

be

used

for

the

definition

of

quite

general

spatial

data

types

and

guarantee

all

the

desired

closure

properties

in

theory

as

well

as

in

computational

practice

Starting

from

integer

arithmetics

we

have

developed

bottom-up

a

precise

formal

framework

that

makes

it

easy

to

define

spatial

algebras

and

to

implement

them

correctly

Indeed

such

a

realm-based

algebra

is

defined

in

-LSB-

-RSB-

In

closing

let

us

briefly

discuss

some

open

problems

and

questions

that

arise

with

this

approach

Topological

correctness

Although

it

goes

a

long

way

the

approach

of

Greene

and

Yao

does

not

completely

guarantee

topological

correctness

As

is

also

stated

in

-LSB-

-RSB-

through

the

finite

representation

disjoint

points

and

lines

may

collapse

However

aside

from

such

degeneracies

we

do

guarantee

that

topology

does

not

change

There

has

been

a

lot

of

work

on

numeric

robustness

and

topological

correctness

for

geometric

computation

-LRB-

e.g.

-LSB-

-RSB-

-RRB-

We

have

selected

-LSB-

-RSB-

because

it

fits

well

with

our

idea

of

realms

as

grid-based

planar

graphs

underlying

spatial

data

types

However

one

might

try

to

extend

this

by

adding

further

integrity

constraints

-LRB-

such

as

our

rule

that

R-points

must

not

lie

on

envelopes

-RRB-

or

by

techniques

from

the

other

approaches

-LRB-

e.g.

symbolic

reasoning

-RRB-

to

avoid

the

remaining

anomalies

Efficiency

The

realm

update

algorithms

of

Section

have

been

given

in

rather

abstract

terms

one

might

be

concerned

whether

they

are

efficiently

implementable

We

suggest

to

represent

a

realm

in

a

spatial

index

structure

-LRB-

e.g.

-LSB-

-RSB-

-RRB-

and

are

currently

implementing

realms

on

the

basis

of

LSD

Trees

-LSB-

-RSB-

The

lookup

operations

needed

in

the

algorithms

can

then

be

performed

efficiently

Such

a

realm

representation

can

at

the

same

time

be

used

as

an

index

into

the

database

A

separate

issue

is

the

efficiency

of

spatial

algebra

operations

-LRB-

such

as

intersecting

two

regions

-RRB-

This

can

be

done

by

variations

of

plane-sweep

algorithms

such

as

-LSB-

-RSB-

Indeed

these

algorithms

are

now

much

simpler

and

more

efficient

since

they

do

not

need

to

discover

new

intersections

and

do

not

have

to

treat

special

cases

The

study

of

algorithms

for

realm-based

data

types

might

become

an

interesting

field

of

its

own

Space

overhead

By

redrawing

many

more

segments

may

be

created

than

were

present

in

the

original

set

of

intersecting

line

segments

How

many

more

is

an

interesting

question

that

should

be

studied

theoretically

as

well

as

in

experiments

with

real

life

data

In

any

case

we

feel

one

can

not

trade

correctness

for

space

Multiple

realms

In

this

paper

we

have

only

discussed

the

case

of

a

single

realm

underlying

all

spatial

data

-LRB-

of

a

certain

application

area

-RRB-

There

are

several

reasons

why

one

might

be

interested

in

several

realms

over

the

same

area

One

is

to

reduce

space

overhead

-LRB-

by

not

intersecting

spatial

values

of

different

realms

-RRB-

Another

reason

is

that

there

exist

interesting

SDT

operations

that

are

not

closed

with

respect

to

a

realm

An

example

is

the

creation

of

a

buffer

area

around

a

polyline

To

accommodate

such

operations

one

might

dynamically

create

a

realm

containing

just

the

new

spatial

values

select

a

set

of

SDT

values

that

might

interact

with

these

new

geometries

and

create

a

small

realm

for

them

and

then

use

a

merge

operation

on

realms

to

compute

all

intersections

correctly

Appendix

Definition

of

Geometric

Primitives

As

a

basis

for

definition

and

implementation

we

only

assume

that

the

following

arithmetic

primitives

are

available

and

are

error-free

with

respect

to

overflow

INT

INT

fi

INT

div

mod

INT

INT

fi

BOOL

To

fulfill

this

requirement

in

an

implementation

it

is

sufficient

that

the

INT

data

type

can

represent

numbers

in

the

range

-LSB-

-RSB-

where

n

N

-LRB-

see

below

-RRB-

Either

this

relationship

holds

between

N

needed

by

the

application

and

a

programming

language

integer

type

or

one

needs

to

implement

a

special

integer

type

with

these

operations

For

an

N-point

p

we

denote

by

p.x

and

p.y

its

first

and

second

component

respectively

Two

N-points

p

and

q

are

equal

p

q

p.x

q.x

p.y

q.y

Two

N-segments

-LRB-

-RRB-

and

-LRB-

-RRB-

are

equal

-LRB-

-RRB-

-LRB-

-RRB-

Let

-LRB-

-RRB-

-LRB-

-LRB-

-RRB-

-LRB-

-RRB-

-RRB-

and

-LRB-

-RRB-

-LRB-

-LRB-

-RRB-

-LRB-

-RRB-

-RRB-

be

two

N-segments

For

the

calculation

of

a

possible

intersection

point

of

the

two

N-segments

we

use

the

following

matrix

representation

where

l

m

are

rational

numbers

-LRB-

to

be

represented

by

pairs

of

INT

values

-RRB-

This

leads

to

the

following

inhomogeneous

linear

equation

system

in

two

variables

l

-LRB-

-RRB-

m

-LRB-

-RRB-

l

-LRB-

-RRB-

m

-LRB-

-RRB-

Let

and

Then

l

m

fi

l

-LRB-

-RRB-

l

m

m

-LRB-

-RRB-

With

D

and

D

we

get

-LRB-

EQ

-RRB-

l

m

l

D

m

D

Two

N-segments

intersect

if

D

and

l

and

m

Note

that

the

situation

where

an

end

point

of

one

segment

lies

on

the

other

segment

is

excluded

In

particular

no

two

end

points

are

equal

Two

N-segments

are

parallel

if

D

For

an

N-segment

s

-LRB-

-LRB-

-RRB-

-LRB-

-RRB-

-RRB-

x-ext

-LRB-

s

-RRB-

-LCB-

min

-LRB-

-RRB-

max

-LRB-

-RRB-

-RCB-

N

and

y-ext

-LRB-

s

-RRB-

-LCB-

min

-LRB-

-RRB-

max

-LRB-

-RRB-

-RCB-

N

denote

the

x

and

y-intervals

of

its

bounding

box

The

resulting

intervals

are

called

N-intervals

Two

N-intervals

and

overlap

if

card

-LRB-

-RRB-

They

are

disjoint

if

Two

N-segments

overlap

if

-LRB-

i

-RRB-

D

-LRB-

ii

-RRB-

-LRB-

iii

-RRB-

x-ext

-LRB-

-RRB-

and

x-ext

-LRB-

-RRB-

overlap

y-ext

-LRB-

-RRB-

and

y-ext

-LRB-

-RRB-

overlap

If

condition

-LRB-

iii

-RRB-

does

not

hold

and

the

x

and

y-intervals

of

and

are

disjoint

the

two

N-segments

are

called

aligned

Two

N-segments

-LRB-

-RRB-

and

-LRB-

-RRB-

meet

if

they

have

exactly

one

end

point

in

common

Two

N-segments

are

disjoint

if

they

are

neither

equal

nor

meet

nor

intersect

If

two

N-segments

-LRB-

-RRB-

-LRB-

-LRB-

-RRB-

-LRB-

-RRB-

-RRB-

and

-LRB-

-RRB-

intersect

then

intersection

-LRB-

-RRB-

is

the

N-point

-LRB-

x

y

-RRB-

-LRB-

-LRB-

-RRB-

-LRB-

-RRB-

-RRB-

where

-LRB-

i

-RRB-

l

-LRB-

-RRB-

-LRB-

EQ

-RRB-

l

-LRB-

-RRB-

and

are

two

rational

numbers

resulting

from

solving

the

two

equations

in

exact

rational

arithmetic

-LRB-

to

be

implemented

through

the

INT

primitives

alone

-RRB-

l

is

chosen

as

mentioned

in

-LRB-

EQ

-RRB-

-LRB-

ii

-RRB-

the

function

rounds

a

rational

number

to

the

nearest

number

in

N.

For

the

function

we

give

a

simple

algorithm

to

show

that

integer

arithmetic

is

sufficient

to

calculate

the

nearest

number

in

N

from

a

rational

number

function

-LRB-

a

b

integer

-RRB-

integer

var

z

integer

begin

if

a

b

then

z

a

div

b

a

a

mod

b

else

z

end

-LRB-

now

a

b

so

that

a/b

hold

-RRB-

if

a

then

return

z

end

if

a

b

then

return

z

else

return

z

end

end

Let

s

-LRB-

-RRB-

-LRB-

-LRB-

-RRB-

-LRB-

-RRB-

-RRB-

be

an

N-segment

and

let

p

-LRB-

x

y

-RRB-

be

an

N-point

p

lies

on

s

for

short

p

on

s

if

-LRB-

i

-RRB-

-LRB-

-RRB-

-LRB-

y

-RRB-

-LRB-

x

-RRB-

-LRB-

-RRB-

-LRB-

ii

-RRB-

x

x-ext

-LRB-

s

-RRB-

y

y-ext

-LRB-

s

-RRB-

An

N-point

p

lies

within

an

N-segment

s

for

short

p

in

s

if

additionally

to

-LRB-

i

-RRB-

and

-LRB-

ii

-RRB-

holds

-LRB-

iii

-RRB-

x

-LCB-

-RCB-

y

-LCB-

-RCB-

One

can

observe

that

the

largest

numbers

occur

in

the

equations

-LRB-

EQ

-RRB-

c

a

b

which

leads

to

the

requirement

that

numbers

up

to

should

be

representable

References

-LSB-

-RSB-

Abiteboul

S.

and

C.

Beeri

On

the

Power

of

Languages

for

the

Manipulation

of

Complex

Objects

Technical

Report

INRIA

-LRB-

Paris

-RRB-

-LSB-

-RSB-

Bentley

J.L.

and

T.

Ottmann

Algorithms

for

Reporting

and

Counting

Geometric

Intersections

IEEE

Trans

on

Computers

-LRB-

-RRB-

-LSB-

-RSB-

Edelsbrunner

H.

and

E.P.

M?cke

Simulation

of

Simplicity

Proc

ACM

Symposium

on

Computational

Geometry

-LRB-

Urbana-Champaign

Illinois

-RRB-

-LSB-

-RSB-

Egenhofer

M.J.

A.

Frank

and

J.P.

Jackson

A

Topological

Data

Model

for

Spatial

Databases

Proc

SSD

-LRB-

Santa

Barbara

California

-RRB-

-LSB-

-RSB-

Gargano

M.

E.

Nardelli

and

M.

Talamo

Abstract

Data

Types

for

the

Logical

Modeling

of

Complex

Data

Information

Systems

-LRB-

-RRB-

-LSB-

-RSB-

Greene

D.

and

F.

Yao

Finite-Resolution

Computational

Geometry

Proc

IEEE

Symp

on

Foundations

of

Computer

Science

-LSB-

-RSB-

Guibas

L.

D.

Salesin

and

J.

Stolfi

Epsilon-geometry

Building

Robust

Algorithms

from

Imprecise

Computations

Proc

SIAM

Conf

on

Geometric

Design

-LRB-

Tempe

Arizona

-RRB-

-LSB-

-RSB-

Guttman

A.

R-Trees

A

Dynamic

Index

Structure

for

Spatial

Searching

Proc

ACM

SIGMOD

Conf

-LSB-

G

-RSB-

G?ting

R.H.

Geo-Relational

Algebra

A

Model

and

Query

Language

for

Geometric

Database

Systems

Proc

of

the

Intl.

Conf

on

Extending

Database

Technology

-LRB-

Venice

Italy

-RRB-

-LSB-

G

-RSB-

G?ting

R.H.

Modeling

Non-Standard

Database

Systems

by

Many-Sorted

Algebras

Fachbereich

Informatik

Universit?t

Dortmund

Report

-LSB-

G

-RSB-

G?ting

R.H.

Gral

An

Extensible

Relational

Database

System

for

Geometric

Applications

Proc

of

the

Intl.

Conf

on

Very

Large

Databases

-LRB-

Amsterdam

The

Netherlands

-RRB-

-LSB-

-RSB-

G?ting

R.H.

and

M.

Schneider

Realm-Based

Spatial

Data

Types

FernUniversit?t

Hagen

Manuscript

in

preparation

-LSB-

-RSB-

Henrich

A.

H.-W

Six

and

P.

Widmayer

The

LSD

Tree

Spatial

Access

to

Multidimensional

Point

and

Non-Point-Objects

Proc

of

the

Intl.

Conf

on

Very

Large

Data

Bases

-LRB-

Amsterdam

The

Netherlands

-RRB-

-LSB-

-RSB-

Joseph

T.

and

A.

Cardenas

PICQUERY

A

High

Level

Query

Language

for

Pictorial

Database

Management

IEEE

Trans

on

Software

Engineering

-LRB-

-RRB-

-LSB-

-RSB-

Lipeck

U.

and

K.

Neumann

Modelling

and

Manipulating

Objects

in

Geoscientific

Databases

Proc

Intl.

Conf

on

the

Entity-Relationship

Approach

-LRB-

Dijon

France

-RRB-

-LSB-

-RSB-

Nagy

G.

M.

Mukherjee

and

D.W.

Embley

Making

Do

with

Finite

Numerical

Precision

in

Spatial

Data

Structures

Proc

Intl.

Symp

on

Spatial

Data

Handling

-LRB-

Z?rich

Switzerland

-RRB-

-LSB-

-RSB-

Nievergelt

J.

and

F.P.

Preparata

Plane-Sweep

Algorithms

for

Intersecting

Geometric

Figures

Communications

of

the

ACM

-LRB-

-RRB-

-LSB-

-RSB-

Orenstein

J.

and

F.

Manola

PROBE

Spatial

Data

Modeling

and

Query

Processing

in

an

Image

Database

Application

IEEE

Trans

on

Software

Engineering

-LRB-

-RRB-

-LSB-

-RSB-

Ottmann

T.

G.

Thiemt

and

C.

Ullrich

Numerical

Stability

of

Geometric

Algorithms

Proc

ACM

Symp

on

Computational

Geometry

-LSB-

-RSB-

Rossopoulos

N.

C.

Faloutsos

and

T.

Sellis

An

Efficient

Pictorial

Database

System

for

PSQL

IEEE

Trans

on

Software

Engineering

-LRB-

-RRB-

-LSB-

-RSB-

Scholl

M.

and

A.

Voisard

Thematic

Map

Modeling

Proc

SSD

-LRB-

Santa

Barbara

California

-RRB-

-LRB-

-RRB-

D

-LRB-

-RRB-

D

-LSB-

-RSB-

Svensson

P.

and

Z.

Huang

Geo-SAL

A

Query

Language

for

Spatial

Data

Analysis

Proc

SSD

-LRB-

Z?rich

Switzerland

-RRB-

-LSB-

-RSB-

Voisard

A.

Bases

de

donn?es

g?ographiques

du

mod?le

de

donn?es

l?interface

utilisateur

Ph.D.

Thesis

University

of

Paris-Sud

-LRB-

Centre

d?Orsay

-RRB-

algebra
finite resolution
geometric consistency
numerical robustness
realm
spatial data types
topological correctness