<commit_before>/**
 * \file
 * \author      <NAME> <<EMAIL>>
 * \copyright   MIT License
 **/
#include "base/math/matrix.h"

#include <string.h>

namespace base {
namespace math {

const Matrix4 Matrix4::Zero(0.f, 0.f, 0.f, 0.f,
                            0.f, 0.f, 0.f, 0.f,
                            0.f, 0.f, 0.f, 0.f,
                            0.f, 0.f, 0.f, 0.f);

const Matrix4 Matrix4::Identity(1.f, 0.f, 0.f, 0.f,
                            0.f, 1.f, 0.f, 0.f,
                            0.f, 0.f, 1.f, 0.f,
                            0.f, 0.f, 0.f, 1.f);

Matrix4::Matrix4()
    : xx(1.f), xy(0.f), xz(0.f), xw(0.f)
    , yx(0.f), yy(1.f), yz(0.f), yw(0.f)
    , zx(0.f), zy(0.f), zz(1.f), zw(0.f)
    , wx(0.f), wy(0.f), wz(0.f), ww(1.f) {
}

Matrix4::Matrix4(f32 vxx, f32 vxy, f32 vxz, f32 vxw,
                 f32 vyx, f32 vyy, f32 vyz, f32 vyw,
                 f32 vzx, f32 vzy, f32 vzz, f32 vzw,
                 f32 vwx, f32 vwy, f32 vwz, f32 vww)
    : xx(vxx), xy(vxy), xz(vxz), xw(vxw)
    , yx(vyx), yy(vyy), yz(vyz), yw(vyw)
    , zx(vzx), zy(vzy), zz(vzz), zw(vzw)
    , wx(vwx), wy(vwy), wz(vwz), ww(vww) {
}

Matrix4::Matrix4(const f32 *m) {
    memcpy(array1d, m, sizeof(array1d));
}

Matrix4::Matrix4(const Vector3& ax, const Vector3& ay, const Vector3& az) {
    xx = ax.x;
    yx = ax.y;
    zx = ax.z;
    wx = 0.f;

    xy = ay.x;
    yy = ay.y;
    zy = ay.z;
    wy = 0.f;

    xz = az.x;
    yz = az.y;
    zz = az.z;
    wz = 0.f;
    
    wx = 0.f;
    wy = 0.f;
    wz = 0.f;
    ww = 1.f;        
}

Matrix4 Matrix4::GetScale(const Vector3 &_scale_vector) {
    Matrix4 _matrix = Zero;

    _matrix.array2d[0][0] = _scale_vector.x;
    _matrix.array2d[1][1] = _scale_vector.y;
    _matrix.array2d[2][2] = _scale_vector.z;
    _matrix.array2d[3][3] = 1.0f;

    return _matrix;
}

Matrix4 Matrix4::GetTranslation(const Vector3 &_translation_vector) {
    Matrix4 _matrix = Identity;

    _matrix.array2d[0][3] = _translation_vector.x;
    _matrix.array2d[1][3] = _translation_vector.y;<commit_msg>Matrix.cpp fix<commit_after>/**
 * \file
 * \author      <NAME> <<EMAIL>>
 * \copyright   MIT License
 **/
#include "base/math/matrix.h"

#include <string.h>

namespace base {
namespace math {

const Matrix4 Matrix4::Zero(0.f, 0.f, 0.f, 0.f,
                            0.f, 0.f, 0.f, 0.f,
                            0.f, 0.f, 0.f, 0.f,
                            0.f, 0.f, 0.f, 0.f);

const Matrix4 Matrix4::Identity(1.f, 0.f, 0.f, 0.f,
                            0.f, 1.f, 0.f, 0.f,
                            0.f, 0.f, 1.f, 0.f,
                            0.f, 0.f, 0.f, 1.f);

Matrix4::Matrix4()
    : xx(1.f), xy(0.f), xz(0.f), xw(0.f)
    , yx(0.f), yy(1.f), yz(0.f), yw(0.f)
    , zx(0.f), zy(0.f), zz(1.f), zw(0.f)
    , wx(0.f), wy(0.f), wz(0.f), ww(1.f) {
}

Matrix4::Matrix4(f32 vxx, f32 vxy, f32 vxz, f32 vxw,
                 f32 vyx, f32 vyy, f32 vyz, f32 vyw,
                 f32 vzx, f32 vzy, f32 vzz, f32 vzw,
                 f32 vwx, f32 vwy, f32 vwz, f32 vww)
    : xx(vxx), xy(vxy), xz(vxz), xw(vxw)
    , yx(vyx), yy(vyy), yz(vyz), yw(vyw)
    , zx(vzx), zy(vzy), zz(vzz), zw(vzw)
    , wx(vwx), wy(vwy), wz(vwz), ww(vww) {
}

Matrix4::Matrix4(const f32 *m) {
    memcpy(array1d, m, sizeof(array1d));
}

Matrix4::Matrix4(const Vector3& ax, const Vector3& ay, const Vector3& az) {
    xx = ax.x;
    yx = ax.y;
    zx = ax.z;
    wx = 0.f;

    xy = ay.x;
    yy = ay.y;
    zy = ay.z;
    wy = 0.f;

    xz = az.x;
    yz = az.y;
    zz = az.z;
    wz = 0.f;
    
    xw = 0.f;
    yw = 0.f;
    zw = 0.f;
    ww = 1.f;        
}

Matrix4 Matrix4::GetScale(const Vector3 &_scale_vector) {
    Matrix4 _matrix = Zero;

    _matrix.array2d[0][0] = _scale_vector.x;
    _matrix.array2d[1][1] = _scale_vector.y;
    _matrix.array2d[2][2] = _scale_vector.z;
    _matrix.array2d[3][3] = 1.0f;

    return _matrix;
}

Matrix4 Matrix4::GetTranslation(const Vector3 &_translation_vector) {
    Matrix4 _matrix = Identity;

    _matrix.array2d[0][3] = _translation_vector.x;
    _matrix.array2d[1][3] = _translation_vector.y;
{'fraction_non_alphanumeric': 0.18776009791921663, 'fraction_numerical': 0.06560587515299877, 'mean_word_length': 1.835530881332408, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5076353', 'n_tokens_mistral': 2043, 'n_tokens_neox': 1911, 'n_words': 384}