/*=========================================================================
*
* Altimaps.h	- Altimap functions
*
* Version			1.0
* Revision date
*
*=======================================================================*/
#ifndef __ALTIMAP_H__
#define __ALTIMAP_H__


//--- Includes --------------------------------------------------------

#include "MTH.h"

#include "geoobj.h"

//--- structures --------------------------------------------------------


//----------------------------------------------------------------------

#ifdef _WINDOWS
/********************************************************/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus 
/********************************************************/
#endif //_WINDOWS


//--- Functions ---------------------------------------------------------


// test function
extern BOOL MLT_bIsAltimap	(float **p_fX, int **p_iEqualX, MLT_tdstGeometricObject *p_stGeometric, int *k);
// build function
extern void MLT_vCompleteAltimapStructure	(MLT_tdstGeometricObject *p_stGeometric, MLT_tdstElementAltimap* p_stAltimap);
// free functions
extern void MLT_vFreeAltimap	(MLT_tdstElementAltimap* p_stAltimap);
extern void MLT_vFree			(MLT_tdstElementAltimap* p_stAltimap);
extern void MLT_vFreeAlloc		(float *d_fX, float *d_fY, MLT_tdstTripledIndex *d_stVertexIndexes);

// sort functions
extern void MLT_vBubbleSort	(float **p_fX, int **p_iXIndex, long lNbPoints);
extern void MLT_vFinalSort	(float **p_fX, int **p_iXIndex, int iFirst, int iLast);
extern void MLT_vSortIndex	(MLT_tdstTripledIndex *p_stListOfFaces, MLT_tdstElementAltimap* p_stAltimap, int **p_iInd);
// exchange functions
extern void MLT_vExchange			(float **p_fX, int *p_iXIndex, long lNbPoints);
extern void MLT_vExchangeIndexes	(MLT_tdstTripledIndex **p_fX, int *p_iXIndex, long lNbPoints, long lGeomPoints);
extern void MLT_vExchangeNormals	(MTH3D_tdstVector **p_fX, int *p_iXIndex, long lNbPoints);
// order functions
extern void MLT_vOrder			(int **p_iValues, int ** p_iInd);
extern void MLT_vArrangeArray	(int **p_iCol, int *p_iInd);
// index functions
extern int	MLT_iMin			(int *p_iValues);
extern int	MLT_iGetIndex		(int *p_iXIndex, int iValue, long lNbPoints);
extern int	MLT_iIndexSquare	(MLT_tdstTripledIndex *p_stListOfFaces, MLT_tdstElementAltimap* p_stAltimap, BOOL *bIsFirst);
// search function
extern BOOL MLT_bExist			(ACP_tdst2DUVValues *p_stUV, ACP_tdst2DUVValues stUVi, int *iNew, long lNumber);



#ifdef _WINDOWS
/********************************************************/
#ifdef __cplusplus
}
#endif // __cplusplus 
/********************************************************/
#endif //_WINDOWS

#endif // __ALTIMAP_H__ 
