<commit_before>#ifndef BULL_MATH_MATRIX_MATRIX4_HPP
#define BULL_MATH_MATRIX_MATRIX4_HPP

#include <array>

#include <Bull/Math/Angle.hpp>
#include <Bull/Math/Matrix/SquareMatrix.hpp>
#include <Bull/Math/Polygon/Rectangle.hpp>
#include <Bull/Math/Quaternion.hpp>
#include <Bull/Math/Vector/Vector4.hpp>

namespace Bull
{
    template<typename T>
    struct Matrix4 : public SquareMatrix<T, 4>
    {
        static Matrix4<T> Identity;

        /*! \brief Create a scaling transformation matrix
         *
         * \param scale The scaling factor
         *
         * \return The transformation matrix
         *
         */
        static Matrix4<T> makeScale(const Vector3<T>& scale)
        {
            Matrix4<T> model = Matrix4<T>::Identity;

            model.at(0, 0) = scale.at(0);
            model.at(1, 1) = scale.at(1);
            model.at(2, 2) = scale.at(2);

            return model;
        }

        /*! \brief Create a rotation transformation matrix
         *
         * \param rotation The rotation
         *
         * \return The transformation matrix
         *
         */
        static Matrix4<T> makeRotation(const Quaternion<T>& rotation)
        {
            Matrix4<T> model;

            T tx  = rotation.x + rotation.x;
            T ty  = rotation.y + rotation.y;
            T tz  = rotation.z + rotation.z;
            T twx = tx * rotation.w;
            T twy = ty * rotation.w;
            T twz = tz * rotation.w;
            T txx = tx * rotation.x;
            T txy = ty * rotation.x;
            T txz = tz * rotation.x;
            T tyy = ty * rotation.y;
            T tyz = tz * rotation.y;
            T tzz = tz * rotation.z;

            model.at(0, 0) = 1.f - (tyy + tzz);
            model.at(0, 1) = txy + twz;
            model.at(0, 2) = txz - twy;

            model.at(1, 0) = txy - twz;
            model.at(1, 1) = 1.f - (txx + tzz);
            model.at(1, 2) = tyz + twx;

            model.at(2, 0) = txz + twy;<commit_msg>[Math/Matrix4] Fix bad rotation matrix without translation<commit_after>#ifndef BULL_MATH_MATRIX_MATRIX4_HPP
#define BULL_MATH_MATRIX_MATRIX4_HPP

#include <array>

#include <Bull/Math/Angle.hpp>
#include <Bull/Math/Matrix/SquareMatrix.hpp>
#include <Bull/Math/Polygon/Rectangle.hpp>
#include <Bull/Math/Quaternion.hpp>
#include <Bull/Math/Vector/Vector4.hpp>

namespace Bull
{
    template<typename T>
    struct Matrix4 : public SquareMatrix<T, 4>
    {
        static Matrix4<T> Identity;

        /*! \brief Create a scaling transformation matrix
         *
         * \param scale The scaling factor
         *
         * \return The transformation matrix
         *
         */
        static Matrix4<T> makeScale(const Vector3<T>& scale)
        {
            Matrix4<T> model = Matrix4<T>::Identity;

            model.at(0, 0) = scale.at(0);
            model.at(1, 1) = scale.at(1);
            model.at(2, 2) = scale.at(2);

            return model;
        }

        /*! \brief Create a rotation transformation matrix
         *
         * \param rotation The rotation
         *
         * \return The transformation matrix
         *
         */
        static Matrix4<T> makeRotation(const Quaternion<T>& rotation)
        {
            Matrix4<T> model = Identity;

            T tx  = rotation.x + rotation.x;
            T ty  = rotation.y + rotation.y;
            T tz  = rotation.z + rotation.z;
            T twx = tx * rotation.w;
            T twy = ty * rotation.w;
            T twz = tz * rotation.w;
            T txx = tx * rotation.x;
            T txy = ty * rotation.x;
            T txz = tz * rotation.x;
            T tyy = ty * rotation.y;
            T tyz = tz * rotation.y;
            T tzz = tz * rotation.z;

            model.at(0, 0) = 1.f - (tyy + tzz);
            model.at(0, 1) = txy + twz;
            model.at(0, 2) = txz - twy;

            model.at(1, 0) = txy - twz;
            model.at(1, 1) = 1.f - (txx + tzz);
            model.at(1, 2) = tyz + twx;

            model.at(2, 0) = txz + twy;
{'fraction_non_alphanumeric': 0.12067260138476756, 'fraction_numerical': 0.018545994065281898, 'mean_word_length': 1.5633713561470215, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, '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': '2998475', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1323, 'n_words': 328}