<commit_before>#pragma once
#include <extlibs/fmt.hpp>
#include <extlibs/glm.hpp>

#include <array>
#include <cmath>
#include <limits>
#include <ostream>
#include <string>

namespace boomhs
{
struct Transform;

template <typename T, typename V>
struct RectT
{
  // fields
  T left, top;
  T right, bottom;

  // methods
  auto constexpr left_top() const { return V{left, top}; }
  auto constexpr left_bottom() const { return V{left, bottom}; }

  auto constexpr right_top() const { return V{right, top}; }
  auto constexpr right_bottom() const { return V{right, bottom}; }

  auto width() const { return std::abs(right - left); }
  auto height() const { return std::abs(top - bottom); }
  auto dimensions() const { return V{width(), height()}; }

  auto half_dimensions() const { return dimensions() / 2; }
  auto half_width() const { return width() / 2; }
  auto half_height() const { return height() / 2; }

  auto center() const { return left_top() + half_dimensions(); }
  auto center_left() const { return V{left, center().y}; }
  auto center_right() const { return V{right, center().y}; }

  auto center_top() const { return V{center().x, top}; }
  auto center_bottom() const { return V{center().x, bottom}; }

  std::string to_string() const
  {
    return fmt::sprintf("left/top: (%f,%f) right/bottom: (%f,%f)", left, top, right, bottom);
  }
};

class FloatRect : public RectT<float, glm::vec2>
{<commit_msg>rename dimensions on rect to size<commit_after>#pragma once
#include <extlibs/fmt.hpp>
#include <extlibs/glm.hpp>

#include <array>
#include <cmath>
#include <limits>
#include <ostream>
#include <string>

namespace boomhs
{
struct Transform;

template <typename T, typename V>
struct RectT
{
  // fields
  T left, top;
  T right, bottom;

  // methods
  auto constexpr left_top() const { return V{left, top}; }
  auto constexpr left_bottom() const { return V{left, bottom}; }

  auto constexpr right_top() const { return V{right, top}; }
  auto constexpr right_bottom() const { return V{right, bottom}; }

  auto width() const { return std::abs(right - left); }
  auto height() const { return std::abs(top - bottom); }
  auto size() const { return V{width(), height()}; }

  auto half_size() const { return size() / 2; }
  auto half_width() const { return width() / 2; }
  auto half_height() const { return height() / 2; }

  auto center() const { return left_top() + half_size(); }
  auto center_left() const { return V{left, center().y}; }
  auto center_right() const { return V{right, center().y}; }

  auto center_top() const { return V{center().x, top}; }
  auto center_bottom() const { return V{center().x, bottom}; }

  std::string to_string() const
  {
    return fmt::sprintf("left/top: (%f,%f) right/bottom: (%f,%f)", left, top, right, bottom);
  }
};

class FloatRect : public RectT<float, glm::vec2>
{
{'fraction_non_alphanumeric': 0.15901060070671377, 'fraction_numerical': 0.0028268551236749115, 'mean_word_length': 4.223247232472325, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '4002519', 'n_tokens_mistral': 948, 'n_tokens_neox': 910, 'n_words': 297}