mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-09 13:44:32 +00:00
initial commit jolt
This commit is contained in:
parent
0c2aa5328c
commit
8acf7da95b
1086 changed files with 214612 additions and 4 deletions
27
Engine/lib/JoltPhysics/UnitTests/Math/TrigonometryTests.cpp
Normal file
27
Engine/lib/JoltPhysics/UnitTests/Math/TrigonometryTests.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
||||
// SPDX-FileCopyrightText: 2024 Jorrit Rouwe
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "UnitTestFramework.h"
|
||||
#include <Jolt/Math/Trigonometry.h>
|
||||
|
||||
TEST_SUITE("TrigonometryTests")
|
||||
{
|
||||
TEST_CASE("TestACosApproximate")
|
||||
{
|
||||
// Check error over entire range [-1, 1]
|
||||
for (int i = -1000; i <= 1000; i++)
|
||||
{
|
||||
float x = float(i) / 1000.0f;
|
||||
float acos1 = acos(x);
|
||||
float acos2 = ACosApproximate(x);
|
||||
CHECK_APPROX_EQUAL(acos1, acos2, 4.3e-3f);
|
||||
}
|
||||
|
||||
// Check edge cases for exact matches
|
||||
CHECK(ACosApproximate(1.0f) == 0.0f);
|
||||
CHECK(ACosApproximate(1.0e-12f) == JPH_PI / 2);
|
||||
CHECK(ACosApproximate(-1.0e-12f) == JPH_PI / 2);
|
||||
CHECK(ACosApproximate(-1.0f) == JPH_PI);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue