pub struct Polygon { /* private fields */ }
Implementations§
Source§impl Polygon
impl Polygon
Sourcepub fn contains_point(&self, p: Point) -> bool
pub fn contains_point(&self, p: Point) -> bool
Do point-in-polygon search.
Sourcepub fn new(exterior: Vec<Point>, holes: Vec<Vec<Point>>) -> Polygon
pub fn new(exterior: Vec<Point>, holes: Vec<Vec<Point>>) -> Polygon
Create a new Polygon instance from exterior and holes.
Example:
use std::vec;
use geometry_rs;
let poly = geometry_rs::Polygon::new(
vec![
geometry_rs::Point {
x: 90.48826291293898,
y: 45.951129815858565,
},
geometry_rs::Point {
x: 90.48826291293898,
y: 27.99437617512571,
},
geometry_rs::Point {
x: 122.83201291294,
y: 27.99437617512571,
},
geometry_rs::Point {
x: 122.83201291294,
y: 45.951129815858565,
},
geometry_rs::Point {
x: 90.48826291293898,
y: 45.951129815858565,
},
],
vec![],
);
let p_out = geometry_rs::Point {
x: 130.74216916294148,
y: 37.649011392900306,
};
print!("{:?}\n", poly.contains_point(p_out));
let p_in = geometry_rs::Point {
x: 99.9804504129416,
y: 39.70716466970461,
};
print!("{:?}\n", poly.contains_point(p_in));
Auto Trait Implementations§
impl Freeze for Polygon
impl RefUnwindSafe for Polygon
impl Send for Polygon
impl Sync for Polygon
impl Unpin for Polygon
impl UnwindSafe for Polygon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more