private static void UpdateEdge(HalfEdge edgeToRemove, KeyedPriorityQueue <int, HalfEdge, float> priorityQueue, HashSet <EdgeID> deletedEdgeSet, List <Vector2> pointList) { HalfEdge left = GetUndeletedLeft(edgeToRemove, deletedEdgeSet); HalfEdge right = GetUndeletedRight(edgeToRemove, deletedEdgeSet); HalfEdge reLeft = RepresentActive(left); if (priorityQueue.Contain(reLeft.mKey)) { // Check if this is still removable HalfEdge leftOfLeft = GetUndeletedLeft(left.mPartner, deletedEdgeSet); if ((leftOfLeft.mPartner != null && (leftOfLeft.mPartner.mKey == right.mKey || leftOfLeft.mPartner.mKey == edgeToRemove.mKey)) || !GeoPolygonUtils.IsConvex(pointList[edgeToRemove.mIndex], pointList[right.mNext.mIndex], pointList[leftOfLeft.mIndex])) { priorityQueue.Remove(reLeft.mKey); } else { // Need to update the priority float pri = GetSmallestAdjacentAngleOnEdge(left, deletedEdgeSet, pointList); priorityQueue.Remove(reLeft.mKey); priorityQueue.Enqueue(reLeft.mKey, reLeft, pri); } } HalfEdge reRight = RepresentActive(right); if (priorityQueue.Contain(reRight.mKey)) { HalfEdge rightOfRight = GetUndeletedRight(right, deletedEdgeSet); if ((rightOfRight.mPartner != null && (rightOfRight.mPartner.mKey == left.mKey || rightOfRight.mKey == edgeToRemove.mKey)) || !GeoPolygonUtils.IsConvex(pointList[edgeToRemove.mIndex], pointList[rightOfRight.mNext.mIndex], pointList[left.mIndex])) { priorityQueue.Remove(reRight.mKey); } else { priorityQueue.Remove(reRight.mKey); priorityQueue.Enqueue(reRight.mKey, reRight, GetSmallestAdjacentAngleOnEdge(right, deletedEdgeSet, pointList)); } } }