Repository: bevyengine/bevy
File: crates/bevy_math/src/direction.rs (Rust)

Code before:
            -Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            -Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            -Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
        )),
    ];
    /// All neighboring directions on a grid. A combination of [`Self::CARDINALS`] and [`Self::DIAGONALS`]
    pub const ALL_NEIGHBORS: [Self; 14] = [
        Self::X,
        Self::NEG_X,
        Self::Y,
        Self::NEG_Y,
        Self::Z,
        Self::NEG_Z,
        Self(Vec3::new(
            Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            -Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            -Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,

Review comment (suggestion):
This isn't all neighbors in a 3x3x3 range, it's the directly adjacent ones coresponding to 6 faces of a cube + the ones corresponding to the 8 vertices of a cube, but then there's missing 12 neighbors which correspond to the edges of a cube (which are closer than the corner ones, so it imho doesn't make sense to not include them). Overall there should be 26 of them (Since 3x3x3 = 27 and we remove the center).

Code after:
            Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            -Self::FRAC_1_SQRT_3,
            Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
        )),
        Self(Vec3::new(
            -Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
            -Self::FRAC_1_SQRT_3,
        )),
    ];
    /// The directions towards centers of each edge of a cube
    pub const ALL_EDGES: [Self; 12] = [
        Self(Vec3::new(FRAC_1_SQRT_2, FRAC_1_SQRT_2, 0.)),
        Self(Vec3::new(-FRAC_1_SQRT_2, FRAC_1_SQRT_2, 0.)),
        Self(Vec3::new(FRAC_1_SQRT_2, -FRAC_1_SQRT_2, 0.)),
        Self(Vec3::new(-FRAC_1_SQRT_2, -FRAC_1_SQRT_2, 0.)),
        Self(Vec3::new(FRAC_1_SQRT_2, 0., FRAC_1_SQRT_2)),
        Self(Vec3::new(-FRAC_1_SQRT_2, 0., FRAC_1_SQRT_2)),
        Self(Vec3::new(FRAC_1_SQRT_2, 0., -FRAC_1_SQRT_2)),
        Self(Vec3::new(-FRAC_1_SQRT_2, 0., -FRAC_1_SQRT_2)),
        Self(Vec3::new(0., FRAC_1_SQRT_2, FRAC_1_SQRT_2)),
        Self(Vec3::new(0., -FRAC_1_SQRT_2, FRAC_1_SQRT_2)),
        Self(Vec3::new(0., FRAC_1_SQRT_2, -FRAC_1_SQRT_2)),
        Self(Vec3::new(0., -FRAC_1_SQRT_2, -FRAC_1_SQRT_2)),
    ];
    /// All neighbors of a tile on a cube grid a 3x3x3 neighborhood. A combination of [`Self::CARDINALS`], [`Self::ALL_EDGES`] and [`Self::ALL_VERTICES`]
    pub const ALL_NEIGHBORS: [Self; 26] = [
        Self::X,
        Self::NEG_X,
        Self::Y,
        Self::NEG_Y,
        Self::Z,
        Self::NEG_Z,
        Self(Vec3::new(FRAC_1_SQRT_2, FRAC_1_SQRT_2, 0.)),
        Self(Vec3::new(-FRAC_1_SQRT_2, FRAC_1_SQRT_2, 0.)),
        Self(Vec3::new(FRAC_1_SQRT_2, -FRAC_1_SQRT_2, 0.)),
        Self(Vec3::new(-FRAC_1_SQRT_2, -FRAC_1_SQRT_2, 0.)),
        Self(Vec3::new(FRAC_1_SQRT_2, 0., FRAC_1_SQRT_2)),
        Self(Vec3::new(-FRAC_1_SQRT_2, 0., FRAC_1_SQRT_2)),
        Self(Vec3::new(FRAC_1_SQRT_2, 0., -FRAC_1_SQRT_2)),
        Self(Vec3::new(-FRAC_1_SQRT_2, 0., -FRAC_1_SQRT_2)),