Trait geo::algorithm::orient::Orient [−][src]
Required methods
fn orient(&self, orientation: Direction) -> Self
[src]
Orients a Polygon’s exterior and interior rings according to convention
By default, the exterior ring of a Polygon is oriented counter-clockwise, and any interior rings are oriented clockwise.
Examples
use geo::orient::{Direction, Orient}; use geo::polygon; // a diamond shape let polygon = polygon![ // exterior oriented clockwise exterior: [ (x: 1.0, y: 0.0), (x: 0.0, y: 1.0), (x: 1.0, y: 2.0), (x: 2.0, y: 1.0), (x: 1.0, y: 0.0), ], // interior oriented counter-clockwise interiors: [ [ (x: 1.0, y: 0.5), (x: 1.5, y: 1.0), (x: 1.0, y: 1.5), (x: 0.5, y: 1.0), (x: 1.0, y: 0.5), ], ], ]; let oriented = polygon.orient(Direction::Default); // a diamond shape let expected = polygon![ // exterior oriented counter-clockwise exterior: [ (x: 1.0, y: 0.0), (x: 2.0, y: 1.0), (x: 1.0, y: 2.0), (x: 0.0, y: 1.0), (x: 1.0, y: 0.0), ], // interior oriented clockwise interiors: [ [ (x: 1.0, y: 0.5), (x: 0.5, y: 1.0), (x: 1.0, y: 1.5), (x: 1.5, y: 1.0), (x: 1.0, y: 0.5), ], ], ]; assert_eq!(expected, oriented);
Implementors
impl<T> Orient for MultiPolygon<T> where
T: GeoNum,
[src]
T: GeoNum,
fn orient(&self, direction: Direction) -> MultiPolygon<T>
[src]
impl<T> Orient for Polygon<T> where
T: GeoNum,
[src]
T: GeoNum,