Completed Vector3 vectors
Former-commit-id: 73c16102c22fe1d01b9b9411aa3e1bf82949542c
This commit is contained in:
@@ -36,8 +36,12 @@ template<typename T> class NzVector3
|
||||
NzVector3 GetNormal(T* length = nullptr) const;
|
||||
T GetSquaredLength() const;
|
||||
|
||||
NzVector3& MakeBackward();
|
||||
NzVector3& MakeDown();
|
||||
NzVector3& MakeForward();
|
||||
NzVector3& MakeLeft();
|
||||
NzVector3& MakeRight();
|
||||
NzVector3& MakeUnit();
|
||||
NzVector3& MakeUnitX();
|
||||
NzVector3& MakeUnitY();
|
||||
NzVector3& MakeUnitZ();
|
||||
@@ -90,12 +94,16 @@ template<typename T> class NzVector3
|
||||
bool operator>(const NzVector3& vec) const;
|
||||
bool operator>=(const NzVector3& vec) const;
|
||||
|
||||
static NzVector3 Backward();
|
||||
static NzVector3 CrossProduct(const NzVector3& vec1, const NzVector3& vec2);
|
||||
static T DotProduct(const NzVector3& vec1, const NzVector3& vec2);
|
||||
static NzVector3 Down();
|
||||
static NzVector3 Forward();
|
||||
static NzVector3 Left();
|
||||
static NzVector3 Lerp(const NzVector3& from, const NzVector3& to, T interpolation);
|
||||
static NzVector3 Normalize(const NzVector3& vec);
|
||||
static NzVector3 Right();
|
||||
static NzVector3 Unit();
|
||||
static NzVector3 UnitX();
|
||||
static NzVector3 UnitY();
|
||||
static NzVector3 UnitZ();
|
||||
|
||||
@@ -111,6 +111,18 @@ T NzVector3<T>::GetSquaredLength() const
|
||||
return x*x + y*y + z*z;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T>& NzVector3<T>::MakeBackward()
|
||||
{
|
||||
return Set(F(0.0), F(0.0), F(1.0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T>& NzVector3<T>::MakeDown()
|
||||
{
|
||||
return Set(F(0.0), F(-1.0), F(0.0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T>& NzVector3<T>::MakeForward()
|
||||
{
|
||||
@@ -123,6 +135,18 @@ NzVector3<T>& NzVector3<T>::MakeLeft()
|
||||
return Set(F(-1.0), F(0.0), F(0.0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T>& NzVector3<T>::MakeRight()
|
||||
{
|
||||
return Set(F(1.0), F(0.0), F(0.0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T>& NzVector3<T>::MakeUnit()
|
||||
{
|
||||
return Set(F(1.0), F(1.0), F(1.0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T>& NzVector3<T>::MakeUnitX()
|
||||
{
|
||||
@@ -526,6 +550,24 @@ T NzVector3<T>::DotProduct(const NzVector3& vec1, const NzVector3& vec2)
|
||||
return vec1.DotProduct(vec2);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzVector3<T>::Backward()
|
||||
{
|
||||
NzVector3 vector;
|
||||
vector.MakeBackward();
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzVector3<T>::Down()
|
||||
{
|
||||
NzVector3 vector;
|
||||
vector.MakeDown();
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzVector3<T>::Forward()
|
||||
{
|
||||
@@ -556,6 +598,24 @@ NzVector3<T> NzVector3<T>::Normalize(const NzVector3& vec)
|
||||
return vec.GetNormal();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzVector3<T>::Right()
|
||||
{
|
||||
NzVector3 vector;
|
||||
vector.MakeRight();
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzVector3<T>::Unit()
|
||||
{
|
||||
NzVector3 vector;
|
||||
vector.MakeUnit();
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzVector3<T>::UnitX()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user