DHART
|
Evaluate visibility between points in a set of locations. More...
Functions | |
bool | HeightCheck (const Node &Node, float height, EmbreeRayTracer &ert) |
Check if Node can be raised by height without clipping into any geometry. More... | |
vector< int > | HeightCheckAllNodes (const vector< Node > &nodes_to_filter, float height, EmbreeRayTracer &ert) |
Obtain the indexes of all nodes that pass the HeightCheck. More... | |
bool | IsOcclusionBetween (const Node &node_a, const Node &node_b, EmbreeRayTracer &ert, float height=1.7f, float pre_calculated_distance=0.0f) |
Perform a line of sight check between two nodes. More... | |
Graph | AllToAll (HF::RayTracer::EmbreeRayTracer &ert, const std::vector< HF::SpatialStructures::Node > &input_nodes, float height=1.7f) |
Generate a Visibility Graph between every node in a set of nodes in parallel. More... | |
Graph | GroupToGroup (HF::RayTracer::EmbreeRayTracer &ert, const std::vector< HF::SpatialStructures::Node > &from, const std::vector< HF::SpatialStructures::Node > &to, float height=1.7f) |
Generate a Visibility Graph from a set of nodes to another set of nodes. More... | |
Graph | AllToAllUndirected (HF::RayTracer::EmbreeRayTracer &ert, const std::vector< HF::SpatialStructures::Node > &nodes, float height, int cores=-1) |
Generate a Visibility Graph with every edge stored twice. More... | |
Evaluate visibility between points in a set of locations.
A Visibility Graph is a graph of points of space locations that have a clear line of sight to eachother.
Edges in Visibility Graph are bidirectional, since if one node can see another node, the inverse is true. Generating a Visibility Graph from a set of nodes consists of performing a line of sight check between each combination of nodes, and creating an edge if the line of sight check passes.
HF::SpatialStructures::Graph HF::VisibilityGraph::AllToAll | ( | HF::RayTracer::EmbreeRayTracer & | ert, |
const std::vector< HF::SpatialStructures::Node > & | input_nodes, | ||
float | height = 1.7f |
||
) |
Generate a Visibility Graph between every node in a set of nodes in parallel.
ert | A Raytracer conatining the geometry to use as obstacles for occlusion checks. |
input_nodes | X,Y,Z locations of nodes for the Visibility Graph. |
height | Height to offset nodes in the z-direction before generating the VisibilityGraph. |
Every node is offset height meters off the ground, then an occlusion ray is cast between every set of nodes. If this occlusion ray does not intersect any geometry then an edge is created between the set of nodes with a cost equal to the distance between both nodes. The Graph generated by this algorithm is directed, however for each pair of nodes the edge is only stored in the node with the lower ID. This reduces the size of the graph in memory by about 50% and reduces the number of checks since every node will only need to check for edges with nodes that have a higher ID than itself.
Definition at line 128 of file visibility_graph.cpp.
References HF::SpatialStructures::Node::distanceTo(), HeightCheckAllNodes(), IsOcclusionBetween(), and HF::SpatialStructures::Graph::size().
Referenced by CreateVisibilityGraphAllToAll().
HF::SpatialStructures::Graph HF::VisibilityGraph::AllToAllUndirected | ( | HF::RayTracer::EmbreeRayTracer & | ert, |
const std::vector< HF::SpatialStructures::Node > & | nodes, | ||
float | height, | ||
int | cores = -1 |
||
) |
Generate a Visibility Graph with every edge stored twice.
ert | A Raytracer conatining the geometry to use as obstacles for occlusion checks. |
from | X,Y,Z locations of nodes to create the visibility graph from. |
Height | to offset nodes in the z-direction before generating the VisibilityGraph. |
cores | number of cores to use for parallel processing. -1 will use all available cores. |
Similar to VisibilityGraph::AllToAll, however every edge is stored in both nodes that it connects. For example, An edge betwee node 1 and node 2 would only be stored in node 1 in AllToAll, however here the edge would exist in both node1, and node2, in this algorithm.
Definition at line 252 of file visibility_graph.cpp.
References HF::SpatialStructures::Node::distanceTo(), HeightCheckAllNodes(), IsOcclusionBetween(), and HF::SpatialStructures::Graph::size().
Referenced by CreateVisibilityGraphAllToAllUndirected().
HF::SpatialStructures::Graph HF::VisibilityGraph::GroupToGroup | ( | HF::RayTracer::EmbreeRayTracer & | ert, |
const std::vector< HF::SpatialStructures::Node > & | from, | ||
const std::vector< HF::SpatialStructures::Node > & | to, | ||
float | height = 1.7f |
||
) |
Generate a Visibility Graph from a set of nodes to another set of nodes.
ert | A Raytracer conatining the geometry to use as obstacles for occlusion checks. |
from | X,Y,Z locations of nodes to cast rays from. |
to | X,Y,Z locations of nodes to cast rays to. |
Height | to offset nodes in the z-direction before generating the VisibilityGraph. |
The algorithm used here is similar to that of VisibilityGraph::AllToAll, however edges are cast from every node in from to every node in to. All nodes in to will have no outgoing edges.
Definition at line 189 of file visibility_graph.cpp.
References HF::SpatialStructures::Node::distanceTo(), HeightCheckAllNodes(), IsOcclusionBetween(), and HF::SpatialStructures::Graph::size().
Referenced by CreateVisibilityGraphGroupToGroup().
|
inline |
Check if Node can be raised by height without clipping into any geometry.
Node | Node to perform height check on. |
height | Distance to check above the node in meters. Default = 1.7m. |
ert | Raytracer containing geometry to intersect with. |
Cast an occlusion ray straight up with a distance of height to determine if it will intersect with any geometry.
Definition at line 47 of file visibility_graph.cpp.
References HF::RayTracer::EmbreeRayTracer::Occluded(), and HF::SpatialStructures::ROUNDING_PRECISION.
Referenced by HeightCheckAllNodes().
vector< int > HF::VisibilityGraph::HeightCheckAllNodes | ( | const vector< Node > & | nodes_to_filter, |
float | height, | ||
EmbreeRayTracer & | ert | ||
) |
Obtain the indexes of all nodes that pass the HeightCheck.
nodes_to_filter | Nodes to perform the height check on |
height | Height to check above the nodes |
ert | Raytracer containing the geometry to use as obstacles |
Definition at line 69 of file visibility_graph.cpp.
References HeightCheck().
Referenced by AllToAll(), AllToAllUndirected(), and GroupToGroup().
|
inline |
Perform a line of sight check between two nodes.
node_a | Node to check occlusion from. |
node_b | Node to check occlusion to. |
ert | Raytracer containing the geometry to use as obstacles. |
height | Distance to offset a node in the z-direction before performing the check. |
pre_calculated_distance | Distance from node_a to node_b. If set to zero then this will be calculated automatically. |
Calculate the distance between node_a and node_b if required, then calculate the direction between them. Cast an occlusion ray in the direction between node_a and node_b with a maximum distance equal to the distance between them. If the ray intersects anything then the nodes don't have a line of sight.
Definition at line 103 of file visibility_graph.cpp.
References HF::SpatialStructures::Node::directionTo(), HF::SpatialStructures::Node::distanceTo(), and HF::RayTracer::EmbreeRayTracer::Occluded().
Referenced by AllToAll(), AllToAllUndirected(), and GroupToGroup().