1
0

started to implement second algorithm

This commit is contained in:
2019-05-15 11:23:57 +02:00
parent 8f2aed3dbb
commit 57314a0a94
4 changed files with 80 additions and 2 deletions

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using Priority_Queue;
namespace TMI_practicum
{
public static class SweepLineAlgorithm
{
public static IEnumerable<Intersection> Solve(IList<Circle> circles)
{
// fuck deze priority queue piece of shit.... >:(
SimplePriorityQueue<Event, double> events = new SimplePriorityQueue<Event, double>();
Stack<Intersection> intersections = new Stack<Intersection>();
var segments = new List<Segment>();
foreach (var circle in circles)
{
events.Enqueue(new Event(Event.EventType.Start, circle.X - circle.R), circle.X - circle.R);
events.Enqueue(new Event(Event.EventType.End, circle.X + circle.R), circle.X + circle.R);
}
return null;
}
private struct Event
{
public EventType Type { get; }
public double X { get; }
public enum EventType
{
Start,
End,
Intersect
}
public Event(EventType type, double xCoordinate)
{
Type = type;
X = xCoordinate;
}
}
private struct Segment
{
public SegmentType Type { get; }
public Circle Circle { get; }
public enum SegmentType
{
Top,
Bottom
}
public Segment(Circle circle, SegmentType type)
{
Circle = circle;
Type = type;
}
}
}
}