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>>,
options: Option<PolygonBuildOptions>,
) -> Polygon
pub fn new( exterior: Vec<Point>, holes: Vec<Vec<Point>>, options: Option<PolygonBuildOptions>, ) -> 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![],
None,
);
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));pub fn exterior(&self) -> &[Point]
pub fn holes(&self) -> &[Vec<Point>]
pub fn rect(&self) -> Rect
pub fn options(&self) -> PolygonBuildOptions
pub fn index_stats(&self) -> &PolygonIndexStats
pub fn set_exterior(&mut self, exterior: Vec<Point>)
pub fn set_holes(&mut self, holes: Vec<Vec<Point>>)
pub fn set_options(&mut self, options: PolygonBuildOptions)
Auto Trait Implementations§
impl Freeze for Polygon
impl RefUnwindSafe for Polygon
impl Send for Polygon
impl Sync for Polygon
impl Unpin for Polygon
impl UnsafeUnpin 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