PNTreeLight.h 1.39 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
/***************************************
	Auteur : Pierre Aubert
	Mail : aubertp7@gmail.com
	Licence : CeCILL-C
****************************************/

#ifndef __PNTREELIGHT_H__
#define __PNTREELIGHT_H__

#include "PNTreeLightNode.h"

///@brief Describes only the PNTreeClass tree, without the size
template<typename T, typename U, unsigned char N>
class PNTreeLight{
	public:
		PNTreeLight();
		PNTreeLight(T pos[N], T size[N], T sizeLimit = 1e-5);
		virtual ~PNTreeLight();
		PNTreeLight & operator = (const PNTreeLight<T,U,N> & other);
		
		bool saveGnuplotData(const std::string & fileName);
		bool saveGnuplotData(std::ofstream & fs, T height);
		
		void setPosition(T pos[N]);
		void setSize(T size[N]);
		void setLimitSize(T limitSize);
		
		bool addElement(T * posData, U * data);
		const U * getLastData(T * posData) const;
		const U * getCloserData(T * posData) const;
		const U * getCloserDataDist(T & distFromCloserData, T * posData) const;
		
	protected:
		void copyPNTreeLight(const PNTreeLight<T,U,N> & other);
		
	private:
		PNTreeLight(const PNTreeLight<T,U,N> & other);
		void initialisationPNTreeLight(T pos[N], T size[N], T sizeLimit);
		
		///Position of the hyper cube
		T p_pos[N];
		///Size of the hyper cube
		T p_size[N];
		///Size limit of the cells
		T p_sizeLimit;
		///Table of the children of the current node
		PNTreeLightNode<T,U,N> p_node;
};

#include "PNTreeLight_impl.h"


#endif