public void Add(T node, T neighbour, bool oneway = false) { if (node == null) { throw new ArgumentNullException("node"); } if (neighbour == null) { throw new ArgumentNullException("neighbour"); } NeighbourInfo info = null; if (_entries.TryGetValue(node, out info) && info != null) { while (info != null) { if (_entries.Comparer.Equals(info.Value, neighbour)) { break; } else if (info.Next == null) { info.Next = new NeighbourInfo() { Value = neighbour }; break; } else { info = info.Next; } } } else { _entries[node] = new NeighbourInfo() { Value = neighbour }; } if (!oneway) { this.Add(neighbour, node, true); } else if (!_entries.ContainsKey(neighbour)) { _entries.Add(neighbour, null); } }
public CornerInfo(Vector3 point) { isRounded = false; vertex = point; angle = Uninitiated; toPrevious = new NeighbourInfo() { dirty = true }; toNext = new NeighbourInfo() { dirty = true }; arcCenter = arcPoint1 = arcPoint2 = Vector3.zero; radiusExpected = radiusAdjusted = Uninitiated; }
public void AddNeighbour(AAPrism neighbour, List <Vector3> points) { Vector3 average = Vector3.zero; foreach (var item in points) { average += item; } average /= points.Count; float d1 = (Centre - average).sqrMagnitude, d2 = (neighbour.Centre - average).sqrMagnitude; NeighbourInfo n = new NeighbourInfo(neighbour, d1 + d2, points); if (neighbours.Contains(n)) { return; } neighbours.Add(n); }