Ladybug geometry is a Python library that houses all of the basic geometry computation needed for Ladybug Tools core libraries.
Project description
ladybuggeometry
Ladybug geometry is a Python library that houses geometry objects used throughout the Ladybug Tools core libraries.
API Documentation
Reasons for this Library
We initially debated whether geometry computation should be placed largely on the CAD plugins or whether it should be inincluded in the core. As we developed the core libraries out, it became clear that there are large advantages to having it in the core (ie. cross compatability between the CAD plugins, ability to process more inputs from command line, and shear speed since the CAD libraries are made to address many more geometric use cases than are typically needed). So we have decided to include geomtery computation as part of the Ladybug Tools core.
We looked into using other geometry computation libraries for the core including:
However, Rhino3dm lacks basic types of computation that is needed in the core (like generating a grid of points from a surface). Furthermore, Blender library only works in Python3 and this would break our workflows for the Grasshopper and Dynamo plugins, where rely on IronPython. Topologic seems to have many things that we need but it appears that it has C dependencies, making it unusable from ironpython. Furthermore, its dual license may create some difficulties for certain use cases of Ladybug Tools.
After considering it further, we realized that many of the calculations that we need can be done fairly easily as long as the geometry is planar. Since all of the geometry going to the engines (Radiance, E+) is eventually converted to a planar format anyway, we made the decision that the core libraries will support certain basic types of geometry computation for planar objects only. We planned to do this by taking the most relevant parts of existing open source geometry libraries, including euclid and OpenStudio. Thus this repository was born!
For this library, we can borrow some of the math from the previous open source libaraies listed above (Rhino3dm and Blender), as well as other projects like this PhD on Grid Generation for Radiance to build tis core library.
Things that Are or Will be a Part of this Library
(We Can do Easily in Pure Python)
 [x] Vectormath (already exists in Ladybug core)
 [x] Calculate Bounding Box (already exists in Butterfly core)
 [x] Compute Triangle + Quad Areas, Center Points + Normals (partly exists in Butterfly core)
 [x] Compute Area + Perimeter of Planar Geometry (should be doable by using this formula)
 [x] Check Concavity of a 2D Geometry (already exists in legacy find nonconvex component)
 [x] Convert Concave 2D Geometry to Convex Geometries (should be possible with the ear clipping method)
 [x] Triangulate Planar Geometry (possible by converting convex geometry to concave and using fan triangulation)
 [x] Move Geometry (can be taken from Rhino3dm)
 [x] Rotate Geometry Around a Base Point (can be taken from Rhino3dm)
 [x] Mirror Geometry (can be taken from Rhino3dm)
 [x] Scale Geometry from a Base Point (can be taken from Rhino3dm)
 [x] Is Point Inside 2D Polygon (look pretty straightforward from this example)
 [x] Planar surface grid generation (as done in this thesis, which uses bounding box and is point inside)
 [x] Glazing Based on Ratio (currently implemented in legacy glazing based on ratio component)
 [x] Solve Adjacencies (possible with good geometric equivalency tests)
 [x] Generate louvers, fins and overhangs from a face. Should be easy by extruding intersected line segments generated from the Face3D.intersect_plane method that is already implemented.
 [x] Check if a 3D PolyFace is Closed (should be possible by creating a 3D triangulated mesh)
 [x] Ensure that all faces of a solid PolyFace are facing outward (possible with a 3D version of the current method that checks whether a point is inside a polygon. Essentially, shoot a ray from the center of a face using the face normal and make sure that the ray intersects 0 or an even number of other faces in the polyface)
 [x] Check if a Point is Inside a Closed 3D Geometry (useful for thermal comfort studies where points in a grid must be matched with zone results) (should be possible with a variation of the function that checks if a face is outwardfacing except we use the point in question as the origin of the ray we shoot)
 [ ] Straight Skeleton Methods (currently implemented in legacy core/perimeter component but should be expanded to accept concave geometry)
 [ ] Offset edge curve of a planar surface (can be done by translating vertices along the straight skeleton to make a "wavefront")
Things That Should be a Part of this Library
(We Think We Can Do Them But They Will Require Some Expertise)
 [ ] Create Matching Zone Surfaces (intersection of surfaces with one another). OpenStudio has methods for this as @saeranv shows here
 [ ] Curve Boolean a set of 2D curves (useful for finding outer boundaries of set of THERM polygons, calculating building footprints from floor curves, and more). Should be possible with this method here
Things that We Will Rely on the CAD Interface For:
 Conversion of Curved Surfaces to Planar Surfaces (ideally with methods for treating single curvature differently than double curvature)
 Solid Boolean Unions (we can probably get away with not needing this for anything in Ladybug Tools)
Project details
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size  File type  Python version  Upload date  Hashes 

Filename, size ladybug_geometry1.10.0py2.py3noneany.whl (105.6 kB)  File type Wheel  Python version py2.py3  Upload date  Hashes View hashes 
Filename, size ladybuggeometry1.10.0.tar.gz (121.3 kB)  File type Source  Python version None  Upload date  Hashes View hashes 
Hashes for ladybug_geometry1.10.0py2.py3noneany.whl
Algorithm  Hash digest  

SHA256  e63ca3cb0e3719b74cd616eca6e3a8230092a97f58da93fcc7b3da2c7cdc8e03 

MD5  fd8eb150659ff65708897394a626e9bd 

BLAKE2256  1e199869a6d7fd4caab39363251ac604c1bbfdd24fa09e709088eaabe5f5e6cd 