-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
This does not produce the correct visibility in the following situation:
let point = geo::Point::new(1.53, -0.4);
let lines = vec![
Line {
start: Coordinate { x: 0.0, y: 0.5 },
end: Coordinate { x: 1.5, y: 0.5 },
},
Line {
start: Coordinate { x: 0.0, y: 0.0 },
end: Coordinate { x: 0.0, y: 1.0 },
},
Line {
start: Coordinate { x: 1.5, y: 0.5 },
end: Coordinate { x: 1.5, y: 1.5 },
},
Line {
start: Coordinate { x: 0.5, y: -0.5 },
end: Coordinate { x: 0.5, y: 0.5 },
},
Line {
start: Coordinate { x: -25.0, y: -25.0 },
end: Coordinate { x: 25.0, y: -25.0 },
},
Line {
start: Coordinate { x: 25.0, y: -25.0 },
end: Coordinate { x: 25.0, y: 25.0 },
},
Line {
start: Coordinate { x: 25.0, y: 25.0 },
end: Coordinate { x: -25.0, y: 25.0 },
},
Line {
start: Coordinate { x: -25.0, y: 25.0 },
end: Coordinate { x: -25.0, y: -25.0 },
},
];
let vis = point.visibility(lines.as_slice());
The output is:
Polygon { exterior: LineString([Coordinate { x: 25.0, y: 25.0 }, Coordinate { x: 25.0, y: -25.0 }, Coordinate { x: -25.0, y: -25.0 }, Coordinate { x: -25.0, y: -2.975728155339805 }, Coordinate { x: 0.5, y: -0.5 }, Coordinate { x: 0.5, y: 0.5 }, Coordinate { x: 0.0, y: 1.0 }, Coordinate { x: 0.5464285714285712, y: 0.5000000000000001 }, Coordinate { x: 25.0, y: 25.0 }]), interiors: [] }
This is incorrect. In particular, the Coordinate { x: 0.0, y: 1.0 } should not be visible (the first line blocks it).
It also prints out the following warnings:
[geo_visibility::visibility] ray intersects a line segment iff the line segment is in the state
[geo_visibility::visibility] ray intersects a line segment iff the line segment is in the state
[geo_visibility::visibility] ray intersects a line segment iff the line segment is in the state
ginnyTheCat
Metadata
Metadata
Assignees
Labels
No labels