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 3.7 Python 2.7 IronPython

ladybug-geometry

Ladybug geometry is a Python library that houses geometry objects used throughout the Ladybug Tools core libraries.

Installation

pip install -U ladybug-geometry

API Documentation

Local Development

  1. Clone this repo locally
git clone git@github.com:ladybug-tools/ladybug-geometry.git

# or

git clone https://github.com/ladybug-tools/ladybug-geometry.git
  1. Install dependencies:
cd ladybug-geometry
pip install -r dev-requirements.txt
pip install -r requirements.txt
  1. Run Tests:
python -m pytests tests/
  1. Generate Documentation:
sphinx-apidoc -f -e -d 4 -o ./docs ./ladybug_geometry
sphinx-build -b html ./docs ./docs/_build/docs

Currently Supported Capabilities of this Library

  • Vector Math
  • Calculate Bounding Box (Min, Max, Center)
  • Compute Area + Perimeter of Planar Geometry
  • Check Concavity and Clockwise Ordering of 2D Geometry
  • Triangulate Planar Geometry
  • Compute Triangle + Quad Areas, Centroids, and Normals
  • Move Geometry
  • Rotate Geometry Around an Axis
  • Mirror Geometry
  • Scale Geometry from a Base Point
  • Is Point Inside 2D Polygon
  • 3D Face Intersection with a Ray or Line
  • Mesh Grid Generation from a 3D Face
  • Windows Based on Ratio with a Face
  • Solve Adjacencies
  • Generate Louvers, Fins and Overhangs from a Face
  • Check if a 3D PolyFace is a Closed Solid
  • Ensure All Faces of a Solid PolyFace are Point Outwards
  • Join Polylines and Polyfaces
  • Check if a Point is Inside a Closed 3D Polyface
  • Boolean a Set of 2D Curves (joining the naked edges around them)

Capabilities that should eventually be a part of this library

  • Create Matching Zone Surfaces (intersection of surfaces with one another). OpenStudio's boost geometry has methods for this as @saeranv shows here

Officially Unsupported Capabilities for which One Must Rely on CAD Interfaces

  • Conversion of Curved Surfaces to Planar Surfaces (including both single curvature and double curvature)
  • Fancier Meshing (eg. gridded meshing that completely fills the base surface)
  • Solid Boolean Unions (this should not be needed for anything in Ladybug Tools)

Reasons for this Library

We initially debated whether geometry computation should be placed largely on the CAD plugins or whether it should be included 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 compatibility 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 geometry 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!

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.24.11.tar.gz (170.8 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.24.11-py2.py3-none-any.whl (135.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: ladybug-geometry-1.24.11.tar.gz
  • Upload date:
  • Size: 170.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.9.2 requests/2.28.1 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.7.15

File hashes

Hashes for ladybug-geometry-1.24.11.tar.gz
Algorithm Hash digest
SHA256 578599c1d61ef44c0a4a09d344628f9b18b3ecf405692f91add711486bfe5d20
MD5 b19e902ea4c9db3cca9fc1dbb5c72593
BLAKE2b-256 84b2755bba89e5881b352a0ddc37917a27e75aa1d6cf054970afbb1774740c1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ladybug_geometry-1.24.11-py2.py3-none-any.whl
  • Upload date:
  • Size: 135.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.9.2 requests/2.28.1 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.7.15

File hashes

Hashes for ladybug_geometry-1.24.11-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7da615f5156b99271b9ac61df2dcaff3183cc76cd0a82b0b223b2b578a21ec58
MD5 1dabebc0c974b1aced320b8f319bb354
BLAKE2b-256 85869b18c5a0aaf0d9f4f052f6f267b68a720767ee4a137aaa4f74186e62ea88

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