From cb0efb5d47e1c98cc3d9997285cd457e868db29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 11 Jan 2012 00:56:17 +0100 Subject: [PATCH] Vector3 constructor from Vector2 and optional Z/B value (default 0). --- src/Math/Vector3.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Math/Vector3.h b/src/Math/Vector3.h index c915d3330..bfdee4f1a 100644 --- a/src/Math/Vector3.h +++ b/src/Math/Vector3.h @@ -61,6 +61,15 @@ template class Vector3: public Vector { setX(x); setY(y); setZ(z); } + /** + * @brief Constructor + * @param other Two component vector + * @param z Z / B value + */ + inline Vector3(const Vector& other, T z = T(0)) { + setX(other[0]); setY(other[1]); setZ(z); + } + inline T x() const { return Vector::at(0); } /**< @brief X component */ inline T y() const { return Vector::at(1); } /**< @brief Y component */ inline T z() const { return Vector::at(2); } /**< @brief Z component */