private void addSegmentToGraph()

in diagram/src/main/java/jetbrains/jetpad/projectional/diagram/algorithm/orthogonal/OrthogonalRouteWithObstacles.java [463:494]


    private void addSegmentToGraph(Segment seg, Set<Vector> points) {
      for (Segment s: myEndpointSegments) {
        addVertex(seg, points, s, null);
      }
      boolean ver = seg.start.x == seg.end.x;
      int coord = ver ? seg.start.x : seg.start.y;
      for (MyLine l: mySegmentsMap.keySet()) {
        if (l.ver == ver) continue;
        boolean segIntersectsLine;
        if (ver) {
          segIntersectsLine = seg.start.y <= l.coord && l.coord <= seg.end.y;
        } else {
          segIntersectsLine = seg.start.x <= l.coord && l.coord <= seg.end.x;
        }
        if (!segIntersectsLine) continue;
        Segment s = getIntersectingSegment(l, coord);
        if (s != null) {
         Vector intersectingPoint;
          if (ver) {
            intersectingPoint = new Vector(coord, l.coord);
          } else {
            intersectingPoint = new Vector(l.coord, coord);
          }
          points.add(intersectingPoint);
          put(intersectingPoint);
          if (!pointsToLine.containsKey(intersectingPoint)) {
            pointsToLine.put(intersectingPoint, l);
          }
        }
      }
      connectList(new ArrayList<>(points));
    }