summaryrefslogtreecommitdiff
path: root/src/estd/graphics/curve.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/estd/graphics/curve.zig')
-rw-r--r--src/estd/graphics/curve.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/estd/graphics/curve.zig b/src/estd/graphics/curve.zig
index 70569a3..6c591fa 100644
--- a/src/estd/graphics/curve.zig
+++ b/src/estd/graphics/curve.zig
@@ -29,7 +29,7 @@ pub const Curve = struct {
const middle_y: f64 = @floatFromInt(self.middle.y);
const end_x: f64 = @floatFromInt(self.end.x);
const end_y: f64 = @floatFromInt(self.end.y);
- const resolution = 2 + (
+ const resolution = 1 + (
distance(self.start.x, self.end.x) + distance(self.start.y, self.end.y)
) / 8;
@@ -37,7 +37,7 @@ pub const Curve = struct {
canvas.buffer[last.x + last.y * canvas.width] = .{ .red = 0xff, .green = 0xff, .blue = 0xff };
- for (1..resolution) |index| {
+ for (1..resolution + 1) |index| {
const t: f64 = @as(f64, @floatFromInt(index)) / @as(f64, @floatFromInt(resolution));
const x: u32 = @intFromFloat(@round(
(1 - t) * ((1 - t) * start_x + t * middle_x) + t * ((1 - t) * middle_x + t * end_x)