1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
//! This crate contains algorithms to compute [visibility polygon](https://www.wikiwand.com/en/Visibility_polygon). //! //! This code is a Rust port of the C++ lib [visibility](https://github.com/trylock/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](https://docs.rs/geo-types/0.4.3/geo_types/). //! //! ``` //! # fn main() { //! 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()); //! # } //! ``` //! //! [`Visibility`]: visibility/trait.Visibility.html //! [`visibility`]: visibility/trait.Visibility.html#method.visibility mod angle_comparator; mod comparable_line; mod orientation; mod ray; mod utils; mod visibility; mod visibility_event; pub use visibility::Visibility;