feat(cpp-object-oriented-modular-refactoring): step 8 - element-geometry-vector3

This commit is contained in:
KOKO\Mimi
2026-08-16 07:27:51 +09:00
parent cbad5c3592
commit a9ff75b3fa
9 changed files with 320 additions and 233 deletions
+30
View File
@@ -10,6 +10,8 @@
#include <string>
#include <vector>
#include "fesa/math/vector3.h"
namespace {
using Vector3 = std::array<double, 3>;
@@ -134,6 +136,34 @@ TEST(Mitc4Geometry,
}
}
TEST(Mitc4Geometry, PreservesExactWarpedResultsAcrossVector3Migration) {
const std::vector<fesa::Node> warped_nodes{
Node(0U, {0.0, 0.0, 0.0}), Node(1U, {2.0, 0.0, 0.0}),
Node(2U, {2.0, 1.0, 0.2}), Node(3U, {0.0, 1.0, 0.0})};
const auto warped = fesa::PreprocessShellGeometry(
warped_nodes, {Element(12U, {0U, 1U, 2U, 3U})}, Sections());
ASSERT_TRUE(warped.HasValue());
const auto& element = warped.Value().element_data[0U];
const auto& frame = FrameFor(warped.Value(), 0U);
const fesa::Vector3 normal{element.normal_candidate};
const fesa::Vector3 director{frame.director};
const fesa::Vector3 tangent_a{frame.tangent_a};
const fesa::Vector3 tangent_b{frame.tangent_b};
EXPECT_DOUBLE_EQ(normal.X(), -0x1.97105218e28c2p-5);
EXPECT_DOUBLE_EQ(normal.Y(), -0x1.97105218e28c2p-4);
EXPECT_DOUBLE_EQ(normal.Z(), 0x1.fcd4669f1b2f2p-1);
EXPECT_DOUBLE_EQ(element.surface_area_weight, 0x1.021ebe8f40622p+1);
EXPECT_DOUBLE_EQ(director.X(), -0x1.97105218e28c2p-5);
EXPECT_DOUBLE_EQ(director.Y(), -0x1.97105218e28c2p-4);
EXPECT_DOUBLE_EQ(director.Z(), 0x1.fcd4669f1b2f2p-1);
EXPECT_DOUBLE_EQ(tangent_a.X(), 0x1.ff5e152c2d2abp-1);
EXPECT_DOUBLE_EQ(tangent_a.Y(), -0x1.4408ec773d925p-8);
EXPECT_DOUBLE_EQ(tangent_a.Z(), 0x1.950b27950cf6dp-5);
EXPECT_DOUBLE_EQ(tangent_b.X(), 0.0);
EXPECT_DOUBLE_EQ(tangent_b.Y(), 0x1.fd7583bc82e28p-1);
EXPECT_DOUBLE_EQ(tangent_b.Z(), 0x1.9791363068b53p-4);
}
// MITC4-GEO-002
TEST(Mitc4Geometry, AreaWeightsSharedDirectorsInStableSourceIdentityOrder) {
const std::vector<fesa::Node> nodes{