geom/iostream: add segment ostream operator
This commit is contained in:
parent
922d46dd8a
commit
f58390de06
11
geom/fwd.hpp
11
geom/fwd.hpp
@ -12,13 +12,14 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
namespace cruft::geom {
|
namespace cruft::geom {
|
||||||
template <size_t S, typename T> struct ray;
|
|
||||||
template <size_t S, typename T> struct plane;
|
|
||||||
template <size_t S, typename T> struct aabb;
|
template <size_t S, typename T> struct aabb;
|
||||||
template <size_t S, typename T> struct sphere;
|
|
||||||
template <size_t S, typename T> struct ellipse;
|
|
||||||
template <size_t S, typename T> struct rect;
|
|
||||||
template <size_t S, typename T> struct cylinder;
|
template <size_t S, typename T> struct cylinder;
|
||||||
|
template <size_t S, typename T> struct ellipse;
|
||||||
|
template <size_t S, typename T> struct plane;
|
||||||
|
template <size_t S, typename T> struct ray;
|
||||||
|
template <size_t S, typename T> struct rect;
|
||||||
|
template <size_t S, typename T> struct segment;
|
||||||
|
template <size_t S, typename T> struct sphere;
|
||||||
template <size_t S, typename T> struct tri;
|
template <size_t S, typename T> struct tri;
|
||||||
|
|
||||||
template <typename T> struct frustum;
|
template <typename T> struct frustum;
|
||||||
|
@ -8,9 +8,11 @@
|
|||||||
|
|
||||||
#include "iostream.hpp"
|
#include "iostream.hpp"
|
||||||
|
|
||||||
#include "sphere.hpp"
|
|
||||||
#include "plane.hpp"
|
|
||||||
#include "frustum.hpp"
|
#include "frustum.hpp"
|
||||||
|
#include "plane.hpp"
|
||||||
|
#include "segment.hpp"
|
||||||
|
#include "sphere.hpp"
|
||||||
|
|
||||||
#include "../coord/iostream.hpp"
|
#include "../coord/iostream.hpp"
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +30,19 @@ template std::ostream& cruft::geom::operator<< (std::ostream&, cruft::geom::sphe
|
|||||||
template std::ostream& cruft::geom::operator<< (std::ostream&, cruft::geom::sphere<3,float>);
|
template std::ostream& cruft::geom::operator<< (std::ostream&, cruft::geom::sphere<3,float>);
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
template <size_t S, typename T>
|
||||||
|
std::ostream&
|
||||||
|
cruft::geom::operator<< (std::ostream &os, cruft::geom::segment<S,T> const &val)
|
||||||
|
{
|
||||||
|
return os << "[ " << val.a << ", " << val.b << " ]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template std::ostream& cruft::geom::operator<< (std::ostream&, cruft::geom::segment2i const&);
|
||||||
|
template std::ostream& cruft::geom::operator<< (std::ostream&, cruft::geom::segment2f const&);
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <size_t S, typename T>
|
template <size_t S, typename T>
|
||||||
std::ostream&
|
std::ostream&
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*
|
*
|
||||||
* Copyright 2015-2018 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2015-2019 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CRUFT_UTIL_GEOM_IOSTREAM_HPP
|
#pragma once
|
||||||
#define CRUFT_UTIL_GEOM_IOSTREAM_HPP
|
|
||||||
|
|
||||||
#include "fwd.hpp"
|
#include "fwd.hpp"
|
||||||
|
|
||||||
@ -20,6 +19,10 @@ namespace cruft::geom {
|
|||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream&, aabb<S,T>);
|
operator<< (std::ostream&, aabb<S,T>);
|
||||||
|
|
||||||
|
template <size_t S, typename T>
|
||||||
|
std::ostream&
|
||||||
|
operator<< (std::ostream&, segment<S,T> const&);
|
||||||
|
|
||||||
template <size_t S, typename T>
|
template <size_t S, typename T>
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream&, ray<S,T>);
|
operator<< (std::ostream&, ray<S,T>);
|
||||||
@ -36,5 +39,3 @@ namespace cruft::geom {
|
|||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream&, frustum<T>);
|
operator<< (std::ostream&, frustum<T>);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user