///// <summary> ///// key - Пересекаемый набор линий (другой объект)<br/> ///// value - Список пересекаемых линий (линия данного объекта, линии другого объекта) ///// </summary> public void CheckIntersects(LineSet otherLineSet) { var otherIntersects = otherLineSet.IntersectLineSets; IntersectLines thisIntersectLines = new IntersectLines(); IntersectLines otherIntersectLines = new IntersectLines(); foreach (var line in lines) { List <Line> lineInters = new List <Line>(); foreach (var otherLine in otherLineSet.lines) { if (line.IsIntersect(otherLine)) { lineInters.Add(otherLine); //intersects.Add(otherItem); // В набор текущего объекта пересечений добавляем линию из другого набора //var otherIntersects = otherLineSet.intersects; // Набор пересечений другого объекта //List<Line> otherIntersectsValues; //if (otherIntersects.ContainsKey(this)) //{ // otherIntersectsValues = otherIntersects[this]; //} //else //{ // otherIntersectsValues = new List<Line>(); // otherIntersects.Add(this, otherIntersectsValues); //} //otherIntersectsValues.Add(item); // Добавление записи о пересечении для другого объекта } } if (lineInters.Count > 0) { } } }
public void Add(Line line, Line lineOther) { LineSet other = lineOther.Owner; IntersectLines intersected; if (!others.TryGetValue(other, out intersected)) { intersected = new IntersectLines(); others.Add(other, intersected); } List <Line> lines; if (!intersected.TryGetValue(line, out lines)) { lines = new List <Line>(); intersected.Add(line, lines); } lines.Add(lineOther); }