# HG changeset patch # User sam # Date 1723473188 -25200 # Node ID c5a23e910feabb893b750d406ad8cca02f10d81b # Parent 544709f64ac4f82400bc5b7039e41abee0d010d9 add: floorMod for vec/vec operations diff -r 544709f64ac4 -r c5a23e910fea semicongine/core/vector.nim --- a/semicongine/core/vector.nim Mon Aug 12 17:52:29 2024 +0700 +++ b/semicongine/core/vector.nim Mon Aug 12 21:33:08 2024 +0700 @@ -259,19 +259,23 @@ func `*`*(a, b: TVec3): auto = TVec3([a[0] * b[0], a[1] * b[1], a[2] * b[2]]) func `*`*(a, b: TVec4): auto = TVec4([a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3]]) func `div`*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([a[0] div b[0]]) -func `floorDiv`*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([floorDiv(a[0], b[0])]) +func floorDiv*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([floorDiv(a[0], b[0])]) +func floorMod*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([floorMod(a[0], b[0])]) func `/`*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([a[0] / b[0]]) func `/`*[T: SomeFloat](a, b: TVec1[T]): auto = TVec1([a[0] / b[0]]) func `div`*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([a[0] div b[0], a[1] div b[1]]) -func `floorDiv`*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([floorDiv(a[0], b[0]), floorDiv(a[1], b[1])]) +func floorDiv*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([floorDiv(a[0], b[0]), floorDiv(a[1], b[1])]) +func floorMod*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([floorMod(a[0], b[0]), floorMod(a[1], b[1])]) func `/`*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([a[0] / b[0], a[1] / b[1]]) func `/`*[T: SomeFloat](a, b: TVec2[T]): auto = TVec2([a[0] / b[0], a[1] / b[1]]) func `div`*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([a[0] div b[0], a[1] div b[1], a[2] div b[2]]) -func `floorDiv`*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([floorDiv(a[0], b[0]), floorDiv(a[1], b[1]), floorDiv(a[2], b[2])]) +func floorDiv*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([floorDiv(a[0], b[0]), floorDiv(a[1], b[1]), floorDiv(a[2], b[2])]) +func floorMod*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([floorMod(a[0], b[0]), floorMod(a[1], b[1]), floorMod(a[2], b[2])]) func `/`*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([a[0] / b[0], a[1] / b[1], a[2] / b[2]]) func `/`*[T: SomeFloat](a, b: TVec3[T]): auto = TVec3([a[0] / b[0], a[1] / b[1], a[2] / b[2]]) func `div`*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([a[0] div b[0], a[1] div b[1], a[2] div b[2], a[3] div b[3]]) -func `floorDiv`*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([floorDiv(a[0], b[0]), floorDiv(a[1], b[1]), floorDiv(a[2], b[2]), floorDiv(a[3], b[3])]) +func floorDiv*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([floorDiv(a[0], b[0]), floorDiv(a[1], b[1]), floorDiv(a[2], b[2]), floorDiv(a[3], b[3])]) +func floorMod*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([floorMod(a[0], b[0]), floorMod(a[1], b[1]), floorMod(a[2], b[2]), floorMod(a[3], b[3])]) func `/`*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([a[0] / b[0], a[1] / b[1], a[2] / b[2], a[3] / b[3]]) func `/`*[T: SomeFloat](a, b: TVec4[T]): auto = TVec4([a[0] / b[0], a[1] / b[1], a[2] / b[2], a[3] / b[3]])