dhart.visibilitygraph.VisibilityGraphAllToAll¶
- dhart.visibilitygraph.VisibilityGraphAllToAll(bvh: EmbreeBVH, nodes: List[Tuple[float, float, float]], height: float) Graph ¶
Construct a directed visibility graph using all nodes in nodes
O(n^3) complexity in both space and time. Should only be used with smaller datasets, otherwise running out of memory is likely.
- Parameters:
bvh – A pointer to a valid BVH object.
nodes – a list of nodes,
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 VisibilityGraphAllToAll
>>> loaded_obj = ConstructPlane() >>> loaded_obj.Rotate(CommonRotations.Yup_to_Zup) >>> bvh = EmbreeBVH(loaded_obj)
>>> # The model is a flat plane, so only nodes 0,2 should connect. >>> points = [(0,0,1), (0,0,-10), (0,2,0)] >>> height = 1.7 >>> VG = VisibilityGraphAllToAll(bvh, points, height)
>>> print(VG.AggregateEdgeCosts(CostAggregationType.SUM, True)) [ 2.236068 10.198039 12.434107]