6 releases (breaking)
0.5.0 | Apr 25, 2021 |
---|---|
0.4.0 | Apr 6, 2021 |
0.3.0 | Feb 3, 2020 |
0.2.0 | Nov 8, 2019 |
0.1.1 | Jul 3, 2019 |
#2079 in Algorithms
42KB
1K
SLoC
geo-visibility
This crate contains algorithms to compute visibility polygon.
This code is a Rust port of the C++ lib visibility.
Example
The following example shows how to compute the visibility polygon of a point amongst line obstacles.
The visibility
method is provided by the Visibility
trait which is implemented for most geo-types.
use geo::{Coordinate, Line};
use geo_visibility::Visibility;
let point = geo::Point::new(0.0, 0.0);
let lines = vec![
Line::new(
Coordinate { x: 1.0, y: 1.0 },
Coordinate { x: 1.0, y: -1.0 },
),
Line::new(
Coordinate { x: -1.0, y: -1.0 },
Coordinate { x: -1.0, y: -2.0 },
),
];
let visibility_polygon = point.visibility(lines.as_slice());
Dependencies
~4–6.5MB
~122K SLoC