added 2 methods

This commit is contained in:
2024-06-17 01:35:16 +03:00
parent d697cc517f
commit 528b8a0ca9
2 changed files with 23 additions and 0 deletions

View File

@@ -210,4 +210,23 @@ namespace uml
0.f
};
}
Vector3 Vector3::Cross(const Vector3 &v) const
{
return {
y * v.z - z * v.y,
z * v.x - x * v.z,
x * v.y - y * v.x
};
}
Vector3 Vector3::Normalized() const
{
float length = this->Length();
if (length != 0)
{
return *this / length;
}
return *this;
}
}