Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn matmul(comptime T: type, a: [][]T, b: [][]T, c: [][]T) void {}
- fn translate(x: f64, y: f64) [3][3]f64 {
- return [_][_]f64{
- [_]f64{ 1, 0, x },
- [_]f64{ 0, 1, y },
- [_]f64{ 0, 0, 1 },
- };
- }
- test "translate" {
- const point = [2][1]f64{
- [_]f64{2},
- [_]f64{1},
- };
- const actual = [_][1]f64{[_]f64{0}} ** 2;
- const translation = translate(-3, 1);
- try matmul(f64, translation[0..], point, &actual);
- const expected = [_][_]f64{
- [_]f64{-1},
- [_]f64{2},
- };
- assert(std.mem.equal(f64, actual, expected));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement