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

pub trait RotatePoint<T> {
    fn rotate_around_point(&self, angle: T, point: Point<T>) -> Self
    where
        T: CoordFloat
; }

Required methods

fn rotate_around_point(&self, angle: T, point: Point<T>) -> Self where
    T: CoordFloat
[src]

Rotate a Geometry around an arbitrary point by an angle, given in degrees

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

Units

  • angle: degrees

Examples

use geo::algorithm::rotate::RotatePoint;
use geo::{line_string, point};

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

let rotated = ls.rotate_around_point(
    -45.0,
    point!(x: 10.0, y: 0.0),
);

assert_eq!(rotated, line_string![
    (x: 2.9289321881345245, y: 7.071067811865475),
    (x: 10.0, y: 7.0710678118654755),
    (x: 17.071067811865476, y: 7.0710678118654755)
]);
Loading content...

Implementors

impl<T, G> RotatePoint<T> for G where
    T: CoordFloat,
    G: MapCoords<T, T, Output = G>, 
[src]

Loading content...