ladybug_display.geometry2d.vector module

A vector that can be displayed in 2D space.

class ladybug_display.geometry2d.vector.DisplayVector2D(geometry, color=None)[source]

Bases: _DisplayBase

A vector in 2D space with display properties.

Parameters
  • geometry – A ladybug-geometry Vector2D object.

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

Properties:
  • geometry

  • color

  • x

  • y

  • magnitude

  • user_data

ToString()
angle(other)[source]

Get the angle between this vector and another DisplayVector2D in degrees.

dot(other)[source]

Get the dot product of this vector with another DisplayVector2D.

duplicate()

Get a copy of this object.

classmethod from_dict(data)[source]

Initialize a DisplayVector2D from a dictionary.

Parameters

data – A dictionary representation of an DisplayVector2D object.

normalize()[source]

Ensure that this DisplayVector2D is a unit vector (magnitude=1).

reflect(normal)[source]

Reflect this geometry across a plane with the input normal vector.

Parameters

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

reverse()[source]

Get a copy of this vector that is reversed.

rotate(angle)[source]

Rotate this geometry by a certain angle around an axis and origin.

Parameters
  • axis – A ladybug_geometry Vector2D axis representing the axis of rotation.

  • angle – An angle for rotation in degrees.

to_dict()[source]

Return DisplayVector2D as a dictionary.

property color

Get or set a color for this object.

property geometry

Get a ladybug_geometry object.

property magnitude

Get the magnitude of the vector.

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 x

Get the X coordinate.

property y

Get the Y coordinate.