pub trait Lerp {
    // Required methods
    fn lerp(self, end: Self, percent: f32) -> Self;
    fn inv_lerp(self, end: Self, point: Self) -> f32;
}

Required Methods§

fn lerp(self, end: Self, percent: f32) -> Self

calculate the point at percent between self and end

e.g. 10.lerp(20, 0.5) returns 15 and 10.lerp(20, 0.1) returns 11

internally the values are cast as f32 and rounded before being returned

fn inv_lerp(self, end: Self, point: Self) -> f32

calculate the percent for point between self and end

e.g. 10.inv_lerp(20, 15) returns 0.5 and 10.inv_lerp(20, 11) returns 0.1

internally the values are cast as f32 and rounded before being returned

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl Lerp for i8

§

fn lerp(self, end: i8, percent: f32) -> i8

§

fn inv_lerp(self, end: i8, point: i8) -> f32

§

impl Lerp for i16

§

fn lerp(self, end: i16, percent: f32) -> i16

§

fn inv_lerp(self, end: i16, point: i16) -> f32

§

impl Lerp for i32

§

fn lerp(self, end: i32, percent: f32) -> i32

§

fn inv_lerp(self, end: i32, point: i32) -> f32

§

impl Lerp for i64

§

fn lerp(self, end: i64, percent: f32) -> i64

§

fn inv_lerp(self, end: i64, point: i64) -> f32

§

impl Lerp for i128

§

fn lerp(self, end: i128, percent: f32) -> i128

§

fn inv_lerp(self, end: i128, point: i128) -> f32

§

impl Lerp for isize

§

fn lerp(self, end: isize, percent: f32) -> isize

§

fn inv_lerp(self, end: isize, point: isize) -> f32

§

impl Lerp for u8

§

fn lerp(self, end: u8, percent: f32) -> u8

§

fn inv_lerp(self, end: u8, point: u8) -> f32

§

impl Lerp for u16

§

fn lerp(self, end: u16, percent: f32) -> u16

§

fn inv_lerp(self, end: u16, point: u16) -> f32

§

impl Lerp for u32

§

fn lerp(self, end: u32, percent: f32) -> u32

§

fn inv_lerp(self, end: u32, point: u32) -> f32

§

impl Lerp for u64

§

fn lerp(self, end: u64, percent: f32) -> u64

§

fn inv_lerp(self, end: u64, point: u64) -> f32

§

impl Lerp for u128

§

fn lerp(self, end: u128, percent: f32) -> u128

§

fn inv_lerp(self, end: u128, point: u128) -> f32

§

impl Lerp for usize

§

fn lerp(self, end: usize, percent: f32) -> usize

§

fn inv_lerp(self, end: usize, point: usize) -> f32

Implementors§

§

impl Lerp for Coord