mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Feature/more constexpr (#125)
* added constexpr * fix * improved stuff * added const * improvement * fix * fix * patch
This commit is contained in:
@@ -12,14 +12,14 @@ using namespace omath;
|
||||
|
||||
TEST(LinearAlgebraHelpers, Vector3NoInlineHelpersExecute)
|
||||
{
|
||||
Vector3<float> a{1.f, 2.f, 3.f};
|
||||
Vector3<float> b{4.f, 5.f, 6.f};
|
||||
constexpr Vector3<float> a{1.f, 2.f, 3.f};
|
||||
constexpr Vector3<float> b{4.f, 5.f, 6.f};
|
||||
|
||||
// Execute helpers that were made non-inlined
|
||||
auto l = a.length();
|
||||
auto ang = a.angle_between(b);
|
||||
auto perp = a.is_perpendicular(b);
|
||||
auto norm = a.normalized();
|
||||
const auto l = a.length();
|
||||
const auto ang = a.angle_between(b);
|
||||
const auto perp = a.is_perpendicular(b);
|
||||
const auto norm = a.normalized();
|
||||
|
||||
(void)l; (void)ang; (void)perp; (void)norm;
|
||||
SUCCEED();
|
||||
@@ -27,17 +27,17 @@ TEST(LinearAlgebraHelpers, Vector3NoInlineHelpersExecute)
|
||||
|
||||
TEST(LinearAlgebraHelpers, TriangleNoInlineHelpersExecute)
|
||||
{
|
||||
Vector3<float> v1{0.f,0.f,0.f};
|
||||
Vector3<float> v2{3.f,0.f,0.f};
|
||||
Vector3<float> v3{3.f,4.f,0.f};
|
||||
constexpr Vector3<float> v1{0.f,0.f,0.f};
|
||||
constexpr Vector3<float> v2{3.f,0.f,0.f};
|
||||
constexpr Vector3<float> v3{3.f,4.f,0.f};
|
||||
|
||||
Triangle<Vector3<float>> t{v1, v2, v3};
|
||||
constexpr Triangle<Vector3<float>> t{v1, v2, v3};
|
||||
|
||||
auto n = t.calculate_normal();
|
||||
auto a = t.side_a_length();
|
||||
auto b = t.side_b_length();
|
||||
auto h = t.hypot();
|
||||
auto r = t.is_rectangular();
|
||||
const auto n = t.calculate_normal();
|
||||
const auto a = t.side_a_length();
|
||||
const auto b = t.side_b_length();
|
||||
const auto h = t.hypot();
|
||||
const auto r = t.is_rectangular();
|
||||
|
||||
(void)n; (void)a; (void)b; (void)h; (void)r;
|
||||
SUCCEED();
|
||||
@@ -47,8 +47,8 @@ TEST(LinearAlgebraHelpers, Vector4NoInlineHelpersExecute)
|
||||
{
|
||||
Vector4<float> v{1.f,2.f,3.f,4.f};
|
||||
|
||||
auto l = v.length();
|
||||
auto s = v.sum();
|
||||
const auto l = v.length();
|
||||
const auto s = v.sum();
|
||||
v.clamp(-10.f, 10.f);
|
||||
|
||||
(void)l; (void)s;
|
||||
|
||||
Reference in New Issue
Block a user