Added [Cube/Rect]::Get[Negative/Positive]Vertex
Former-commit-id: 66e4851be7751402077ea67df0554a51f3d28df2
This commit is contained in:
@@ -138,12 +138,46 @@ NzVector3<T> NzCube<T>::GetCenter() const
|
||||
return NzVector3<T>(x + width/F(2.0), y + height/F(2.0), z + depth/F(2.0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzCube<T>::GetNegativeVertex(const NzVector3<T>& normal) const
|
||||
{
|
||||
NzVector3<T> neg(GetPosition());
|
||||
|
||||
if (normal.x < F(0.0))
|
||||
neg.x += width;
|
||||
|
||||
if (normal.y < F(0.0))
|
||||
neg.y += height;
|
||||
|
||||
if (normal.z < F(0.0))
|
||||
neg.z += depth;
|
||||
|
||||
return neg;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzCube<T>::GetPosition() const
|
||||
{
|
||||
return NzVector3<T>(x, y, z);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzCube<T>::GetPositiveVertex(const NzVector3<T>& normal) const
|
||||
{
|
||||
NzVector3<T> pos(GetPosition());
|
||||
|
||||
if (normal.x > F(0.0))
|
||||
pos.x += width;
|
||||
|
||||
if (normal.y > F(0.0))
|
||||
pos.y += height;
|
||||
|
||||
if (normal.z > F(0.0))
|
||||
pos.z += depth;
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzCube<T>::GetSize() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user