pub struct Mat {
pub a: f64,
pub b: f64,
pub c: f64,
pub d: f64,
pub e: f64,
pub f: f64,
}Expand description
A PDF transformation matrix.
Fields§
§a: f64§b: f64§c: f64§d: f64§e: f64§f: f64Implementations§
Source§impl Mat
impl Mat
pub const IDENTITY: Mat
pub fn new(a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) -> Mat
pub fn scale(sx: f64, sy: f64) -> Mat
pub fn translate(tx: f64, ty: f64) -> Mat
Sourcepub fn from_slice(v: &[f64]) -> Option<Mat>
pub fn from_slice(v: &[f64]) -> Option<Mat>
From a six-element array, None unless every entry is finite.
Sourcepub fn then(self, r: Mat) -> Mat
pub fn then(self, r: Mat) -> Mat
self × r: apply self first, then r (PDF’s cm prepends the new
matrix to the CTM: new_ctm = m × ctm).
pub fn apply(self, x: f64, y: f64) -> (f64, f64)
Sourcepub fn apply_vec(self, x: f64, y: f64) -> (f64, f64)
pub fn apply_vec(self, x: f64, y: f64) -> (f64, f64)
The linear part applied to a vector (no translation).
pub fn det(self) -> f64
Sourcepub fn mean_scale(self) -> f64
pub fn mean_scale(self) -> f64
sqrt(|det|): the geometric mean scale — what docling-parse scales a
line width by (pdf_state<SHAPE>::trafo_scale).
pub fn invert(self) -> Option<Mat>
pub fn is_finite(self) -> bool
Trait Implementations§
impl Copy for Mat
impl StructuralPartialEq for Mat
Auto Trait Implementations§
impl Freeze for Mat
impl RefUnwindSafe for Mat
impl Send for Mat
impl Sync for Mat
impl Unpin for Mat
impl UnsafeUnpin for Mat
impl UnwindSafe for Mat
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more