DHART
Loading...
Searching...
No Matches
DHARTAPI.GraphGenerator.GraphGenerator Class Reference

Generate a graph of accessible space on a mesh. More...

Static Public Member Functions

static Graph GenerateGraph (EmbreeBVH bvh, Vector3D start_point, Vector3D spacing, int max_nodes=-1, float up_step=0.2f, float up_slope=20, float down_step=0.2f, float down_slope=20, int max_step_connections=1, int min_connections=1, int core_count=-1, int[] obstacle_ids=null, int[] walkable_ids=null)
 Generate a graph of accessible space with the given settings. If no graph can be generated, null will be returned. More...
 

Detailed Description

Generate a graph of accessible space on a mesh.

Remarks
Use the graph generator to quickly map out accessible space in an environment for other analysis methods without needing to manually place nodes.

Member Function Documentation

◆ GenerateGraph()

static Graph DHARTAPI.GraphGenerator.GraphGenerator.GenerateGraph ( EmbreeBVH  bvh,
Vector3D  start_point,
Vector3D  spacing,
int  max_nodes = -1,
float  up_step = 0.2f,
float  up_slope = 20,
float  down_step = 0.2f,
float  down_slope = 20,
int  max_step_connections = 1,
int  min_connections = 1,
int  core_count = -1,
int[]  obstacle_ids = null,
int[]  walkable_ids = null 
)
static

Generate a graph of accessible space with the given settings. If no graph can be generated, null will be returned.

Parameters
bvhA valid BVH to conduct the graph generation on. Geometry must be Z-Up.
start_pointThe starting point for the graph generator. If this isn't above solid ground, no nodes will be generated.
spacingSpace between nodes. Lower values will yield more nodes for a higher resolution graph.
max_nodesThe maximum amount of nodes to generate.
up_stepMaximum height of a step the graph can traverse. Any steps higher this will be considered inaccessible.
up_slopeMaximum upward slope the graph can traverse in degrees. Any slopes steeper than this will be considered inaccessible.
down_stepMaximum step down the graph can traverse. Any steps steeper than this will be considered inaccessible.
down_slopeThe maximum downward slope the graph can traverse. Any slopes steeper than this will be considered inaccessible.
max_step_connectionsMultiplier for number of children to generate for each node. Increasing this value will increase the number of edges in the graph, and as a result the amount of memory the algorithm requires.
min_connectionsThe required out-degree for a node to be valid and stored. This must be greater than 0 and equal or less than the total connections created from max_step_connections. Default is 1. A value of 8 when max_step_connections=1 would be a grid.
core_countNumber of cores to use. -1 will use all available cores, and 0 will run a serialized version of the algorithm.
walkable_idIDs of geometry to be considered as obstacles
obstacle_idIDs of geometry to be considered as walkable surfaces
Returns
The resulting graph or, If no nodes were generated, null.
Note
All parameters relating to distances are in meters, and all angles are in degrees.
Geometry MUST be Z-UP in order for this to work.
EmbreeBVH BVH = new EmbreeBVH(Mesh);
Vector3D start_point = new Vector3D(0, 9000, 1);
Vector3D spacing = new Vector3D(1, 1, 1);
// A standard graph with a spacing of 1 meter on each side with a maximum of 100 nodes
Graph G = DHARTAPI.GraphGenerator.GraphGenerator.GenerateGraph(BVH, start_point, spacing, 100);
// A graph that cannot traverse stairs
Graph G = DHARTAPI.GraphGenerator.GraphGenerator.GenerateGraph(BVH, start_point, spacing, 100, up_step:0, downstep:0);
// A graph that is able to traverse up 30 degree slopes, but can only traverse down 10
// degree slopes
Graph G = DHARTAPI.GraphGenerator.GraphGenerator.GenerateGraph(BVH, start_point, spacing, 100, up_slope:30, down_slope:10);
A collection of rotations that are frequently useful in DHARTAPI.
Definition: CommonRotations.cs:7
static Vector3D Yup_To_Zup
Will rotate a mesh from Y-Up to Z-Up.
Definition: CommonRotations.cs:16
A collection of vertices and indices representing geometry.
Definition: MeshInfo.cs:50
Load mesh geometry from OBJ files on disk.
Definition: OBJLoader.cs:26
static MeshInfo LoadOBJ(string path, float xrot=0, float yrot=0, float zrot=0)
Load an obj from the OBJ file at the given filepath.
Definition: OBJLoader.cs:50
Generate a graph of accessible space on a mesh.
Definition: GraphGenerator.cs:45
static Graph GenerateGraph(EmbreeBVH bvh, Vector3D start_point, Vector3D spacing, int max_nodes=-1, float up_step=0.2f, float up_slope=20, float down_step=0.2f, float down_slope=20, int max_step_connections=1, int min_connections=1, int core_count=-1, int[] obstacle_ids=null, int[] walkable_ids=null)
Generate a graph of accessible space with the given settings. If no graph can be generated,...
Definition: GraphGenerator.cs:101
A Bounding Volume Hierarchy for the EmbreeRaytracer.
Definition: EmbreeBVH.cs:31
A graph representing connections between points in space.
Definition: Graph.cs:112
Generate a graph of accessible space from a given start point.
Definition: GraphGenerator.cs:36
Automated analysis of the built environent
Definition: CommonTypes.cs:9
A three dimensional vector with built in utility functions.
Definition: CommonTypes.cs:40

Referenced by StringToEdgeCost.Main().


The documentation for this class was generated from the following file: