private static void Delaunay2DCreateSuperTriangle(List <Vertex> vertices, Adjacency adjacency, out int stIdx1, out int stIdx2, out int stIdx3) { // Calculate super triangle Bounds2D bounds = new Bounds2D(); for (int i = 0; i < vertices.Count; i++) { bounds.AddPoint(vertices[i]); } Vertex center; float radius; bounds.BoundingCircunference(out center, out radius); Vertex st1 = new Vertex(); Vertex st2 = new Vertex(); Vertex st3 = new Vertex(); const float DEG2RAD = (float)Math.PI / 180.0f; st1.x = center.x + 2.0f * radius * (float)Math.Cos(0.0f * DEG2RAD); st1.y = center.y + 2.0f * radius * (float)Math.Sin(0.0f * DEG2RAD); st2.x = center.x + 2.0f * radius * (float)Math.Cos(120.0f * DEG2RAD); st2.y = center.y + 2.0f * radius * (float)Math.Sin(120.0f * DEG2RAD); st3.x = center.x + 2.0f * radius * (float)Math.Cos(240.0f * DEG2RAD); st3.y = center.y + 2.0f * radius * (float)Math.Sin(240.0f * DEG2RAD); adjacency.vertices.Add(st1); adjacency.vertices.Add(st2); adjacency.vertices.Add(st3); stIdx1 = adjacency.vertices.Count - 3; stIdx2 = adjacency.vertices.Count - 2; stIdx3 = adjacency.vertices.Count - 1; adjacency.CreateTriangle(stIdx1, stIdx2, stIdx3); }
private static void Delaunay2DCreateSuperTriangle(List<Vertex> vertices, Adjacency adjacency, out int stIdx1, out int stIdx2, out int stIdx3) { // Calculate super triangle Bounds2D bounds = new Bounds2D(); for (int i = 0; i < vertices.Count; i++) { bounds.AddPoint(vertices[i]); } Vertex center; float radius; bounds.BoundingCircunference(out center, out radius); Vertex st1 = new Vertex(); Vertex st2 = new Vertex(); Vertex st3 = new Vertex(); const float DEG2RAD = (float)Math.PI / 180.0f; st1.x = center.x + 2.0f * radius * (float)Math.Cos(0.0f * DEG2RAD); st1.y = center.y + 2.0f * radius * (float)Math.Sin(0.0f * DEG2RAD); st2.x = center.x + 2.0f * radius * (float)Math.Cos(120.0f * DEG2RAD); st2.y = center.y + 2.0f * radius * (float)Math.Sin(120.0f * DEG2RAD); st3.x = center.x + 2.0f * radius * (float)Math.Cos(240.0f * DEG2RAD); st3.y = center.y + 2.0f * radius * (float)Math.Sin(240.0f * DEG2RAD); adjacency.vertices.Add(st1); adjacency.vertices.Add(st2); adjacency.vertices.Add(st3); stIdx1 = adjacency.vertices.Count - 3; stIdx2 = adjacency.vertices.Count - 2; stIdx3 = adjacency.vertices.Count - 1; adjacency.CreateTriangle(stIdx1, stIdx2, stIdx3); }