CellNetwork.cell_neighbors() modification
What type of change is this?
- [x] Bug fix in a backwards-compatible manner.
- [x] New feature in a backwards-compatible manner.
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
- [x] I added a line to the
CHANGELOG.mdfile in theUnreleasedsection under the most fitting heading (e.g.Added,Changed,Removed). - [ ] I ran all tests on my computer and it's all green (i.e.
invoke test). - [x] I ran lint on my computer and there are no errors (i.e.
invoke lint). - [x] I added new functions/classes and made them available on a second-level import, e.g.
compas.datastructures.Mesh. - [x] I have added tests that prove my fix is effective or that my feature works.
- [ ] I have added necessary documentation (if appropriate)
Some description.
CellNetwork.cell_neighbors
I've been trying to analyze connections between building elements using CellNetwork.cell_neighbors method and found out that simple common faces search could not work, because faces can point at the vertices with same coordinates, but which have different indexes, because there's no duplicate vertex check in CellNetwork.add_vertex method. Therefore I've modified the comparison logic to simple common vertices search. If 2 cells have more than 2 vertices in common, they might be adjacent. (Maybe a condition that points don't lie on the same line should be considered as well). This method performed quite well in a graph construction process of an HVAC received from Speckle.
I've added this particular CellNetwork to tests/compas/datastructures/fixtures folder.
CellNetwork.add_mesh
Also I've implemeted add_mesh method to CellNetwork which simple decomposes mesh to vertices and faces, checks if it's manifold and adds as a Cell to CellNetwork
hi,
thanks for this. would you mind fixing the lint in the code so the workflows can run properly?
we will automate this in the future, but for now this needs to be done locally...
thanks!
Hi @2twenity! Thank you for the PR!