From fbaa4846b6c60bf42f025b4af277c44d2115b976 Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Tue, 19 Jul 2022 03:41:40 -0700 Subject: [PATCH] fixes --- src/math/vec.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/math/vec.zig b/src/math/vec.zig index 707276b..76cc3c3 100644 --- a/src/math/vec.zig +++ b/src/math/vec.zig @@ -88,11 +88,11 @@ pub fn Vec(comptime nelem: comptime_int, comptime T: anytype) type { // 3-element operations pub usingnamespace if (nelem >= 3) struct { - pub inline fn sum3(self: Self) f32 { + pub inline fn sum3(self: Self) T { return self.x + self.y + self.z; } - pub inline fn dot3(a: Self, b: Self) f32 { + pub inline fn dot3(a: Self, b: Self) T { return a.mul(b).sum3(); } @@ -136,8 +136,8 @@ pub fn Vec(comptime nelem: comptime_int, comptime T: anytype) type { return zxy(sub(mul(zxy(a), b), mul(a, zxy(b)))); } - pub inline fn length3(self: Self) f32 { - return @sqrt(@maximum(std.math.f32_epsilon, self.dot3(self))); + pub inline fn length3(self: Self) T { + return @sqrt(@maximum(std.math.epsilon(T), self.dot3(self))); } pub inline fn normalize3(self: Self) Self {