Closed EscapedGibbon closed 2 months ago
Variance will return the result of a 0-division if the array of points is empty. Did you think about what should happen in that case?
Same question is relevant for the other operations.
Variance will return the result of a 0-division if the array of points is empty. Did you think about what should happen in that case?
Indeed this should throw. Should we also check the validity of a coordinate? Right now the user can input any value there, regardless whether the point belongs to an image or not.
Indeed this should throw.
I agree
Should we also check the validity of a coordinate? Right now the user can input any value there, regardless whether the point belongs to an image or not.
I think it should throw as well. To be efficient, I suggest that you first convert the points to indices so that you don't do it twice, checking their value (compare with size
) and then use getValue
safely.
Please add test cases for each of those scenarios (no points, invalid points).
close: https://github.com/image-js/image-js-typescript/issues/470