| 190 | } |
| 191 | |
| 192 | inline bool RectangleOverlapsBezier(const ImRect& rectangle, const CubicBezier& cubic_bezier) |
| 193 | { |
| 194 | ImVec2 current = |
| 195 | EvalCubicBezier(0.f, cubic_bezier.P0, cubic_bezier.P1, cubic_bezier.P2, cubic_bezier.P3); |
| 196 | const float dt = 1.0f / cubic_bezier.NumSegments; |
| 197 | for (int s = 0; s < cubic_bezier.NumSegments; ++s) |
| 198 | { |
| 199 | ImVec2 next = EvalCubicBezier( |
| 200 | static_cast<float>((s + 1) * dt), |
| 201 | cubic_bezier.P0, |
| 202 | cubic_bezier.P1, |
| 203 | cubic_bezier.P2, |
| 204 | cubic_bezier.P3); |
| 205 | if (RectangleOverlapsLineSegment(rectangle, current, next)) |
| 206 | { |
| 207 | return true; |
| 208 | } |
| 209 | current = next; |
| 210 | } |
| 211 | return false; |
| 212 | } |
| 213 | |
| 214 | inline bool RectangleOverlapsLink( |
| 215 | const ImRect& rectangle, |
no test coverage detected