#include "stdafx.h"
#include "Vector4.h"
#include "Point.h"
#include "Vector.h"
#include "Core/Str.h"
#include "Core/StrBuf.h"

namespace storm {
	namespace geometry {

		Vector4::Vector4() : x(0), y(0), z(0), w(1) {}

		Vector4::Vector4(Float x, Float y, Float z) : x(x), y(y), z(z), w(1) {}

		Vector4::Vector4(Float x, Float y, Float z, Float w) : x(x), y(y), z(z), w(w) {}

		Vector4::Vector4(const Point &p) : x(p.x), y(p.y), z(0), w(1) {}

		Vector4::Vector4(const Vector &v) : x(v.x), y(v.y), z(v.z), w(1) {}

		Float Vector4::lengthSq() const {
			return Vector(*this).lengthSq();
		}

		Float Vector4::length() const {
			return Vector(*this).length();
		}

		Float Vector4::taxiLength() const {
			return Vector(*this).taxiLength();
		}

		void Vector4::toS(StrBuf *to) const {
			*to << S("(") << x << S(", ") << y << S(", ") << z << S(", ") << w << S(")");
		}

		wostream &operator <<(wostream &to, const Vector4 &p) {
			return to << L"(" << p.x << L", " << p.y << L", " << p.z << L", " << p.w << L")";
		}

	}
}
