mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 17:03:43 +02:00
Angles aren't boolean!
This commit is contained in:
parent
47e99cdeac
commit
7cb917f735
2 changed files with 6 additions and 6 deletions
|
@ -69,7 +69,7 @@ bool ConicalViewFrustum::intersects(const AABox& box) const {
|
|||
return intersects(position, distance, radius);
|
||||
}
|
||||
|
||||
bool ConicalViewFrustum::getAngularSize(const AACube& cube) const {
|
||||
float ConicalViewFrustum::getAngularSize(const AACube& cube) const {
|
||||
auto radius = 0.5f * SQRT_THREE * cube.getScale(); // radius of bounding sphere
|
||||
auto position = cube.calcCenter() - _position; // position of bounding sphere in view-frame
|
||||
float distance = glm::length(position);
|
||||
|
@ -77,7 +77,7 @@ bool ConicalViewFrustum::getAngularSize(const AACube& cube) const {
|
|||
return getAngularSize(distance, radius);
|
||||
}
|
||||
|
||||
bool ConicalViewFrustum::getAngularSize(const AABox& box) const {
|
||||
float ConicalViewFrustum::getAngularSize(const AABox& box) const {
|
||||
auto radius = 0.5f * glm::length(box.getScale()); // radius of bounding sphere
|
||||
auto position = box.calcCenter() - _position; // position of bounding sphere in view-frame
|
||||
float distance = glm::length(position);
|
||||
|
@ -107,7 +107,7 @@ bool ConicalViewFrustum::intersects(const glm::vec3& relativePosition, float dis
|
|||
sqrtf(distance * distance - radius * radius) * _cosAngle - radius * _sinAngle;
|
||||
}
|
||||
|
||||
bool ConicalViewFrustum::getAngularSize(float distance, float radius) const {
|
||||
float ConicalViewFrustum::getAngularSize(float distance, float radius) const {
|
||||
const float AVOID_DIVIDE_BY_ZERO = 0.001f;
|
||||
float angularSize = radius / (distance + AVOID_DIVIDE_BY_ZERO);
|
||||
return angularSize;
|
||||
|
|
|
@ -45,11 +45,11 @@ public:
|
|||
|
||||
bool intersects(const AACube& cube) const;
|
||||
bool intersects(const AABox& box) const;
|
||||
bool getAngularSize(const AACube& cube) const;
|
||||
bool getAngularSize(const AABox& box) const;
|
||||
float getAngularSize(const AACube& cube) const;
|
||||
float getAngularSize(const AABox& box) const;
|
||||
|
||||
bool intersects(const glm::vec3& relativePosition, float distance, float radius) const;
|
||||
bool getAngularSize(float distance, float radius) const;
|
||||
float getAngularSize(float distance, float radius) const;
|
||||
|
||||
int serialize(unsigned char* destinationBuffer) const;
|
||||
int deserialize(const unsigned char* sourceBuffer);
|
||||
|
|
Loading…
Reference in a new issue