| 159 | } |
| 160 | |
| 161 | double parameterOfPointOnLine(double x0, double y0, double dx, double dy, double x, double y, bool& ok) |
| 162 | { |
| 163 | const double epsilon = 1e-5; |
| 164 | ok = true; |
| 165 | |
| 166 | if (qAbs(dx) > qAbs(dy)) |
| 167 | { |
| 168 | double param = (x - x0) / dx; |
| 169 | if (qAbs(y0 + param * dy - y) < epsilon) |
| 170 | return param; |
| 171 | } |
| 172 | else if (dy != 0) |
| 173 | { |
| 174 | double param = (y - y0) / dy; |
| 175 | if (qAbs(x0 + param * dx - x) < epsilon) |
| 176 | return param; |
| 177 | } |
| 178 | |
| 179 | ok = false; |
| 180 | return -1; |
| 181 | } |
| 182 | |
| 183 | bool isPointOnSegment(const MapCoordF& seg_start, const MapCoordF& seg_end, const MapCoordF& point) |
| 184 | { |
no outgoing calls
no test coverage detected