Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
How to find the points lying on the boundary of a convex hull in a Integer 2D grid

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.

graph showing plotted matrix

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!