[−][src]Trait geo::algorithm::rotate::Rotate
Required methods
fn rotate(&self, angle: T) -> Self where
T: Float,
T: Float,
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::{LineString, Point}; let mut vec = Vec::new(); vec.push(Point::new(0.0, 0.0)); vec.push(Point::new(5.0, 5.0)); vec.push(Point::new(10.0, 10.0)); let linestring = LineString::from(vec); let rotated = linestring.rotate(-45.0); let mut correct = Vec::new(); correct.push(Point::new(-2.0710678118654755, 5.0)); correct.push(Point::new(5.0, 5.0)); correct.push(Point::new(12.071067811865476, 5.0)); let correct_ls = LineString::from(correct); assert_eq!(rotated, correct_ls);
Implementors
impl<T> Rotate<T> for Line<T> where
T: Float,
[src]
T: Float,
impl<T> Rotate<T> for LineString<T> where
T: Float,
[src]
T: Float,
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: Float + FromPrimitive,
[src]
T: Float + FromPrimitive,
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: Float + FromPrimitive,
[src]
T: Float + FromPrimitive,
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: Float + FromPrimitive + Sum,
[src]
T: Float + FromPrimitive + Sum,
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: Float,
[src]
T: Float,
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: Float + FromPrimitive + Sum,
[src]
T: Float + FromPrimitive + Sum,