From 0211ed5b3763379f65805581d5f4acfb1a87fd6c Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 2 Apr 2015 14:58:02 +1100 Subject: [PATCH] matrix: add 2d translate convenience function --- matrix.cpp | 9 +++++++++ matrix.hpp | 1 + 2 files changed, 10 insertions(+) diff --git a/matrix.cpp b/matrix.cpp index 96c6c5e0..1801e0b7 100644 --- a/matrix.cpp +++ b/matrix.cpp @@ -439,6 +439,15 @@ matrix::look_at (util::point<3,T> eye, } +//----------------------------------------------------------------------------- +template +matrix +matrix::translate (util::vector<2,T> v) +{ + return translate ({v.x, v.y, 0}); +} + + //----------------------------------------------------------------------------- template matrix diff --git a/matrix.hpp b/matrix.hpp index 3d0ace2b..629d0e6c 100644 --- a/matrix.hpp +++ b/matrix.hpp @@ -67,6 +67,7 @@ namespace util { static matrix look_at (point<3,T> eye, point<3,T> centre, vector<3,T> up); // Affine matrices + static matrix translate (util::vector<2,T>); static matrix translate (util::vector<3,T>); static matrix scale (util::vector<3,T>); static matrix scale (T);