[Interest] best qt class to use to detect line/polygon/region collision
maitai
maitai at virtual-winds.org
Mon Aug 8 18:05:48 CEST 2016
Hello all,
I have a list of lines (QLineF) in 2D space. Some might represent a
closed polygon, some others are just a line or represent a non closed
polygon. Classical problem: I need to detect if another given line is
crossing one of the lines in the list. I don't need the crossing point,
just to know if it crosses or not.
For the time being, I just iterate on the list and use
QLineF::intersects(). This is of course badly slow.
I read that post (and many others):
http://stackoverflow.com/questions/9393672/intersection-point-of-qpainterpath-and-line-find-qpainterpath-y-by-x
Using a QPainterPath seems the right idea, but as it seems it does not
work with a single line, so maybe I should convert the line in a tiny
rectangle to be able to use QPainterPath::intersects(). Will that be
faster?
Before I try that, I was wondering if someone has a better idea as of
what class to use in qt to solve this? Calculation speed is the most
important thing in my case.
Thanks for pointing me in the right direction
Philippe Lelong
More information about the Interest
mailing list