// Copyright (C) 2012 Jérôme Leclercq // This file is part of the "Nazara Engine - Mathematics module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_CUBE_HPP #define NAZARA_CUBE_HPP #include #include #include #include template class NzCube { public: NzCube() = default; NzCube(T X, T Y, T Z, T Width, T Height, T Depth); NzCube(const T cube[6]); NzCube(const NzRect& rect); NzCube(const NzVector3& vec1, const NzVector3& vec2); template explicit NzCube(const NzCube& cube); NzCube(const NzCube& cube) = default; ~NzCube() = default; bool Contains(T X, T Y, T Z) const; bool Contains(const NzVector3& point) const; bool Contains(const NzCube& cube) const; NzCube& ExtendTo(T X, T Y, T Z); NzCube& ExtendTo(const NzVector3& point); NzCube& ExtendTo(const NzCube& cube); NzVector3 GetCorner(nzCorner corner) const; NzVector3 GetCenter() const; NzVector3 GetNegativeVertex(const NzVector3& normal) const; NzVector3 GetPosition() const; NzVector3 GetPositiveVertex(const NzVector3& normal) const; NzVector3 GetSize() const; bool Intersect(const NzCube& cube, NzCube* intersection = nullptr) const; bool IsValid() const; NzCube& MakeZero(); NzCube& Set(T X, T Y, T Z, T Width, T Height, T Depth); NzCube& Set(const T cube[6]); NzCube& Set(const NzCube& cube); NzCube& Set(const NzRect& rect); NzCube& Set(const NzVector3& vec1, const NzVector3& vec2); template NzCube& Set(const NzCube& cube); NzString ToString() const; T& operator[](unsigned int i); T operator[](unsigned int i) const; NzCube operator*(T scalar) const; NzCube& operator*=(T scalar); bool operator==(const NzCube& cube) const; bool operator!=(const NzCube& cube) const; static NzCube Lerp(const NzCube& from, const NzCube& to, T interpolation); static NzCube Zero(); T x, y, z, width, height, depth; }; template std::ostream& operator<<(std::ostream& out, const NzCube& cube); typedef NzCube NzCubed; typedef NzCube NzCubef; typedef NzCube NzCubei; typedef NzCube NzCubeui; #include #endif // NAZARA_CUBE_HPP