static public bool IntersectSlice(List <Vector2D> points, Vector2D circle, float radius) { foreach (Pair2D id in Pair2D.GetList(points, false)) // Remove GetList() { if (IntersectLine(id, circle, radius) == true) { return(true); } } return(false); }
static public bool IntersectPolygon(Polygon2D poly, Vector2D circle, float radius) { foreach (Pair2D id in Pair2D.GetList(poly.pointsList)) // Remove GetList() { if (IntersectLine(id, circle, radius) == true) { return(true); } } return(false); }
// Might Break (Only for 2 collisions) /// <summary> /// Return a list which starts with first interesction with given slice /// </summary> public static List <Vector2D> GetListStartingIntersectSlice(List <Vector2D> pointsList, List <Vector2D> slice) { List <Vector2D> result = new List <Vector2D> (); bool start = false; List <Pair2D> pointsPairList = Pair2D.GetList(pointsList); foreach (Pair2D p in pointsPairList) { List <Vector2D> r = Math2D.GetListLineIntersectSlice(p, slice); if (start == true) { result.Add(p.A); } if (r.Count > 0) { result.Add(r.First()); start = true; } } foreach (Pair2D p in pointsPairList) { List <Vector2D> r = Math2D.GetListLineIntersectSlice(p, slice); if (start == true) { result.Add(p.A); } if (r.Count > 0) { result.Add(r.First()); start = false; } } return(result); }