Whether point q lies on segment p-r (given that p, q, r are collinear).
(p: [f64; 2], q: [f64; 2], r: [f64; 2])
| 31 | |
| 32 | /// Whether point q lies on segment p-r (given that p, q, r are collinear). |
| 33 | pub fn on_segment(p: [f64; 2], q: [f64; 2], r: [f64; 2]) -> bool { |
| 34 | q[0] <= p[0].max(r[0]) |
| 35 | && q[0] >= p[0].min(r[0]) |
| 36 | && q[1] <= p[1].max(r[1]) |
| 37 | && q[1] >= p[1].min(r[1]) |
| 38 | } |
| 39 | |
| 40 | /// Whether two segments (p1-q1) and (p2-q2) intersect. |
| 41 | /// |
no outgoing calls
no test coverage detected