How to find the points lying on the boundary of a convex hull in a Integer 2D grid. I have the vertices point and all the points that are part of the shapes. Tried checking all the points for their collinearity and a lot of points which were collinear with two other points were just lying inside in the shapes.

I have already calculated the blue dots co-ordinates and the vertices co-ordinates but am not able to find the co-ordinates of the point on the boundary of the convex hull. Code I tried to get all the points but then failed in doing so
function collinear(p, q, r) {
var a = p.x * (q.y - r.y) + q.x * (r.y - p.y) + r.x * (p.y - q.y);
if (a == 0 && !hull.includes(q)) hull.push(q);
else return;
}
for (let i = 0; i < hull.length; i++) {
for (let j = 0; j < hull.length; j++) {
for (let k = 1; k < points.length; k++) {
collinear(hull[i], hull[j], points[k]);
}
}
}
Hull array contains object of points which are at the vertices, and point array consists of all the points which are 1 in the 2d integer grid. How to find the points on the boundary of the convex hull?