/// <summary> /// Initializes a new instance of the <see cref="EventQueue" /> class. /// </summary> /// <param name="source">The source coordinates representing multiple line strings.</param> /// <exception cref="System.ArgumentNullException">The source is null.</exception> public EventQueue(IEnumerable <IList <Coordinate> > source) { // source: http://geomalgorithms.com/a09-_intersect-3.html if (source == null) { throw new ArgumentNullException("source", "The source is null."); } _comparer = new CoordinateComparer(); _eventHeap = new EventHeap(); Int32 index = 0, compare; foreach (IList <Coordinate> coordinateList in source) { if (coordinateList == null || coordinateList.Count < 2) { continue; } for (Int32 i = 0; i < coordinateList.Count - 1; i++) { EndPointEvent firstEvent = new EndPointEvent { Edge = index, Vertex = coordinateList[i] }; EndPointEvent secondEvent = new EndPointEvent { Edge = index, Vertex = coordinateList[i + 1] }; compare = _comparer.Compare(coordinateList[i], coordinateList[i + 1]); if (compare == 0) { continue; } if (compare < 0) { firstEvent.Type = EventType.Left; secondEvent.Type = EventType.Right; } else { firstEvent.Type = EventType.Right; secondEvent.Type = EventType.Left; } _eventHeap.Insert(firstEvent); _eventHeap.Insert(secondEvent); index++; } index++; } }
/// <summary> /// Initializes a new instance of the <see cref="EventQueue" /> class. /// </summary> /// <param name="source">The source coordinates representing a single line string.</param> /// <exception cref="System.ArgumentNullException">The source is null.</exception> public EventQueue(IEnumerable <Coordinate> source) { if (source == null) { throw new ArgumentNullException(nameof(source)); } this.comparer = new CoordinateComparer(); this.coordinateCount = 0; this.eventHeap = new EventHeap(); this.AppendCoordinates(source); }
public GameState() { var character = Globals.CreateInstance <ICharacter>(); Debug.Assert(character != null); EnhancedParser = !Globals.IsRulesetVersion(5); Sa = new long[character.SpellAbilities.Length]; ImportedArtUids = new long[character.Weapons.Length + 2]; HeldWpnUids = new long[character.Weapons.Length]; BeforePrintPlayerRoomEventHeap = new EventHeap(); AfterPrintPlayerRoomEventHeap = new EventHeap(); }