Trait geo::algorithm::rotate::Rotate[][src]

pub trait Rotate<T> {
    fn rotate(&self, angle: T) -> Self
    where
        T: CoordFloat
; }

Required methods

fn rotate(&self, angle: T) -> Self where
    T: CoordFloat
[src]

Rotate a Geometry around its centroid by an angle, in degrees

Positive angles are counter-clockwise, and negative angles are clockwise rotations.

Units

  • angle: degrees

Examples

use geo::algorithm::rotate::Rotate;
use geo::line_string;

let line_string = line_string![
    (x: 0.0, y: 0.0),
    (x: 5.0, y: 5.0),
    (x: 10.0, y: 10.0),
];

let rotated = line_string.rotate(-45.0);

let expected = line_string![
    (x: -2.0710678118654755, y: 5.0),
    (x: 5.0, y: 5.0),
    (x: 12.071067811865476, y: 5.0),
];

assert_eq!(expected, rotated);
Loading content...

Implementors

impl<T> Rotate<T> for Line<T> where
    T: GeoFloat
[src]

impl<T> Rotate<T> for LineString<T> where
    T: GeoFloat
[src]

fn rotate(&self, angle: T) -> Self[src]

Rotate the LineString about its centroid by the given number of degrees

impl<T> Rotate<T> for MultiLineString<T> where
    T: GeoFloat
[src]

fn rotate(&self, angle: T) -> Self[src]

Rotate the contained LineStrings about their centroids by the given number of degrees

impl<T> Rotate<T> for MultiPoint<T> where
    T: CoordFloat
[src]

fn rotate(&self, angle: T) -> Self[src]

Rotate the contained Points about their centroids by the given number of degrees

impl<T> Rotate<T> for MultiPolygon<T> where
    T: GeoFloat
[src]

fn rotate(&self, angle: T) -> Self[src]

Rotate the contained Polygons about their centroids by the given number of degrees

impl<T> Rotate<T> for Point<T> where
    T: CoordFloat
[src]

fn rotate(&self, _angle: T) -> Self[src]

Rotate the Point about itself by the given number of degrees This operation leaves the point coordinates unchanged

impl<T> Rotate<T> for Polygon<T> where
    T: GeoFloat
[src]

fn rotate(&self, angle: T) -> Self[src]

Rotate the Polygon about its centroid by the given number of degrees

Loading content...