2024-06-28 20:34:45 +00:00
|
|
|
// Copyright 2022-2024, Collabora, Inc.
|
2022-11-29 09:11:05 +00:00
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief Test for m_vec3_angle.
|
|
|
|
* @author Moses Turner <moses@collabora.com>
|
|
|
|
*/
|
|
|
|
#include "xrt/xrt_defines.h"
|
|
|
|
#include <math/m_vec3.h>
|
|
|
|
|
|
|
|
|
2024-06-28 20:34:45 +00:00
|
|
|
#include "catch_amalgamated.hpp"
|
2022-11-29 09:11:05 +00:00
|
|
|
|
|
|
|
TEST_CASE("Vec3Angle")
|
|
|
|
{
|
|
|
|
float sqrt2_2 = sqrtf(2) / 2;
|
2024-06-28 20:34:45 +00:00
|
|
|
CHECK(m_vec3_angle({1, 0, 0}, {-1, 0, 0}) == Catch::Approx(M_PI));
|
|
|
|
CHECK(m_vec3_angle({1, 0, 0}, {0, 1, 0}) == Catch::Approx(M_PI / 2));
|
|
|
|
CHECK(m_vec3_angle({1, 0, 0}, {sqrt2_2, sqrt2_2, 0}) == Catch::Approx(M_PI / 4));
|
2022-11-29 09:11:05 +00:00
|
|
|
}
|