# HG changeset patch # User sam # Date 1723537736 -25200 # Node ID 43db6f5abb61ab7b9ca4a6cefa59f4d478d906ff # Parent 03400de84910491e2738d2e99de9d3fcc14406fe add: more vector utils diff -r 03400de84910 -r 43db6f5abb61 semicongine/core/vector.nim --- a/semicongine/core/vector.nim Tue Aug 13 14:45:18 2024 +0700 +++ b/semicongine/core/vector.nim Tue Aug 13 15:28:56 2024 +0700 @@ -178,6 +178,11 @@ func abs*[T](vec: TVec3[T]): auto = TVec3([abs(vec[0]), abs(vec[1]), abs(vec[2])]) func abs*[T](vec: TVec4[T]): auto = TVec4([abs(vec[0]), abs(vec[1]), abs(vec[2]), abs(vec[3])]) +func floor*[T](vec: TVec1[T]): auto = TVec1([floor(vec[0])]) +func floor*[T](vec: TVec2[T]): auto = TVec2([floor(vec[0]), floor(vec[1])]) +func floor*[T](vec: TVec3[T]): auto = TVec3([floor(vec[0]), floor(vec[1]), floor(vec[2])]) +func floor*[T](vec: TVec4[T]): auto = TVec4([floor(vec[0]), floor(vec[1]), floor(vec[2]), floor(vec[3])]) + func manhattan*(vec: TVec1): auto = abs(vec[0]) func manhattan*(vec: TVec2): auto = abs(vec[0]) + abs(vec[1]) func manhattan*(vec: TVec3): auto = abs(vec[0]) + abs(vec[1]) + abs(vec[2])