geo icon indicating copy to clipboard operation
geo copied to clipboard

Add example to Contains documentation demonstrating self-containing behavior

Open frewsxcv opened this issue 4 years ago • 0 comments

Following up from https://github.com/georust/geo/issues/615, it could be good to demonstrate this case in the # Examples section of the documentation: https://docs.rs/geo/0.17.0/geo/algorithm/contains/trait.Contains.html#examples

Adding something like:

//! Because this algorithm conforms to [DE-9IM], a one-dimensional type like `LineString` does not
//! contain itself, compared to a two-dimensional type like `Polygon`:
//!
//! ```
//! let line_string = geo::line_string[...];
//! assert!(!line_string.contains(&line_string));
//!
//! let polygon = geo::Polygon::new(line_string, vec![]);
//! assert!(polygon.contains(&polygon));
//! ```

frewsxcv avatar Feb 06 '21 15:02 frewsxcv