dhart.visibilitygraph.VisibilityGraphGroupToGroup¶
- dhart.visibilitygraph.VisibilityGraphGroupToGroup(bvh: EmbreeBVH, group_a: List[Tuple[float, float, float]], group_b: List[Tuple[float, float, float]], height: float, cores: int = -1) Graph | None ¶
Construct visibility graph between all nodes in group_a, and group_b
Note: Node ids will be assigned first first to group_a, then to group_b. I.E if group_a has three nodes, and group_b has four, A’s nodes would be [1,2,3] and group_b’s would be [4,5,6,7]
- Parameters:
bvh – the pointer to a valid embree bvh
group_a – a list of nodes as (x,y,z) tuples
group_b – 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
Examples
Create a new visibility graph from one group of nodes to another group of nodes then print a summary of their scores
>>> from dhart.geometry import LoadOBJ, CommonRotations, ConstructPlane >>> from dhart.spatialstructures.graph import CostAggregationType >>> from dhart.raytracer import EmbreeBVH >>> from dhart.visibilitygraph import VisibilityGraphGroupToGroup
>>> loaded_obj = ConstructPlane() >>> loaded_obj.Rotate(rotation=CommonRotations.Yup_to_Zup) >>> bvh = EmbreeBVH(loaded_obj)
>>> nodes_a = [(1,1,1), (1,2,0)] >>> nodes_b = [(2,1,1), (1,1,2)]
>>> graph = VisibilityGraphGroupToGroup(bvh, nodes_a, nodes_b, 1.7, -1) >>> print(graph.AggregateEdgeCosts(CostAggregationType.AVERAGE, True)) [1. 1.9840593 0. 0. ]
- Returns:
An undirected graph created in C++ None: If the given inputs produced a graph with no edges
- Return type: