////////////////////////////////////////////////////////////
/* vector.h - headers for point/vector class library      */
/* Chris X Edwards                                        */
/* cxe- Sun Feb  3 00:40:14 PST 2002                      */
/* $Date$ - $Revision$  */
////////////////////////////////////////////////////////////

#include <iostream.h>
#include <math.h>

class Vector
{  friend class Line;
  public:
    Vector();
    Vector(float, float, float); // Vector mypnt(20,40,30);
    ~Vector();
    Vector gg_set2(float, float, float);
    float  gg_valX(), gg_valY(), gg_valZ();
    Vector gg_inverse(); // ! just returns value
    Vector gg_set2_inverse(); // returns and resets value
    float  gg_magnitude();
    float  gg_distance(Vector);
    Vector gg_direction(); // just returns value
    Vector gg_set2_direction(); // returns and resets value

    Vector gg_add(Vector); // +
    Vector gg_set2_add(Vector); // +=
    Vector gg_subtract(Vector);  // -
    Vector gg_set2_subtract(Vector); // -=

    Vector gg_rotate(float &rads); // %
    Vector gg_rotate(float &rads, Vector &basept);
    Vector gg_set2_rotate(float &rads); // %=
    Vector gg_set2_rotate(float &rads, Vector &basept);

    Vector gg_tilt(float &rads); // rotation in XZ axis
    Vector gg_tilt(float &rads, Vector &basept);
    Vector gg_set2_tilt(float &rads);
    Vector gg_set2_tilt(float &rads, Vector &basept);

    Vector gg_viewvector(Vector &VV);
    Vector gg_set2_viewvector(Vector &VV);
    Vector gg_perspective(float &lens, float &camdist);
    Vector gg_set2_perspective(float &lens, float &camdist);

    Vector gg_scale(float &fact); // *
    Vector gg_scale(float &fact, Vector &basept);
    Vector gg_set2_scale(float &fact); // *=
    Vector gg_set2_scale(float &fact, Vector &basept);
    Vector gg_scale(Vector &fact3d); // *
    Vector gg_scale(Vector &fact3d, Vector &basept);
    Vector gg_set2_scale(Vector &fact3d); // *=
    Vector gg_set2_scale(Vector &fact3d, Vector &basept);

    float  gg_dot(Vector &B); // |
    float  gg_angle(Vector &B);
    float  gg_angle(Vector B, Vector basept);
    Vector gg_midpoint(Vector &B);
    Vector gg_cross(Vector &B); // &
    Vector gg_set2_cross(Vector &B);

    bool compareto(Vector Q);
    void print(ostream *os);

private:
    float x, y, z;
}; 

// Operator overloads for Vector type
Vector operator!(Vector A);            // invert
Vector operator+(Vector A, Vector B);  // add
Vector operator+=(Vector &A, Vector B); // set 2 add
Vector operator-(Vector A, Vector B);  // subtract
Vector operator-=(Vector &A, Vector B); // set 2 subtract
Vector operator%(Vector A, float B);  // rotate
Vector operator%=(Vector &A, float B); // set 2 rotate
Vector operator*(Vector A, float B);  // scale
Vector operator*=(Vector &A, float B); // set 2 scale
Vector operator*(Vector A, Vector B);  // 3dscale
Vector operator*=(Vector &A, Vector B); // set 2 3dscale
float operator|(Vector A, Vector B); // dot product
Vector operator&(Vector A, Vector B); // cross product
Vector operator&=(Vector &A, Vector B); // set 2 cross product
bool operator==(Vector A, Vector B);

ostream &operator<<(ostream &os, Vector p); // print
