diff --git a/geom/fwd.hpp b/geom/fwd.hpp index 8761c350..3401e844 100644 --- a/geom/fwd.hpp +++ b/geom/fwd.hpp @@ -12,13 +12,14 @@ #include namespace cruft::geom { - template struct ray; - template struct plane; template struct aabb; - template struct sphere; - template struct ellipse; - template struct rect; template struct cylinder; + template struct ellipse; + template struct plane; + template struct ray; + template struct rect; + template struct segment; + template struct sphere; template struct tri; template struct frustum; diff --git a/geom/iostream.cpp b/geom/iostream.cpp index 5529b094..ae6d6349 100644 --- a/geom/iostream.cpp +++ b/geom/iostream.cpp @@ -8,9 +8,11 @@ #include "iostream.hpp" -#include "sphere.hpp" -#include "plane.hpp" #include "frustum.hpp" +#include "plane.hpp" +#include "segment.hpp" +#include "sphere.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 &os, cruft::geom::segment 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 std::ostream& diff --git a/geom/iostream.hpp b/geom/iostream.hpp index 099fa39f..72b1534e 100644 --- a/geom/iostream.hpp +++ b/geom/iostream.hpp @@ -3,11 +3,10 @@ * 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/. * - * Copyright 2015-2018 Danny Robson + * Copyright 2015-2019 Danny Robson */ -#ifndef CRUFT_UTIL_GEOM_IOSTREAM_HPP -#define CRUFT_UTIL_GEOM_IOSTREAM_HPP +#pragma once #include "fwd.hpp" @@ -20,6 +19,10 @@ namespace cruft::geom { std::ostream& operator<< (std::ostream&, aabb); + template + std::ostream& + operator<< (std::ostream&, segment const&); + template std::ostream& operator<< (std::ostream&, ray); @@ -36,5 +39,3 @@ namespace cruft::geom { std::ostream& operator<< (std::ostream&, frustum); } - -#endif