Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

242
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda