#ifndef VEC2_H
#define VEC2_H

#include "Vec.h"

namespace Salamander
{

/*
** A Two-Dimensional implementation of a vector. Defines the additional operators:
**		~	Perpendicular
**		|	Perp-Dot Product
*/

class Vec2 : public Vec<Vec2>
{
public:
	Vec2(double x = 0.0f, 
		 double y = 0.0f);
	virtual ~Vec2();

public:
	// Comparison Operators
	virtual bool operator== (const Vec2& v);	// Equals
	virtual bool operator!= (const Vec2& v);	// Does not equal

	// Unary Operators
	Vec2 operator-();			// Negate
	Vec2 operator~();			// Perpendicular

	// Scalar Operators
	Vec2 operator* (double s);	// Scalar multiply
	Vec2 operator/ (double s);	// Scalar divide
	Vec2 operator^ (double s);	// Scalar perpendicular

	// Vector Operators
	Vec2 operator+ (const Vec2& v);		// Component add
	Vec2 operator- (const Vec2& v);		// Component subtract
	double operator* (const Vec2& v);	// Dot product
	Vec2 operator| (const Vec2& v);		// Perp-Dot product
	Vec2 operator/ (const Vec2& v);		// Component divide
	double operator^ (const Vec2& v);	// Cross product

	// Additive Operators
	Vec2& operator*= (double s);	// Scalar multiply increment
	Vec2& operator/= (double s);	// Scalar divide increment
	Vec2& operator+= (const Vec2& v);	// Vector increment
	Vec2& operator-= (const Vec2& v);	// Vector decrement

	// Properties
	double length();
	double lengthSquared();

	// Other operations
	Vec2& normalise();		// Normalise this vector
	Vec2 normal();			// Return a normalised copy

public:
	double x_, y_;

};

}
#endif // VEC2_H


