geo-visibility

Crates.iogeo-visibility
lib.rsgeo-visibility
version0.5.0
sourcesrc
created_at2019-07-03 10:48:43.839807
updated_at2021-04-25 13:56:51.666188
descriptionCompute visibility polygon
homepage
repositoryhttps://github.com/lelongg/geo-visibility
max_upload_size
id145610
size42,536
GĂ©rald Lelong (lelongg)

documentation

https://docs.rs/geo-visibility/

README

geo-visibility

This crate contains algorithms to compute visibility polygon.

crate.io docs.rs

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());
Commit count: 49

cargo fmt