#ifndef VECTOR_H_INCLUDED
#define VECTOR_H_INCLUDED

#include <math.h>

class CVector
{
    private:
    protected:
    public:

    float x;
    float y;

    CVector()
    {
        x = y = 0.0f;
    }

    CVector(float px, float py)
    {
        x = px;
        y = py;
    }

    float length()
    {
        return sqrt((x*x) + (y*y));
    }

    void normalize()
    {
        float veclength = length();

        x=x/veclength;
        y=y/veclength;
    }

    void scale(float scalar)
    {
        x=x*scalar;
        y=y*scalar;
    }

    void rotate(float angle)
    {
        float veclength = length();

        float tmpx = cos(angle);
        float tmpy = sin(angle);

        x = tmpx * veclength;
        y = tmpy * veclength;
    }
};

#endif // VECTOR_H_INCLUDED
