Years ago I was making a diagram editor with the intent of doing code generation from diagrams (like simulink, not stateflow). I started with splines for the connections and decided straight lines and junctions would be better for complex diagrams. I realized that a better way to internally define the connecting wires is via a set of lines and their connectivity (vs their endpoint coordinates). Imagine each line segment is defined by a direction (vertical or horizontal) and a position (perpendicular distance from the origin) Like ax+by=d where a and b are either 0 or 1. You also need to define which other lines it connects to. Given the list of connections you can then calculate the intersections at rendering time. By sorting the list of connections you can render the line without features at the start and end, and then draw junctions for any intermediate connections. The beauty of this would be to allow dragging blocks around and having the lines follow with the junctions passing through each other as needed. There is some housekeeping with this data structure (merging colinear segments that connect, breaking segments when needed) but the UI for dragging should be much better than anything out there.