| 2147 | } |
| 2148 | |
| 2149 | ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p) |
| 2150 | { |
| 2151 | ImVec2 ap = p - a; |
| 2152 | ImVec2 ab_dir = b - a; |
| 2153 | float dot = ap.x * ab_dir.x + ap.y * ab_dir.y; |
| 2154 | if (dot < 0.0f) |
| 2155 | return a; |
| 2156 | float ab_len_sqr = ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y; |
| 2157 | if (dot > ab_len_sqr) |
| 2158 | return b; |
| 2159 | return a + ab_dir * dot / ab_len_sqr; |
| 2160 | } |
| 2161 | |
| 2162 | bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p) |
| 2163 | { |
no outgoing calls
no test coverage detected