pub struct TransBilinear { /* private fields */ }Expand description
Bilinear 2D transformation.
Solves for a 4x2 coefficient matrix that maps points between two quadrilaterals using bilinear interpolation:
x' = m[0][0] + m[1][0]*x*y + m[2][0]*x + m[3][0]*y
y' = m[0][1] + m[1][1]*x*y + m[2][1]*x + m[3][1]*yPort of C++ trans_bilinear.
Implementations§
Source§impl TransBilinear
impl TransBilinear
Sourcepub fn new_quad_to_quad(src: &[f64; 8], dst: &[f64; 8]) -> Self
pub fn new_quad_to_quad(src: &[f64; 8], dst: &[f64; 8]) -> Self
Create from arbitrary quadrilateral to quadrilateral mapping.
Sourcepub fn new_rect_to_quad(
x1: f64,
y1: f64,
x2: f64,
y2: f64,
quad: &[f64; 8],
) -> Self
pub fn new_rect_to_quad( x1: f64, y1: f64, x2: f64, y2: f64, quad: &[f64; 8], ) -> Self
Create a rectangle → quadrilateral mapping.
Sourcepub fn new_quad_to_rect(
quad: &[f64; 8],
x1: f64,
y1: f64,
x2: f64,
y2: f64,
) -> Self
pub fn new_quad_to_rect( quad: &[f64; 8], x1: f64, y1: f64, x2: f64, y2: f64, ) -> Self
Create a quadrilateral → rectangle mapping.
Sourcepub fn quad_to_quad(&mut self, src: &[f64; 8], dst: &[f64; 8])
pub fn quad_to_quad(&mut self, src: &[f64; 8], dst: &[f64; 8])
Set the transformation from two arbitrary quadrilaterals.
Solves a 4×2 system via Gaussian elimination.
Sourcepub fn rect_to_quad(
&mut self,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
quad: &[f64; 8],
)
pub fn rect_to_quad( &mut self, x1: f64, y1: f64, x2: f64, y2: f64, quad: &[f64; 8], )
Set the direct transformation: rectangle → quadrilateral.
Trait Implementations§
Source§impl Default for TransBilinear
impl Default for TransBilinear
Source§impl Transformer for TransBilinear
impl Transformer for TransBilinear
Auto Trait Implementations§
impl Freeze for TransBilinear
impl RefUnwindSafe for TransBilinear
impl Send for TransBilinear
impl Sync for TransBilinear
impl Unpin for TransBilinear
impl UnwindSafe for TransBilinear
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