Overte C++ Documentation
OctreeUtils.h
1 //
2 // OctreeUtils.h
3 // libraries/octree/src
4 //
5 // Created by Andrew Meadows 2016.03.04
6 // Copyright 2016 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_OctreeUtils_h
13 #define hifi_OctreeUtils_h
14 
15 #include <NumericalConstants.h>
16 
17 #include "OctreeConstants.h"
18 
19 class AABox;
20 class AACube;
21 class QJsonDocument;
22 
23 float boundaryDistanceForRenderLevel(unsigned int renderLevel, float visibilityDistance);
24 
25 float getPerspectiveAccuracyHalfAngleTan(float visibilityDistance, int boundaryLevelAdjust);
26 float getPerspectiveAccuracyHalfAngle(float visibilityDistance, int boundaryLevelAdjust);
27 float getVisibilityDistanceFromHalfAngle(float halfAngle);
28 float getHalfAngleFromVisibilityDistance(float visibilityDistance);
29 float getOrthographicAccuracySize(float visibilityDistance, int boundaryLevelAdjust);
30 
31 // MIN_ELEMENT_ANGULAR_DIAMETER = angular diameter of 1x1x1m cube at 400m = sqrt(3) / 400 = 0.0043301 radians ~= 0.25 degrees
32 const float MIN_ELEMENT_ANGULAR_DIAMETER = 0.0043301f; // radians
33 // NOTE: the entity bounding cube is larger than the smallest possible containing octree element by sqrt(3)
34 const float MIN_ENTITY_ANGULAR_DIAMETER = MIN_ELEMENT_ANGULAR_DIAMETER * SQRT_THREE;
35 const float MIN_VISIBLE_DISTANCE = 0.0001f; // helps avoid divide-by-zero check
36 
37 #endif // hifi_OctreeUtils_h