pub struct Transform {
pub scale: f64,
pub offset: f64,
}
Expand description
A scale and an offset that transforms xyz coordinates.
Fields§
§scale: f64
The scale.
offset: f64
The offset.
Implementations§
source§impl Transform
impl Transform
sourcepub fn direct(&self, n: i32) -> f64
pub fn direct(&self, n: i32) -> f64
Applies this transform to an i32, returning a float.
§Examples
use las::Transform;
let transform = Transform { scale: 2., offset: 1. };
assert_eq!(3., transform.direct(1));
sourcepub fn inverse(&self, n: f64) -> Result<i32>
pub fn inverse(&self, n: f64) -> Result<i32>
Applies the inverse transform, and rounds the result.
Returns an error if the resultant value can’t be represented as an i32.
§Examples
use las::Transform;
let transform = Transform { scale: 2., offset: 1. };
assert_eq!(1, transform.inverse(2.9).unwrap());
Trait Implementations§
source§impl PartialEq for Transform
impl PartialEq for Transform
impl Copy for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
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