From b3229865c1c686b11599ede2e9d529ac7cc56e00 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Wed, 6 Feb 2019 21:47:28 -0500 Subject: Add CLI and gnuplot interface --- vec3.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'vec3.cpp') diff --git a/vec3.cpp b/vec3.cpp index 51d4870..e894a01 100644 --- a/vec3.cpp +++ b/vec3.cpp @@ -88,6 +88,13 @@ std::ostream &operator<<(std::ostream &output, const vec3 &v) { return output << v[0] << " " << v[1] << " " << v[2]; } +std::istream &operator>>(std::istream &input, vec3 &v) +{ + if(!(input >> v[0] >> v[1] >> v[2])) + throw "error parsing vector"; + return input; +} + vec3 operator*(scalar scale, const vec3 &v) { return v * scale; -- cgit v1.1