#ifndef LOG_H
#define LOG_H
#include <string>
#include <sstream>
#include <iomanip>
#include "vector.h"
#include "matrix.h"
#include "perspective.h"
class Log {
public:
static const std::string& tab()
{ static std::string t = " "; return t; }
static const std::string tab(int count) {
const std::string &t = tab();
std::string tt;
for(int i = 0; i < count; ++i) tt += t;
return tt;
}
template<typename T>
static std::string to_string(const VectorT<T> &x, int w = 0) {
std::stringstream s;
s << "(";
for(int i = 0; i < VectorT<T>::Count; ++i)
s << (i ? ", " : "") << std::setw(w) << x[i] << std::setw(0);
s << ")";
return s.str();
}
template<typename T>
static std::string to_string(const PairT<T> &x, int w = 0)
{ return to_string(x.p0, w) + "-" + to_string(x.p1, w); }
static std::string to_string(const Matrix3 &x, int w = 0, const std::string &prefix = std::string()) {
std::stringstream s;
for(int i = 0; i < 3; ++i)
s << prefix << to_string(x[i], w) << std::endl;
return s.str();
}
};
#endif