You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//todo: fill is not optimal we can fill symmetrically
80
-
if(column-1>center.column){
82
+
// Filling the first line of the circle.
83
+
if(index===0){
81
84
newImage.drawLine(
82
85
{ row,column: column-1},
83
-
{ row,column: center.column},
86
+
{
87
+
row,
88
+
column: center.column-(column-center.column-1),
89
+
},
84
90
{strokeColor: fill,out: newImage},
85
91
);
86
-
}elseif(column+1<center.column){
92
+
}
93
+
// The algorithm used is Bresenham's circle algorithm (@link https://www.geeksforgeeks.org/bresenhams-circle-drawing-algorithm/) to find points that constitute the circle outline. However, in this algorithm The circle is divided in 4 parts instead of 8: top, right, bottom and left.
94
+
// The algorithm draws a point per quadrant until the circle is complete.
95
+
// We use bottom (index % 4 === 1, quadrant 2) point of the outline to fill the circle with color.
0 commit comments