public void ComputeStreetIntersections(List <List <Vector3> > streets) { intersections = new List <List <int> > (); for (int i = 0; i < streets.Count; i++) { List <int> streetIntersections = new List <int> (); for (int j = 0; j < streets.Count; j++) { for (int k = 0; k < streets [i].Count - 1; k++) { for (int t = 0; t < streets [j].Count - 1; t++) { Vector3 intersection = new Vector3(); if (Math3D.AreLineSegmentsCrossing(out intersection, streets [i] [k], streets [i] [k + 1], streets [j] [t], streets [j] [t + 1])) { streetIntersections.Add(j); } } } } intersections.Add(streetIntersections); } }