common: add qv::to_string

This commit is contained in:
Eric Wasylishen 2017-04-23 20:57:35 -06:00
parent 1c1c105abb
commit 48e057b31a
3 changed files with 12 additions and 2 deletions

View File

@ -26,8 +26,6 @@
#include <map>
#include <glm/glm.hpp>
#include <glm/ext.hpp>
#include <glm/gtx/closest_point.hpp>
using namespace polylib;

View File

@ -19,6 +19,8 @@
#include <common/qvec.hh>
#include <sstream>
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@ -136,3 +138,10 @@ qmat2x2f qv::invert(const qmat2x2f &m, bool *ok)
return result * (1.0f/det);
}
std::string qv::to_string(const qvec<3,float> &v1)
{
std::stringstream ss;
ss << v1[0] << " " << v1[1] << " " << v1[2];
return ss.str();
}

View File

@ -23,6 +23,7 @@
#include <initializer_list>
#include <cassert>
#include <cmath>
#include <string>
#ifndef qmax // FIXME: Remove this ifdef
#define qmax(a,b) (((a)>(b)) ? (a) : (b))
@ -205,6 +206,8 @@ namespace qv {
T distance(const qvec<N,T> &v1, const qvec<N,T> &v2) {
return length(v2 - v1);
}
std::string to_string(const qvec<3,float> &v1);
};