42 strain << 0.01, 0.003, -0.002, 0.003, -0.006, 0.001, -0.002, 0.001, 0.004;
43 const M Q = Eigen::AngleAxisd(0.71,
V(1, 2, 3).normalized()).toRotationMatrix();
44 std::mt19937 rng(123);
45 std::normal_distribution<double> normal;
46 std::vector<V> directions;
47 for(
int k = 0;
k < 512; ++
k)
49 const V direction(normal(rng), normal(rng), normal(rng));
50 directions.push_back(direction.normalized());
52 std::cout <<
"axes,region,sphere_ns,ellipsoid_ns,ratio,ellipsoid_min_ns,ellipsoid_max_ns\n";
53 for(
const V &lengths : {
V(1, 1, 1),
V(3, 2, 1),
V(10, 1, 0.1),
V(100, 1, 1)})
60 for(
const double radialFactor : {0.5, 1.000001, 2.0, 10.0})
62 std::vector<V> points;
63 for(
const auto &direction : directions)
65 if(radialFactor < 1.0)
67 points.push_back(0.5 * lengths.minCoeff() * direction);
71 points.push_back(
Q * (radialFactor * lengths.cwiseProduct(direction)));
76 std::vector<double> sphereTimes, ellipsoidTimes;
77 for(
int repeat = 0; repeat < 7; ++repeat)
82 ellipsoidTimes.push_back(
measure(ellipsoid, points));
86 ellipsoidTimes.push_back(
measure(ellipsoid, points));
90 std::sort(sphereTimes.begin(), sphereTimes.end());
91 std::sort(ellipsoidTimes.begin(), ellipsoidTimes.end());
92 const char *region = radialFactor < 1.0 ?
"interior"
93 : radialFactor < 1.1 ?
"near_surface"
94 : radialFactor < 3.0 ?
"2x_surface"
96 std::cout << lengths(0) <<
':' << lengths(1) <<
':' << lengths(2) <<
',' << region <<
',' << std::fixed
97 << std::setprecision(2) << sphereTimes[3] <<
',' << ellipsoidTimes[3] <<
','
98 << ellipsoidTimes[3] / sphereTimes[3] <<
',' << ellipsoidTimes.front() <<
','
99 << ellipsoidTimes.back() << std::endl;