From c03ae47a277c4f23ef0af14f89895e0fc258107f Mon Sep 17 00:00:00 2001 From: Chris Marchesi Date: Tue, 12 Dec 2023 00:10:40 -0800 Subject: [PATCH] Powerline: add references for the ellipse algorithm Further to the additional comments in #1055, this adds some references to the comments in the ellipse algorithm (including the original reference for the circle algorithm). --- src/font/sprite/Powerline.zig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/font/sprite/Powerline.zig b/src/font/sprite/Powerline.zig index 46c16e829..642ecdad2 100644 --- a/src/font/sprite/Powerline.zig +++ b/src/font/sprite/Powerline.zig @@ -214,6 +214,24 @@ fn draw_half_circle(self: Powerline, alloc: Allocator, canvas: *font.sprite.Canv // does use some floating point math in calculating the decision // parameter, but I've found it clear in its implementation and it does // not require adjustment for integer error. + // + // This algorithm has undergone some iterations, so the following + // references might be helpful for understanding: + // + // * "Drawing a circle, point by point, without floating point + // support" (Dennis Yurichev, + // https://yurichev.com/news/20220322_circle/), which describes the + // midpoint circle algorithm and implementation we initially adapted + // here. + // + // * "Ellipse-Generating Algorithms" (RTU Latvia, + // https://daugavpils.rtu.lv/wp-content/uploads/sites/34/2020/11/LEC_3.pdf), + // which was used to further adapt the algorithm for ellipses. + // + // * "An Effective Approach to Minimize Error in Midpoint Ellipse + // Drawing Algorithm" (Dr. M. Javed Idrisi, Aayesha Ashraf, + // https://arxiv.org/abs/2103.04033), which includes a synopsis of + // the history of ellipse drawing algorithms, and further references. // Declare some casted constants for use in various calculations below const rx: i32 = @intCast(radius_x);