//===========================================================================// // File: point.hh // // Project: MUNGA Brick: Math Library // // Contents: Interface specification of the point class // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 11/19/94 JMA Initial coding. // //---------------------------------------------------------------------------// // Copyright (C) 1994, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #if !defined(POINT_HH) # define POINT_HH # if !defined(VECTOR3D_HH) # include "vector3d.hh" # endif # if !defined(VECTOR4D_HH) # include "vector4d.hh" # endif //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Point2D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ template class Point2DOf: public Vector2DOf { public: // // Constructors // Point2DOf() {} Point2DOf( T x, T y ): Vector2DOf(x,y) {} Point2DOf(const Vector2DOf &v): Vector2DOf(v) {} // // Assignment operators // Point2DOf& operator=(const Vector2DOf& v) {Vector2DOf::operator=(v); return *this;} // // Math operators // Point2DOf& Negate(const Vector2DOf &v) {Vector2DOf::Negate(v); return *this;} Point2DOf& Add( const Vector2DOf& v1, const Vector2DOf& v2 ) {Vector2DOf::Add(v1,v2); return *this;} Point2DOf& operator+=(const Vector2DOf& v) {return Add(*this,v);} Point2DOf& Subtract( const Point2DOf& p, const Vector2DOf& v ) {Vector2DOf::Subtract(p,v); return *this;} Point2DOf& operator-=(const Vector2DOf& v) {return Subtract(*this,v);} float operator*(const Vector2DOf& v) const {return Vector2DOf::operator*(v);} Point2DOf& Multiply( const Point2DOf& p, float scale ) {Vector2DOf::Multiply(p,scale); return *this;} Point2DOf& operator*=(float value) {return Multiply(*this,value);} Point2DOf& Multiply( const Point2DOf& p, const Vector2DOf& v ) {Vector2DOf::Multiply(p,v); return *this;} Point2DOf& operator*=(const Vector2DOf &v) {return Multiply(*this,v);} Point2DOf& Divide( const Vector2DOf& v, float scale ) {Vector2DOf::Divide(v,scale); return *this;} Point2DOf& operator/=(float value) {return Divide(*this,value);} Point2DOf& Divide( const Vector2DOf& v1, const Vector2DOf& v2 ) {Vector2DOf::Divide(v1,v2); return *this;} Point2DOf& operator/=(const Vector2DOf &v) {return Divide(*this,v);} // // Miscellaneous functions // Point2DOf& Combine( const Vector2DOf& v1, float t1, const Vector2DOf& v2, float t2 ) {Vector2DOf::Combine(v1,t1,v2,t2); return *this;} // // Template support functions // Point2DOf& Lerp( const Vector2DOf& v1, const Vector2DOf& v2, float t ) {Vector2DOf::Lerp(v1,v2,t); return *this;} }; #endif