{"repo":"omaraaa/VecFns","free":true,"listed":false,"github":"https://github.com/omaraaa/VecFns","clone":"git clone https://github.com/omaraaa/VecFns.git","description":"Automatic Vector Math Functions In Zig","language":"Zig","stars":29,"topics":["gamedev","library","math","zig"],"license":"MIT-0","category":"game-templates","readme_excerpt":"VecFns - RIP Automatic vector math functions for your vector structs. Usage Just add VecFns with usingnamespace to your struct, you will get the usual math functions for your vector. All fields of the struct should be the same type, and also be numeric. Functions The following functions will be in the namespace of your struct type after including VecFns . zig // Applies a function f to the vector. args is any additional arguments to be passed to f . fn map(self: Self, comptime f: anytype, args: anytype) Self // Same as map but without args argument. fn apply(self: Self, comptime f: anytype) Self // Applies a function f to 2 vectors. fn map2(a: anytype, b: anytype, comptime f: anytype, args: anytype) Self // Same as map , reduces the vector into a single value. fn reduce(self: Self, comptime f: anytype, args: anytype) T // Adds either 2 vectors or a vector and a scalar value. fn add(self: Self, other: anytype) Self // Subtracts either 2 vectors or a vector and a scalar value. fn sub(self: Self, other: anytype) Self // Multiplies either 2 vectors or a vector and a scalar value. fn mul(self: Self, other: anytype) Self // Divides either 2 vectors or a vector and a scalar value. fn div(self: Self, other: anytype) Self // Same as div, but uses @divExact fn divExact(self: Self, other: anytype) Self // Same as div, but uses @divFloor fn divFloor(self: Self, other: anytype) Self // Returns the sum of the vector. fn sum(self: Self) T // Given 2 vectors or a vector and a scalar value, r","default_branch":null,"files":null,"tree":[],"storefront":"/r/omaraaa","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/omaraaa/VecFns/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}