Hi there.
My problem is, that I want to find a "circle" within a matrix, but I just cant wrap my head around it at the moment. It seems like I am having a blockade in my head.
Lets assume we have a big matrix filled with integer numbers, like this:
And I specify one of the cells of the matrix and the size of the circle:0) 1) 2) 3) 4) 5) 6) 7) 0) [ 0, 0, 0, 0, 0, 0, 0, 0 ] 1) [ 0, 0, 0, 0, 0, 0, 0, 0 ] 2) [ 0, 0, 0, 0, 0, 0, 0, 0 ] 3) [ 0, 0, 0, 0, 0, 0, 0, 0 ] 4) [ 0, 0, 0, 0, 0, 0, 0, 0 ] 5) [ 0, 0, 0, 0, 0, 0, 0, 0 ] 6) [ 0, 0, 0, 0, 0, 0, 0, 0 ]
The resulting matrix should look like this:matrix.doCircle(column = 3, row = 4, radius = 2.5);
So a circle centered at (3, 4) with the radius 2.5 has been filled with 1's in that matrix.0) 1) 2) 3) 4) 5) 6) 7) 0) [ 0, 0, 0, 0, 0, 0, 0, 0 ] 1) [ 0, 0, 0, 1, 1, 1, 0, 0 ] 2) [ 0, 0, 1, 1, 1, 1, 1, 0 ] 3) [ 0, 0, 1, 1, 1, 1, 1, 0 ] 4) [ 0, 0, 1, 1, 1, 1, 1, 0 ] 5) [ 0, 0, 0, 1, 1, 1, 0, 0 ] 6) [ 0, 0, 0, 0, 0, 0, 0, 0 ]
The circle should be as smooth as possible, and the matrices and radii could get very big.
Does anybody know a good algorithm which would solve this problem in a somewhat effective way?
Thank you very much.