Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rectangle xy #1426

Merged
merged 5 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

* Fixed unexpected behavior in `compas.geometry.bbox_numpy.minimum_area_rectangle_xy`.
* Changed `requirements.txt` to allow `numpy>=2`.
* Fixed bug in `compas.geometry.Polygon.points` setter by removing duplicate points if they exist.
* Fixed bug in `compas.geometry.Polygon.plane` by aligning the normal of the bestfit plane with the approximate normal of the polygon faces.
* Changed the order of face vertices in `compas.geometry.Surface.to_vertices_and_faces` to a counter clockwise cycling direction and outward facing normals for curved surfaces.
* Changed the order of face vertices in `compas.geometry.Surface.to_vertices_and_faces` to a counter clockwise cycling direction and outward facing normals for curved surfaces.>>>>>>> main

### Removed

Expand Down
5 changes: 2 additions & 3 deletions src/compas/geometry/bbox_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,10 @@ def minimum_area_rectangle_xy(points, return_size=False):
"""
boxes = []

n = len(points)
points = points[:, :2]
hull = ConvexHull(points)
xy = points[hull.vertices, :2]
mean = sum(xy, axis=0) / n
hull_centroid = sum(xy, axis=0) / len(xy)

for simplex in hull.simplices:
p0 = points[simplex[0]]
Expand Down Expand Up @@ -288,7 +287,7 @@ def minimum_area_rectangle_xy(points, return_size=False):
a = w * h

# other box corners
if dot(t, mean - p0) < 0:
if dot(t, hull_centroid - p0) < 0:
b3 = b0 - h * tu
b2 = b1 - h * tu
else:
Expand Down
Loading
Loading