<commit_before>#include "gamelib/geometry/GroupTransform.hpp"

// TODO: adapt position for individual elements, when scaling/rotating

namespace gamelib
{
    GroupTransform::GroupTransform() :
        GroupTransform(math::Point2f())
    { }

    GroupTransform::GroupTransform(float x, float y) :
        GroupTransform(math::Point2f(x, y))
    { }

    GroupTransform::GroupTransform(const math::Point2f& pos) :
        _pos(pos),
        _scale(1, 1),
        _rotation(0)
    { }

    void GroupTransform::add(Transformable* trans)
    {
        _objs.push_back(trans);
        refreshBBox();
    }

    void GroupTransform::remove(Transformable* trans)
    {
        auto it = std::find(_objs.begin(), _objs.end(), trans);
        if (it != _objs.end())
        {
            if (_objs.size() > 1)
                std::swap(*it, _objs.back());
            _objs.pop_back();
        }
        refreshBBox();
    }

    void GroupTransform::refreshBBox()
    {
        math::AABBf bbox;
        for (auto& i : _objs)
            bbox.combine(i->getBBox());
        _bbox = bbox;
    }
<commit_msg>Apply transformation to newly registered objects<commit_after>#include "gamelib/geometry/GroupTransform.hpp"

// TODO: adapt position for individual elements, when scaling/rotating

namespace gamelib
{
    GroupTransform::GroupTransform() :
        GroupTransform(math::Point2f())
    { }

    GroupTransform::GroupTransform(float x, float y) :
        GroupTransform(math::Point2f(x, y))
    { }

    GroupTransform::GroupTransform(const math::Point2f& pos) :
        _pos(pos),
        _scale(1, 1),
        _rotation(0)
    { }

    void GroupTransform::add(Transformable* trans)
    {
        _objs.push_back(trans);
        _objs.back()->setPosition(_pos);
        _objs.back()->setScale(_scale);
        _objs.back()->setRotation(_rotation);
        refreshBBox();
    }

    void GroupTransform::remove(Transformable* trans)
    {
        auto it = std::find(_objs.begin(), _objs.end(), trans);
        if (it != _objs.end())
        {
            if (_objs.size() > 1)
                std::swap(*it, _objs.back());
            _objs.pop_back();
        }
        refreshBBox();
    }

    void GroupTransform::refreshBBox()
    {
        math::AABBf bbox;
        for (auto& i : _objs)
            bbox.combine(i->getBBox());
        _bbox = bbox;
    }

{'fraction_non_alphanumeric': 0.1388653683319221, 'fraction_numerical': 0.0059271803556308214, 'mean_word_length': 2.295676429567643, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '2964690', 'n_tokens_mistral': 763, 'n_tokens_neox': 742, 'n_words': 130}