![Page 1: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/1.jpg)
Institut für Kartographie und GeoinformationProf. Dr. Lutz Plümer
Diskrete Mathematik II
Foliendesign: Jörg Steinrücken & Tobias Kahn
Vorlesung 618.05.00
Segmentschnitt III
![Page 2: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/2.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 2
Reduktion von 2-dim auf 1-dim
• Überlappung der horizontalen Projektionen ist notwendig, aber nicht hinreichend für einen Schnitt
![Page 3: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/3.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 3
Scan-Line-Verfahren
A
B F
C
D
ES1
S3
S2
S4
![Page 4: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/4.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 4
Gegenbeispiel
zu viele Elemente gleichzeitig aktiv O(n2)
![Page 5: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/5.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 5
Nachbarschaft
-UmgebungA
B
![Page 6: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/6.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 6
Ordnungsrelation „x <‘‘
x x‘
B
A
C
Ax < B
Ax < C
Cx‘ < A
Cx < B
Ax‘ < B
Cx‘ < B
![Page 7: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/7.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 7
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
![Page 8: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/8.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 8
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
A
![Page 9: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/9.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 9
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
AE
![Page 10: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/10.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 10
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
B
EA
![Page 11: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/11.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 11
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
B
DA
E
![Page 12: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/12.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 12
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
B
CA
DE
![Page 13: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/13.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 13
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
B
DC
E
![Page 14: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/14.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 14
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
B
EC
D
![Page 15: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/15.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 15
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
F
CB
ED
![Page 16: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/16.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 16
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
B
CF
ED
![Page 17: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/17.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 17
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
B
CF
E
![Page 18: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/18.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 18
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
C
EF
![Page 19: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/19.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 19
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
C
FE
![Page 20: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/20.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 20
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
C
![Page 21: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/21.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 21
Scan-Line & dynamische Ordnung
A
B F
C
D
ES1
S3
S2
S4
![Page 22: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/22.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 22
Zusatzfrage: Wann wird der Schnittpunkt S1 erkannt?
A
S1
Übung: Wird ein Schnittpunkt ggf. mehr als einmal erkannt?
C
D
E
B
![Page 23: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/23.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 23
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 24: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/24.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 24
Algorithmus Scan-Line
Input:S: eine Menge von SegmentenOutput:die Schnittpunkte der Elemente von SSeiT = 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 pTx 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 25: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/25.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 25
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 L an der Stelle xnachfolger(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 Schnitt-punkt p und fügt ihn als neuen Haltepunkt in T ein.
offene Probleme: eine geeignete Datenstruktur für Teine geeignete Datenstruktur für LPrüfung auf Schnitt, Berechnung des Schnittpunkts
![Page 26: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/26.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 26
Datenstrukturen für T und S
• Datenstrukur für T– AVL-Baum– letztes Semester
• was ist ein AVL-Baum– erstens ein Suchbaum– zweitens ausgeglichen
• Datenstruktur für L– AVL-Baum?– Problem: „Vorgänger“ und „Nachfolger“ finden
das wird vom AVL-Baum nicht unterstützt– also: Variante des AVL-Baums
• alle Informationen sind in Blättern (nicht in inneren Knoten)• die Blätter bilden eine doppelt verkettete Liste
![Page 27: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/27.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 27
Eine Variante des AVL-Baums
• mit einer doppelt verketteten Liste der Blätter
• für die Menge der aktiven Elemente
![Page 28: Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung 6 18.05.00](https://reader036.vdokument.com/reader036/viewer/2022070507/570491c31a28ab14218d95c6/html5/thumbnails/28.jpg)
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 6 - 18.05.00 28
für die Haltepunkte ...
• ...mit den Operationen– Einfügen eines gefundenen Schnittpunktes– Finden und Entfernen des nächsten (also minimalen)
Elements ...
• ... genügt ein „normaler“ AVL-Baum• obwohl man mit Kanonen auf Spatzen schießt• besser: ein Heap (wie bei Dijkstra)