mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-12 22:53:27 +00:00
try
This commit is contained in:
8
.github/workflows/cmake-multi-platform.yml
vendored
8
.github/workflows/cmake-multi-platform.yml
vendored
@@ -506,6 +506,14 @@ jobs:
|
||||
cmake-build/build/${{ matrix.preset }}/**/*.log
|
||||
${{ env.VCPKG_ROOT }}/buildtrees/**/*.log
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Run WASM Unit Tests
|
||||
run: node out/Release/unit_tests.js
|
||||
|
||||
##############################################################################
|
||||
# 8) Windows MSYS2 MinGW – GCC / Ninja
|
||||
##############################################################################
|
||||
|
||||
@@ -233,10 +233,10 @@ namespace omath
|
||||
return Angle<float, 0.f, 180.f, AngleFlags::Clamped>::from_radians(std::acos(dot(other) / bottom));
|
||||
}
|
||||
|
||||
[[nodiscard]] bool is_perpendicular(const Vector3& other) const noexcept
|
||||
[[nodiscard]] bool is_perpendicular(const Vector3& other, Type epsilon = static_cast<Type>(0.0001)) const noexcept
|
||||
{
|
||||
if (const auto angle = angle_between(other))
|
||||
return angle->as_degrees() == static_cast<Type>(90);
|
||||
return std::abs(angle->as_degrees() - static_cast<Type>(90)) <= epsilon;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -390,8 +390,10 @@ TEST_F(UnitTestVector3, AsTuple)
|
||||
// Test AsTuple method
|
||||
TEST_F(UnitTestVector3, AngleBeatween)
|
||||
{
|
||||
EXPECT_EQ(Vector3(0.0f, 0.0f, 1.0f).angle_between({1, 0 ,0}).value().as_degrees(), 90.0f);
|
||||
EXPECT_EQ(Vector3(0.0f, 0.0f, 1.0f).angle_between({0.0f, 0.0f, 1.0f}).value().as_degrees(), 0.0f);
|
||||
EXPECT_NEAR(Vector3(0.0f, 0.0f, 1.0f).angle_between({1, 0, 0}).value().as_degrees(),
|
||||
90.0f, 0.001f);
|
||||
EXPECT_NEAR(Vector3(0.0f, 0.0f, 1.0f).angle_between({0.0f, 0.0f, 1.0f}).value().as_degrees(),
|
||||
0.0f, 0.001f);
|
||||
EXPECT_FALSE(Vector3(0.0f, 0.0f, 0.0f).angle_between({0.0f, 0.0f, 1.0f}).has_value());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user