I have a matrix in the format below. I am looking for help to identify the outline that forms a circle:
EDIT 1: What about the outline? The outline should not include spaces (each y-value should have at least 2 x-values).
EDIT 2: What is considered a circle? I am searching for circles that are relatively precise, similar to the example provided below! (consistently maintaining radius)
// Matrix representation
00000000000000000000000000000000
00000000000001111111100000000000
...
00000000000000000000000000000000
In addition, I have an array containing all positions of the outline:
var coordinates = [
[13,1],[14,1],[15,1], ... ,[20,22]
]
What's the best method to determine if these coordinates form a circular shape?
Initially, I attempted using this code snippet but I believe there might be a more efficient solution:
var circle = [[13,1],[14,1],[15,1], ... ,[20,22]];
var no_circle= [[13,1],[14,1],[25,4]];
Array.prototype.is_circle = function() {
// Code logic for determining a circle
}
var result1 = circle.is_circle();
console.log(result1)
var result2 = no_circle.is_circle();
console.log(result2)