bbox_numpy to mesh.aabb method integration or Box class extra features
@tomvanmele ci sta già lavorando.
Dal 10/4/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Feature Request
Hello everyone, I'd like to implement some extra features as a developer to Box so the mesh.aabb returns more flexible object. Ideal case would be a box that is fully based on numpy and represented simply as 2 diagonal points (2 numpy arrays). Maybe some flag could be added to mesh.aabb so we can choose which sort of a box we expect.
Details
Problem statement
I'm playing with compas_model bvh.from_meshes method and trying to implement bvh based on aabb nodes. To calculate parameters like SAH (Surface Are Heuristic) the following box methods are required:
- Boxes summing or union method
- Box surface area
- Box centroid
Solution Proposal
I'll paste some rough logic of what is supposed to happen
- add method or "union" which will allow to sum 2 instances of a Box class
def __add__(self, box):
"""Returns a 3D summary box that contains both of summed boxes"""
if isinstance(box, SuperchargedBox):
all_points = self.points + box.points
return self.from_points(all_points)
else:
raise TypeError("Instances belong to different classes")
- Surface are calculations
def compute_surface_area(self):
return (self.xsize * self.ysize + self.xsize * self.zsize + self.ysize * self.zsize) * 2
- Centroid
def centroid(self) -> Point:
"""Returns a Centroid of the Box"""
arr_max = np.asarray([self.xmax, self.ymax, self.zmax])
arr_min = np.asarray([self.xmin, self.ymin, self.zmin])
res = (arr_max + arr_min) / 2
return Point(*res)
Alternatives
If the box is represented as 2 numpy arrays (2 points of the diagonal). So none of the extra calculations called on constructors methods. It'll also allow to make infinitely small box and infinitely big boxes for summing/union operations.
Also, as I mentioned, some sort of flexibility when making calling a mesh.aabb would be useful.
Mesh.aabb(numpy_box=True) -> bbox_numpy
Or these changes could be made in compas_model. I'd appreciate your feedback on these changes.
- Lingua principale
- Python
- Stelle
- 387
- Fork
- 124
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di compas-dev/compas
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
compas-dev/compas#1523 · 3 commenti ·
-
Numpy and Rhino 9Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
compas-dev/compas#1507 · 2 commenti · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
compas-dev/compas#1504 · 1 commento ·
-
More transformations of shapesForse già presa @copilot-swe-agent l’ha presa 367 giorni fa. Aperta
compas-dev/compas#1493 · 1 reazione · 1 assegnatario ·
-
`Polygon.normal` with `normal_polygon` instead of `normal_triangle`?Forse già presa @copilot-swe-agent l’ha presa 353 giorni fa. Aperta
compas-dev/compas#1487 · 1 reazione · 1 assegnatario ·
Tutte le issue di compas-dev/compas
Issue simili
-
`lvm_compact` has no self-hosted twin, and `docs/158` §5 says every language-face component mustApertabug sev-3 vm
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
sierra-research/tau2-bench#635 ·
I maintainer di solito rispondono entro 1 giorno
-
The add-ssm-model skill requires a Cython simulator; the contributing guide allows Python onesForse già presa @fmuia l’ha presa oggi. Apertadocumentation skill
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
lnccbrown/ssm-simulators#406 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
btclib-org/btclib-ecc#309 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
autowarefoundation/autoware_carla_scenario#281 ·
I maintainer di solito rispondono entro 1 giorno