| 1971 | } |
| 1972 | |
| 1973 | ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p) |
| 1974 | { |
| 1975 | ImVec2 ap = p - a; |
| 1976 | ImVec2 ab_dir = b - a; |
| 1977 | float dot = ap.x * ab_dir.x + ap.y * ab_dir.y; |
| 1978 | if (dot < 0.0f) |
| 1979 | return a; |
| 1980 | float ab_len_sqr = ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y; |
| 1981 | if (dot > ab_len_sqr) |
| 1982 | return b; |
| 1983 | return a + ab_dir * dot / ab_len_sqr; |
| 1984 | } |
| 1985 | |
| 1986 | bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p) |
| 1987 | { |
no outgoing calls
no test coverage detected