Esempio n. 1
0
def test_horizontal_radial_patches():
    view_mesh, view_vec = view_sphere.horizontal_radial_patches(30, 2)

    assert len(view_vec) == 576
    assert all(isinstance(vec, Vector3D) for vec in view_vec)
    assert isinstance(view_mesh, Mesh3D)

    view_mesh, view_vec = view_sphere.horizontal_radial_patches(30, 2, True)

    assert len(view_vec) == 576
    assert all(isinstance(vec, Vector3D) for vec in view_vec)
    assert isinstance(view_mesh, Mesh3D)
Esempio n. 2
0
    _offset_dist_ = _offset_dist_ if _offset_dist_ is not None \
        else 0.1 / conversion_to_meters()
    if _geo_block_ is None:
        _geo_block_ = True if vt_str in ('Sky Exposure', 'Sky View') else False

    # create the gridded mesh from the geometry
    study_mesh = to_joined_gridded_mesh3d(_geometry, _grid_size, _offset_dist_)
    points = [from_point3d(pt) for pt in study_mesh.face_centroids]
    hide_output(ghenv.Component, 1)

    # get the view vectors based on the view type
    patch_wghts = None
    if vt_str == 'Horizontal Radial':
        lb_vecs = view_sphere.horizontal_radial_vectors(30 * _resolution_)
    elif vt_str == 'Horizontal 30-Degree Offset':
        patch_mesh, lb_vecs = view_sphere.horizontal_radial_patches(
            30, _resolution_)
        patch_wghts = view_sphere.horizontal_radial_patch_weights(
            30, _resolution_)
    elif vt_str == 'Spherical':
        patch_mesh, lb_vecs = view_sphere.sphere_patches(_resolution_)
        patch_wghts = view_sphere.sphere_patch_weights(_resolution_)
    else:
        patch_mesh, lb_vecs = view_sphere.dome_patches(_resolution_)
        patch_wghts = view_sphere.dome_patch_weights(_resolution_)
    view_vecs = [from_vector3d(pt) for pt in lb_vecs]

    # mesh the geometry and context
    shade_mesh = join_geometry_to_mesh(_geometry + context_) if _geo_block_ \
        else join_geometry_to_mesh(context_)

    # intersect the rays with the mesh