Skip to main content

Ladybug geometry is a Python library that houses all of the basic geometry computation needed for Ladybug Tools core libraries.

Project description

Ladybug

Build Status Coverage Status

Python 2.7 Python 3.6 IronPython

ladybug-geometry

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)

  • Vectormath (already exists in Ladybug core)
  • Calculate Bounding Box (already exists in Butterfly core)
  • Compute Triangle + Quad Areas, Center Points + Normals (partly exists in Butterfly core)
  • Compute Area + Perimeter of Planar Geometry (should be doable by using this formula)
  • Check Concavity of a 2D Geometry (already exists in legacy find non-convex component)
  • Convert Concave 2D Geometry to Convex Geometries (should be possible with the ear clipping method)
  • Triangulate Planar Geometry (possible by converting convex geometry to concave and using fan triangulation)
  • Move Geometry (can be taken from Rhino3dm)
  • Rotate Geometry Around a Base Point (can be taken from Rhino3dm)
  • Mirror Geometry (can be taken from Rhino3dm)
  • Scale Geometry from a Base Point (can be taken from Rhino3dm)
  • Is Point Inside 2D Polygon (look pretty straightforward from this example)
  • Planar surface grid generation (as done in this thesis, which uses bounding box and is point inside)
  • Glazing Based on Ratio (currently implemented in legacy glazing based on ratio component)
  • Solve Adjacencies (possible with good geometric equivalency tests)
  • 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.
  • Check if a 3D PolyFace is Closed (should be possible by creating a 3D triangulated mesh)
  • 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)
  • 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 outward-facing 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 | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ladybug-geometry-1.21.1.tar.gz (137.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ladybug_geometry-1.21.1-py2.py3-none-any.whl (119.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ladybug-geometry-1.21.1.tar.gz.

File metadata

  • Download URL: ladybug-geometry-1.21.1.tar.gz
  • Upload date:
  • Size: 137.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for ladybug-geometry-1.21.1.tar.gz
Algorithm Hash digest
SHA256 f523dbe2452af87fd1dc8589a9831df994ed5720f3e8d08283f8ee02bd1153f8
MD5 1b5b5d8c2664c8dee729d735beac5324
BLAKE2b-256 01b1b8aa2ca5ece7e9110e60dea17a4565a6d0d3d2ba9228a62391781d574862

See more details on using hashes here.

File details

Details for the file ladybug_geometry-1.21.1-py2.py3-none-any.whl.

File metadata

  • Download URL: ladybug_geometry-1.21.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 119.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for ladybug_geometry-1.21.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d894c5c4c4ba051861838f87193f65c836079babc2f58ea483b15937d87ea707
MD5 6e24853f070676859e406c1005b66452
BLAKE2b-256 34264fd74c7be96767f99060e678e58a7be80337d064b7981ee5d09fa4b40a0b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page