compas-dev / compas-dev/compas

unexpected behavior of `compas.geometry.convex_hull`?

Open
#1,430 0 comments 0 reactions 1 assignee Claimed by @tomvanmele View on GitHub
Dominant language
Python
Stars
386
Forks
122
Avg merge
11d 46m
Merged PRs (30d)
1

Description

Not sure about this one, maybe I'm using it wrong but getting an unexpected result when running `convex_hull` (the pure python one) on a collection of co-planar points.

**To Reproduce**
1. Create planar surface in Rhino with a cutout along one of the edges.
2. Run following GH code:

```python
from compas.geometry import Point, convex_hull
from compas.scene import Scene

vertex_locations = [Point(*vertex.Location) for vertex in brep.Vertices]

hull = convex_hull(vertex_locations)

scene = Scene()
for face in hull:
for v_index in face:
scene.add(vertex_locations[v_index])

a = scene.draw()
```
I'd expect only the points along the convex outline of the surface to return but two internal points are included:

![Image](https://github.com/user-attachments/assets/cb252e59-467e-487c-948c-b27b393f3bbd)

**Desktop (please complete the following information):**
- OS: Windows
- Python version 3.9

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.