minor improvements

This commit is contained in:
2024-07-28 17:06:55 +03:00
parent 9b77e2e0be
commit 632d6a45b1
3 changed files with 9 additions and 10 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/cmake-build/ /cmake-build/
/.idea /.idea
/out

View File

@@ -204,8 +204,8 @@ namespace omath
return return
{ {
angles::RadiansToDegrees(asinf(delta.z / distance)), angles::RadiansToDegrees(std::asin(delta.z / distance)),
angles::RadiansToDegrees(atan2f(delta.y, delta.x)), angles::RadiansToDegrees(std::atan2(delta.y, delta.x)),
0.f 0.f
}; };
} }
@@ -241,7 +241,8 @@ namespace omath
Vector3 Vector3::Cross(const Vector3 &v) const Vector3 Vector3::Cross(const Vector3 &v) const
{ {
return { return
{
y * v.z - z * v.y, y * v.z - z * v.y,
z * v.x - x * v.z, z * v.x - x * v.z,
x * v.y - y * v.x x * v.y - y * v.x
@@ -251,10 +252,7 @@ namespace omath
Vector3 Vector3::Normalized() const Vector3 Vector3::Normalized() const
{ {
const float length = this->Length(); const float length = this->Length();
if (length != 0)
{ return length != 0 ? *this / length : *this;
return *this / length;
}
return *this;
} }
} }

View File

@@ -1,7 +1,7 @@
enable_testing() enable_testing()
project(unit-tests) project(unit-tests)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
file(GLOB TEST_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) file(GLOB TEST_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
include(GoogleTest) include(GoogleTest)