Skip to content

Commit

Permalink
vec: add Vec2 stub for "move_forward" function
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon committed Mar 9, 2024
1 parent 0015705 commit 21a4328
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vec/vec2.v
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,13 @@ pub fn (v Vec2[T]) normalize() Vec2[T] {
pub fn (v Vec2[T]) sum() T {
return v.x + v.y
}

// move_toward moves `v` towards `to` by `delta`
// pub fn (v Vec2[T]) move_toward[U](to Vec2[T], delta U) Vec2[T] {
// vdiff := to.sub(v)
// len := vdiff.magnitude()
// if len <= delta || len < vec.vec_epsilon {
// return to
// }
// return v.add(vdiff).div_scalar(len * delta)
// }

0 comments on commit 21a4328

Please sign in to comment.