mirror of
https://github.com/tsoding/boomer
synced 2024-11-16 12:12:47 +00:00
(#24) Make vec2.len and vec2.norm inlinable
This commit is contained in:
parent
081eae684f
commit
6e0e8656ce
@ -13,10 +13,10 @@ proc `*=`*(v: var Vec2, s: float) {.inline.} =
|
||||
v.x *= s
|
||||
v.y *= s
|
||||
|
||||
proc len*(v: Vec2): float =
|
||||
proc len*(v: Vec2): float {.inline.} =
|
||||
sqrt(v.x * v.x + v.y * v.y)
|
||||
|
||||
proc norm*(v: Vec2): Vec2 =
|
||||
proc norm*(v: Vec2): Vec2 {.inline.} =
|
||||
let l = v.len
|
||||
if abs(l) < 1e-9:
|
||||
result = (0.0, 0.0)
|
||||
|
Loading…
Reference in New Issue
Block a user