#ifndef _AwPoint
#define _AwPoint
#include <AwMath.h>
#include <AwVector.h>
class AwPoint {
public:
AwPoint();
AwPoint(const AwPoint &);
AwPoint(const AwVector &);
AwPoint(double xx, double yy, double zz = 0.0, double ww = 1.0);
#ifndef COMPILE_OUTSIDE_MAYA
#endif
~AwPoint();
AwPoint &operator=(const AwPoint &);
AwPoint &set(double xx, double yy, double zz = 0.0, double ww = 1.0);
double &operator[](size_t i);
double operator[](size_t i) const;
AwPoint operator+(const AwVector &) const;
AwPoint operator-(const AwVector &) const;
AwVector operator-(const AwPoint &) const;
AwPoint operator*(const AwMatrix &right) const;
bool operator==(const AwPoint &) const;
bool operator!=(const AwPoint &) const;
AwPoint cartesian() const;
AwPoint &cartesianize();
AwPoint &setToProduct(const AwPoint &left, const AwMatrix &right);
friend ostream &operator<<(ostream &os, const AwPoint &);
static const AwPoint origin;
double x, y, z, w;
private:
AwVector cartesianSub(const AwPoint &) const;
AwPoint cartesianAdd(const AwVector &) const;
AwPoint cartesianSub(const AwVector &) const;
};
inline AwPoint::AwPoint()
: x(0.0), y(0.0), z(0.0), w(1.0)
{}
inline AwPoint::AwPoint(const AwPoint &pt)
: x(pt.x), y(pt.y), z(pt.z), w(pt.w)
{}
inline AwPoint::AwPoint(const AwVector &v)
: x(v.x), y(v.y), z(v.z), w(1.0)
{}
inline AwPoint::AwPoint(double xx, double yy, double zz, double ww)
: x(xx), y(yy), z(zz), w(ww)
{}
#ifndef COMPILE_OUTSIDE_MAYA
inline AwPoint::AwPoint(
const MPoint &pt)
: x(pt.x), y(pt.y), z(pt.z), w(pt.w)
{}
#endif
inline AwPoint::~AwPoint()
{}
inline AwPoint &AwPoint::set(double xx, double yy, double zz, double ww)
{ x = xx; y = yy; z = zz; w = ww; return *this; }
inline AwPoint &AwPoint::operator=(const AwPoint &src)
{ x = src.x; y = src.y; z = src.z; w = src.w; return *this; }
inline double &AwPoint::operator[](size_t i)
{ return (&x)[i]; }
inline double AwPoint::operator[](size_t i) const
{ return (&x)[i]; }
inline AwPoint AwPoint::operator+(const AwVector &v) const
{ if (w == 1.0) return AwPoint(x+v.x, y+v.y, z+v.z);
else return cartesianAdd(v); }
inline AwPoint AwPoint::operator-(const AwVector &v) const
{ if (w == 1.0) return AwPoint(x-v.x, y-v.y, z-v.z);
else return cartesianSub(v); }
inline AwVector AwPoint::operator-(const AwPoint &o) const
{ if (w == 1.0 && o.w == 1.0) return AwVector(x-o.x, y-o.y, z-o.z);
else return cartesianSub(o); }
inline bool AwPoint::operator==(const AwPoint &p) const
{ return( x == p.x && y == p.y && z == p.z && w == p.w); }
inline bool AwPoint::operator!=(const AwPoint &otherPoint) const
{ return !(*this == otherPoint); }
inline AwPoint AwPoint::cartesian() const
{ AwPoint temp(*this); return temp.cartesianize(); }
#endif