Merge pull request #1057 from vancluever/vancluever-powerline-half-circle-ellipse-refs

Powerline: add references for the ellipse algorithm
This commit is contained in:
Mitchell Hashimoto
2023-12-12 07:46:59 -08:00
committed by GitHub

View File

@ -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 // does use some floating point math in calculating the decision
// parameter, but I've found it clear in its implementation and it does // parameter, but I've found it clear in its implementation and it does
// not require adjustment for integer error. // 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 // Declare some casted constants for use in various calculations below
const rx: i32 = @intCast(radius_x); const rx: i32 = @intCast(radius_x);