pub const Vec2f = struct { x: f32 = 0, y: f32 = 0, pub fn init(x: f32, y: f32) Vec2f { return .{ .x = x, .y = y }; } pub fn add(self: Vec2f, other: Vec2f) Vec2f { return .{ .x = self.x + other.x, .y = self.y + other.y }; } pub fn sub(self: Vec2f, other: Vec2f) Vec2f { return .{ .x = self.x - other.x, .y = self.y - other.y }; } pub fn mul(self: Vec2f, s: f32) Vec2f { return .{ .x = self.x * s, .y = self.y * s }; } pub fn div(self: Vec2f, s: f32) Vec2f { return .{ .x = self.x / s, .y = self.y / s }; } pub fn length(self: Vec2f) f32 { return @sqrt(self.x * self.x + self.y * self.y); } pub fn abs(self: Vec2f) Vec2f { return .{ .x = @abs(self.x), .y = @abs(self.y) }; } };