matrix: add 2d translate convenience function

This commit is contained in:
Danny Robson 2015-04-02 14:58:02 +11:00
parent a300f99b87
commit 0211ed5b37
2 changed files with 10 additions and 0 deletions

View File

@ -439,6 +439,15 @@ matrix<T>::look_at (util::point<3,T> eye,
}
//-----------------------------------------------------------------------------
template <typename T>
matrix<T>
matrix<T>::translate (util::vector<2,T> v)
{
return translate ({v.x, v.y, 0});
}
//-----------------------------------------------------------------------------
template <typename T>
matrix<T>

View File

@ -67,6 +67,7 @@ namespace util {
static matrix<T> look_at (point<3,T> eye, point<3,T> centre, vector<3,T> up);
// Affine matrices
static matrix<T> translate (util::vector<2,T>);
static matrix<T> translate (util::vector<3,T>);
static matrix<T> scale (util::vector<3,T>);
static matrix<T> scale (T);