/*-
 * Copyright (c) 1999,2000 Qube Software, Ltd.
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of the source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 
 * 2. Any redistribution solely in binary form must conspicuously
 *    reproduce the following disclaimer in documentation provided with the
 *    binary redistribution.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'', WITHOUT ANY WARRANTIES, EXPRESS
 * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  LICENSOR SHALL
 * NOT BE LIABLE FOR ANY LOSS OR DAMAGES RESULTING FROM THE USE OF THIS
 * SOFTWARE, EITHER ALONE OR IN COMBINATION WITH ANY OTHER SOFTWARE.
 * 
 * 	$Id: mout.h,v 1.6 2000/05/26 11:05:58 dfr Exp $
 */

#ifndef __mout_h__
#define __mout_h__

#include <iostream>
#include "vec2.h"
#include "vec3.h"
#include "vec4.h"
#include "matrix3.h"
#include "matrix4.h"
#include "box2.h"
#include "box3.h"

MATHS_BEGIN

template<class T> std::ostream& operator << (std::ostream& os, const Vec2<T>& v)
{
    return os << v.x << ", " << v.y;
}

template<class T> std::ostream& operator<<(std::ostream& os, const Vec3<T>& v)
{
    return os << v.x << "," << v.y << "," << v.z;
}

template<class T> std::ostream& operator<<(std::ostream& os, const Vec4<T>& v)
{
    return os << v[0] << ", " << v[1] << ", " << v[2]
	      << ", " << v[3];
}

inline std::ostream& operator<<(std::ostream& os, const Box3f& b)
{
    return os << '[' << b.min << " , " << b.max << ']';
} 

inline std::ostream& operator<<(std::ostream& os, const Matrix3f& m) 
{
    return os << '[' << m[0] << ' ' << m[1] << ' ' << m[2] << ']';
}

inline std::ostream& operator<<(std::ostream& os, const Matrix4f& m) 
{
    os << '[';
    for (unsigned int i = 0; i < 3; ++i) {
        os << '[' << m[i] << "] ";
    }
    return os << '[' << m[3] << "]]";
}

template<class T> std::ostream& operator << (std::ostream& os, const Box2<T>& b)
{
    return os << '[' << b.min << " , " << b.max << ']';
}

inline std::ostream& operator<<(std::ostream& os, const Plane4f& p)
{
    return os << p.n << " , " << p.d;
}

MATHS_END

#endif /* __mout_h__ */
