-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrotations.cpp
More file actions
25 lines (22 loc) · 920 Bytes
/
rotations.cpp
File metadata and controls
25 lines (22 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "pstack/calc/rotations.hpp"
#include <random>
namespace pstack::calc {
const std::array<geo::matrix3<float>, 32> arbitrary_rotations = [] {
std::array<geo::matrix3<float>, 32> out;
out[0] = geo::eye3<float>;
out[1] = geo::rot3<float>({ 1, 1, 1 }, geo::degrees{120});
out[2] = geo::rot3<float>({ 1, 1, 1 }, geo::degrees{240});
out[3] = geo::rot3<float>({ 1, 0, 0 }, geo::degrees{180});
out[4] = geo::rot3<float>({ 0, 1, 0 }, geo::degrees{180});
out[5] = geo::rot3<float>({ 0, 0, 1 }, geo::degrees{180});
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<float> dis(0, 2 * geo::pi);
for (std::size_t i = 6; i != 32; ++i) {
out[i] = geo::rot3_z(geo::radians{dis(gen)})
* geo::rot3_y(geo::radians{dis(gen)})
* geo::rot3_x(geo::radians{dis(gen)});
}
return out;
}();
} // namespace pstack::calc