pub struct Diagonal2 {
pub xx: f64,
pub yy: f64,
}Expand description
A diagonal matrix, suitable for representing anisotropic scaling.
Fields§
§xx: f64The horizontal expansion factor.
yy: f64The vertical expansion factor.
Implementations§
Source§impl Diagonal2
impl Diagonal2
Sourcepub const fn inv(self) -> Self
pub const fn inv(self) -> Self
Matrix inverse.
Will of course produce infinities if a component is zero.
Sourcepub fn scale_normal(self, n: Vec2) -> Vec2
pub fn scale_normal(self, n: Vec2) -> Vec2
Scale a normal vector.
This is mathematically equivalent to self * (self * n).normalize()
for positive transforms, but handles zeros and gets the sign correct
when negative.
Note that n need not be unit length.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Diagonal2
impl<'de> Deserialize<'de> for Diagonal2
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Diagonal2
impl StructuralPartialEq for Diagonal2
Auto Trait Implementations§
impl Freeze for Diagonal2
impl RefUnwindSafe for Diagonal2
impl Send for Diagonal2
impl Sync for Diagonal2
impl Unpin for Diagonal2
impl UnsafeUnpin for Diagonal2
impl UnwindSafe for Diagonal2
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