REQUIRE( make_xyz_unit(1, 0, 0) == EAST ); REQUIRE( make_xyz_unit(1, 0, 1) == BELOWEAST ); REQUIRE( make_xyz_unit(-1, 1, -1) == ABOVESOUTHWEST ); REQUIRE( make_xyz_unit(-1, 1, 0) == SOUTHWEST ); REQUIRE( make_xyz_unit(-1, 1, 1) == BELOWSOUTHWEST ); REQUIRE( make_xyz_unit(0, 1, -1) == ABOVESOUTH ); REQUIRE( make_xyz_unit(0, 1, 0) == SOUTH ); REQUIRE( make_xyz_unit(0, 1, 1) == BELOWSOUTH ); REQUIRE( make_xyz_unit(1, 1, -1) == ABOVESOUTHEAST ); REQUIRE( make_xyz_unit(1, 1, 0) == SOUTHEAST ); REQUIRE( make_xyz_unit(1, 1, 1) == BELOWSOUTHEAST ); // Test the unit square values at distance 1 and 2. // Test the multiples of 30deg at 60 squares. // Test 22 deg to either side of the cardinal directions. REQUIRE( make_xyz(-1, -1, -1) == ABOVENORTHWEST ); REQUIRE( make_xyz(-2, -2, -2) == ABOVENORTHWEST ); REQUIRE( make_xyz(-30, -60, -1) == ABOVENORTHWEST ); REQUIRE( make_xyz(-60, -60, -1) == ABOVENORTHWEST ); REQUIRE( make_xyz(-60, -30, -1) == ABOVENORTHWEST ); REQUIRE( make_xyz(-1, -1, 0) == NORTHWEST ); REQUIRE( make_xyz(-2, -2, 0) == NORTHWEST ); REQUIRE( make_xyz(-60, -60, 0) == NORTHWEST ); REQUIRE( make_xyz(-1, -1, 1) == BELOWNORTHWEST ); REQUIRE( make_xyz(-2, -2, 2) == BELOWNORTHWEST ); REQUIRE( make_xyz(-30, -60, 1) == BELOWNORTHWEST ); REQUIRE( make_xyz(-60, -60, 1) == BELOWNORTHWEST ); REQUIRE( make_xyz(-60, -30, 1) == BELOWNORTHWEST ); REQUIRE( make_xyz(0, -1, -1) == ABOVENORTH ); REQUIRE( make_xyz(0, -2, -2) == ABOVENORTH ); REQUIRE( make_xyz(-22, -60, -1) == ABOVENORTH );
direction direction_from(int const x, int const y, int const z) noexcept { return static_cast<direction>(make_xyz(x, y, z)); }