//===========================================================================//
// 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(POINT2D_HPP)
#	define POINT2D_HPP

#	if !defined(VECTOR3D_HPP)
#		include <vector3d.hpp>
#	endif

#	if !defined(VECTOR4D_HPP)
#		include <vector4d.hpp>
#	endif

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Point2D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	template <class T> class Point2DOf:
		public Vector2DOf<T>
	{
	 public:
		//
		// Constructors
		//
		Point2DOf()
			{}
		Point2DOf(
			T x,
			T y
		):
			Vector2DOf<T>(x,y)
				{}
		Point2DOf(const Vector2DOf<T> &v):
			Vector2DOf<T>(v)
				{}

		//
		// Assignment operators
		//
		Point2DOf<T>& operator=(const Vector2DOf<T>& v)
			{Vector2DOf<T>::operator=(v); return *this;}

		//
		// Math operators
		//
		Point2DOf<T>&
			Negate(const Vector2DOf<T> &v)
				{Vector2DOf<T>::Negate(v); return *this;}

		Point2DOf<T>&
			Add(
				const Vector2DOf<T>& v1,
				const Vector2DOf<T>& v2
			)
				{Vector2DOf<T>::Add(v1,v2); return *this;}
		Point2DOf<T>&
			operator+=(const Vector2DOf<T>& v)
				{return Add(*this,v);}

		Point2DOf<T>&
			Subtract(
				const Point2DOf<T>& p,
				const Vector2DOf<T>& v
			)
				{Vector2DOf<T>::Subtract(p,v); return *this;}
		Point2DOf<T>&
			operator-=(const Vector2DOf<T>& v)
				{return Subtract(*this,v);}

		float
			operator*(const Vector2DOf<T>& v) const
				{return Vector2DOf<T>::operator*(v);}

		Point2DOf<T>&
			Multiply(
				const Point2DOf<T>& p,
				float scale
			)
				{Vector2DOf<T>::Multiply(p,scale); return *this;}
		Point2DOf<T>&
			operator*=(float value)
				{return Multiply(*this,value);}

		Point2DOf<T>&
			Multiply(
				const Point2DOf<T>& p,
				const Vector2DOf<T>& v
			)
				{Vector2DOf<T>::Multiply(p,v); return *this;}
		Point2DOf<T>&
			operator*=(const Vector2DOf<T> &v)
				{return Multiply(*this,v);}

		Point2DOf<T>&
			Divide(
				const Vector2DOf<T>& v,
				float scale
			)
				{Vector2DOf<T>::Divide(v,scale); return *this;}
		Point2DOf<T>&
			operator/=(float value)
				{return Divide(*this,value);}

		Point2DOf<T>&
			Divide(
				const Vector2DOf<T>& v1,
				const Vector2DOf<T>& v2
			)
				{Vector2DOf<T>::Divide(v1,v2); return *this;}
		Point2DOf<T>&
			operator/=(const Vector2DOf<T> &v)
				{return Divide(*this,v);}

		//
		// Miscellaneous functions
		//
		Point2DOf<T>&
			Combine(
				const Vector2DOf<T>& v1,
				float t1,
				const Vector2DOf<T>& v2,
				float t2
			)
				{Vector2DOf<T>::Combine(v1,t1,v2,t2); return *this;}

		//
		// Template support functions
		//
		Point2DOf<T>&
			Lerp(
				const Vector2DOf<T>& v1,
				const Vector2DOf<T>& v2,
				float t
			)
				{Vector2DOf<T>::Lerp(v1,v2,t); return *this;}
	};

#endif

