NAP
box.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 #include <utility/dllexport.h>
8 #include <rtti/rtti.h>
9 #include <glm/glm.hpp>
10 
11 namespace nap
12 {
13  namespace math
14  {
20  class NAPAPI Box final
21  {
22  RTTI_ENABLE()
23  public:
24  Box() = default;
25 
32  Box(float width, float height, float depth);
33 
41  Box(float width, float height, float depth, const glm::vec3& position);
42 
49  Box(const glm::vec2& xCoordinates, const glm::vec2& yCoordinates, const glm::vec2& zCoordinates);
50 
56  Box(const glm::vec3& min, const glm::vec3& max);
57 
61  float getWidth() const;
62 
66  float getHeight() const;
67 
71  float getDepth() const;
72 
76  bool inside(const glm::vec3& point) const;
77 
81  const glm::vec3& getMin() const { return mMinCoordinates; }
82 
86  const glm::vec3& getMax() const { return mMaxCoordinates; }
87 
91  glm::vec3 getDimensions() const;
92 
96  glm::vec3 getCenter() const;
97 
98  glm::vec3 mMinCoordinates = { -0.5f, -0.5f, -0.5f };
99  glm::vec3 mMaxCoordinates = { 0.5f, 0.5f, 0.5f };
100  };
101  }
102 }
nap::math::Box
Definition: box.h:20
nap::math::max
T max(T left, T right)
Definition: mathutils.h:337
nap::math::min
T min(T left, T right)
Definition: mathutils.h:331
nap
Definition: templateapp.h:17
nap::math::Box::getMax
const glm::vec3 & getMax() const
Definition: box.h:86
nap::math::Box::getMin
const glm::vec3 & getMin() const
Definition: box.h:81