| 1567 | } |
| 1568 | |
| 1569 | ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p) |
| 1570 | { |
| 1571 | ImVec2 ap = p - a; |
| 1572 | ImVec2 ab_dir = b - a; |
| 1573 | float dot = ap.x * ab_dir.x + ap.y * ab_dir.y; |
| 1574 | if (dot < 0.0f) |
| 1575 | return a; |
| 1576 | float ab_len_sqr = ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y; |
| 1577 | if (dot > ab_len_sqr) |
| 1578 | return b; |
| 1579 | return a + ab_dir * dot / ab_len_sqr; |
| 1580 | } |
| 1581 | |
| 1582 | bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p) |
| 1583 | { |
no outgoing calls
no test coverage detected