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,
fn rotate(&self, angle: T) -> Self where
T: CoordFloat,
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);