Implements rotgen::quaternion
Closes #19 Co-authored-by: Jules Pénuchot <jules@penuchot.com>
This commit is contained in:
parent
aba4d65feb
commit
c400650f1a
53 changed files with 995 additions and 84 deletions
|
|
@ -5,10 +5,12 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/arithmetic.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/arithmetic.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic block transposition-like operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
// Helper: fill matrix from raw data
|
||||
// NB: This function must not be turned into a lambda, otherwise
|
||||
// `test-ubuntu-gcc-release` will not pass and the CI will fail.
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/cwise.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/cwise.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic block cwise operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
//==================================================================================================
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
template<typename EigenType, typename F>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "rotgen/functions/functions.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
void test_value(auto const& matrix,
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/norms.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/norms.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic block norm operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
#include <Eigen/Dense>
|
||||
|
||||
template<typename MatrixType, typename T>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "tts.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
#include <Eigen/Dense>
|
||||
|
||||
namespace rotgen::tests
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "tts.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include <Eigen/Dense>
|
||||
|
||||
namespace rotgen::tests
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "tts.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include <Eigen/Dense>
|
||||
|
||||
namespace rotgen::tests
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//==================================================================================================
|
||||
//==============================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
//==============================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
|
@ -59,30 +59,33 @@ namespace rotgen::tests
|
|||
for (rotgen::Index c = 0; c < output.cols(); ++c) output(r, c) = fn(r, c);
|
||||
}
|
||||
|
||||
auto default_init_function = [](auto row, auto col) {
|
||||
return row + 3 * col - 2.5;
|
||||
};
|
||||
|
||||
auto generate_matrix_references()
|
||||
{
|
||||
auto fn = [](auto r, auto c) { return r + 3 * c - 2.5; };
|
||||
std::vector<rotgen::tests::matrix_descriptor> cases = {
|
||||
// Singular matrix
|
||||
{1, 1, fn},
|
||||
{1, 1, default_init_function},
|
||||
// Square matrix below MAX_SIZE
|
||||
{3, 3, fn},
|
||||
{3, 3, default_init_function},
|
||||
// Square matrix at MAX_SIZE
|
||||
{4, 4, fn},
|
||||
{4, 4, default_init_function},
|
||||
// Square matrix above MAX_SIZE
|
||||
{7, 7, fn},
|
||||
{7, 7, default_init_function},
|
||||
// Tall matrix below MAX_SIZE
|
||||
{5, 2, fn},
|
||||
{5, 2, default_init_function},
|
||||
// Tall matrix at MAX_SIZE
|
||||
{8, 2, fn},
|
||||
{8, 2, default_init_function},
|
||||
// Tall matrix above MAX_SIZE
|
||||
{10, 3, fn},
|
||||
{10, 3, default_init_function},
|
||||
// Thick matrix below MAX_SIZE
|
||||
{2, 5, fn},
|
||||
{2, 5, default_init_function},
|
||||
// Thick matrix at MAX_SIZE
|
||||
{2, 8, fn},
|
||||
{2, 8, default_init_function},
|
||||
// Thick matrix above MAX_SIZE
|
||||
{3, 10, fn}};
|
||||
{3, 10, default_init_function}};
|
||||
|
||||
return cases;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("System solver using QR",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
//==================================================================================================
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("rowwise API", rotgen::tests::types)<typename T, typename O>(
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("SVD decomposition - Dynamic case",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
@ -19,7 +20,8 @@ TTS_CASE_TPL("SVD decomposition - Dynamic case",
|
|||
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value>::Random(5, 5);
|
||||
auto decomp = rotgen::svd(m);
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
rank = decomp.rank();
|
||||
|
||||
auto u = decomp.U(rank);
|
||||
|
|
@ -56,7 +58,8 @@ TTS_CASE_TPL("SVD decomposition - Static case",
|
|||
auto m = rotgen::matrix<T, 5, 5, O::value>::Random();
|
||||
auto decomp = rotgen::svd(m);
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
rank = decomp.rank();
|
||||
|
||||
auto u = decomp.U(rank);
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/arithmetic.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/arithmetic.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic map transposition-like operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Function size", rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("map constructor from pointer and single static size",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/cwise.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/cwise.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic map cwise operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/norms.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/norms.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic map norm operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
template<typename MatrixType>
|
||||
void test_map_operations(rotgen::Index rows,
|
||||
|
|
|
|||
|
|
@ -5,10 +5,13 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/arithmetic.hpp"
|
||||
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/arithmetic.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic matrix transposition-like operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Function size", rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/cwise.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/cwise.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic matrix cwise operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
void test_value(auto const& matrix,
|
||||
std::size_t rows,
|
||||
std::size_t cols,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
//==================================================================================================
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic matrix inverse",
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/norms.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/norms.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic matrix norm operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
template<typename MatrixType>
|
||||
void test_matrix_operations(rotgen::Index rows,
|
||||
rotgen::Index cols,
|
||||
|
|
|
|||
28
test/unit/quaternion/basic_api.cpp
Normal file
28
test/unit/quaternion/basic_api.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
//==============================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test coefficient accessors",
|
||||
float,
|
||||
double)<typename Scalar>(tts::type<Scalar>)
|
||||
{
|
||||
rotgen::quaternion<Scalar> quaterion;
|
||||
|
||||
quaterion.w() = 1;
|
||||
quaterion.x() = 2;
|
||||
quaterion.y() = 3;
|
||||
quaterion.z() = 4;
|
||||
|
||||
TTS_EQUAL(quaterion.w(), rotgen::Index{1});
|
||||
TTS_EQUAL(quaterion.x(), rotgen::Index{2});
|
||||
TTS_EQUAL(quaterion.y(), rotgen::Index{3});
|
||||
TTS_EQUAL(quaterion.z(), rotgen::Index{4});
|
||||
};
|
||||
32
test/unit/quaternion/constructors.cpp
Normal file
32
test/unit/quaternion/constructors.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Default matrix dynamic constructor",
|
||||
float,
|
||||
double)<typename Scalar>(tts::type<Scalar>)
|
||||
{
|
||||
rotgen::quaternion<Scalar> rotgen_quaterion;
|
||||
|
||||
TTS_PASS();
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Default matrix dynamic constructor",
|
||||
float,
|
||||
double)<typename Scalar>(tts::type<Scalar>)
|
||||
{
|
||||
rotgen::quaternion<Scalar> quaterion{1, 2, 3, 4};
|
||||
|
||||
TTS_EQUAL(quaterion.w(), rotgen::Index{1});
|
||||
TTS_EQUAL(quaterion.x(), rotgen::Index{2});
|
||||
TTS_EQUAL(quaterion.y(), rotgen::Index{3});
|
||||
TTS_EQUAL(quaterion.z(), rotgen::Index{4});
|
||||
};
|
||||
114
test/unit/quaternion/generators.cpp
Normal file
114
test/unit/quaternion/generators.cpp
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
//==============================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/references.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
#include <Eigen/Eigen>
|
||||
|
||||
TTS_CASE_TPL("Test quaternion::angleAxis",
|
||||
float,
|
||||
double)<typename Scalar>(tts::type<Scalar>)
|
||||
{
|
||||
// Eigen
|
||||
Eigen::Quaternion<Scalar> eigen_result;
|
||||
eigen_result =
|
||||
Eigen::AngleAxis<Scalar>(13, Eigen::Matrix<Scalar, 3, 1>{1, 2, 3});
|
||||
|
||||
// Rotgen
|
||||
rotgen::quaternion<Scalar> rotgen_result;
|
||||
rotgen_result =
|
||||
rotgen::angleAxis<Scalar>(13, rotgen::matrix<Scalar, 3, 1>{1, 2, 3});
|
||||
|
||||
TTS_EQUAL(rotgen_result.w(), eigen_result.w());
|
||||
TTS_EQUAL(rotgen_result.x(), eigen_result.x());
|
||||
TTS_EQUAL(rotgen_result.y(), eigen_result.y());
|
||||
TTS_EQUAL(rotgen_result.z(), eigen_result.z());
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test quaternion::operator* with rotgen::matrix",
|
||||
float,
|
||||
double)<typename Scalar>(tts::type<Scalar>)
|
||||
{
|
||||
// Eigen
|
||||
Eigen::Quaternion<Scalar> eigen_quat;
|
||||
eigen_quat =
|
||||
Eigen::AngleAxis<Scalar>(13, Eigen::Matrix<Scalar, 3, 1>{1, 2, 3});
|
||||
|
||||
Eigen::Matrix<Scalar, 3, 1> eigen_other{3, 2, 1};
|
||||
auto eigen_result = eigen_quat * eigen_other;
|
||||
|
||||
// Rotgen
|
||||
rotgen::quaternion<Scalar> rotgen_quat;
|
||||
rotgen_quat =
|
||||
rotgen::angleAxis<Scalar>(13, rotgen::matrix<Scalar, 3, 1>{1, 2, 3});
|
||||
|
||||
rotgen::matrix<Scalar, 3, 1> rotgen_other{3, 2, 1};
|
||||
auto rotgen_result = rotgen_quat * rotgen_other;
|
||||
|
||||
for (auto i = 0; i < eigen_result.size(); i++)
|
||||
TTS_ULP_EQUAL(rotgen_result(i), eigen_result(i), 2);
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test quaternion::operator* with rotgen::map",
|
||||
float,
|
||||
double)<typename Scalar>(tts::type<Scalar>)
|
||||
{
|
||||
Scalar data[] = {3, 2, 1};
|
||||
|
||||
// Eigen
|
||||
Eigen::Quaternion<Scalar> eigen_quat;
|
||||
eigen_quat =
|
||||
Eigen::AngleAxis<Scalar>(13, Eigen::Matrix<Scalar, 3, 1>{1, 2, 3});
|
||||
|
||||
Eigen::Map<Eigen::Matrix<Scalar, 3, 1>> eigen_other{data};
|
||||
auto eigen_result = eigen_quat * eigen_other;
|
||||
|
||||
// Rotgen
|
||||
rotgen::quaternion<Scalar> rotgen_quat;
|
||||
rotgen_quat =
|
||||
rotgen::angleAxis<Scalar>(13, rotgen::matrix<Scalar, 3, 1>{1, 2, 3});
|
||||
|
||||
rotgen::map<rotgen::matrix<Scalar, 3, 1>> rotgen_other{data};
|
||||
auto rotgen_result = rotgen_quat * rotgen_other;
|
||||
|
||||
for (auto i = 0; i < eigen_result.size(); i++)
|
||||
TTS_ULP_EQUAL(rotgen_result(i), eigen_result(i), 2);
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test quaternion::operator* with rotgen::block",
|
||||
float,
|
||||
double)<typename Scalar>(tts::type<Scalar>)
|
||||
{
|
||||
|
||||
// Eigen
|
||||
Eigen::Quaternion<Scalar> eigen_quat;
|
||||
eigen_quat =
|
||||
Eigen::AngleAxis<Scalar>(13, Eigen::Matrix<Scalar, 3, 1>{1, 2, 3});
|
||||
|
||||
Eigen::Matrix<Scalar, 16, 16> eigen_original_mat;
|
||||
rotgen::tests::prepare(16, 16, rotgen::tests::default_init_function,
|
||||
eigen_original_mat);
|
||||
auto eigen_other = eigen_original_mat.template block<3, 1>(0, 0);
|
||||
auto eigen_result = eigen_quat * eigen_other;
|
||||
|
||||
// Rotgen
|
||||
rotgen::quaternion<Scalar> rotgen_quat;
|
||||
rotgen_quat =
|
||||
rotgen::angleAxis<Scalar>(13, rotgen::matrix<Scalar, 3, 1>{1, 2, 3});
|
||||
|
||||
rotgen::matrix<Scalar, 16, 16> rotgen_original_mat;
|
||||
rotgen::tests::prepare(16, 16, rotgen::tests::default_init_function,
|
||||
rotgen_original_mat);
|
||||
auto rotgen_other = rotgen::extract<3, 1>(rotgen_original_mat, 0, 0);
|
||||
auto rotgen_result = rotgen_quat * rotgen_other;
|
||||
|
||||
for (auto i = 0; i < eigen_result.size(); i++)
|
||||
TTS_ULP_EQUAL(rotgen_result(i), eigen_result(i), 2);
|
||||
};
|
||||
|
|
@ -7,11 +7,10 @@
|
|||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include "tts.hpp"
|
||||
#include "unit/common/references.hpp"
|
||||
#include <rotgen/config.hpp>
|
||||
#include <rotgen/concepts.hpp>
|
||||
#include <functional>
|
||||
#include <rotgen/config.hpp>
|
||||
|
||||
#include <tts.hpp>
|
||||
|
||||
namespace rotgen::tests
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue