ladybug.compass module

Module for computing geometry for the compass used by a variety of graphics.

class ladybug.compass.Compass(radius=100, center=Point2D(0.00, 0.00), north_angle=0, spacing_factor=0.15)[source]

Bases: object

Object for computing geometry for the compass used by a variety of graphics.

Methods to project points to orthographic and stereographic projections are also within this class so that “domed” visualizations can be synchronized with the compass in the 2D plane.

Parameters:
  • radius – A positive number for the radius of the compass. (Default: 100).

  • center – A ladybug_geometry Point2D for the center of the compass in the scene. (Default: (0, 0) for the World origin).

  • north_angle – A number between -360 and 360 for the counterclockwise difference between the North and the positive Y-axis in degrees. 90 is West and 270 is East (Default: 0).

  • spacing_factor – A positive number for the fraction of the radius that labels and tick marks occupy around the compass. (Default: 0.15)

Properties:
  • radius

  • center

  • north_angle

  • north_vector

  • spacing_factor

  • min_point

  • max_point

  • inner_boundary_circle

  • all_boundary_circles

  • major_azimuth_points

  • major_azimuth_ticks

  • minor_azimuth_points

  • minor_azimuth_ticks

  • orthographic_altitude_circles

  • orthographic_altitude_points

  • stereographic_altitude_circles

  • stereographic_altitude_points

duplicate()[source]

Get a copy of this object.

label_points_from_angles(angles, factor=0.8)[source]

Get a list of label points from a list of angles between 0 and 360.

Parameters:
  • angles – An array of numbers between 0 and 360 for the angles of custom angle labels to be generated for the compass.

  • factor – A number between 0 and 1 for the fraction of the spacing_factor at which the points should be generated.

max_point3d(z=0)[source]

Get a Point3D for the minimum around the entire compass.

min_point3d(z=0)[source]

Get a Point3D for the minimum around the entire compass.

static point3d_to_orthographic(point)[source]

Get a Point2D for a given Point3D using a orthographic projection.

Parameters:

point – A ladybug_geometry Point3D to be projected into 2D space via stereographic projection.

static point3d_to_stereographic(point, radius=100, origin=Point3D(0.00, 0.00, 0.00))[source]

Get a Point2D for a given Point3D using a stereographic projection.

Parameters:
  • point – A ladybug_geometry Point3D to be projected into 2D space via stereographic projection.

  • radius – A positive number for the radius of the sphere on which the point exists. (Default: 100).

  • origin – An optional ladybug_geometry Point3D representing the origin of the coordinate system in which the projection is happening. (eg. the center of the compass).

ticks_from_angles(angles, factor=0.3)[source]

Get a list of Linesegment2Ds from a list of angles between 0 and 360.

ALTITUDES = (10, 20, 30, 40, 50, 60, 70, 80)
MAJOR_AZIMUTHS = (0, 90, 180, 270)
MAJOR_TEXT = ('N', 'E', 'S', 'W')
MINOR_AZIMUTHS = (22.5, 45, 67.5, 112.5, 135, 157.5, 202.5, 225, 247.5, 292.5, 315, 337.5)
MINOR_TEXT = ('NNE', 'NE', 'ENE', 'ESE', 'SE', 'SSE', 'SSW', 'SW', 'WSW', 'WNW', 'NW', 'NNW')
PI = 3.141592653589793
property all_boundary_circles

Get an array of 3 Arc2Ds for the circles of the compass.

property center

Get or set a Point2D for the center of the compass in the scene.

property inner_boundary_circle

Get a Arc2D for the inner circle of the compass.

This is essentially a circle with the compass radius.

property major_azimuth_points

Get a list of Point2Ds for the major azimuth labels.

property major_azimuth_ticks

Get a list of LineSegment2Ds for the major azimuth labels.

property max_point

Get a Point2D for the minimum around the entire compass.

property min_point

Get a Point2D for the minimum around the entire compass.

property minor_azimuth_points

Get a list of Point2Ds for the minor azimuth labels.

property minor_azimuth_ticks

Get a list of LineSegment2Ds for the minor azimuth labels.

property north_angle

Get or set a number between -360 and 360 for the north_angle in degrees.

property north_vector

Get or set a ladybug_geometry Vector2D for the north direction.

property orthographic_altitude_circles

Get a list of circles for the orthographic altitude labels.

property orthographic_altitude_points

Get a list of Point2Ds for the orthographic altitude labels.

property radius

Get or set a positive number for the radius of the compass.

property spacing_factor

Get or set a number for the fraction of radius occupied by labels and ticks.

property stereographic_altitude_circles

Get a list of circles for the stereographic altitude labels.

property stereographic_altitude_points

Get a list of Point2Ds for the stereographic altitude labels.