DHART
|
Functions | |
vector< std::array< float, 3 > > | HF::ViewAnalysis::FibbonacciDistributePoints (int num_points, float upwards_fov=50.0f, float downward_fov=70.0f) |
Evenly distribute a set of points around a sphere centered at the origin. More... | |
template<typename RES , typename RT , typename N > | |
std::vector< RES > | HF::ViewAnalysis::SphericalViewAnalysis (RT &ray_tracer, const std::vector< N > &Nodes, int num_rays, float upward_limit=50.0f, float downward_limit=70.0f, float height=1.7f) |
Conduct view analysis with any Raytracer in parallel. More... | |
template<typename RT , typename N > | |
std::vector< float > | HF::ViewAnalysis::SphericalRayshootWithAnyRTForDistance (RT &ray_tracer, const std::vector< N > &Nodes, int num_rays, float upward_limit=50.0f, float downward_limit=70.0f, float height=1.7f, const AGGREGATE_TYPE aggregation=AGGREGATE_TYPE::SUM) |
Conduct view analysis and recieve a summarized set of results for each node. More... | |
C_INTERFACE | SphereicalViewAnalysisAggregate (HF::RayTracer::EmbreeRayTracer *ERT, HF::SpatialStructures::Node *node_ptr, int node_size, int max_rays, float upward_fov, float downward_fov, float height, AGGREGATE_TYPE AT, std::vector< float > **out_scores, float **out_scores_ptr, int *out_scores_size) |
Conduct view analysis, then aggregate the results. More... | |
C_INTERFACE | SphereicalViewAnalysisAggregateFlat (HF::RayTracer::EmbreeRayTracer *ERT, const float *node_ptr, int node_size, int max_rays, float upward_fov, float downward_fov, float height, AGGREGATE_TYPE AT, std::vector< float > **out_scores, float **out_scores_ptr, int *out_scores_size) |
Conduct view analysis, and aggregate the results. More... | |
C_INTERFACE | SphericalViewAnalysisNoAggregate (HF::RayTracer::EmbreeRayTracer *ERT, const HF::SpatialStructures::Node *node_ptr, int node_size, int *max_rays, float upward_fov, float downward_fov, float height, std::vector< RayResult > **out_results, RayResult **out_results_ptr) |
Perform view analysis, then get the distance and meshid for each individual ray casted. More... | |
C_INTERFACE | SphericalViewAnalysisNoAggregateFlat (HF::RayTracer::EmbreeRayTracer *ERT, const float *node_ptr, int node_size, int *max_rays, float upward_fov, float downward_fov, float height, std::vector< RayResult > **out_results, RayResult **out_results_ptr) |
Perform view analysis, and get the distance and meshid for each individual ray casted. More... | |
C_INTERFACE | SphericalDistribute (int *num_rays, std::vector< float > **out_direction_vector, float **out_direction_data, float upward_fov, float downward_fov) |
Equally distribute points around a unit sphere. More... | |
Analyze the view from points in the environment.
std::vector< std::array< float, 3 > > HF::ViewAnalysis::FibbonacciDistributePoints | ( | int | num_points, |
float | upwards_fov = 50.0f , |
||
float | downward_fov = 70.0f |
||
) |
#include <Cpp/analysismethods/src/view_analysis.cpp>
Evenly distribute a set of points around a sphere centered at the origin.
num_points | Maximum number of points to distribute. |
upward_limit | Maximum angle in degrees to cast rays above the viewpoint. |
downward_limit | Maximum angle in degrees to cast rays below the viewpoint. |
>>> Number of Points:8
>>> [(-0, -1, 0), (-0.304862, -0.75, -0.586992), (0.813476, -0.5, 0.29708), (-0.894994, -0.25, 0.369441),
(0.423846, 0, -0.905734), (0.289781, 0.25, 0.923865), (-0.749296, 0.5, -0.43423), (0.64601, 0.75, -0.142025)]
Definition at line 121 of file view_analysis.cpp.
References HF::ViewAnalysis::FibbonacciDist().
Referenced by SphericalDistribute(), HF::ViewAnalysis::SphericalRayshootWithAnyRTForDistance(), and HF::ViewAnalysis::SphericalViewAnalysis().
C_INTERFACE SphereicalViewAnalysisAggregate | ( | HF::RayTracer::EmbreeRayTracer * | ERT, |
HF::SpatialStructures::Node * | node_ptr, | ||
int | node_size, | ||
int | max_rays, | ||
float | upward_fov, | ||
float | downward_fov, | ||
float | height, | ||
AGGREGATE_TYPE | AT, | ||
std::vector< float > ** | out_scores, | ||
float ** | out_scores_ptr, | ||
int * | out_scores_size | ||
) |
#include <Cinterface/view_analysis_C.h>
Conduct view analysis, then aggregate the results.
ERT | Raytracer containing the geometry to use for ray intersections. |
node_ptr | Observer points for the view analysis. |
node_size | Number of nodes in the array pointed to by node_ptr. |
max_rays | Number of rays to cast for each node in node_ptr. Note that this may cast fewer rays than max_rays, depending on FOV restrictions. |
upward_fov | Maximum degrees upward from the viewer's eye level to consider. |
downward_fov | Maximum degrees downward from the viewer's eye level to consider. |
height | Height to offset nodes from the ground (+Z direction). |
AT | Type of aggregation method to use. |
out_scores | Output parameter for node scores. |
out_scores_ptr | Pointer to the data of out_scores. |
out_scores_size | Size of output_scores_ptr. |
Begin by loading an .obj file (Mesh setup).
Then, create a BVH (Raytracer setup) using the mesh.
Set up the parameters for the view analysis.
Now you must prepare a pointer to a std::vector<float>, where the aggregation results will be stored.
You must also select the aggregate type.
Now we are ready to call SphereicalViewAnalysisAggregate .
We can output the contents of the aggregate results vector to stdout .
After using the view analysis results, its resources must be relinquished .
From here, please review the example at Raytracer teardown for instructions
on how to free the remainder of the resources used for the view analysis –
which are the (vector<HF::Geometry::MeshInfo> *) and (HF::Raytracer::EmbreeRayTracer *) instances.
>>> LoadOBJ loaded mesh successfully into loaded_obj at address 00000293CC9C8650, code: 1
>>> CreateRaytracer created EmbreeRayTracer successfully into bvh at address 00000293C3012D20, code: 1
>>> [7.43102, 0, 0]
Definition at line 17 of file view_analysis_C.cpp.
References HF::Exceptions::OK, and HF::ViewAnalysis::SphericalRayshootWithAnyRTForDistance().
C_INTERFACE SphereicalViewAnalysisAggregateFlat | ( | HF::RayTracer::EmbreeRayTracer * | ERT, |
const float * | node_ptr, | ||
int | node_size, | ||
int | max_rays, | ||
float | upward_fov, | ||
float | downward_fov, | ||
float | height, | ||
AGGREGATE_TYPE | AT, | ||
std::vector< float > ** | out_scores, | ||
float ** | out_scores_ptr, | ||
int * | out_scores_size | ||
) |
#include <Cinterface/view_analysis_C.h>
Conduct view analysis, and aggregate the results.
ERT | Raytracer containing the geometry to use for ray intersections. |
node_ptr | Observer points for the view analysis. Each 3 floats represent the {x, y, z} of a new node. |
node_size | Number of nodes in the array pointed to by node_ptr. |
max_rays | Number of rays to cast for each node in node_ptr. Note that this may cast fewer rays than max_rays depending on fov restrictions. |
upward_fov | Maximum degrees upward from the viewer's eye level to consider. |
downward_fov | Maximum degrees downward from the viewer's eye level to consider. |
height | Height to offset nodes from the ground (+Z direction). |
AT | Type of aggregation method to use. |
out_scores | Output parameter for node scores. |
out_scores_ptr | Pointer to the data of out_scores. |
out_scores_size | Size of out_scores_ptr. |
Similar to SphericalViewAnalysis but uses a flat array of floats instead of an array of nodes. This is to make the SphericalViewAnalysis function more accessible.
Begin by loading an .obj file (Mesh setup).
Then, create a BVH (Raytracer setup) using the mesh.
Set up the parameters for the view analysis.
Now you must prepare a pointer to a std::vector<float>, where the aggregation results will be stored.
You must also select the aggregate type.
Now we are ready to call SphericalViewAnalysisAggregateFlat .
We can output the contents of the aggregate results vector to stdout.
After using the view analysis results, its resources must be relinquished.
From here, please review the example at Raytracer teardown for instructions
on how to free the remainder of the resources used for the view analysis –
which are the (vector<HF::Geometry::MeshInfo> *) and (HF::Raytracer::EmbreeRayTracer *) instances.
>>> LoadOBJ loaded mesh successfully into loaded_obj at address 00000293CC9C84D0, code: 1
>>> CreateRaytracer created EmbreeRayTracer successfully into bvh at address 00000293C3012D20, code: 1
>>> [7.43102]
Definition at line 50 of file view_analysis_C.cpp.
References ConvertRawFloatArrayToPoints(), HF::Exceptions::OK, and HF::ViewAnalysis::SphericalRayshootWithAnyRTForDistance().
C_INTERFACE SphericalDistribute | ( | int * | num_rays, |
std::vector< float > ** | out_direction_vector, | ||
float ** | out_direction_data, | ||
float | upward_fov, | ||
float | downward_fov | ||
) |
#include <Cinterface/view_analysis_C.h>
Equally distribute points around a unit sphere.
num_rays | Number of points to distribute. |
out_direction_vector | Output parameter for points generated. Every 3 floats represents a new point. |
out_direction_data | pointer to the data of out_direction_vector |
upward_fov | Maximum degrees upward from the viewer's eye level to consider. |
downward_fov | Maximum degrees downward from the viewer's eye level to consider. |
Begin by initializing input values:
We are now ready to call SphericalDistribute .
Let's output the result, stored in out_float_data (you can also access *out_float).
Make sure to destroy the resources addressed by out_float when you are finished with it.
>>> Number of rays: 10
>>> (-0, -1, 0)
>>> (-0.276545, -0.8, -0.532469)
>>> (0.751457, -0.6, 0.27443)
>>> (-0.847177, -0.4, 0.349703)
>>> (0.415282, -0.2, -0.887435)
>>> (0.299284, 0, 0.954164)
>>> (-0.847731, 0.2, -0.491275)
>>> (0.895138, 0.4, -0.196795)
>>> (-0.460102, 0.6, 0.654451)
>>> (-0.0771074, 0.8, -0.595025)
Definition at line 126 of file view_analysis_C.cpp.
References HF::ViewAnalysis::FibbonacciDistributePoints(), and HF::Exceptions::OK.
std::vector< float > HF::ViewAnalysis::SphericalRayshootWithAnyRTForDistance | ( | RT & | ray_tracer, |
const std::vector< N > & | Nodes, | ||
int | num_rays, | ||
float | upward_limit = 50.0f , |
||
float | downward_limit = 70.0f , |
||
float | height = 1.7f , |
||
const AGGREGATE_TYPE | aggregation = AGGREGATE_TYPE::SUM |
||
) |
#include <Cpp/analysismethods/src/view_analysis.h>
Conduct view analysis and recieve a summarized set of results for each node.
ray_tracer | A valid raytracer that already has the geometry loaded. |
Nodes | Points to perform analysis from. |
num_rays | The number of rays to cast from each point in nodes. The actual amount of rays cast may be less or more than this number. Due to how the spherical ray distribution is calculated. |
upward_limit | Maximum angle in degrees to cast rays above the viewpoint. |
downward_limit | Maximum angle in degrees to cast rays below the viewpoint. |
height | Height off the ground to cast from. All points in Nodes will be offset this distance from the ground (+Z) before calculations are performed |
aggregation | The type of aggregation to use. |
RT | A Raytracer with IntersectOutputArguments defined for the type of N. |
N | A point that overloads [] for 0, 1 and 2. |
The analysis performed by this function is identical to that described in SphericalViewAnalysis, but results are summarized over the course of the analysis for every observer point instead of recording each individual intersection. The memory usage for this function is drastically lower than that of SphericalViewAnalysis, resulting in lower execution times at the cost of being restricted to a set of predefined aggregation methods.
std::bad_array_new_length | The number of rays is larger than that which can be stored in a std::vector. |
>>> (2746.72, 932.565, 170.858, 76.8413)
Definition at line 484 of file view_analysis.h.
References HF::ViewAnalysis::Aggregate(), HF::ViewAnalysis::FibbonacciDistributePoints(), and HF::ViewAnalysis::MIN.
Referenced by SphereicalViewAnalysisAggregate(), and SphereicalViewAnalysisAggregateFlat().
std::vector< RES > HF::ViewAnalysis::SphericalViewAnalysis | ( | RT & | ray_tracer, |
const std::vector< N > & | Nodes, | ||
int | num_rays, | ||
float | upward_limit = 50.0f , |
||
float | downward_limit = 70.0f , |
||
float | height = 1.7f |
||
) |
#include <Cpp/analysismethods/src/view_analysis.h>
Conduct view analysis with any Raytracer in parallel.
ray_tracer | A valid raytracer that already has the geometry loaded. |
Nodes | Points to perform analysis from. |
num_rays | The number of rays to cast from each point in nodes. The actual amount of rays cast may be less or more than this number. Due to how the spherical ray distribution is calculated. |
upward_limit | Maximum angle in degrees to cast rays above the viewpoint. |
downward_limit | Maximum angle in degrees to cast rays below the viewpoint. |
height | Height off the ground to cast from. All points in Nodes will be offset this distance from the ground (+Z) before calculations are performed |
RES | A class or struct that has a .SetHit() function. This function will be called with the node, direction, distance to intersection, and MeshID intersected for every ray that intersects geometry. |
RT | A Raytracer with IntersectOutputArguments defined for the type of N. |
N | A point that overloads [] for 0, 1 and 2. |
ViewAnalysis is calculated by casting a series of rays equally distributed in a sphere from each point in Nodes. This function will run in parallel using all available cores. Depending on RES, this function's complexity and results can vary.
std::bad_array_new_length | The number of rays is larger than that which can be stored in a std::vector. |
>>> (-1, 7.35812, -1, -1, 3.70356, -1, 5.56647, 12.1517, -1, 2.36725, -1, -1, 2.97477, 2.58713, -1,
-1, 1.91404, 5.95885, 4.26368, 1.86167, -1, -1, 2.0406, 2.78304, -1, -1, -1, -1, 2.83909, 2.05302,
-1, -1, 1.90724, 4.29017, 6.3381, 1.98544, -1, -1, 2.75554, 3.15929, -1, -1, 2.6345, -1, -1,
6.80486, -1, 5.12012, -1)
Definition at line 335 of file view_analysis.h.
References HF::ViewAnalysis::FibbonacciDistributePoints().
C_INTERFACE SphericalViewAnalysisNoAggregate | ( | HF::RayTracer::EmbreeRayTracer * | ERT, |
const HF::SpatialStructures::Node * | node_ptr, | ||
int | node_size, | ||
int * | max_rays, | ||
float | upward_fov, | ||
float | downward_fov, | ||
float | height, | ||
std::vector< RayResult > ** | out_results, | ||
RayResult ** | out_results_ptr | ||
) |
#include <Cinterface/view_analysis_C.h>
Perform view analysis, then get the distance and meshid for each individual ray casted.
ERT | Raytracer containing the geometry to use for ray intersections. |
node_ptr | Observer points for the view analysis. |
node_size | Number of nodes in the array pointed to by node_ptr. |
max_rays | Number of rays to cast for each node in node_ptr. This will be updated with the actual number of rays casted upon completion. |
upward_fov | Maximum degrees upward from the viewer's eye level to consider. |
downward_fov | Maximum degrees downward from the viewer's eye level to consider. |
height | Height to offset nodes from the ground (+Z direction). |
out_results | Pointer to the vector containing the results of every ray casted. |
out_results_ptr | Pointer to the data of out_results. |
Rays that do not intersect with any geometry will have a meshid of -1.
Begin by loading an .obj file (Mesh setup).
Then, create a BVH (Raytracer setup) using the mesh.
Set up the parameters for the view analysis.
Now you must prepare a pointer to a std::vector<RayResult>.
View analysis results will be stored at the memory addressed by this pointer.
Now we are ready to call SphericalViewAnalysisNoAggregate .
We can output the contents of the aggregate results vector to stdout.
After using the view analysis results, its resources must be relinquished.
From here, please review the example at Raytracer teardown for instructions
on how to free the remainder of the resources used for the view analysis –
which are the (vector<HF::Geometry::MeshInfo> *) and (HF::Raytracer::EmbreeRayTracer *) instances.
>>> LoadOBJ loaded mesh successfully into loaded_obj at address 00000293CC9C84D0, code: 1
>>> CreateRaytracer created EmbreeRayTracer successfully into bvh at address 00000293C3012500, code: 1
>>> [(-1, -1), (-1, -1), (15.8334, 0), (-1, -1), (-1, -1)]
Definition at line 73 of file view_analysis_C.cpp.
References HF::Exceptions::OK.
C_INTERFACE SphericalViewAnalysisNoAggregateFlat | ( | HF::RayTracer::EmbreeRayTracer * | ERT, |
const float * | node_ptr, | ||
int | node_size, | ||
int * | max_rays, | ||
float | upward_fov, | ||
float | downward_fov, | ||
float | height, | ||
std::vector< RayResult > ** | out_results, | ||
RayResult ** | out_results_ptr | ||
) |
#include <Cinterface/view_analysis_C.h>
Perform view analysis, and get the distance and meshid for each individual ray casted.
ERT | Raytracer containing the geometry to use for ray intersections. |
node_ptr | observer points for the view analysis. Every 3 elements represents the x,y,z coordinates of a new point. |
node_size | number of nodes in the array pointed to by node_ptr. Should be equal to the length of the array contained by node_ptr * 3. |
max_rays | number of rays to cast for each node in node_ptr. This will be updated with the actual number of rays casted upon completion. |
upward_fov | Maximum degrees upward from the viewer's eye level to consider. |
downward_fov | Maximum degrees downward from the viewer's eye level to consider. |
height | Height to offset nodes from the ground (+Z direction). |
out_results | Pointer to the vector containing the results of every ray casted. |
out_results_ptr | Pointer to the data of out_results. |
Rays that do not intersect with any geometry will have a meshid of -1.
Begin by loading an .obj file (Mesh setup).
Then, create a BVH (Raytracer setup) using the mesh.
Set up the parameters for the view analysis.
Now you must prepare a pointer to a std::vector<RayResult>.
View analysis results will be stored at the memory addressed by this pointer.
We are now ready to call SphericalViewAnalysisNoAggregateFlat.
We can output the contents of the results vector to stdout.
After using the view analysis results, its resources must be relinquished.
From here, please review the example at Raytracer teardown for instructions
on how to free the remainder of the resources used for the view analysis –
which are the (vector<HF::Geometry::MeshInfo> *) and (HF::Raytracer::EmbreeRayTracer *) instances.
>>> LoadOBJ loaded mesh successfully into loaded_obj at address 00000293CC9C8290, code: 1
>>> CreateRaytracer created EmbreeRayTracer successfully into bvh at address 00000293C3012D20, code: 1
>>> [(-1, -1), (-1, -1), (15.8334, 0), (-1, -1), (-1, -1)]
Definition at line 106 of file view_analysis_C.cpp.
References ConvertRawFloatArrayToPoints(), and HF::Exceptions::OK.