bitshifter/glam-rs

Feature request: add `towards` for vectors

chompaa opened this issue · 1 comments

I'm not sure if this fits within the scope of the library, but I think interpolating in this fashion could be useful.

Rough implementation:

fn towards(&self, rhs: Self, delta: f32) -> Self {
  let a = rhs - self;
  let len = a.length();
  
  if len <= delta || len <= 1e-4 {
    return rhs;
  }
    
  self + a / len * delta
}

I saw that this was somewhat discussed briefly in #265, but am unsure if it's wanted.

Note earlier discussion here #265