/****************************************************************************************************

		Plane.h
		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Arnaud
		Date:	3/22/2005

****************************************************************************************************/

#ifndef __Plane__
#define __Plane__

#if CP_PRAGMA_ONCE
#pragma once
#endif


#include "Vector3.h"



/// Represents a plane by the direction of its normal and a scalar.
///
class TPlane : public TMCObject
{
	public:
							TPlane() {}
		void 				Set(const TVector3& DD, real hh);
		void				SetPlaneVectors(const TVector3& UU, const TVector3& VV) { fU = UU; fV = VV; }	
		void				Build(const TVector3& O, const TVector3& UU, const TVector3& VV);
		real		 		Power(const TVector3& PP) const;
		void 				PassThrough(const TVector3& PP);
		const TVector3&	GetD(void) const {return fD;}
		const real&			GetH(void) const {return fh;}
		void 				Project(const TVector3& PP,TVector3& QQ) const;
		boolean 			ProjectAlong(const TVector3& PP,const TVector3& DD,TVector3& QQ) const;
		boolean 			ProjectAlong(const TVector3& PP,const TVector3& DD,real64& t) const;
		boolean 			operator==(const TPlane& aplane) const;
		void				PlaneCoordinates(const TVector3& PP, TVector2& result) const;
		void				GlobalCoordinates(const TVector2& PP, TVector3& result) const;
		
	private:
		TVector3	fD;
		TVector3	fU, fV;	// two orthogonal vectors of the plane
		real		fh;
};

/// Represents a line by its direction and origin
///
struct TStraightLine : public TMCObject
{
	TVector3		fO;	///<the line's origin
	TVector3		fD; ///<the line's direction
};

//******************************************************************

#endif
