honeybee_radiance.view module

Create a Radiance view.

class honeybee_radiance.view.View(identifier, position=None, direction=None, up_vector=None, type='v', h_size=60, v_size=60, shift=None, lift=None)[source]

Bases: object

A Radiance view.

Parameters:
  • identifier – Text string for a unique View ID. Must not contain spaces or special characters. This will be used to identify the object across a model and in the exported Radiance files.

  • position – Set the view position (-vp) to (x, y, z). This is the focal point of a perspective view or the center of a parallel projection. Default: (0, 0, 0)

  • direction – Set the view direction (-vd) vector to (x, y, z). The length of this vector indicates the focal distance as needed by the pixel depth of field (-pd) in rpict. Default: (0, 0, 1)

  • up_vector – Set the view up (-vu) vector (vertical direction) to (x, y, z) default: (0, 1, 0).

  • type

    A single character for the view type (-vt). Choose from the following.

    • v - Perspective

    • h - Hemispherical fisheye

    • l - Parallel

    • c - Cylindrical panorama

    • a - Angular fisheye

    • s - Planisphere [stereographic] projection

    For more detailed description about view types check rpict manual page: (http://radsite.lbl.gov/radiance/man_html/rpict.1.html)

  • h_size – Set the view horizontal size (-vh). For a perspective projection (including fisheye views), val is the horizontal field of view (in degrees). For a parallel projection, val is the view width in world coordinates.

  • v_size – Set the view vertical size (-vv). For a perspective projection (including fisheye views), val is the horizontal field of view (in degrees). For a parallel projection, val is the view width in world coordinates.

  • shift – Set the view shift (-vs). This is the amount the actual image will be shifted to the right of the specified view. This option is useful for generating skewed perspectives or rendering an image a piece at a time. A value of 1 means that the rendered image starts just to the right of the normal view. A value of -1 would be to the left. Larger or fractional values are permitted as well.

  • lift – Set the view lift (-vl) to a value. This is the amount the actual image will be lifted up from the specified view.

Properties:
  • identifier

  • display_name

  • position

  • direction

  • up_vector

  • type

  • h_size

  • v_size

  • shift

  • lift

  • room_identifier

  • light_path

  • group_identifier

  • full_identifier

Usage:

v = View()
# add a fore clip
v.fore_clip = 100
print(v)

> -vtv -vp 0.000 0.000 0.000 -vd 0.000 0.000 1.000 -vu 0.000 1.000
   0.000 -vh 60.000 -vv 60.000 -vo 100.000

# split the view into a view grid
gridViews = v.grid(2, 2, 600, 600)
for g in gridViews:
    print(g)

> -vtv -vp 0.000 0.000 0.000 -vd 0.000 0.000 1.000 -vu 0.000 1.000
   0.000 -vh 29.341 -vv 32.204  -vs -0.500 -vl -0.500 -vo 100.000

> -vtv -vp 0.000 0.000 0.000 -vd 0.000 0.000 1.000 -vu 0.000 1.000
   0.000 -vh 29.341 -vv 32.204 -vs 0.500 -vl -0.500 -vo 100.000

> -vtv -vp 0.000 0.000 0.000 -vd 0.000 0.000 1.000 -vu 0.000 1.000
   0.000 -vh 29.341 -vv 32.204 -vs -0.500 -vl 0.500 -vo 100.000

> -vtv -vp 0.000 0.000 0.000 -vd 0.000 0.000 1.000 -vu 0.000 1.000
  0.000 -vh 29.341 -vv 32.204 -vs 0.500 -vl 0.500 -vo 100.000
ToString()[source]

Overwrite .NET ToString.

dimension(x_res=None, y_res=None)[source]

Get dimensions for this view as ‘-x %d -y %d [-ld-]’.

This method is same as vwrays -d. Default values for x_res and y_res are set to match Radiance defaults.

dimension_x_y(x_res=None, y_res=None)[source]

Get dimensions for this view as x, y.

Default values for x_res and y_res are set to match Radiance defaults.

duplicate()[source]

Get a copy of this object.

classmethod from_dict(view_dict)[source]

Create a view from a dictionary in the following format.

{
'type': 'View',
'identifier': str,  # View identifier
"display_name": str,  # View display name
'position': [],  # list with position value
'direction': [],  # list with direction value
'up_vector': [],  # list with up_vector value
'h_size': number,  # h_size.value
'v_size': number,  # v_size value
'shift': number,  # shift value
'lift': number,  # lift value
'view_type': number,  # view_type value
'fore_clip': number,  # fore_clip value
'aft_clip': number,  # aft_clip value
'room_identifier': str,  # optional room identifier
'light_path':  []  # optional list of lists for light path
}
classmethod from_file(file_path, identifier=None)[source]

Create view from a view file.

Parameters:
  • file_path – Full path to view file.

  • identifier – Optional ext string for a unique View ID. Must not contain spaces or special characters. This will be used to identify the object across a model and in the exported Radiance files. If None, this will be set to file name. (Default: None)

classmethod from_grid(grid, identifier='from_grid')[source]

Create view from a grid of views. Generally the grid argument should be the views generated by the grid method. :param grid: A list of subviews. If only a single view is given, this view will be

returned. The views can be either class instances of View, strings or .unf files. If strings are used, the views will be created by the from_string method. If .unf files are used, the views will be created by the from_string method using the view found in the Radiance header.

Parameters:

identifier – Text string for a unique View ID. Must not contain spaces or special characters. This will be used to identify the object across a model and in the exported Radiance files. If None, this will be set to ‘from_grid’. (Default: ‘from_grid’)

classmethod from_string(identifier, view_string)[source]

Create a view object from a string.

This method is similar to from_string method for radiance parameters with the difference that all the parameters that are not related to view will be ignored.

grid(x_div_count=1, y_div_count=1)[source]

Break-down the view into a grid of views based on x and y grid count.

Views will be returned row by row from right to left.

Parameters:
  • x_div_count – Set number of divisions in x direction (Default: 1).

  • y_div_count – Set number of divisions in y direction (Default: 1).

Returns:

A tuple of views. Views are sorted row by row from right to left.

info_dict(model=None)[source]

Get a dictionary with information about the View.

This can be written as a JSON into a model radiance folder to narrow down the number of aperture groups that have to be run with this view.

Parameters:

model – A honeybee Model object which will be used to identify the aperture groups that will be run with this view. Default: None.

move(moving_vec)[source]

Move this view along a vector.

Parameters:

moving_vec – A ladybug_geometry Vector3D with the direction and distance to move the view.

reflect(plane)[source]

Reflect this view across a plane.

Parameters:

plane – A ladybug_geometry Plane across which the object will be reflected.

rotate(axis, angle, origin=None)[source]

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

Parameters:
  • axis – Rotation axis as a Vector3D. If None, self.up_vector will be used.

  • angle – An angle for rotation in degrees.

  • origin – A ladybug_geometry Point3D for the origin around which the object will be rotated. If None, self.position is used. (Default: None).

rotate_xy(angle, origin=None)[source]

Rotate this view counterclockwise in the world XY plane by a certain angle.

Parameters:
  • angle – An angle in degrees.

  • origin – A ladybug_geometry Point3D for the origin around which the object will be rotated. If None, self.position is used. (Default: None).

scale(factor, origin=None)[source]

Scale this view by a factor from an origin point.

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

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

standardize_fisheye()[source]

Automatically set view size to 180 degrees if the view type is a fisheye.

Alternatively it sets the view size to 360 degrees if both the view type is angular fisheye and either the horizontal or vertical view size is 360 degrees.

to_dict()[source]

Translate view to a dictionary.

to_file(folder, file_name=None, mkdir=False)[source]

Save view to a file.

Parameters:
  • folder – Target folder.

  • file_name – Optional file name without extension (Default: self.identifier).

  • mkdir – A boolean to indicate if the folder should be created in case it doesn’t exist already (Default: False).

Returns:

Full path to newly created file.

to_radiance()[source]

Return full Radiance definition as a string.

property aft_clip

View aft clip (-va) at a distance from the view point.

Set the view aft clipping plane at a distance of val from the view point. Like the view fore plane, it will be perpendicular to the view direction for perspective and parallel view types. For fisheye view types, the clipping plane is actually a clipping sphere, centered on the view point with radius val. Objects behind this imaginary surface will not be visible. A value of zero means no aft clipping, and is the only way to see infinitely distant objects such as the sky.

property direction

Set the view direction (-vd) vector to (x, y, z).

The length of this vector indicates the focal distance as needed by the pixel depth of field (-pd) in rpict. Default: (0, 0, 1)

property display_name

Get or set a string for the object name without any character restrictions.

If not set, this will be equal to the identifier.

property fore_clip

View fore clip (-vo) at a distance from the view point.

The plane will be perpendicular to the view direction for perspective and parallel view types. For fisheye view types, the clipping plane is actually a clipping sphere, centered on the view point with radius val. Objects in front of this imaginary surface will not be visible. This may be useful for seeing through walls (to get a longer perspective from an exterior view point) or for incremental rendering. A value of zero implies no foreground clipping. A negative value produces some interesting effects, since it creates an inverted image for objects behind the viewpoint.

property full_identifier

Get full identifier for view.

For a view with group identifier it will be group_identifier/identifier

property group_identifier

Get or set text for the group identifier to which this View belongs.

This will be used in the write to radiance folder method to write all the views with the same group identifier under the same subfolder.

You may use / in name to identify nested view groups. For example floor_1/living_room create a view under living_room/floor_1 subfolder.

If None, the view will be written to the root of views folder.

property h_size

Set the view horizontal size (-vh).

For a perspective projection (including fisheye views), this is the horizontal field of view (in degrees). For a parallel projection, this is the view width in world coordinates.

property identifier

Get or set a text string for a unique View identifier.

property is_fisheye

Check if the view type is one of the fisheye views.

property lift

Set the view lift (-vl) to a value.

This is the amount the actual image will be lifted up from the specified view.

property light_path

Get or set list of lists for the light path from the view to the sky.

Each sub-list contains identifiers of aperture groups through which light passes. (eg. [[‘SouthWindow1’], [‘__static_apertures__’, ‘NorthWindow2’]]). Setting this property will override any auto-calculation of the light path from the model upon export to the simulation.

property position

Set the view position (-vp) to (x, y, z).

This is the focal point of a perspective view or the center of a parallel projection. Default: (0, 0, 0)

property room_identifier

Get or set text for the Room identifier to which this View belongs.

This will be used in the info_dict method to narrow down the number of aperture groups that have to be run with this view. If None, the view will be run with all aperture groups in the model.

property shift

Set the view shift (-vs).

This is the amount the actual image will be shifted to the right of the specified view. This option is useful for generating skewed perspectives or rendering an image a piece at a time. A value of 1 means that the rendered image starts just to the right of the normal view. A value of -1 would be to the left. Larger or fractional values are permitted as well.

property type

Set and get view type (-vt) to one of the choices below.

  • v - Perspective (v)

  • h - Hemispherical fisheye (h)

  • l - Parallel (l)

  • c - Cylindrical panorama (c)

  • a - Angular fisheye (a)

  • s - Planisphere [stereographic] projection (s)

property up_vector

Set and get the view up (-vu) vector (vertical direction) to (x, y, z)

Default: (0, 1, 0).

property v_size

Set the view vertical size (-vv).

For a perspective projection (including fisheye views), this is the horizontal field of view (in degrees). For a parallel projection, this is the view width in world coordinates.

property va

View aft clip as a string in radiance format.

property vd

View direction as a string in radiance format.

property vh

View horizontal size as a string in radiance format.

property vl

View lift as a string in radiance format.

property vo

View fore clip as a string in radiance format.

property vp

View point / position as a string in radiance format.

property vs

View shift as a string in radiance format.

property vt

View type as a string in radiance format.

property vu

View up as a string in radiance format.

property vv

View vertical size as a string in radiance format.