//---------------------------------------------------------------------------
#ifndef Points3D_H
#define Points3D_H
//---------------------------------------------------------------------------

#include "..\TNT\cmat.h"
using namespace TNT;

#include "transformation.h"

enum Coordinate { X = 0, Y, Z, W }; // Used as index into array of coordinates


/****************************************************************************
* Points3D represents points coordinates in 
*     Cartesian coordinate system. A point is given in homogeneous coordinates
*     as 4x1 matrix, containing x,y,z coordinates and 4-th element is 1.0
*
*
*
*/


class Points3D: public Matrix_d 
{
	public:
		Points3D(int numberOfPoints = 0) 
		:	Matrix_d(4,numberOfPoints) {
			for( Subscript i=0; i<numberOfPoints; ++i ) {
				(*this)[X][i] = 0.0;
				(*this)[Y][i] = 0.0;
				(*this)[Z][i] = 0.0;
				(*this)[W][i] = 1.0;
			}

		}

		~Points3D() {
		}


		Matrix_d& toMatrix() const { return *((Matrix_d*)this); }

		static Points3D* matrixToPoints3D(Matrix_d* mptr){
			return (Points3D*)(mptr);		// converts Matrix pointer to Points3D pointer
		}                                   // used to inherit all matrix operators
		
		Points3D& operator = (Matrix_d& m){
			assert(m.num_rows() == 4);
			Matrix_d::operator = (m);
			return *this;
		}
};


Points3D operator * ( const TransformationMatrix& R, const Points3D& p );
Points3D operator + ( const Points3D& p, const Points3D& q );
Points3D operator - ( const Points3D& p, const Points3D& q );


#endif
