7 releases (breaking)

new 0.6.0 Feb 8, 2025
0.5.0 Apr 25, 2021
0.4.0 Apr 6, 2021
0.3.0 Feb 3, 2020
0.1.1 Jul 3, 2019

#855 in Algorithms

Download history 2/week @ 2024-10-30 12/week @ 2024-11-06 7/week @ 2024-11-13 1/week @ 2024-12-04 9/week @ 2024-12-11 5/week @ 2024-12-18 121/week @ 2025-02-05

121 downloads per month

ISC license

42KB
1K SLoC

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::{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());

Dependencies

~9MB
~155K SLoC