Add of some mathematical functions

Plane: Getters and classic planes
Sphere: Getter
Vector2: Angle between two vectors
Vector3: Same in 3D

Former-commit-id: 07e6421def813743e5fd8248fe2e9503cebbb8a8
This commit is contained in:
Gawaboumga
2014-06-27 19:33:28 +02:00
parent f84897e47a
commit ca595bca20
8 changed files with 82 additions and 1 deletions

View File

@@ -58,6 +58,18 @@ T NzPlane<T>::Distance(T x, T y, T z) const
return Distance(NzVector3<T>(x, y, z));
}
template<typename T>
NzVector3 NzPlane<T>::GetNormal() const
{
return normal;
}
template<typename T>
T NzPlane<T>::GetDistance() const
{
return distance;
}
template<typename T>
NzPlane<T>& NzPlane<T>::Set(T normalX, T normalY, T normalZ, T D)
{
@@ -152,6 +164,24 @@ NzPlane<T> NzPlane<T>::Lerp(const NzPlane& from, const NzPlane& to, T interpolat
return plane;
}
template<typename T>
NzPlane<T> NzPlane<T>::XY()
{
return NzPlane<T>(F(0.0), F(0.0), F(1.0), F(0.0));
}
template<typename T>
NzPlane<T> NzPlane<T>::XZ()
{
return NzPlane<T>(F(0.0), F(1.0), F(0.0), F(0.0));
}
template<typename T>
NzPlane<T> NzPlane<T>::YZ()
{
return NzPlane<T>(F(1.0), F(0.0), F(0.0), F(0.0));
}
template<typename T>
std::ostream& operator<<(std::ostream& out, const NzPlane<T>& plane)
{