mach: math lib consistent function naming

This commit is contained in:
RokKos 2023-06-29 14:43:09 +02:00 committed by Stephen Gutekanst
parent 72e2df50a3
commit 9ec766c165

View file

@ -455,7 +455,7 @@ pub const mat = struct {
} else @compileError("Expected matrix, found '" ++ @typeName(T) ++ "'");
}
pub inline fn set_2d_matrix(data: []const f32) Mat3x3 {
pub inline fn set2dMatrix(data: []const f32) Mat3x3 {
std.debug.assert(data.len == 9);
return .{
data[0], data[1], data[2], 0,
@ -464,7 +464,7 @@ pub const mat = struct {
};
}
pub inline fn set_3d_matrix(data: []const f32) Mat4x4 {
pub inline fn set3dMatrix(data: []const f32) Mat4x4 {
std.debug.assert(data.len == 16);
return .{
data[0], data[1], data[2], data[3],
@ -1132,7 +1132,7 @@ test "mat.mul" {
const R_yz = mat.mul(R_y, R_z);
// NOTE: This values are calculated by hand with help of matrix calculator: https://matrix.reshish.com/multCalculation.php
const expected_R_yz = mat.set_3d_matrix(&[_]f32{
const expected_R_yz = mat.set3dMatrix(&[_]f32{
-0.43938504177070496278, -0.8191520442889918, -0.36868782649461236545, 0,
0.62750687159713312638, -0.573576436351046, 0.52654078451836329713, 0,
-0.6427876096865394, 0, 0.766044443118978, 0,
@ -1141,7 +1141,7 @@ test "mat.mul" {
try expect(mat.equalsApproximately(R_yz, expected_R_yz, tolerance));
const R_xyz = mat.mul(R_x, R_yz);
const expected_R_xyz = mat.set_3d_matrix(&[_]f32{
const expected_R_xyz = mat.set3dMatrix(&[_]f32{
-0.439385041770705, -0.52506256666891627986, -0.72886904595489960019, 0,
0.6275068715971331, -0.76000215715133560834, 0.16920947734596765363, 0,
-0.6427876096865394, -0.383022221559489, 0.66341394816893832989, 0,
@ -1150,7 +1150,7 @@ test "mat.mul" {
try expect(mat.equalsApproximately(R_xyz, expected_R_xyz, tolerance));
const SR = mat.mul(S, R_xyz);
const expected_SR = mat.set_3d_matrix(&[_]f32{
const expected_SR = mat.set3dMatrix(&[_]f32{
-1.318155125312115, -0.5250625666689163, 3.6443452297744985, 0,
1.8825206147913993, -0.7600021571513356, -0.8460473867298382, 0,
-1.9283628290596182, -0.383022221559489, -3.3170697408446915, 0,
@ -1159,7 +1159,7 @@ test "mat.mul" {
try expect(mat.equalsApproximately(SR, expected_SR, tolerance));
const TSR = mat.mul(T, SR);
const expected_TSR = mat.set_3d_matrix(&[_]f32{
const expected_TSR = mat.set3dMatrix(&[_]f32{
-1.318155125312115, -0.5250625666689163, 3.6443452297744985, 0,
1.8825206147913993, -0.7600021571513356, -0.8460473867298382, 0,
-1.9283628290596182, -0.383022221559489, -3.3170697408446914, 0,