dhart.visibilitygraph.VisibilityGraphUndirectedAllToAll¶
- dhart.visibilitygraph.VisibilityGraphUndirectedAllToAll(bvh: EmbreeBVH, nodes: List[Tuple[float, float, float]], height: float, cores: int = -1) Graph ¶
Construct visibility graph using all nodes in nodes
Unlike the standard visibility graph algorithm, the Undirected visibility graph is able to be parallelized, making it better suited to larger datasets.
- Parameters:
bvh – the pointer to a valid embree bvh
nodes – a list of nodes as (x,y,z) tuples
height – height to evaluate the visibility graph from
cores – number of cores to use in the evaluation. 0 will not be parallelized
Example
Create a visibility graph between 3 nodes
>>> from dhart.geometry import LoadOBJ, CommonRotations, ConstructPlane >>> from dhart.spatialstructures.graph import CostAggregationType >>> from dhart.raytracer import EmbreeBVH >>> from dhart.visibilitygraph import VisibilityGraphUndirectedAllToAll
>>> loaded_obj = ConstructPlane() >>> loaded_obj.Rotate(CommonRotations.Yup_to_Zup) >>> bvh = EmbreeBVH(loaded_obj)
>>> points = [(0,0,1), (0,0,-10), (0,2,0)] >>> height = 1.7 >>> VG = VisibilityGraphUndirectedAllToAll(bvh,points,height)
>>> print(VG.AggregateEdgeCosts(CostAggregationType.SUM, True)) [ 2.236068 10.198039 0. ]
- Returns:
An undirected graph created in C++
- Return type: