[Qt-interest] Detecting intersections in a QPainterPath
Colin S. Miller
no-spam-thank-you at csmiller.demon.co.uk
Mon Aug 16 21:38:41 CEST 2010
benswerts at telenet.be wrote:
> Thanks to everyone who replied.
>
> I don't think I can use the QPainterPath::intersects function as it closes any open paths. I also cannot specify any bounds as the points are in floating point format.
>
> I decided to go for a fully customized solution and wrote functions that can detect whether a line intersects with an arc or whether two arcs intersect. The one constraint I have is the fact that the arcs are circular so I could base them on line/circle and circle/circle intersection algorithms. The final algorithm is O(N^2), just like the original version that only worked on linear segments.
>
> Greets,
>
Ben,
At some complexity, you could create a reverse path from the original path, and then merge them.
Might be quicker than digging through the path code.
HTH,
Colin S. Miller
More information about the Qt-interest-old
mailing list