![Page 1: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/1.jpg)
Institut für Kartographie und GeoinformationProf. Dr. Lutz Plümer
Diskrete Mathematik IIVorlesung 5
SS 2001
Segmentschnitt II (n Segmente)
![Page 2: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/2.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
2 2
Übersicht I
• Von 2 zu n Segmenten• Vorgehen• Reduktion von 2-dim auf 1-dim• Was haben wir davon?• Scan-Line-Verfahren• Idee• Scan-Line-Verfahren• Ist das wirklich schon der tolle Algorithmus,
den wir suchen?• Gegenbeispiel
![Page 3: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/3.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
3 3
Übersicht II
• Und nun?• Nachbarschaft• Ausnutzung der Nachbarschaft• Ordnungsrelation „x <‘‘• Ordnung der Segmente durch die Scan-Line• Scan-Line & dynamische Ordnung• Zusatzfrage: Wann wird der Schnittpunkt S1 erkannt?• Vereinfachende Annahmen• Algorithmus Scan-Line• Algorithmus (II)
![Page 4: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/4.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
4 4
Von 2 zu n Segmenten
• naheliegendes Vorgehen:überprüfe jedes Paar von Segmenten
• Wie viele Paare gibt es?– O(n2 )
• wende den zuvor skizzierten Algorithmus auf diese Paare an
• geht es auch schneller?• optimal wäre O(n * log n) (so schnell wie Sortieren)
![Page 5: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/5.jpg)
0
10
20
30
40
50
0 2 4 6 8 10 12 14 16 18 20
n²
n log n
}n> n alle für f(n)cg(n) mit
0c|NN :{g O(f)
0
00
![Page 6: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/6.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
6 6
Vorgehen
• was wissen wir, was können wir ausnutzen?– Vermeidung unnötiger Berechnungen, deren Ergebnis durch
systematische Überlegung gewonnen werden kann
• was ist eine besonders einfache Variante dieses Problems?– alle Segmente liegen auf einer Geraden ( x-Achse)– eindimensionale Problemstellung
Können wir die allgemeine (schwierige) Variante auf die spezielle (einfache) zurückführen?
![Page 7: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/7.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
7 7
Reduktion von 2-dim auf 1-dim
• Überlappung der horizontalen Projektionen ist notwendig, aber nicht hinreichend für einen Schnitt
![Page 8: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/8.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
8 8
Was haben wir davon?
• nur Segmente, deren horizontale Projektionen sich überlappen, können sich auch schneiden
• man kann die Prüfung auf diese Segmente einschränken
• Überprüfen aller Segmente durch sequentielles Vorgehen von links nach rechts („Scannen“)
• „Scan-Line“
![Page 9: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/9.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
9 9
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 10: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/10.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
10 10
Idee:
• horizontale Scan-Line über die Ebene schieben– aktive Elemente: Schnitt mit der Scan-Line– nur aktive Elemente können horizontale Überschneidungen
haben– überprüfe aktive Elemente auf Schnittfreiheit
• Problem: wo sind die Haltepunkte der Scan-Line– Anfangspunkt eines Segments
– Endpunkt eines Segments
– interessant sind also die x-Koordinaten der Anfangs- und Endpunkte
• 1. Schritt: sortiere alle Punkte nach aufsteigenden x-Koordinaten– anders ausgedrückt: sortiere die x-Koordinaten und statte jede
x-Koordinate mit einem Verweis auf den zugehörigen Punkt aus
![Page 11: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/11.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
11 11
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 12: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/12.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
12 12
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 13: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/13.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
13 13
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 14: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/14.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
14 14
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 15: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/15.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
15 15
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 16: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/16.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
16 16
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 17: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/17.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
17 17
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 18: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/18.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
18 18
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 19: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/19.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
19 19
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 20: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/20.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
20 20
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 21: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/21.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
21 21
Scan-Line-Verfahren
A
BF
C
D
ES1
S3
S2
S4
![Page 22: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/22.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
22 22
Ist das wirklich schon der tolle Algorithmus, den wir suchen?
![Page 23: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/23.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
23 23
Gegenbeispiel
zu viele Elemente gleichzeitig aktiv O(n2)
![Page 24: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/24.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
24 24
Und nun?
• Scannen allein reicht nicht• zu viele Elemente gleichzeitig aktiv• wir können uns an jedem Haltepunkt der Scan-Line
maximal ein oder zwei (oder konstant viele) Tests erlauben
• also müssen wir sparen ...• und zusätzliches Wissen einspeisen• „nur benachbarte Segmente können sich schneiden“
![Page 25: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/25.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
25 25
Nachbarschaft
-Umgebung
A
B
![Page 26: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/26.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
26 26
Ausnutzung der Nachbarschaft
• wie definiert man „Nachbarschaft“ ...• ... so, daß man sehr schnell erkennt, ob zwei
Segmente benachbart sind?• Nutzung der Scan-Line
– Betrachte die Schnittpunkte der aktiven Segmente mit der Scan-Line
– ordne die Segmente nach den y-Koordinaten ihrer Schnittpunkte mit der Scan-Line
– nenne diese Ordnung „x <‘‘
![Page 27: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/27.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
27 27
Ordnungsrelation „x <‘‘
x x‘
B
A
C
Ax < B
Ax < C
Cx‘ < A
Cx < B
Ax‘ < B
Cx‘ < B
![Page 28: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/28.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
28 28
Ordnung der Segmente durch die Scan-Line
x< ist eine „partielle“ Ordnung ...– ... die nur auf der Menge der aktiven Elemente definiert ist– die Ordnung x< zwischen zwei Elementen wird an ihren
Schnittpunkten umgedreht• aus a x< b wird
b x< aam Schnittpunkt s von a und b
• diese Ordnung ist natürlich eindimensional• und für die aktiven Elemente vollständig• sie ist abhängig vom Haltepunkt x der Scan-Line• diese Ordnung ist also dynamisch und hängt von x als
Parameter ab• tun wir vorübergehend so, als hätten wir diese Ordnung „im Griff“
![Page 29: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/29.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
29 29
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
![Page 30: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/30.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
30 30
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
A
![Page 31: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/31.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
31 31
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
AE
![Page 32: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/32.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
32 32
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
B
EA
![Page 33: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/33.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
33 33
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
B
DA
E
![Page 34: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/34.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
34 34
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
B
CA
DE
![Page 35: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/35.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
35 35
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
B
DC
E
![Page 36: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/36.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
36 36
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
B
EC
D
![Page 37: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/37.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
37 37
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
F
CB
ED
![Page 38: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/38.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
38 38
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
B
CF
ED
![Page 39: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/39.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
39 39
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
B
CF
E
![Page 40: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/40.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
40 40
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
C
EF
![Page 41: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/41.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
41 41
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
C
FE
![Page 42: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/42.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
42 42
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
C
![Page 43: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/43.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
43 43
Scan-Line & dynamische Ordnung
A
BF
C
D
ES1
S3
S2
S4
![Page 44: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/44.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
44 44
Zusatzfrage: Wann wird der Schnittpunkt S1 erkannt?
A
S1
Übung: Wird ein Schnittpunkt ggf. mehr als einmal erkannt?
C
D
E
B
![Page 45: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/45.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
45 45
Vereinfachende Annahmen
Annahme• 2 Segmente schneiden sich
höchstens in einem Punkt
• in keinem Punkt schneiden sich mehr als 2 Segmente
• die x-Koordinaten aller Segmente sind paarweise verschieden
• kein Segment ist vertikal
Gegenbeispiele
![Page 46: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/46.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
46 46
Algorithmus Scan-Line
Input:
S: eine Menge von Segmenten
Output:
die Schnittpunkte der Elemente von S
Sei
T = Endpunkte der Segmente von S nach x-Koordinaten sortiert (Haltepunkte)
L = // aktive Segmente von S
while T do
bestimme und entferne den nächsten Punkt pT
x ist x-Koordinate von p
case: p ist linker Endpunkt von sfuege_ein(s,x,L)sl = vorgaenger(s,x,L)sr = nachfolger(s,x,L)schnitt(sl,s,T);schnitt(s,sr,T);
p ist rechter Endpunkt von ssl = vorgaenger(s,x,L)sr = nachfolger(s,x,L)entferne(s,x,L)schnitt(sl,sr,T)p ist Schnittpunkt von s und tvertausche(s,t,L,x) // t < ssl = vorgaenger(t,x,L)sr = nachfolger(s,x,L)schnitt(sl,t,T)schnitt(s,sr,T)
![Page 47: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)](https://reader030.vdocuments.site/reader030/viewer/2022012922/55204d7549795902118c9775/html5/thumbnails/47.jpg)
Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 5
47 47
Algorithmus (II)
fuege_ein(s,x,L): fügt das Segment s in die Menge L ein entsprechend der Ordnung an der Stelle x
entferne(s,x,L): entfernt das Segment s aus die Menge L an der Stelle x
nachfolger(s,x,L): liefert den Nachfolger von s in L an der Stelle x, falls vorhanden
vorgaenger(s,x,L) liefert den Vorgänger von s in L an der Stelle x, falls vorhanden
schnitt(s,t,T) prüft s und t auf Schnitt. Berechnet ggf. den Schnittpunkt p und fügt ihn als neuen Haltepunkt in T ein.
offene Probleme:
eine geeignete Datenstruktur für T
eine geeignete Datenstruktur für L
Prüfung auf Schnitt, Berechnung des Schnittpunkts