-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat(geometry): Adding Geometry Objects #3
feat(geometry): Adding Geometry Objects #3
Conversation
... there are just a couple of last things that I need to impelment on Mesh2D.
I still need to write some tests for them but all fundamental 2D objects are now complete.
I have been doing tests in Rhino just because it is quicker so I am fairly certain that 80% of the code is working. I will begin writing pure Python tests and (likely) fixing bugs soon.
Thanks @chriswmackey! This is a long one. Let's see what will be the best strategy to review it. A number of quick notes after checking a number of files.
|
@mostaphaRoudsari , To respond to your comments:
|
@mostaphaRoudsari , |
I realized that one of the methods that I added previously did not do what I thought it did so I have removed it. I also added a method to automatically create a single closed polygon from a shape with a hole. I ran it through several tests in Rhino and it seems to be working well. There aren't any cases I can think of that will not work with the general calculation method and I think I can get it to work for shapes with multiple hole just by having it recurse.
... and everything seems to be working well!
This should give us everything that we need to build energy model geometry in the way that we do now with honeybee legacy. There are just a few small methods left that I want to implement on the Polyface3D object to make it consistent with the other objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a number of comments on the first couple of files that I get to check. Will add more comments once I get a chance.
.. needed for export to EnergyPlus / OpenStudio
Co-Authored-By: Mostapha Sadeghipour Roudsari <sadeghipour@gmail.com>
... and I just extended the scale() method.
I relaized this creates issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good! Thank you for making all the changes. As discussed let's merge this in and we will know more about the performance as we integrate the library into other ladybug tools libraries.
PS: I suggest to squash and merge them as a single commit to end up with a cleaner git history and also make @AntoineDao happy! ;) |
Realistically what would make me happy is smaller PRs merged more often rather than one spanning from end of March... But of well, you can't have it all I guess 😛 |
With regards to commit messages it's mostly for the sake of:
|
Definitely going to Squash and merge this one. The only reason why I didn't do my semantic duty is because this is the first PR that is actually establishing the repo (all future PRs will be much more diligent). We definitely got carried away leaving this PR for 2 months and this should also not happen in the future. |
* feat(2d): More 2D Geometries * Almost Done With All 2D Geometry ... there are just a couple of last things that I need to impelment on Mesh2D. * Finished All 2D Objects I still need to write some tests for them but all fundamental 2D objects are now complete. * Added 1D Objects in 3D Space * Finished 3D Geometries I have been doing tests in Rhino just because it is quicker so I am fairly certain that 80% of the code is working. I will begin writing pure Python tests and (likely) fixing bugs soon. * Bug Fix to Surface Class * Update README.md * More Reliable is_point_inside method * Documenting Fringe Cases * Responding to comments by @mostaphaRoudsari * Found a Better Way to Avoid Mesh Grid Fringe Cases * Cleaning Up Code I realized that one of the methods that I added previously did not do what I thought it did so I have removed it. I also added a method to automatically create a single closed polygon from a shape with a hole. I ran it through several tests in Rhino and it seems to be working well. There aren't any cases I can think of that will not work with the general calculation method and I think I can get it to work for shapes with multiple hole just by having it recurse. * Added the Capability to Have Faces with Holes ... and everything seems to be working well! * Update dev-requirements.txt * Finished Tests for Points * Finished Tests for LineSegment * Added Test for Ray2D * Finished Tests for Rays * More Polygon2D Tests * More Tests for Mesh2D * Decided to Remove the Ability to Override Checks I realized that the overhad for the checks is not that bad and things really get wonky when they can be overridden on the class. * Finished Tests for Polygon2D * Finished All 2D Tests ... and fixed a lot of bugs / poor design decisions that were discovered in the process. * Added Mesh3D Test * Finished Mesh3D Tests * Finished Tests for Plane ... and fixed a few bugs found along the way. * Started Tests for Face3D * More Face3D Tests ... and I added a method to Plane to test for co-planarity within a certain tolerance. * Finished Tests * Added Methods to Test Equivalency of Geometry This is what I think should be used for solving adjacency and it has been optimized for this purpose. * Added method to get sub faces by ratio * Added Methods to Extract Rectangles from Faces * Updated documentation * Small Bug Fix in Plane * Small Bug Fix in Face3D Sub Face Generation * Finished All Methods for Glazing by Ratio * Responded to Comments by @mostaphaRoudsari ... and I realized that I forgot to add in methods last time to split rectangular glazing vertically, which is now added. * All Geometry Objects are Now Immutable This has simplified the code a lot and makes it much easier to communicate how to interact with the ladybug_geomtry API. The only exception to the universal immutability rule is that the colors of mesh objects are set-able. * Added Methods to Tell if a Face is Inside Another * Added methods to generate contoured fins (aka. louvers) * Added Object for Polyface This should give us everything that we need to build energy model geometry in the way that we do now with honeybee legacy. There are just a few small methods left that I want to implement on the Polyface3D object to make it consistent with the other objects. * Added Transform Methods to Polyface * Added Volume Property to Polyface * Adding More Polyface tests * Realized an Important Case that Needs Solving * Polyface now has good checks for solidity * Finished Polyface3D * Fixed a Bug and Added Tests for it * Responding to @mostaphaRoudsari 's comments on _mesh.py * Changed Mesh Grid to Use a Scaled Polygon * Added a Property to Get Upper Left Counter Clockwise Vertices .. needed for export to EnergyPlus / OpenStudio * Using try/except instead of if * Update ladybug_geometry/_mesh.py Co-Authored-By: Mostapha Sadeghipour Roudsari <sadeghipour@gmail.com> * Bug Fix for Python Float Tolerance Cases * Took Out scale_world_origin method ... and I just extended the scale() method. * Adding __init__ and __repr__ to Base Classes * Removing __slots__ from Base Classes I relaized this creates issues * Typo Fix * Update README.md
You can see that this is a fairly large PR with ~5k lines of pythonic new code and docstrings. It gives us more than half of the things originally on the checklist for this library as you can see on the updated Readme page on my fork
If you want to get an initial sense of the capabilities, I recommend browsing the Surface3D class since many of the other classes in the library are in service of this one and this is also the one that I have been imaging would describe honeybee surfaces, essentially allowing us to move/transform them, generate glazing based on a ratio from them, generate analysis grids from them, etc.
The main reason why this is a draft PR is that I have been doing most of the testing of the library with the help of Rhino since it is much easier to generate a lot of cases and visually evaluate them there. So, while I am confident that 80% of the code works well from these tests, this means that I don't have any pure Python tests for CI and there are probably some bugs in the parts that have not been tested with Rhino. So, the next step for me is writing these tests.
In the meantime, I could definitely use feedback on the code and especially the class names and organization of the library. The organization seems very clear to me but I have a feeling this is because I have been in the zone working on it the last week.