// 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 template class NzCube { public: NzCube(); 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; void ExtendTo(const NzVector3& point); void ExtendTo(const NzCube& cube); NzVector3 GetCenter() const; bool Intersect(const NzCube& cube, NzCube* intersection = nullptr) const; bool IsValid() const; void MakeZero(); void Set(T X, T Y, T Z, T Width, T Height, T Depth); void Set(const T cube[6]); void Set(const NzRect& rect); void Set(const NzVector3& vec1, const NzVector3& vec2); template void Set(const NzCube& cube); NzString ToString() const; operator NzString() 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& vec); typedef NzCube NzCubed; typedef NzCube NzCubef; typedef NzCube NzCubei; typedef NzCube NzCubeui; #include #endif // NAZARA_CUBE_HPP