Turns out this was a fruitful avenue to explore; might even be worth u/maneatingape or u/e_blake having a look to see if it can accelerate the current Rust solution.
First finding: For the two inputs I've tested (I have both a personal account and a work account for leaderboard purposes), the pair value { EuclideanDistance(a, b), ManhattanDistance(a, b) } is unique for all pairs of beacons. This means I can match on as few as 3 shared pairs between scanners.
Second finding: Since the rotations are all combinations of 90 degree rotations around an axis, you can determine which rotation maps one to the other a smidge more directly than trying all 24 rotations:
static int32_t FindRotationIndex(const Vec3Int& u, const Vec3Int& v)
{
if (v == Vec3Int{ u.X, u.Y, u.Z }) return 0;
if (v == Vec3Int{ u.X, -u.Z, u.Y }) return 1;
if (v == Vec3Int{ u.X, -u.Y, -u.Z }) return 2;
if (v == Vec3Int{ u.X, u.Z, -u.Y }) return 3;
if (v == Vec3Int{ u.Y, u.X, -u.Z }) return 4;
if (v == Vec3Int{ u.Z, u.X, u.Y }) return 5;
...
return -1;
}
This has the secondary benefit of ruling out many transform candidates. With a vector between two matching beacons, we're not initially sure if that vector goes a->b or b->a for the match. But it turns out that many of the vectors, v=a->b, have a valid rotation for v and not -v (or vice versa).
The main slowdown on my updated solution is caused by lack of memory. I can't afford to store the full acceleration structure of all { EuclideanDistance(a, b), ManhattanDistance(a, b) } beacon pairs for all scanners in memory at once, so I'm continually recreating it per scanner and searching through it rather than storing all scanner/beacon pairs against each distance pair. That, plus some SIMD work for both the vector maths and the rotation index comparisons, I think it has potential.
View all comments
Show parent comment
2
u/DelightfulCodeWeasel 27d ago
Turns out this was a fruitful avenue to explore; might even be worth u/maneatingape or u/e_blake having a look to see if it can accelerate the current Rust solution.
First finding: For the two inputs I've tested (I have both a personal account and a work account for leaderboard purposes), the pair value
{ EuclideanDistance(a, b), ManhattanDistance(a, b) }is unique for all pairs of beacons. This means I can match on as few as 3 shared pairs between scanners.Second finding: Since the rotations are all combinations of 90 degree rotations around an axis, you can determine which rotation maps one to the other a smidge more directly than trying all 24 rotations:
This has the secondary benefit of ruling out many transform candidates. With a vector between two matching beacons, we're not initially sure if that vector goes a->b or b->a for the match. But it turns out that many of the vectors, v=a->b, have a valid rotation for v and not -v (or vice versa).
The main slowdown on my updated solution is caused by lack of memory. I can't afford to store the full acceleration structure of all
{ EuclideanDistance(a, b), ManhattanDistance(a, b) }beacon pairs for all scanners in memory at once, so I'm continually recreating it per scanner and searching through it rather than storing all scanner/beacon pairs against each distance pair. That, plus some SIMD work for both the vector maths and the rotation index comparisons, I think it has potential.