Added [Cube/Rect]::Get[Negative/Positive]Vertex

Former-commit-id: 66e4851be7751402077ea67df0554a51f3d28df2
This commit is contained in:
Lynix
2013-02-17 23:41:43 +01:00
parent 4a11ff269f
commit ee7a9c572b
4 changed files with 66 additions and 0 deletions

View File

@@ -91,12 +91,40 @@ NzVector2<T> NzRect<T>::GetCenter() const
return NzVector2<T>(x + width/F(2.0), y + height/F(2.0));
}
template<typename T>
NzVector2<T> NzRect<T>::GetNegativeVertex(const NzVector2<T>& normal) const
{
NzVector2<T> neg(GetPosition());
if (normal.x < F(0.0))
neg.x += width;
if (normal.y < F(0.0))
neg.y += height;
return neg;
}
template<typename T>
NzVector2<T> NzRect<T>::GetPosition() const
{
return NzVector2<T>(x, y);
}
template<typename T>
NzVector2<T> NzRect<T>::GetPositiveVertex(const NzVector2<T>& normal) const
{
NzVector2<T> pos(GetPosition());
if (normal.x > F(0.0))
pos.x += width;
if (normal.y > F(0.0))
pos.y += height;
return pos;
}
template<typename T>
NzVector2<T> NzRect<T>::GetSize() const
{