ladybug_display.geometry2d.mesh module

A mesh in 2D space with display properties.

class ladybug_display.geometry2d.mesh.DisplayMesh2D(geometry, color=None, display_mode='Surface')[source]

Bases: _SingleColorModeBase2D

A mesh in 2D space with display properties.

Parameters:
  • geometry – A ladybug-geometry Mesh2D.

  • color – A ladybug Color object. If None, a default black color will be used. (Default: None).

  • display_mode

    Text to indicate the display mode (surface, wireframe, etc.). Choose from the following. (Default: Surface).

    • Surface

    • SurfaceWithEdges

    • Wireframe

    • Points

Properties:
  • geometry

  • color

  • display_mode

  • vertices

  • faces

  • min

  • max

  • center

  • area

  • face_areas

  • face_centroids

  • user_data

ToString()
duplicate()

Get a copy of this object.

classmethod from_dict(data)[source]

Initialize a DisplayMesh2D from a dictionary.

Parameters:

data – A dictionary representation of an DisplayMesh2D object.

move(moving_vec)

Move this geometry along a vector.

Parameters:

moving_vec – A ladybug_geometry Vector with the direction and distance to move the geometry.

reflect(normal, origin)

Reflect this geometry across a plane defined by a normal and origin.

Parameters:
  • normal – A Vector2D representing the normal vector for the plane across which the line segment will be reflected. THIS VECTOR MUST BE NORMALIZED.

  • origin – A Point2D representing the origin from which to reflect.

rotate(angle, origin)

Rotate this geometry counterclockwise by a certain angle.

Parameters:
  • angle – An angle for rotation in degrees.

  • origin – A Point2D for the origin around which the line segment will be rotated.

scale(factor, origin=None)

Scale this geometry by a factor from an origin point.

Parameters:
  • factor – A number representing how much the object should be scaled.

  • origin – A ladybug_geometry Point representing the origin from which to scale. If None, it will be scaled from the World origin.

to_dict()[source]

Return DisplayMesh2D as a dictionary.

property area

Get the area of the mesh.

property center

Get a Point2D for the center of the bounding box around the object.

property color

Get or set a color for this object.

property display_mode

Get or set text to indicate the display mode.

property face_areas

Get a tuple with the area of each face in the mesh.

property face_centroids

Get a tuple with the centroid of each face in the mesh.

property faces

Get a tuple of all faces in the mesh.

property geometry

Get a ladybug_geometry object.

property max

Get a Point2D for the maximum of the bounding box around the object.

property min

Get a Point2D for the minimum of the bounding box around the object.

property user_data

Get or set an optional dictionary for additional meta data for this object.

This will be None until it has been set. All keys and values of this dictionary should be of a standard Python type to ensure correct serialization of the object to/from JSON (eg. str, float, int, list, dict)

property vertices

Get a tuple of vertices in the mesh.