#ifndef EVECTOR4_H
#define EVECTOR4_H

#include "eutils.h"

#include <iostream>

class evector4f;

class evector4fp
{
 public:
  float *px;

  evector4fp();
  evector4fp(float *px);

  float len() const;

  float   operator *(const evector4fp& a) const;

  void normalize();
  evector4f unit() const;
//  evector4 rot(float angle);
  evector4f proj(const evector4fp& a) const;
  evector4f operator +(const evector4fp& a) const;
  evector4f operator -(const evector4fp& a) const;
  evector4fp& operator +=(const evector4fp& a);
  evector4fp& operator -=(const evector4fp& a);
  evector4fp& operator = (const evector4fp& a);

  evector4f operator *(float a) const;
  evector4f operator /(float a) const;

  friend std::ostream &operator<<(std::ostream &stream,const evector4fp &vec);
//  friend inline evector4f operator*(float v,const evector4fp &vec){ return(vec*v); }
  friend evector4f operator*(float v,const evector4fp &vec);
};

class evector4f : public evector4fp
{
 public:
  evector4f();
  evector4f(float x,float y,float z,float w);
  evector4f(const evector4fp& a);
  ~evector4f();
};

class evector4
{
 public:
  double x,y,z,w;

  evector4();
  evector4(const evector4& a);
//  evector4(float x,float y,float z);
  evector4(double x,double y,double z,double w);

  double len() const;

  double   operator *(const evector4& a) const;

  void normalize();
  evector4 unit() const;
//  evector4 rot(float angle);
  evector4 proj(const evector4& a) const;
  evector4 operator +(const evector4& a) const;
  evector4 operator -(const evector4& a) const;
  evector4& operator +=(const evector4& a);
  evector4& operator -=(const evector4& a);
  evector4& operator = (const evector4& a);

  evector4 operator *(double a) const;
  evector4 operator /(double a) const;

  friend std::ostream &operator<<(std::ostream &stream,const evector4 &vec);
  friend inline evector4 operator*(double v,const evector4 &vec){ return(vec*v); }
};

extern const evector4 ux4;
extern const evector4 uy4;
extern const evector4 uz4;
extern const evector4 uw4;
extern const evector4 u04;

extern const evector4f ux4f;
extern const evector4f uy4f;
extern const evector4f uz4f;
extern const evector4f uw4f;
extern const evector4f u04f;

#endif

