Beispiel #1
0
 /**
  * Report triangles surrounding site in order (cw or ccw).
  * @param site we want the surrounding triangles for this site
  * @param triangle a "starting" triangle that has site as a vertex
  * @return all triangles surrounding site in order (cw or ccw)
  * @throws ArgumentException if site is not in triangle
  */
 public List<Triangle> surroundingTriangles(Pnt site, Triangle triangle)
 {
     if (!triangle.Contains(site))
         throw new ArgumentException("Site not in triangle");
     List<Triangle> list = new List<Triangle>();
     Triangle start = triangle;
     Pnt guide = triangle.getVertexButNot(site);        // Affects cw or ccw
     while (true) {
         list.AddIfNotContains(triangle);
         Triangle previous = triangle;
         triangle = neighborOpposite(guide, triangle); // Next triangle
         guide = previous.getVertexButNot(site, guide);     // Update guide
         if (triangle == start) break;
     }
     return list;
 }