mirror of
https://github.com/overte-org/overte.git
synced 2025-08-16 11:12:25 +02:00
handy conversions between AABox, AACube, and Extents
This commit is contained in:
parent
7cadc3433a
commit
d616c7fa0c
4 changed files with 26 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "AABox.h"
|
||||
#include "AACube.h"
|
||||
#include "Extents.h"
|
||||
#include "GeometryUtil.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
|
@ -19,6 +20,11 @@ AABox::AABox(const AACube& other) :
|
|||
_corner(other.getCorner()), _scale(other.getScale(), other.getScale(), other.getScale()) {
|
||||
}
|
||||
|
||||
AABox::AABox(const Extents& other) :
|
||||
_corner(other.minimum),
|
||||
_scale(other.maximum - other.minimum) {
|
||||
}
|
||||
|
||||
AABox::AABox(const glm::vec3& corner, float size) :
|
||||
_corner(corner), _scale(size, size, size) {
|
||||
};
|
||||
|
|
|
@ -23,11 +23,13 @@
|
|||
#include "StreamUtils.h"
|
||||
|
||||
class AACube;
|
||||
class Extents;
|
||||
|
||||
class AABox {
|
||||
|
||||
public:
|
||||
AABox(const AACube& other);
|
||||
AABox(const Extents& other);
|
||||
AABox(const glm::vec3& corner, float size);
|
||||
AABox(const glm::vec3& corner, const glm::vec3& dimensions);
|
||||
AABox();
|
||||
|
|
|
@ -9,11 +9,25 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <glm/gtx/extented_min_max.hpp>
|
||||
|
||||
#include "AABox.h"
|
||||
#include "AACube.h"
|
||||
#include "Extents.h"
|
||||
#include "GeometryUtil.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
AACube::AACube(const AABox& other) :
|
||||
_corner(other.getCorner()), _scale(other.getLargestDimension()) {
|
||||
}
|
||||
|
||||
AACube::AACube(const Extents& other) :
|
||||
_corner(other.minimum)
|
||||
{
|
||||
glm::vec3 dimensions = other.maximum - other.minimum;
|
||||
_scale = glm::max(dimensions.x, dimensions.y, dimensions.z);
|
||||
}
|
||||
|
||||
AACube::AACube(const glm::vec3& corner, float size) :
|
||||
_corner(corner), _scale(size) {
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// AACube.h
|
||||
// libraries/octree/src
|
||||
// libraries/shared/src
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 04/11/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
@ -22,10 +22,13 @@
|
|||
#include "BoxBase.h"
|
||||
|
||||
class AABox;
|
||||
class Extents;
|
||||
|
||||
class AACube {
|
||||
|
||||
public:
|
||||
AACube(const AABox& other);
|
||||
AACube(const Extents& other);
|
||||
AACube(const glm::vec3& corner, float size);
|
||||
AACube();
|
||||
~AACube() {};
|
||||
|
|
Loading…
Reference in a new issue