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§
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
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