Sweep-Line Algorithm for Line Segment Intersection (2/5) | Computational Geometry - Lecture 02

  Рет қаралды 51,085

Philipp Kindermann

Philipp Kindermann

4 жыл бұрын

Computational Geometry
Lecture 02: Sweep-Line Algorithm for Line Segment Intersection
Part II: Sweep-Line Algorithm
Philipp Kindermann
Playlist: • Sweep-Line Algorithm f...
Slides: algo.uni-trier.de/lectures/al...
Full course: / @philippkindermann

Пікірлер: 28
@fridericusrex9812
@fridericusrex9812 3 ай бұрын
Best explanation on KZfaq.
@moritzgro2442
@moritzgro2442 2 жыл бұрын
This is really good. Please also upload further lectures!
@juliuslirr9635
@juliuslirr9635 4 жыл бұрын
Thank you for making this available to the public! Great explanation
@karatsurba4791
@karatsurba4791 10 ай бұрын
Thanks for sharing the knowledge Professor.
@GR3AT3ST
@GR3AT3ST 4 жыл бұрын
The best explanation out there, thank you so much!
@AndresFH7233
@AndresFH7233 3 жыл бұрын
It is a great explanation, thank you!
@kannanmohan4422
@kannanmohan4422 Жыл бұрын
Best explanation found in the topic
@h_2577
@h_2577 2 жыл бұрын
Thank u for this amazing tutorial.
@Alex-xx8ij
@Alex-xx8ij 2 жыл бұрын
Great lecture!
@anirudhmenon749
@anirudhmenon749 4 жыл бұрын
Your explanation- Amazing! Your accent - Even better! Thanks for the great work. Keep the video's coming!
@gagra1234
@gagra1234 4 жыл бұрын
Hey, Phillip! Thanks for a cool explanation. Wouldn't it be more appropriate to use a heap data structure in order to keep trask of sweep line motion? It seems that the only operation that we need for this part of the algorithm is actually "get the topmost point" and such an operation is provided by the max binary heap with the same algorithmic complexity as a BST (log(n)) but with less overhead for pointers and stuff. What do you think?
@PhilippKindermann
@PhilippKindermann 4 жыл бұрын
Hey gagra, great suggestion! The reason we use a BST instead of a heap is a bit hidden: In line 4 of findNewEvent (see the next video, Part III: Algorithmic Details), we have to check whether the intersection point of two neighboring segments already exists in the event queue. This is an operation that we cannot do in O(log n) time on a heap. We could store all points that we already found and then do this test in O(log n) time, but that defeats the advantages of a heap. Also, in the improvement of the space consumption (very last slide, Part V: Running Time) from O(n+k) to O(n), we have to remove points from the queue, which we also cannot do fast enough on a heap.
@gagra1234
@gagra1234 4 жыл бұрын
@@PhilippKindermann I checked out the second video and now i see why you use a BST for a general case, thanks for an explanation. However in my case I am not looking for all intersection, I am looking for the first one (I just need to verify that a set of segements in not self intersecting) so in my case 1) the segments never change order on the sweep line, case when they do they have an intersection and I simply quit the routine 2) I never have to add anything else except for initial points to the event queue for the same reason. This kinda simplifies the task alot from the algorithimc perspecitive and many things that you handle in the general case I can just omit. So in my special case it still looks like the binary heap would work. Another bonus of a binary heap in my scenario is that to construct a heap out on N points you need O(N) operations, while an incremental construction of a BST would require O(N log(N)). And of course despite the fact that a self balancing BST and a heap have the same assimptotic complexity O(log(N)) of the exctact min operation the binary heap has a way smaller constant assosiated with it since you just need to sink a single element after you grab your min element and this is much more simple than a remove operation of a BST that may require a sequence of rotations. I see you have a whole bunch of videos on computational geometry. That is cool, keep it going man! I will check them out.
@PhilippKindermann
@PhilippKindermann 4 жыл бұрын
@@gagra1234 This is true, if you only want to find any intersection, then you don't need a binary tree. In this case, you could even store all the points in a sorted list / array, since your event queue is static (we only add intersection points to the event queue, but you stop as soon as you find one). Then construction takes O(n log n) time, but you only need constant time for extraction; this should give you even smaller constants. Thank you for your kind words!
@sergiocalad
@sergiocalad Ай бұрын
Excelent explanation. Can you explain Vatti's algorithm?
@Cabot696
@Cabot696 4 жыл бұрын
Amazingly helpful lesson. I'm trying to compute the visibility polygon of line segments using an angular sweep line algorithm, and your explanation is very easy to understand. Thank you!
@TrucNguyen-uy4kw
@TrucNguyen-uy4kw Жыл бұрын
how can i know one line between two line segment other ?
@102petar
@102petar 3 жыл бұрын
I have one question about the algorithm, let's say we were interested in only counting the intersections that are not using an endpoint of a segment, in the example, there is only one such intersection (the first red dot). So, can we use the sweep line method just to detect these intersections, thus the runtime would be O(I).
@102petar
@102petar 3 жыл бұрын
or does the algorithm only sees the intersections as event points only because it has seen it previously from checking the two segments?
@PhilippKindermann
@PhilippKindermann 3 жыл бұрын
@@102petar Your second thought is correct. To find that intersection point, you first have to process the two segments that intersect in that point. So you still require the O(n log n + I) running time.
@axelmuller4341
@axelmuller4341 3 жыл бұрын
The first time my prof could explain a topic better than the KZfaq
@gabealberro6081
@gabealberro6081 7 ай бұрын
fantastic
@Pkroc138
@Pkroc138 3 жыл бұрын
Which did software you use to do this presentation.?
@PhilippKindermann
@PhilippKindermann 3 жыл бұрын
I used ipe, a vector drawing program with ipe support by the one and only Otfried Cheong: ipe.otfried.org/
@Pkroc138
@Pkroc138 3 жыл бұрын
@@PhilippKindermann Thanks! I used pipe since about a year, but i didn't have idea that I can make presentations with it!
@Code4Ever
@Code4Ever 10 ай бұрын
I expected the first Data Structure to be a maxHeap, since it will be way easier to get this done through a heap where we just need the maximum intersection point. Great explanation nonetheless
@PhilippKindermann
@PhilippKindermann 9 ай бұрын
The reason I didn't use a MaxHeap is that deletion cannot be done trivially in logarithmic time. Otherwise a MaxHeap would be easier, that's true.
@HornOKPlease
@HornOKPlease Жыл бұрын
this saved my ass
Closest Pair of Points (Divide and Conquer) Explained
8:45
One moment can change your life ✨🔄
00:32
A4
Рет қаралды 33 МЛН
Now THIS is entertainment! 🤣
00:59
America's Got Talent
Рет қаралды 39 МЛН
11   2   Line Segment Intersection 546
5:47
Osiris Salazar
Рет қаралды 37 М.
6 Levels of Thinking Every Student MUST Master
17:12
Justin Sung
Рет қаралды 1,3 МЛН
1. The Geometry of Linear Equations
39:49
MIT OpenCourseWare
Рет қаралды 1,7 МЛН
Convex Hull Algorithm - Graham Scan and Jarvis March tutorial
7:24
What's a Tensor?
12:21
Dan Fleisch
Рет қаралды 3,6 МЛН
Segment intersection formula explained
35:26
Radu Mariescu-Istodor
Рет қаралды 31 М.
Convex Hull or Mixing Things (2/5) | Computational Geometry - Lecture 01
9:53
Plane Sweep Algorithm for finding Line Segment Intersections
44:16
Algorithms Lab
Рет қаралды 4,8 М.
Телефон-електрошокер
0:43
RICARDO 2.0
Рет қаралды 1,3 МЛН
Look, this is the 97th generation of the phone?
0:13
Edcers
Рет қаралды 5 МЛН
Samsung Galaxy 🔥 #shorts  #trending #youtubeshorts  #shortvideo ujjawal4u
0:10
Ujjawal4u. 120k Views . 4 hours ago
Рет қаралды 8 МЛН
S24 Ultra and IPhone 14 Pro Max telephoto shooting comparison #shorts
0:15
Photographer Army
Рет қаралды 9 МЛН
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 1,8 МЛН
$1 vs $100,000 Slow Motion Camera!
0:44
Hafu Go
Рет қаралды 27 МЛН
iPhone, Galaxy или Pixel? 😎
0:16
serg1us
Рет қаралды 1,1 МЛН