dhart.viewanalysis.SphericalViewAnalysis¶
- dhart.viewanalysis.SphericalViewAnalysis(bvh: EmbreeBVH, nodes: List[Tuple[float, float, float]] | NodeList, ray_count: int, height: float, upward_fov=50, downward_fov=70) RayResultList ¶
Conduct view analysis on every node in nodes and return the result of every ray cast
The actual number of rays cast may be slightly more or less than the amount specified, based on the fov limitations specified. The direction each ray was cast in can be retrieved from the function SphericallyDistributeRays.
- Parameters:
bvh – the BVH for the geometry you’re shooting at
nodes – A list of tuples containing x,y,z coordinates of points to analyze
ray_count – Amount of rays to shoot, evenly distributed in a sphere around the center
upward_fov – maximum angle up from the user’s eyelevel to be considred
downward_fov – maximum angle down from the user’s eyelevel to be considred
height – height to offset nodes from the ground in meters
- Returns:
A list of results of shape (ray_count, len(nodes))
- Return type:
RayResult
Examples
Conducting view analysis on 2 nodes casting 10 rays.
>>> from dhart.geometry import LoadOBJ, MeshInfo, CommonRotations >>> from dhart.raytracer import EmbreeBVH >>> from dhart.geometry.mesh_info import ConstructPlane >>> from dhart.viewanalysis import SphericalViewAnalysis
>>> MI = ConstructPlane() >>> MI.Rotate(CommonRotations.Zup_to_Yup) >>> BVH = EmbreeBVH(MI) >>> origins = [(0,0,1), (1,0,1)] >>> va = SphericalViewAnalysis(BVH, origins, 10, 1.7) >>> print(va) [[(-1. , -1) (-1. , -1) (-1. , -1) (-1. , -1) (-1. , -1) ( 5.40725 , 0) (-1. , -1) (-1. , -1) ( 3.529445, 0) (-1. , -1)] [(-1. , -1) (-1. , -1) (-1. , -1) (-1. , -1) (-1. , -1) ( 5.40725 , 0) (-1. , -1) (-1. , -1) ( 3.529445, 0) (-1. , -1)]]