src/vector.h
branchpyrit
changeset 14 fc18ac4833f2
parent 12 f4fcabf05785
child 21 79b516a3803d
--- a/src/vector.h	Sat Nov 24 23:55:54 2007 +0100
+++ b/src/vector.h	Sun Nov 25 15:50:01 2007 +0100
@@ -99,11 +99,23 @@
 		return Vector3(f * v.x, f * v.y, f * v.z);
 	}
 
-	friend Vector3 operator*(const float &f, Vector3 &v)
+	friend Vector3 operator*(const float &f, const Vector3 &v)
 	{
 		return v * f;
 	};
 
+	// vector plus scalar
+	friend Vector3 operator+(const Vector3 &v, const float &f)
+	{
+		return Vector3(v.x + f, v.y + f, v.z + f);
+	}
+
+	// vector minus scalar
+	friend Vector3 operator-(const Vector3 &v, const float &f)
+	{
+		return Vector3(v.x - f, v.y - f, v.z - f);
+	}
+
 	// cell by cell product (only usable for colours)
 	friend Vector3 operator*(const Vector3 &a,  const Vector3 &b)
 	{