| Crates.io | geo-visibility |
| lib.rs | geo-visibility |
| version | 0.6.0 |
| created_at | 2019-07-03 10:48:43.839807+00 |
| updated_at | 2025-02-08 10:31:43.63301+00 |
| description | Compute visibility polygon |
| homepage | |
| repository | https://github.com/lelongg/geo-visibility |
| max_upload_size | |
| id | 145610 |
| size | 46,127 |
This crate contains algorithms to compute visibility polygon.
This code is a Rust port of the C++ lib visibility.
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::{Coord, Line};
use geo_visibility::Visibility;
let point = geo::Point::new(0.0, 0.0);
let lines = vec![
Line::new(
Coord { x: 1.0, y: 1.0 },
Coord { x: 1.0, y: -1.0 },
),
Line::new(
Coord { x: -1.0, y: -1.0 },
Coord { x: -1.0, y: -2.0 },
),
];
let visibility_polygon = point.visibility(lines.as_slice());