ladybug_radiance.intersection module¶
Function to compute the intersection between vectors and points.
- ladybug_radiance.intersection.binary_mtx_dimension(filepath)[source]¶
Return binary Radiance matrix dimensions if it exists.
This function returns NROWS, NCOLS, NCOMP and number of header lines including the empty line after last header line.
- Parameters:
filepath – Full path to Radiance file.
- Returns:
A tuple with 4 integers. nrows, ncols, ncomp, line_count
- ladybug_radiance.intersection.binary_to_array(binary_file, nrows=None, ncols=None, ncomp=None, line_count=0)[source]¶
Read a Radiance binary file as a NumPy array.
- Parameters:
binary_file – Path to binary Radiance file.
nrows – Number of rows in the Radiance file.
ncols – Number of columns in the Radiance file.
ncomp – Number of components of each element in the Radiance file.
line_count – Number of lines to skip in the input file. Usually used to skip the header.
- Returns:
A NumPy array.
- ladybug_radiance.intersection.intersection_matrix(vectors, points, normals, context_geometry, offset_distance=0, numericalize=False, sim_folder=None, use_radiance_mesh=False)[source]¶
Compute the intersection matrix between vectors and points.
- Parameters:
vectors – A list of ladybug geometry Vector3D which will be projected from the points of the study_mesh through the context_geometry.
points – A list of ladybug geometry Point3D representing the sensors to be studied.
normals – A list of ladybug geometry Vector3D that matches the length of the points list and indicate the normal direction of each point. THESE VECTORS MUST BE NORMALIZED.
context_geometry – A list of ladybug geometry Face3D and/or Mesh3D that can block the vectors projected from the test points.
offset_distance – An optional number to offset the sensor points before the vectors are cast through the context_geometry. (Default: 0).
numericalize – A boolean to note whether the output matrix should contain numbers representing the cosine of the angle between the normal and each vector or it should simply be a matrix of booleans for whether the vector is seen by the surface (True) or not (False). Numbers can be useful for computing radiation and irradiance while the booleans are more helpful for direct sun and view studies. (Default: False).
sim_folder – An optional path to a folder where the simulation files will be written. If None, a temporary directory will be used. (Default: None).
use_radiance_mesh – A boolean to note whether input Mesh3D should be translated to Radiance Meshes for simulation or whether they should simply have their faces translated to Radiance polygons. For complex context geometry, Radiance meshes will use less memory but they take a longer time to prepare compared to polygons. (Default: False).
- Returns:
A lists of lists, which can be used to account for context shade surrounding visualizations or geometry. The matrix will have a length equal to the points (and normals). Each sub-list consists of booleans and has a length equal to the number of vectors. True indicates that a certain patch is seen and False indicates that the match is blocked.
- ladybug_radiance.intersection.sky_intersection_matrix(sky_matrix, points, normals, context_geometry, offset_distance=0, numericalize=False, sim_folder=None, use_radiance_mesh=False)[source]¶
Compute the intersection matrix between a sky matrix through points.
- Parameters:
sky_matrix – A SkyMatrix object, which provides the vectors to be projected from the points through the context_geometry.
points – A list of ladybug geometry Point3D representing the sensors to be studied.
normals – A list of ladybug geometry Vector3D that matches the length of the points list and indicate the normal direction of each point.
context_geometry – A list of ladybug geometry Face3D that can block the vectors projected from the test points.
offset_distance – An optional number to offset the sensor points before the vectors are cast through the context_geometry. (Default: 0).
numericalize – A boolean to note whether the output matrix should contain numbers representing the cosine of the angle between the normal and each vector or it should simply be a matrix of booleans for whether the vector is seen by the surface (True) or not (False). Numbers can be useful for computing radiation and irradiance while the booleans are more helpful for direct sun and view studies. (Default: False).
sim_folder – An optional path to a folder where the simulation files will be written. If None, a temporary directory will be used. (Default: None).
use_radiance_mesh – A boolean to note whether input Mesh3D should be translated to Radiance Meshes for simulation or whether they should simply have their faces translated to Radiance polygons. For complex context geometry, Radiance meshes will use less memory but they take a longer time to prepare compared to polygons. (Default: False).
- Returns:
A lists of lists, which can be used to account for context shade surrounding visualizations or geometry. The matrix will have a length equal to the points (and normals). Each sub-list consists of booleans and has a length equal to the number of sky patches times 2 (indicating sky patches and ground patches). True indicates that a certain patch is seen and False indicates that the match is blocked.