Integrate Refactor solver sources and dual MSVC CMake builds
This commit is contained in:
@@ -161,6 +161,28 @@ TEST(FiniteRotation, RejectsCoordinatesInsidePrincipalBranchMargin) {
|
||||
"invalid-accepted-state");
|
||||
}
|
||||
|
||||
TEST(FiniteRotation, SpatialMomentSolvePreservesKnownLoadAndVirtualWork) {
|
||||
const Vector3 moment{2.0, -3.0, 4.0};
|
||||
const Vector3 variation{0.3, -0.5, 0.7};
|
||||
const double pi = std::acos(-1.0);
|
||||
for (const double angle : {0.0, 1e-9, 0.7, pi - 1e-6}) {
|
||||
const double a = angle == 0.0 ? 1.0 : std::sin(angle) / angle;
|
||||
const double b = angle < 1e-8 ? angle / 2.0 :
|
||||
(1.0 - std::cos(angle)) / angle;
|
||||
// Independent z-axis J^T*m; the axial component is unchanged.
|
||||
const Vector3 generalized{a * moment.X() + b * moment.Y(),
|
||||
-b * moment.X() + a * moment.Y(), moment.Z()};
|
||||
const auto solved = SpatialMomentSO3(Vector3{0, 0, angle}, generalized);
|
||||
ASSERT_TRUE(solved.HasValue());
|
||||
ExpectVectorNear(solved.Value(), moment, 1e-11);
|
||||
const Vector3 spatial_variation{a * variation.X() - b * variation.Y(),
|
||||
b * variation.X() + a * variation.Y(),
|
||||
variation.Z()};
|
||||
EXPECT_NEAR(generalized.Dot(variation),
|
||||
solved.Value().Dot(spatial_variation), 1e-11);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(FiniteRotation,
|
||||
JacobiansAreFiniteInverseTransposeAndDerivativeConsistent) {
|
||||
const double pi = std::acos(-1.0);
|
||||
@@ -172,18 +194,13 @@ TEST(FiniteRotation,
|
||||
|
||||
for (const Vector3& phi : rotations) {
|
||||
const Matrix left_jacobian = LeftJacobianSO3(phi);
|
||||
const Matrix inverse_transpose = InverseTransposeLeftJacobianSO3(phi);
|
||||
EXPECT_TRUE(IsFinite(left_jacobian));
|
||||
EXPECT_TRUE(IsFinite(inverse_transpose));
|
||||
|
||||
const Matrix identity =
|
||||
Transpose(left_jacobian).Multiply(inverse_transpose);
|
||||
for (std::size_t row = 0U; row < kRotationDimension; ++row) {
|
||||
for (std::size_t column = 0U; column < kRotationDimension; ++column) {
|
||||
EXPECT_NEAR(identity(row, column), row == column ? 1.0 : 0.0,
|
||||
1.0e-11);
|
||||
}
|
||||
}
|
||||
const Vector3 load{0.7, -0.2, 0.4};
|
||||
const auto spatial = SpatialMomentSO3(phi, load);
|
||||
ASSERT_TRUE(spatial.HasValue());
|
||||
ExpectVectorNear(Multiply(Transpose(left_jacobian), spatial.Value()),
|
||||
load, 1e-11);
|
||||
|
||||
const Vector3 director = Multiply(ExpSkew(phi), Vector3{0.0, 0.0, 1.0});
|
||||
const Vector3 positive =
|
||||
|
||||
Reference in New Issue
Block a user