28 return num_in_degrees * (
static_cast<float>(M_PI) / 180.00f);
38 float magnitude = sqrt(
39 pow(x, 2) + pow(y, 2) + pow(z, 2)
63 float x = vec[0];
float y = vec[1];
float z = vec[2];
64 float r = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
65 float phi = acos(z / r);
67 return (phi >= min_angle && phi <= max_angle);
84 vector<std::array<float, 3>>
FibbonacciDist(
int num_points,
float upwards_fov,
float downward_fov)
92 const float max_phi =
static_cast<float>(M_PI_2) + lowerlimit;
93 const float min_phi =
static_cast<float>(M_PI_2) - upperlimit;
95 const int n = num_points;
96 std::vector<std::array<float, 3>> out_points;
97 float offset = 2.0f / float(n);
98 const float increment =
static_cast<float>(M_PI)* (3.0f - sqrtf(5.0f));
100 for (
int i = 5; i < n + 5; i++) {
101 float y = ((float(i) * offset) - 1.0f) - (offset / 0.2f);
102 float r = sqrtf(1.0f - powf(y, 2));
104 float phi = (float(i + 1) * increment);
105 float x = cosf(phi) * r;
106 float z = sinf(phi) * r;
110 if (!isnan(x) && !isnan(y) && !isnan(z)) {
111 auto new_point = std::array<float, 3>{x, y, z};
114 out_points.emplace_back(new_point);
124 auto out_points =
FibbonacciDist(num_points, upwards_fov, downward_fov);
127 int points_removed = num_points - out_points.size();
128 double percent_removed =
static_cast<double>(points_removed) /
static_cast<double>(num_points);
131 int new_out_points = (num_points / (1.0 - percent_removed));
Contains definitions for the ViewAnalysis namespace.
Contains definitions for the EmbreeRayTracer
Contains definitions for the RayTracer namespace.
Contains definitions for the Node structure.
vector< std::array< float, 3 > > FibbonacciDistributePoints(int num_points, float upwards_fov, float downward_fov)
Evenly distribute a set of points around a sphere centered at the origin.
Cast rays to determine if and where they intersect geometry.
Analyze space from the perspective of observers within a 3D environment.
void Normalize(std::array< float, 3 > &vec)
Normalize a vector.
vector< std::array< float, 3 > > FibbonacciDist(int num_points, float upwards_fov, float downward_fov)
bool AltitudeWithinRange(const std::array< float, 3 > &vec, float max_angle, float min_angle)
constexpr float ConvertToRadians(float num_in_degrees)
Convert a number from degrees to radians.
A point in space with an ID.