diff --git a/include/Mathter/Geometry/BezierCurve.hpp b/include/Mathter/Geometry/BezierCurve.hpp index 0486849..0114501 100644 --- a/include/Mathter/Geometry/BezierCurve.hpp +++ b/include/Mathter/Geometry/BezierCurve.hpp @@ -30,11 +30,11 @@ class BezierCurve { } /// Construct from array of control points. - BezierCurve(const std::array& controlPoints) : controlPoints(controlPoints) {} + explicit BezierCurve(const std::array& controlPoints) : controlPoints(controlPoints) {} /// Construct from control points. template > - BezierCurve(const Vectors&... controlPoints) : controlPoints{ controlPoints... } {} + explicit BezierCurve(const Vectors&... controlPoints) : controlPoints{ controlPoints... } {} /// Interpolates the Bezier curve. Vec operator()(const T& t) const { diff --git a/include/Mathter/Geometry/Hyperplane.hpp b/include/Mathter/Geometry/Hyperplane.hpp index 3e68c41..c90f0a0 100644 --- a/include/Mathter/Geometry/Hyperplane.hpp +++ b/include/Mathter/Geometry/Hyperplane.hpp @@ -22,12 +22,11 @@ class Hyperplane { /// Converts from a hyperplane with different scalar type. template - Hyperplane(const Hyperplane& other) : normal(other.normal), scalar(other.scalar) {} + Hyperplane(const Hyperplane& other) : normal(other.normal), scalar(static_cast(other.scalar)) {} /// Construct a plane through a point and a vector normal to the plane. - Hyperplane(const Vec& base, const Vec& normal) : normal(normal) { + Hyperplane(const Vec& base, const Vec& normal) : normal(normal), scalar(Dot(normal, base)) { assert(std::abs(T(1) - Length(normal)) < 0.0001f); - scalar = Dot(normal, base); } /// Construct a plane by its algebraic equation. diff --git a/include/Mathter/Geometry/Intersection.hpp b/include/Mathter/Geometry/Intersection.hpp index a9c48cf..ab51870 100644 --- a/include/Mathter/Geometry/Intersection.hpp +++ b/include/Mathter/Geometry/Intersection.hpp @@ -79,9 +79,10 @@ namespace impl { template auto Intersect(const Hyperplane& plane, const Line& line) -> std::optional, Dim, false>> { + using T = common_arithmetic_type_t; const auto t = impl::IntersectHyperplaneLine(plane, line); if (t) { - return line.PointAt(*t); + return Line(line).PointAt(*t); } else { return std::nullopt; @@ -107,9 +108,10 @@ auto Intersect(const Line& line, const Hyperplane& plane) template auto Intersect(const Hyperplane& plane, const LineSegment& lineSegment) -> std::optional, Dim, false>> { + using T = common_arithmetic_type_t; const auto t = impl::IntersectHyperplaneLine(plane, lineSegment.Line()); if (0 <= t && t < Distance(lineSegment.point1, lineSegment.point2)) { - return lineSegment.Line().PointAt(*t); + return Line(lineSegment.Line()).PointAt(*t); } return std::nullopt; } @@ -133,9 +135,10 @@ auto Intersect(const LineSegment& lineSegment, const Hyperplane auto Intersect(const Hyperplane& plane, const Ray& ray) -> std::optional, Dim, false>> { + using T = common_arithmetic_type_t; const auto t = impl::IntersectHyperplaneLine(plane, ray.Line()); if (0 <= t) { - return ray.Line().PointAt(*t); + return Line(ray.Line()).PointAt(*t); } return std::nullopt; } @@ -173,10 +176,8 @@ template auto Intersect(const LineSegment& lhs, const LineSegment& rhs) -> std::optional, 2, false>> { const auto intersection = Intersect(lhs.Line(), rhs.Line()); - if (intersection) { - if (impl::IsWithin(lhs, *intersection) && impl::IsWithin(rhs, *intersection)) { - return intersection; - } + if (intersection && impl::IsWithin(lhs, *intersection) && impl::IsWithin(rhs, *intersection)) { + return intersection; } return std::nullopt; } @@ -246,7 +247,7 @@ auto Intersect(const Ray& ray, const Triangle& triangle) if (t < epsilon) { return std::nullopt; } - const auto point = ray.PointAt(t); + const auto point = Ray(ray).PointAt(t); return point; } diff --git a/include/Mathter/Geometry/Line.hpp b/include/Mathter/Geometry/Line.hpp index 73218c4..004b667 100644 --- a/include/Mathter/Geometry/Line.hpp +++ b/include/Mathter/Geometry/Line.hpp @@ -57,7 +57,8 @@ class Line { } public: - Vec direction, base; + Vec direction; + Vec base; }; } // namespace mathter \ No newline at end of file diff --git a/include/Mathter/Geometry/LineSegment.hpp b/include/Mathter/Geometry/LineSegment.hpp index 402fd1d..2129cd4 100644 --- a/include/Mathter/Geometry/LineSegment.hpp +++ b/include/Mathter/Geometry/LineSegment.hpp @@ -73,7 +73,8 @@ class LineSegment { } public: - Vec point1, point2; + Vec point1; + Vec point2; }; } // namespace mathter \ No newline at end of file diff --git a/include/Mathter/Geometry/Triangle.hpp b/include/Mathter/Geometry/Triangle.hpp index b61e43a..c054eed 100644 --- a/include/Mathter/Geometry/Triangle.hpp +++ b/include/Mathter/Geometry/Triangle.hpp @@ -26,7 +26,7 @@ class Triangle { : corners{ a, b, c } {} /// Construct a triangle from its corners. - Triangle(const std::array& corners) + explicit Triangle(const std::array& corners) : corners{ corners } {} /// Convert from a triangle with different scalar type. diff --git a/include/Mathter/Matrix/Matrix.hpp b/include/Mathter/Matrix/Matrix.hpp index 2a153ad..b1593e1 100644 --- a/include/Mathter/Matrix/Matrix.hpp +++ b/include/Mathter/Matrix/Matrix.hpp @@ -67,13 +67,13 @@ class Matrix : public MatrixStorage { Matrix(const Matrix, Layout2, Packed2>& rhs); /// Creates a matrix from its elements. - template , T>) && sizeof...(Scalars) == size_t(Rows* Columns), int>> + template , T>)&&sizeof...(Scalars) == size_t(Rows* Columns), int>> Matrix(Scalars&&... elements); /// Constructs a row or column matrix from a vector. /// This can only be used for row or column matrices. template > - Matrix(const Vector& v); + explicit Matrix(const Vector& v); /// Used by internal methods. template @@ -145,14 +145,16 @@ class Matrix : public MatrixStorage { /// Convert a row or column matrix to a vector. template >> - operator Vector() const; + explicit operator Vector() const; protected: template void Assign(Head head, Args... args); template - void Assign() {} + void Assign() { + // Overload to terminate recursion when assign is called with zero arguments. + } }; @@ -351,7 +353,7 @@ Matrix::operator Vector template void Matrix::Assign(Head head, Args... args) { - (*this)(i, j) = (T)head; + (*this)(i, j) = static_cast(head); Assign<((j != Columns - 1) ? i : (i + 1)), ((j + 1) % Columns)>(args...); } diff --git a/include/Mathter/Quaternion/Quaternion.hpp b/include/Mathter/Quaternion/Quaternion.hpp index 7b6f30b..b992db7 100644 --- a/include/Mathter/Quaternion/Quaternion.hpp +++ b/include/Mathter/Quaternion/Quaternion.hpp @@ -105,12 +105,10 @@ class Quaternion { //----------------------------------------------- /// Returns the scalar part (w) of (w + xi + yj + zk). - /// Deprecated: use q.scalar instead. - [[deprecated]] T ScalarPart() const; + [[deprecated("use .scalar")]] T ScalarPart() const; /// Returns the vector part (x, y, z) of (w + xi + yj + zk). - /// Deprecated: use q.vector instead. - [[deprecated]] Vector VectorPart() const; + [[deprecated("use .vector")]] Vector VectorPart() const; /// Returns the angle of the rotation represented by quaternion. /// Only valid for unit quaternions. diff --git a/include/Mathter/Transforms/OrthographicBuilder.hpp b/include/Mathter/Transforms/OrthographicBuilder.hpp index d267a77..e1cee4f 100644 --- a/include/Mathter/Transforms/OrthographicBuilder.hpp +++ b/include/Mathter/Transforms/OrthographicBuilder.hpp @@ -61,8 +61,10 @@ namespace impl { } } - Vector minBounds, maxBounds; - T projNearPlane, projFarPlane; + Vector minBounds; + Vector maxBounds; + T projNearPlane; + T projFarPlane; }; } // namespace impl diff --git a/include/Mathter/Transforms/Rotation3DBuilder.hpp b/include/Mathter/Transforms/Rotation3DBuilder.hpp index 3c84482..dd23751 100644 --- a/include/Mathter/Transforms/Rotation3DBuilder.hpp +++ b/include/Mathter/Transforms/Rotation3DBuilder.hpp @@ -195,27 +195,27 @@ namespace impl { template operator Matrix() const { - return RotationMatrixAxisAngle(axis, angle); + return RotationMatrixAxisAngle(axis, U(angle)); } template operator Matrix() const { - return RotationMatrixAxisAngle(axis, angle); + return RotationMatrixAxisAngle(axis, U(angle)); } template operator Matrix() const { - return RotationMatrixAxisAngle(axis, angle); + return RotationMatrixAxisAngle(axis, U(angle)); } template operator Matrix() const { - return RotationMatrixAxisAngle(axis, angle); + return RotationMatrixAxisAngle(axis, U(angle)); } template operator Quaternion() const { - return RotationQuaternionAxisAngle(axis, angle); + return RotationQuaternionAxisAngle(axis, U(angle)); } private: diff --git a/include/Mathter/Transforms/ScaleBuilder.hpp b/include/Mathter/Transforms/ScaleBuilder.hpp index fedb016..fd9d18a 100644 --- a/include/Mathter/Transforms/ScaleBuilder.hpp +++ b/include/Mathter/Transforms/ScaleBuilder.hpp @@ -20,7 +20,7 @@ namespace impl { template class ScaleBuilder { public: - ScaleBuilder(const std::array& scale) : scale(scale) {} + explicit ScaleBuilder(const std::array& scale) : scale(scale) {} template operator Matrix() const { @@ -56,10 +56,10 @@ namespace impl { m = Zero(); size_t i; for (i = 0; i < scale.size(); ++i) { - m(i, i) = std::move(scale[i]); + m(i, i) = static_cast(scale[i]); } for (; i < std::min(Rows, Columns); ++i) { - m(i, i) = T(1); + m(i, i) = static_cast(1); } } diff --git a/include/Mathter/Transforms/TranslationBuilder.hpp b/include/Mathter/Transforms/TranslationBuilder.hpp index 2c77588..eb40737 100644 --- a/include/Mathter/Transforms/TranslationBuilder.hpp +++ b/include/Mathter/Transforms/TranslationBuilder.hpp @@ -20,7 +20,7 @@ namespace impl { template class TranslationBuilder { public: - TranslationBuilder(const std::array& translation) : translation(translation) {} + explicit TranslationBuilder(const std::array& translation) : translation(translation) {} template operator Matrix() const { @@ -48,13 +48,13 @@ namespace impl { void Set(Matrix& m) const { m = Identity(); if constexpr (Order == eMatrixOrder::FOLLOW_VECTOR) { - for (int i = 0; i < translation.size(); ++i) { - m(Rows - 1, i) = U(translation[i]); + for (size_t i = 0; i < translation.size(); ++i) { + m(Rows - 1, i) = static_cast(translation[i]); } } else { - for (int i = 0; i < translation.size(); ++i) { - m(i, Columns - 1) = U(translation[i]); + for (size_t i = 0; i < translation.size(); ++i) { + m(i, Columns - 1) = static_cast(translation[i]); } } } diff --git a/include/Mathter/Utility.hpp b/include/Mathter/Utility.hpp index 7dbf3ec..bd8607a 100644 --- a/include/Mathter/Utility.hpp +++ b/include/Mathter/Utility.hpp @@ -7,6 +7,8 @@ #include "Common/TypeTraits.hpp" #include "Common/Types.hpp" +#include "Vector/Math.hpp" +#include "Vector/Vector.hpp" #include #include @@ -39,7 +41,7 @@ class Constants { template auto Rad2Deg(Scalar rad) { using Real = remove_complex_t; - using ComputeT = std::conditional_t::value, Real, long double>; + using ComputeT = std::conditional_t, Real, long double>; return rad / Constants::Pi * ComputeT(180); } @@ -47,7 +49,7 @@ auto Rad2Deg(Scalar rad) { template auto Deg2Rad(Scalar deg) { using Real = remove_complex_t; - using ComputeT = std::conditional_t::value, Real, long double>; + using ComputeT = std::conditional_t, Real, long double>; return deg / ComputeT(180) * Constants::Pi; } @@ -75,15 +77,6 @@ template Vector Saturate(const Vector& arg); -} // namespace mathter - - -#include "Vector/Math.hpp" -#include "Vector/Vector.hpp" - -// Implementations of vector clamp functions. -namespace mathter { - template Vector Clamp(const Vector& arg, T lower, T upper) { using Vec = Vector; diff --git a/include/Mathter/Vector/Arithmetic.hpp b/include/Mathter/Vector/Arithmetic.hpp index 90c28d5..58073a2 100644 --- a/include/Mathter/Vector/Arithmetic.hpp +++ b/include/Mathter/Vector/Arithmetic.hpp @@ -16,7 +16,7 @@ namespace mathter { template -auto AvoidDivByZero(Vec&& vec, const Fun& fun) { +auto AvoidDivByZero(const Vec& vec, const Fun&) { using VecDecay = std::decay_t; if constexpr (VecDecay::isBatched && std::is_same_v, std::divides>) { return VecDecay(FillMasked>(vec.elements.Load(), static_cast>(1))); diff --git a/include/Mathter/Vector/Math.hpp b/include/Mathter/Vector/Math.hpp index 6bfac71..c735538 100644 --- a/include/Mathter/Vector/Math.hpp +++ b/include/Mathter/Vector/Math.hpp @@ -301,12 +301,12 @@ namespace impl { int sign = 2 * (Dim % 2) - 1; for (size_t idx = 0; idx < result.Dimension(); ++idx, sign *= -1) { // Fill up sub-matrix the determinant of which yields the coefficient of base-vector. - for (int j = 0; j < idx; ++j) { - for (int i = 0; i < detCalc.RowCount(); ++i) { + for (size_t j = 0; j < idx; ++j) { + for (size_t i = 0; i < detCalc.RowCount(); ++i) { detCalc(i, j) = (*vectors[i]).get()[j]; } } - for (int j = idx + 1; j < result.Dimension(); ++j) { + for (size_t j = idx + 1; j < result.Dimension(); ++j) { for (int i = 0; i < detCalc.RowCount(); ++i) { detCalc(i, j - 1) = (*vectors[i]).get()[j]; } @@ -326,13 +326,13 @@ template auto Cross(IterFirst first, IterLast last) -> std::enable_if_t, Vec> { constexpr auto Dim = dimension_v; - if constexpr (dimension_v == 2) { + if constexpr (Dim == 2) { if (first == last) { throw std::invalid_argument("not enough arguments for cross product"); } return Vec(-first->y, first->x); } - if constexpr (dimension_v == 3) { + if constexpr (Dim == 3) { if (first == last) { throw std::invalid_argument("not enough arguments for cross product"); } diff --git a/include/Mathter/Vector/OperationUtil.hpp b/include/Mathter/Vector/OperationUtil.hpp index 002c421..a4f3522 100644 --- a/include/Mathter/Vector/OperationUtil.hpp +++ b/include/Mathter/Vector/OperationUtil.hpp @@ -20,7 +20,7 @@ template Batch FillMasked(Batch batch, Element value) { #ifdef MATHTER_ENABLE_SIMD struct MaskGenerator { - static constexpr bool get(unsigned idx, unsigned size) noexcept { + static constexpr bool get(unsigned idx, [[maybe_unused]] unsigned size) noexcept { return idx < NumNonMasked; } }; diff --git a/include/Mathter/Vector/SIMDUtil.hpp b/include/Mathter/Vector/SIMDUtil.hpp index d80df13..7f1f20c 100644 --- a/include/Mathter/Vector/SIMDUtil.hpp +++ b/include/Mathter/Vector/SIMDUtil.hpp @@ -11,12 +11,22 @@ namespace mathter { constexpr int GetBatchSize(int Dim, bool Packed) { - return Packed ? Dim : - Dim == 3 ? 4 : - Dim == 5 ? 8 : - Dim == 6 ? 8 : - Dim == 7 ? 8 : - Dim; + if (!Packed) { + switch (Dim) { + case 1: return 1; + case 2: return 2; + case 3: return 4; + case 4: return 4; + case 5: return 8; + case 6: return 8; + case 7: return 8; + case 8: return 8; + default: return Dim; + } + } + else { + return Dim; + } } diff --git a/test/ApplyTransform.hpp b/test/ApplyTransform.hpp index f03a4a4..1d0bc1b 100644 --- a/test/ApplyTransform.hpp +++ b/test/ApplyTransform.hpp @@ -7,7 +7,7 @@ namespace test_util { template && (mathter::is_vector_v || mathter::is_matrix_v)>> -const auto ApplyTransform(const Mat& transform, const Vec& vector) { +auto ApplyTransform(const Mat& transform, const Vec& vector) { if constexpr (mathter::order_v == mathter::eMatrixOrder::PRECEDE_VECTOR) { return transform * vector; } diff --git a/test/Decompositions/TestLU.cpp b/test/Decompositions/TestLU.cpp index 4d08caa..9cc560f 100644 --- a/test/Decompositions/TestLU.cpp +++ b/test/Decompositions/TestLU.cpp @@ -102,7 +102,6 @@ TEMPLATE_LIST_TEST_CASE("LU decomposition: complex", "[LU]", TEMPLATE_LIST_TEST_CASE("LU decomposition: zero matrix", "[LU]", decltype(MatrixCaseList{})) { using Mat = typename TestType::template Matrix<3, 3>; - using T = scalar_type_t; const Mat m = Zero(); diff --git a/test/Decompositions/TestQR.cpp b/test/Decompositions/TestQR.cpp index d225202..d14e01f 100644 --- a/test/Decompositions/TestQR.cpp +++ b/test/Decompositions/TestQR.cpp @@ -259,7 +259,6 @@ TEMPLATE_LIST_TEST_CASE("QR decomposition: compute complex pseudoinverse", "[QR] TEMPLATE_LIST_TEST_CASE("QR decomposition: solve system of equations", "[QR]", decltype(MatrixCaseList{})) { using Mat = typename TestType::template Matrix<3, 3>; - using Scalar = scalar_type_t; using Vec = Vector; using namespace std::complex_literals; @@ -322,7 +321,6 @@ TEMPLATE_LIST_TEST_CASE("QR decomposition: solve multiple systems of equations", TEMPLATE_LIST_TEST_CASE("QR decomposition: solve least squares problem", "[QR]", decltype(MatrixCaseList{})) { using Mat = typename TestType::template Matrix<4, 3>; - using Scalar = scalar_type_t; using Vec = Vector; using namespace std::complex_literals; @@ -368,8 +366,8 @@ TEMPLATE_LIST_TEST_CASE("QR decomposition: QR/LQ selection", "[QR]", }; const auto mt = FlipLayoutAndOrder(m); - const auto dec = DecomposeQRorLQ(m); - const auto decT = DecomposeQRorLQ(mt); + REQUIRE_NOTHROW(DecomposeQRorLQ(m)); + REQUIRE_NOTHROW(DecomposeQRorLQ(mt)); } SECTION("Square") { using Mat = typename TestType::template Matrix<3, 3>; diff --git a/test/Matrix/TestMath.cpp b/test/Matrix/TestMath.cpp index 6fbd926..3e2d169 100644 --- a/test/Matrix/TestMath.cpp +++ b/test/Matrix/TestMath.cpp @@ -321,7 +321,6 @@ TEMPLATE_LIST_TEST_CASE("Matrix - Inverse", "[Matrix]", 2 / 3.0, -5 / 9.0, 2 / 9.0, -1 / 3.0, 13 / 9.0, -7 / 9.0 }; - const bool good = inverse == test_util::Approx(expected); REQUIRE(inverse == test_util::Approx(expected)); } SECTION("4x4") { diff --git a/test/Matrix/TestMatrix.cpp b/test/Matrix/TestMatrix.cpp index e7ca2ec..7a28871 100644 --- a/test/Matrix/TestMatrix.cpp +++ b/test/Matrix/TestMatrix.cpp @@ -62,7 +62,7 @@ TEMPLATE_LIST_TEST_CASE("Matrix - Construct row/column", "[Matrix]", using Mat = typename TestType::template Matrix<1, 3>; using Scalar = scalar_type_t; - Mat m = Vector{ 1, 2, 3 }; + const auto m = Mat(Vector{ 1, 2, 3 }); const auto& c = m; REQUIRE(m(0, 0) == static_cast(1)); @@ -79,7 +79,7 @@ TEMPLATE_LIST_TEST_CASE("Matrix - Construct row/column", "[Matrix]", using Mat = typename TestType::template Matrix<3, 1>; using Scalar = scalar_type_t; - Mat m = Vector{ 1, 2, 3 }; + const auto m = Mat(Vector{ 1, 2, 3 }); const auto& c = m; REQUIRE(m(0, 0) == static_cast(1)); @@ -257,7 +257,7 @@ TEMPLATE_LIST_TEST_CASE("Matrix - Convert to vector", "[Matrix]", using Scalar = scalar_type_t; const Mat m = { 1, 2, 3 }; - const Vector v = m; + const auto v = Vector(m); REQUIRE(v[0] == static_cast(1)); REQUIRE(v[1] == static_cast(2)); @@ -268,7 +268,7 @@ TEMPLATE_LIST_TEST_CASE("Matrix - Convert to vector", "[Matrix]", using Scalar = scalar_type_t; const Mat m = { 1, 2, 3 }; - const Vector v = m; + const auto v = Vector(m); REQUIRE(v[0] == static_cast(1)); REQUIRE(v[1] == static_cast(2)); diff --git a/test/Quaternion/TestLiterals.cpp b/test/Quaternion/TestLiterals.cpp index 6eeb8c3..c51eafa 100644 --- a/test/Quaternion/TestLiterals.cpp +++ b/test/Quaternion/TestLiterals.cpp @@ -98,7 +98,7 @@ TEST_CASE("Quaternion - Literals (long double)", "[Quaternion]") { using namespace quat_literals; SECTION("Real") { - const Quaternion q = 1.0l; + const Quaternion q = 1.0L; static_assert(std::is_same_v>, long double>); REQUIRE(q.s == 1); REQUIRE(q.i == 0); diff --git a/test/Quaternion/TestMath.cpp b/test/Quaternion/TestMath.cpp index 467051a..e265a96 100644 --- a/test/Quaternion/TestMath.cpp +++ b/test/Quaternion/TestMath.cpp @@ -56,15 +56,15 @@ TEMPLATE_LIST_TEST_CASE("Quaternion - LengthPrecise", "[Quaternion]", using Quat = typename TestType::Quat; SECTION("Underflow") { - const Quat q(2e-30, 5e-30, 14e-30, 0); + const Quat q(2e-30f, 5e-30f, 14e-30f, 0.0f); REQUIRE(LengthPrecise(q) == Catch::Approx(15e-30)); } SECTION("Overflow") { - const Quat q(2e+20, 5e+20, 14e+20, 0); + const Quat q(2e+20f, 5e+20f, 14e+20f, 0.0f); REQUIRE(LengthPrecise(q) == Catch::Approx(15e+20)); } SECTION("Zero") { - const Quat q(0, 0, 0, 0); + const Quat q(0.0f, 0.0f, 0.0f, 0.0f); REQUIRE(LengthPrecise(q) == Catch::Approx(0)); } } @@ -75,15 +75,15 @@ TEMPLATE_LIST_TEST_CASE("Quaternion - Abs", "[Quaternion]", using Quat = typename TestType::Quat; SECTION("Underflow") { - const Quat q(2e-30, 5e-30, 14e-30, 0); + const Quat q(2e-30f, 5e-30f, 14e-30f, 0.0f); REQUIRE(Abs(q) == Catch::Approx(15e-30)); } SECTION("Overflow") { - const Quat q(2e+20, 5e+20, 14e+20, 0); + const Quat q(2e+20f, 5e+20f, 14e+20f, 0.0f); REQUIRE(Abs(q) == Catch::Approx(15e+20)); } SECTION("Zero") { - const Quat q(0, 0, 0, 0); + const Quat q(0.0f, 0.0f, 0.0f, 0.0f); REQUIRE(Abs(q) == Catch::Approx(0)); } } diff --git a/test/Transforms/TestRotation2DBuilder.cpp b/test/Transforms/TestRotation2DBuilder.cpp index 3725ff0..7a37feb 100644 --- a/test/Transforms/TestRotation2DBuilder.cpp +++ b/test/Transforms/TestRotation2DBuilder.cpp @@ -32,7 +32,6 @@ TEMPLATE_LIST_TEST_CASE("Transform: Rotation 2D", "[Transforms]", using M22 = typename TestType::template Matrix<2, 2>; const M22 value = Rotation(angle); - const bool v = ApplyTransform(value, testVector) == test_util::Approx(expectedVector, 2e-6f); REQUIRE(ApplyTransform(value, testVector) == test_util::Approx(expectedVector, 2e-6f)); } SECTION("Homogeneous") { diff --git a/test/Transforms/TestRotation3DBuilder.cpp b/test/Transforms/TestRotation3DBuilder.cpp index 6061ec0..bfe2227 100644 --- a/test/Transforms/TestRotation3DBuilder.cpp +++ b/test/Transforms/TestRotation3DBuilder.cpp @@ -317,7 +317,6 @@ TEMPLATE_LIST_TEST_CASE("Transform: Rotation 3D -- Axis-angle matrix", "[Transfo using ExampleMat = typename TestType::template Matrix<1, 1>; using Scalar = remove_complex_t>; using Vec = Vector>; - using Quat = Quaternion; const Scalar angle = 0.577215664901532; const Vec axis = Normalize(Vec(1, 2, 3)); diff --git a/test/Transforms/TestViewBuilder.cpp b/test/Transforms/TestViewBuilder.cpp index 9c3d7e6..6295dce 100644 --- a/test/Transforms/TestViewBuilder.cpp +++ b/test/Transforms/TestViewBuilder.cpp @@ -148,7 +148,6 @@ TEMPLATE_LIST_TEST_CASE("Transform: View 2D", "[Transforms]", const auto eye = map(Vec(0, 10)); const auto target = map(Vec(0, 3)); - const auto up = map(Vec(0, 0.5f)); const std::array testPoints = { diff --git a/test/Vector/TestVector.cpp b/test/Vector/TestVector.cpp index 2b8d048..5f328b2 100644 --- a/test/Vector/TestVector.cpp +++ b/test/Vector/TestVector.cpp @@ -36,6 +36,7 @@ TEMPLATE_LIST_TEST_CASE("Vector - Default initializer", "[Vector]", #ifdef NDEBUG REQUIRE(memoryRegion == expected); #else + static_cast(expected); // Avoiding [[maybe_unused]] in case it's not used for the release builds either. REQUIRE(std::all_of(ptr->begin(), ptr->end(), [](const auto& v) { return std::isnan(std::real(v)); })); #endif } @@ -51,9 +52,9 @@ TEMPLATE_LIST_TEST_CASE("Vector - Ctor: conversion", "[Vector]", VecLhs lhs(1, 2, 3); VecRhs rhs(lhs); - REQUIRE(lhs[0] == scalar_type_t(1)); - REQUIRE(lhs[1] == scalar_type_t(2)); - REQUIRE(lhs[2] == scalar_type_t(3)); + REQUIRE(rhs[0] == scalar_type_t(1)); + REQUIRE(rhs[1] == scalar_type_t(2)); + REQUIRE(rhs[2] == scalar_type_t(3)); }