MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / is_inside

Function is_inside

nodedb-spatial/src/predicates/intersection.rs:165–171  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

163
164/// Check if a point is on the "inside" (left side) of a directed edge.
165fn 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).
174fn line_intersection(a1: [f64; 2], a2: [f64; 2], b1: [f64; 2], b2: [f64; 2]) -> Option<[f64; 2]> {

Callers 1

sutherland_hodgmanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected