Repository: bevyengine/bevy
File: crates/bevy_gizmos/src/gizmos.rs (Rust)

Code before:
            trf, trb, brf, brb, blf, blb, // Front to back
        ];
        self.extend_list_positions(list_positions);

        self.add_list_color(polymorphic_color, 6);
    }

    /// Draw a wireframe cuboid in 3D.
    ///
    /// This should be called for each frame the cuboid needs to be rendered.
    ///
    /// # Example
    /// ```
    /// # use bevy_gizmos::prelude::*;
    /// # use bevy_transform::prelude::*;
    /// # use bevy_math::{bounding::Aabb3d, Vec3};
    /// # use bevy_color::palettes::basic::GREEN;
    /// fn system(mut gizmos: Gizmos) {
    ///     gizmos.cuboid(Aabb3d::new(Vec3::ZERO, Vec3::ONE), Transform::IDENTITY, GREEN);
    /// }
    /// # bevy_ecs::system::assert_is_system(system);
    /// ```
    #[inline]
    pub fn cuboid(
        &mut self,
        aabb: impl Into<Aabb3d>,
        transform: impl TransformPoint,
        color: impl Into<Color>,
    ) {
        let polymorphic_color: Color = color.into();
        if !self.enabled {
            return;
        }
        let aabb = aabb.into();
        let [tlf, trf, brf, blf, tlb, trb, brb, blb] = [
            Vec3::new(aabb.min.x, aabb.max.y, aabb.max.z),
            Vec3::new(aabb.max.x, aabb.max.y, aabb.max.z),
            Vec3::new(aabb.max.x, aabb.min.y, aabb.max.z),
            Vec3::new(aabb.min.x, aabb.min.y, aabb.max.z),
            Vec3::new(aabb.min.x, aabb.max.y, aabb.min.z),
            Vec3::new(aabb.max.x, aabb.max.y, aabb.min.z),
            Vec3::new(aabb.max.x, aabb.min.y, aabb.min.z),
            Vec3::new(aabb.min.x, aabb.min.y, aabb.min.z),
        ]
        .map(|v| transform.transform_point(v));

        let strip_positions = [
            tlf, trf, brf, blf, tlf, // Front
            tlb, trb, brb, blb, tlb, // Back
        ];
        self.linestrip(strip_positions, polymorphic_color);

Review comment (suggestion):
I don't love that this is called `cuboid` but it then takes an `Aabb3d`. I would expect `cuboid` to take a `Cuboid`. For an AABB method, I'd just call this `aabb_3d`

Code after:
            trf, trb, brf, brb, blf, blb, // Front to back
        ];
        self.extend_list_positions(list_positions);

        self.add_list_color(polymorphic_color, 6);
    }

    /// Draw a wireframe aabb in 3D.
    ///
    /// This should be called for each frame the aabb needs to be rendered.
    ///
    /// # Example
    /// ```
    /// # use bevy_gizmos::prelude::*;
    /// # use bevy_transform::prelude::*;
    /// # use bevy_math::{bounding::Aabb3d, Vec3};
    /// # use bevy_color::palettes::basic::GREEN;
    /// fn system(mut gizmos: Gizmos) {
    ///     gizmos.aabb_3d(Aabb3d::new(Vec3::ZERO, Vec3::ONE), Transform::IDENTITY, GREEN);
    /// }
    /// # bevy_ecs::system::assert_is_system(system);
    /// ```
    #[inline]
    pub fn aabb_3d(
        &mut self,
        aabb: impl Into<Aabb3d>,
        transform: impl TransformPoint,
        color: impl Into<Color>,
    ) {
        let polymorphic_color: Color = color.into();
        if !self.enabled {
            return;
        }
        let aabb = aabb.into();
        let [tlf, trf, brf, blf, tlb, trb, brb, blb] = [
            Vec3::new(aabb.min.x, aabb.max.y, aabb.max.z),
            Vec3::new(aabb.max.x, aabb.max.y, aabb.max.z),
            Vec3::new(aabb.max.x, aabb.min.y, aabb.max.z),
            Vec3::new(aabb.min.x, aabb.min.y, aabb.max.z),
            Vec3::new(aabb.min.x, aabb.max.y, aabb.min.z),
            Vec3::new(aabb.max.x, aabb.max.y, aabb.min.z),
            Vec3::new(aabb.max.x, aabb.min.y, aabb.min.z),
            Vec3::new(aabb.min.x, aabb.min.y, aabb.min.z),
        ]
        .map(|v| transform.transform_point(v));

        let strip_positions = [
            tlf, trf, brf, blf, tlf, // Front
            tlb, trb, brb, blb, tlb, // Back
        ];
        self.linestrip(strip_positions, polymorphic_color);