libcruft-util/geom/iostream.cpp

56 lines
1.8 KiB
C++
Raw Normal View History

2015-02-19 13:28:36 +11:00
/*
2018-08-04 15:14:06 +10:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2015-02-19 13:28:36 +11:00
*
2018-03-13 22:37:40 +11:00
* Copyright 2018 Danny Robson <danny@nerdcruft.net>
2015-02-19 13:28:36 +11:00
*/
#include "iostream.hpp"
2015-02-19 13:28:36 +11:00
#include "sphere.hpp"
2018-03-13 22:37:40 +11:00
#include "plane.hpp"
#include "frustum.hpp"
#include "../coord/iostream.hpp"
2015-02-19 13:28:36 +11:00
///////////////////////////////////////////////////////////////////////////////
2015-02-19 13:28:36 +11:00
template <size_t S, typename T>
std::ostream&
cruft::geom::operator<< (std::ostream &os, cruft::geom::sphere<S,T> s)
2015-02-19 13:28:36 +11:00
{
return os << "sphere(" << s.centre << ',' << s.radius << ')';
2015-02-19 13:28:36 +11:00
}
//-----------------------------------------------------------------------------
template std::ostream& cruft::geom::operator<< (std::ostream&, cruft::geom::sphere<2,float>);
template std::ostream& cruft::geom::operator<< (std::ostream&, cruft::geom::sphere<3,float>);
2018-03-13 22:37:40 +11:00
///////////////////////////////////////////////////////////////////////////////
template <size_t S, typename T>
std::ostream&
cruft::geom::operator<< (std::ostream &os, plane<S,T> val)
2018-03-13 22:37:40 +11:00
{
return os << val.coefficients;
}
//-----------------------------------------------------------------------------
template std::ostream& cruft::geom::operator<< (std::ostream&, plane<2,float>);
template std::ostream& cruft::geom::operator<< (std::ostream&, plane<3,float>);
2018-03-13 22:37:40 +11:00
///////////////////////////////////////////////////////////////////////////////
template <typename T>
std::ostream&
cruft::geom::operator<< (std::ostream &os, frustum<T> val)
2018-03-13 22:37:40 +11:00
{
return os << "[ " << cruft::make_infix (val.planes) << " ]";
2018-03-13 22:37:40 +11:00
}
//-----------------------------------------------------------------------------
template std::ostream& cruft::geom::operator<< (std::ostream&, frustum<float>);