Check if a point is on the "inside" (left side) of a directed edge.
(point: [f64; 2], edge_start: [f64; 2], edge_end: [f64; 2])
| 163 | |
| 164 | /// Check if a point is on the "inside" (left side) of a directed edge. |
| 165 | fn is_inside(point: [f64; 2], edge_start: [f64; 2], edge_end: [f64; 2]) -> bool { |
| 166 | // Cross product: (edge_end - edge_start) × (point - edge_start) |
| 167 | // Positive = left side = inside for CCW winding. |
| 168 | let cross = (edge_end[0] - edge_start[0]) * (point[1] - edge_start[1]) |
| 169 | - (edge_end[1] - edge_start[1]) * (point[0] - edge_start[0]); |
| 170 | cross >= 0.0 |
| 171 | } |
| 172 | |
| 173 | /// Compute the intersection point of two line segments (as infinite lines). |
| 174 | fn line_intersection(a1: [f64; 2], a2: [f64; 2], b1: [f64; 2], b2: [f64; 2]) -> Option<[f64; 2]> { |
no outgoing calls
no test coverage detected