/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
***************************************************************************/

#pragma once

#include <glmCoreAPI.h>
#include "glmMemory.h"

namespace glm
{
	/**
	* \brief This class defines a DelaunayQuery
	* 
	* \ingroup delaunay
	*
	* \author Golaem <dev@golaem.com>
	*/
	class GLM_CORE_API DelaunayQuery
	{
	public:

		GLM_ABSTRACTCLASS_STAT_ID( glm::MemoryStatIds::GolaemShared)


		/// \name Internal Types & Structures
		/// @{
		/**
		* \brief DelaunayQuery Type
		* \note You have a choice of speed versus accuracy.  The fastest choice is
		*	Type::INT64, but it gives up a lot of precision, scaling the points
		*	 to [0,2^{16}]^3.  The choice Type::INTEGER gives up less precision,
		*	scaling the points to [0,2^{20}]^3.  The choice Type::RATIONAL uses
		*	exact arithmetic, but is the slowest choice.  The choice Type::REAL
		*	uses floating-point arithmetic, but is not robust in all cases.
		*/
		struct Type
		{
			enum Values
			{
				INT64,
				INTEGER,
				RATIONAL,
				REAL,
				FILTERED,
				END
			};
		};
		//@}

		/**
		* \brief destructor
		*/
		virtual ~DelaunayQuery();

		/// \name accessors
		/// @{
		/**
		* \brief the query type
		* \return the query type
		*/
		virtual Type::Values getType() const = 0;
		/// @}

		/// \name Ordering Functions
		/// @{
		// Support for ordering a set of unique indices into the vertex pool.  On
		// output it is guaranteed that:  v0 < v1 < v2.  This is used to guarantee
		// consistent queries when the vertex ordering of a primitive is permuted,
		// a necessity when using floating-point arithmetic that suffers from
		// numerical round-off errors.  The input indices are considered the
		// positive ordering.  The output indices are either positively ordered
		// (an even number of transpositions occurs during sorting) or negatively
		// ordered (an odd number of transpositions occurs during sorting).  The
		// functions return 'true' for a positive ordering and 'false' for a
		// negative ordering.

		/**
		* \brief Orders a set of unique indices into the vertex pool
		* \param v0 
		* \param v1 
		* \return true for a positive ordering and false for a negative ordering
		*/
		static bool sort(int& v0, int& v1);

		/**
		* \brief Orders a set of unique indices into the vertex pool
		* \param v0 
		* \param v1 
		* \return true for a positive ordering and false for a negative ordering
		*/
		static bool sort(int& v0, int& v1, int& v2);

		/**
		* \brief Orders a set of unique indices into the vertex pool
		* \param v0 
		* \param v1 
		* \return true for a positive ordering and false for a negative ordering
		*/
		static bool sort(int& v0, int& v1, int& v2, int& v3);
		/// @}

	protected:

		/**
		* \brief constructor
		*/
		DelaunayQuery();
	} ;
}

