//#  eulerN -- program for statistical estimation of Euler characteristic of a 3-dimensional body
//#  given as a sufficiently dense "volumetric" point sampling
//#
//#  Copyright (c) 2005-2007 Bradford Jones, Konstantin Rybnikov, Karen Daniels, Daniel Klain
//#  Release 2: 1 June 2007 
//#
//#  This program is free software; you can redistribute it and/or modify it
//#  under the terms of the GNU General Public License as published by the
//#  Free Software Foundation; either version 2, or (at your option) any
//#  later version: http://www.gnu.org/licenses/gpl.txt.
//#
//#  This program is distributed in the hope that it will be useful,
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//#  GNU General Public License for more details.
//#-----------------------------------------------------------------------------

#ifndef EULERIE
#define EULERIE
	#include <vector>
	#include <algorithm>
	#include "d2point.h"
	#include "d3point.h"
	#include "math_vector.h"
	using namespace std;

	typedef int (*d2euler) (vector<d2point>&, vector<double>&, int, vector<math_vector>&);
	class EulerIE
	{
		private:
			static double overlap2d;
			static double overlap3d;
			static math_vector crossproduct(math_vector &v, math_vector &b);
		public:
			EulerIE()
			{
				overlap2d = .5;
				overlap3d = .5;
			}
			EulerIE(double o2d, double o3d)
			{
				overlap2d = o2d;
				overlap3d = o3d;
			}
			static void setOverlap2d(double x)
			{
				overlap2d = x;
			}
			static void setOverlap3d(double x)
			{
				overlap3d = x;
			}
			static double getOverlap2d()
			{
				return overlap2d;
			}
			static double getOverlap3d()
			{
				return overlap3d;
			}
			static int euler1d (vector<double> &pointcloud, double mindistance);
			static int euler2d (vector<d2point> &pointcloud, vector<double> &intervalWidth, int numdirections, vector<math_vector> &directions);
			static int euler3d (vector<d3point> &pointcloud, d2euler previousdimension, vector<double> &intervalWidth, int numdirections,
							   int numdirections2d, vector<math_vector> directions3d, vector<math_vector> directions2d);
	};
#endif
