<commit_before>#pragma once

//std
#include <array>

//mandala
#include "types.hpp"
#include "plane.hpp"
#include "range.hpp"

namespace mandala
{
	namespace details
    {
		template<typename Scalar, typename Enable = void>
		struct aabb2_t;

		template<typename Scalar>
		struct aabb2_t<Scalar, typename std::enable_if<std::is_arithmetic<Scalar>::value>::type> : range_<glm::detail::tvec2<Scalar>>
        {
			typedef Scalar scalar_type;
			typedef aabb2_t<scalar_type> type;

			static const size_t corner_count = 4;

            aabb2_t() = default;
            aabb2_t(const value_type& min, const value_type& max) :
                range_(min, max)
            {
            }

			inline scalar_type width() const
			{
				return max.x - min.x;
			}

			inline scalar_type height() const
			{
				return max.y - min.y;
			}

			inline value_type size() const
			{
				return max - min;
			}

			inline value_type center() const
			{
				return min + (size() / static_cast<scalar_type>(2));
			}

			std::array<value_type, corner_count> get_corners() const
			{
				return { min,
						 value_type(min.x, max.y),
						 value_type(max.x, min.y),
						 max };
			}

			type operator-(const value_type& rhs) const
			{
				return type(min - rhs, max - rhs);
			}

			type& operator-=(const value_type& rhs)
			{
				*this = *this - rhs;

				return *this;
			}

			type operator+(const value_type& rhs) const
			{
				return type(min + rhs, max + rhs);
			}

			type& operator+=(const value_type& rhs)
			{
				*this = *this + rhs;

				return *this;
			}

            static type join(const type& lhs, const type& rhs)
			{
				return type(glm::min(lhs.min, rhs.min), glm::max(lhs.max, rhs.max));
			}

            type& join(const type& rhs)
			{
				*this = join(*this, rhs);

				return *this;
			}

			template<typename Scalar>
			bool operator==(const aabb2_t<Scalar>& rhs) const
			{
				return min == rhs.min && max == rhs.max;
			}

			template<typename Scalar>
			bool operator!=(const aabb2_t<Scalar>& rhs) const
			{
				return min != rhs.min || max != rhs.max;
			}

			template<typename Scalar>
			type& operator=(const aabb2_t<Scalar>& rhs) const
			{
				min = static_cast<vector_type>(rhs.min);
				max = static_cast<vector_type>(rhs.max);

				return *this;
			}

			template<typename T>
			operator aabb2_t<T>()
			{
				return aabb2_t<T>(static_cast<aabb2_t<T>::vector_type>(min), static_cast<aabb2_t<T>::vector_type>(max));
			}

            type operator<<(const type& rhs) const
            {
                return join(*this, rhs);
            }

            type& operator<<=(const type& rhs)
            {
                return this->join(rhs);
            }
		};

		template<typename T, typename Enable = void>
		struct aabb3_t;

		template<typename Scalar>
		struct aabb3_t<Scalar, typename std::enable_if<std::is_arithmetic<Scalar>::value>::type> : range_<glm::detail::tvec3<Scalar>>
		{
			typedef Scalar scalar_type;
			typedef aabb3_t<scalar_type> type;
			typedef plane3_t<float32_t> plane_type;

			static const size_t corner_count = 8;
			static const size_t plane_count = 6;

            aabb3_t() = default;
            aabb3_t(const value_type& min, const value_type& max) :
                range_(min, max)
            {
            }

            inline scalar_type width() const
            {
                return max.x - min.x;
            }

            inline scalar_type height() const
            {
                return max.y - min.y;
            }

            inline scalar_type depth() const
            {
                return max.z - min.z;
            }

			value_type size() const
			{
				return max - min;
			}

            value_type center() const
			{
				return min + ((max - min) / scalar_type(2));
			}

			std::array<plane_type, plane_count> get_planes() const
			{
				return { { min, VEC3_RIGHT },
						 { max, VEC3_LEFT },
						 { min, VEC3_DOWN },
						 { max, VEC3_UP },
						 { min, VEC3_BACKWARD },
						 { max, VEC3_FORWARD } };
			}

			std::array<value_type, corner_count> get_corners() const
			{
				return{ min,
						value_type(min.x, min.y, max.z),
                        value_type(min.x, max.y, min.z),
                        value_type(min.x, max.y, max.z),
                        value_type(max.x, min.y, min.z),
                        value_type(max.x, min.y, max.z),
                        value_type(max.x, max.y, min.z),
						max };
			}

			type operator-(const value_type& rhs) const
			{<commit_msg>added extents() method to aabbs<commit_after>#pragma once

//std
#include <array>

//mandala
#include "types.hpp"
#include "plane.hpp"
#include "range.hpp"

namespace mandala
{
	namespace details
    {
		template<typename Scalar, typename Enable = void>
		struct aabb2_t;

		template<typename Scalar>
		struct aabb2_t<Scalar, typename std::enable_if<std::is_arithmetic<Scalar>::value>::type> : range_<glm::detail::tvec2<Scalar>>
        {
			typedef Scalar scalar_type;
			typedef aabb2_t<scalar_type> type;

			static const size_t corner_count = 4;

            aabb2_t() = default;
            aabb2_t(const value_type& min, const value_type& max) :
                range_(min, max)
            {
            }

			inline scalar_type width() const
			{
				return max.x - min.x;
			}

			inline scalar_type height() const
			{
				return max.y - min.y;
			}

			inline value_type size() const
			{
				return max - min;
			}

			inline value_type center() const
			{
				return min + (size() / static_cast<scalar_type>(2));
			}

            inline value_type extents() const
            {
                return (max - min) / scalar_type(2);
            }

			std::array<value_type, corner_count> get_corners() const
			{
				return { min,
						 value_type(min.x, max.y),
						 value_type(max.x, min.y),
						 max };
			}

			type operator-(const value_type& rhs) const
			{
				return type(min - rhs, max - rhs);
			}

			type& operator-=(const value_type& rhs)
			{
				*this = *this - rhs;

				return *this;
			}

			type operator+(const value_type& rhs) const
			{
				return type(min + rhs, max + rhs);
			}

			type& operator+=(const value_type& rhs)
			{
				*this = *this + rhs;

				return *this;
			}

            static type join(const type& lhs, const type& rhs)
			{
				return type(glm::min(lhs.min, rhs.min), glm::max(lhs.max, rhs.max));
			}

            type& join(const type& rhs)
			{
				*this = join(*this, rhs);

				return *this;
			}

			template<typename Scalar>
			bool operator==(const aabb2_t<Scalar>& rhs) const
			{
				return min == rhs.min && max == rhs.max;
			}

			template<typename Scalar>
			bool operator!=(const aabb2_t<Scalar>& rhs) const
			{
				return min != rhs.min || max != rhs.max;
			}

			template<typename Scalar>
			type& operator=(const aabb2_t<Scalar>& rhs) const
			{
				min = static_cast<vector_type>(rhs.min);
				max = static_cast<vector_type>(rhs.max);

				return *this;
			}

			template<typename T>
			operator aabb2_t<T>()
			{
				return aabb2_t<T>(static_cast<aabb2_t<T>::vector_type>(min), static_cast<aabb2_t<T>::vector_type>(max));
			}

            type operator<<(const type& rhs) const
            {
                return join(*this, rhs);
            }

            type& operator<<=(const type& rhs)
            {
                return this->join(rhs);
            }
		};

		template<typename T, typename Enable = void>
		struct aabb3_t;

		template<typename Scalar>
		struct aabb3_t<Scalar, typename std::enable_if<std::is_arithmetic<Scalar>::value>::type> : range_<glm::detail::tvec3<Scalar>>
		{
			typedef Scalar scalar_type;
			typedef aabb3_t<scalar_type> type;
			typedef plane3_t<float32_t> plane_type;

			static const size_t corner_count = 8;
			static const size_t plane_count = 6;

            aabb3_t() = default;
            aabb3_t(const value_type& min, const value_type& max) :
                range_(min, max)
            {
            }

            inline scalar_type width() const
            {
                return max.x - min.x;
            }

            inline scalar_type height() const
            {
                return max.y - min.y;
            }

            inline scalar_type depth() const
            {
                return max.z - min.z;
            }

			value_type size() const
			{
				return max - min;
			}

            value_type center() const
			{
				return min + ((max - min) / scalar_type(2));
			}

            value_type extents() const
            {
                return (max - min) / scalar_type(2);
            }

			std::array<plane_type, plane_count> get_planes() const
			{
				return { { min, VEC3_RIGHT },
						 { max, VEC3_LEFT },
						 { min, VEC3_DOWN },
						 { max, VEC3_UP },
						 { min, VEC3_BACKWARD },
						 { max, VEC3_FORWARD } };
			}

			std::array<value_type, corner_count> get_corners() const
			{
				return{ min,
						value_type(min.x, min.y, max.z),
                        value_type(min.x, max.y, min.z),
                        value_type(min.x, max.y, max.z),
                        value_type(max.x, min.y, min.z),
                        value_type(max.x, min.y, max.z),
                        value_type(max.x, max.y, min.z),
						max };
			}

			type operator-(const value_type& rhs) const
			{
{'fraction_non_alphanumeric': 0.12364028002154012, 'fraction_numerical': 0.00732364028002154, 'mean_word_length': 1.9629865985960433, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5064064', 'n_tokens_mistral': 3746, 'n_tokens_neox': 3053, 'n_words': 687}