// 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_SPHERE_HPP #define NAZARA_SPHERE_HPP #include #include template class NzSphere { public: NzSphere() = default; NzSphere(T X, T Y, T Z, T Radius); //NzSphere(const NzCircle& circle); NzSphere(const NzVector3& pos, T Radius); NzSphere(const T sphere[4]); template explicit NzSphere(const NzSphere& sphere); NzSphere(const NzSphere& sphere) = default; ~NzSphere() = default; bool Contains(T X, T Y, T Z) const; //bool Contains(const NzCube& cube) const; bool Contains(const NzVector3& point) const; T Distance(T X, T Y, T Z) const; T Distance(const NzVector3& point) const; NzSphere& ExtendTo(T X, T Y, T Z); NzSphere& ExtendTo(const NzVector3& point); NzVector3 GetNegativeVertex(const NzVector3& normal) const; NzVector3 GetPosition() const; NzVector3 GetPositiveVertex(const NzVector3& normal) const; //bool Intersect(const NzCube& cube) const; bool Intersect(const NzSphere& sphere) const; bool IsValid() const; NzSphere& MakeZero(); NzSphere& Set(T X, T Y, T Z, T Radius); //NzSphere& Set(const NzCircle& rect); NzSphere& Set(const NzSphere& sphere); NzSphere& Set(const NzVector3& pos, T Radius); NzSphere& Set(const T sphere[4]); template NzSphere& Set(const NzSphere& sphere); T SquaredDistance(T X, T Y, T Z) const; T SquaredDistance(const NzVector3& point) const; NzString ToString() const; T& operator[](unsigned int i); T operator[](unsigned int i) const; NzSphere operator*(T scalar) const; NzSphere& operator*=(T scalar); bool operator==(const NzSphere& sphere) const; bool operator!=(const NzSphere& sphere) const; static NzSphere Lerp(const NzSphere& from, const NzSphere& to, T interpolation); static NzSphere Zero(); T x, y, z, radius; }; template std::ostream& operator<<(std::ostream& out, const NzSphere& sphere); typedef NzSphere NzSphered; typedef NzSphere NzSpheref; #include #endif // NAZARA_SPHERE_HPP