ladybug_display.geometry2d.polygon module

A polygon that can be displayed in 2D space.

class ladybug_display.geometry2d.polygon.DisplayPolygon2D(geometry, color=None, line_width=Default, line_type='Continuous')[source]

Bases: _LineCurveBase2D

A polygon in 2D space with display properties.

Parameters
  • geometry – A ladybug-geometry Polygon2D object.

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

  • line_width – Number for line width in pixels (for the screen). For print, this will be converted a value in millimeters or inches assuming standard web resolution (72 pixels per inch). This can also be the Default object to indicate that the default settings of the interface should be used (typically one pixel).

  • line_type

    Get or set text to indicate the type of line to display. Choose from the following. (Default: “Continuous”)

    • Continuous

    • Dashed

    • Dotted

    • DashDot

Properties:
  • geometry

  • color

  • line_width

  • line_type

  • vertices

  • segments

  • min

  • max

  • center

  • perimeter

  • area

  • is_clockwise

  • is_convex

  • is_self_intersecting

  • user_data

ToString()
duplicate()

Get a copy of this object.

classmethod from_dict(data)[source]

Initialize a DisplayPolygon2D from a dictionary.

Parameters

data – A dictionary representation of an DisplayPolygon2D 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 DisplayPolygon2D as a dictionary.

property area

Get a number for the area of the polygon.

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 geometry

Get a ladybug_geometry object.

property is_clockwise

Get a boolean for whether the polygon is clockwise.

property is_convex

Get a boolean for whether the polygon is convex.

property is_self_intersecting

Get a boolean for whether the polygon is self intersecting.

property line_type

Get or set text to indicate the type of line to display.

property line_width

Get or set a number to indicate the width of the line in pixels.

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 perimeter

Get a number for the perimeter of the polygon.

property segments

Get a tuple of LineSegment2Ds that make up the polygon.

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 Point2Ds that make up the polygon.