/**********************************************************************
jldsm_lib.h: perform digital elevation model data operations on image
Author(s): Pieter.Kempeneers@ec.europa.eu
Copyright (C) 2016-2022 European Union (Joint Research Centre)
This file is part of jiplib.
jiplib 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 3 of the License, or
(at your option) any later version.
jiplib 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.
You should have received a copy of the GNU General Public License
along with jiplib. If not, see .
***********************************************************************/
#ifndef _JLDEM_LIB_H_
#define _JLDEM_LIB_H_
#include "imageclasses/Jim.h"
#ifndef PI
#define PI 3.1415926535897932384626433832795
#endif
#ifndef DEG2RAD
#define DEG2RAD(DEG) (DEG/180.0*PI)
#endif
#ifndef RAD2DEG
#define RAD2DEG(RAD) (RAD/PI*180)
#endif
template void Jim::hillShade_t(Jim& imgWriter, Jim& sza, Jim& saa){
T1* psrc=static_cast(getDataPointer());
T2* psza=static_cast(sza.getDataPointer());
T2* psaa=static_cast(saa.getDataPointer());
unsigned char* ptrt=static_cast(imgWriter.getDataPointer());
double pixelSize = getDeltaX();
for(size_t index=0;index(sqrt(product*product));//in pixels
// int theDist=static_cast(sqrt((currentValue*tan(DEG2RAD(psza[index]))/pixelSize)*(currentValue*tan(DEG2RAD(psza[index]))/pixelSize)));//in pixels
double theDir=DEG2RAD(psaa[index])+PI/2.0;
if(theDir<0)
theDir+=2*PI;
std::div_t dv{};
dv = std::div(index, nrOfCol());
double x = dv.rem;
double y = dv.quot;
for(int d=0;d=nrOfRow())
continue;
if(indexI<0||indexI>=nrOfCol())
continue;
if(tansza > 0 && (psrc[pos]