pub struct Rotation2 {
pub angle: f64,
}Expand description
A rotation in the plane about the origin.
Fields§
§angle: f64Implementations§
Source§impl Rotation2
impl Rotation2
pub fn new(angle: f64) -> Self
pub fn identity() -> Self
Sourcepub fn from_two_vectors(from: [f64; 2], to: [f64; 2]) -> Self
pub fn from_two_vectors(from: [f64; 2], to: [f64; 2]) -> Self
Counter-clockwise rotation taking direction from to direction to.
pub fn matrix(&self) -> [[f64; 2]; 2]
pub fn rotate(&self, p: [f64; 2]) -> [f64; 2]
Sourcepub fn rotate_about(&self, p: [f64; 2], pivot: [f64; 2]) -> [f64; 2]
pub fn rotate_about(&self, p: [f64; 2], pivot: [f64; 2]) -> [f64; 2]
Rotates p about pivot instead of the origin.
pub fn inverse(&self) -> Self
Sourcepub fn normalized(&self) -> Self
pub fn normalized(&self) -> Self
The angle wrapped into (-π, π].
Trait Implementations§
impl Copy for Rotation2
impl StructuralPartialEq for Rotation2
Auto Trait Implementations§
impl Freeze for Rotation2
impl RefUnwindSafe for Rotation2
impl Send for Rotation2
impl Sync for Rotation2
impl Unpin for Rotation2
impl UnsafeUnpin for Rotation2
impl UnwindSafe for Rotation2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more