public static bool TryIntersect(this TriangulationIsland island, double x, double y, out int triangleIndex) { if (x < island.IntBounds.Left || y < island.IntBounds.Top || x > island.IntBounds.Right || y > island.IntBounds.Bottom) { triangleIndex = -1; return(false); } for (var i = 0; i < island.Triangles.Length; i++) { if (IsPointInTriangle(x, y, ref island.Triangles[i])) { triangleIndex = i; return(true); } } triangleIndex = -1; return(false); }
public bool NN(TriangulationIsland island, DoubleVector2 destination, out (int, int[]) res)
public static bool TryIntersect(this Triangulation triangulation, double x, double y, out TriangulationIsland island, out int triangleIndex) { foreach (var candidateIsland in triangulation.Islands) { if (candidateIsland.TryIntersect(x, y, out triangleIndex)) { island = candidateIsland; return(true); } } island = null; triangleIndex = -1; return(false); }