#include <amscudafractallevelset/amscudafractallevelset.cuh>

namespace amscuda
{
namespace fractallevelset
{


// __host__ __device__ float main_function(cuvec3f pos, main_functionpars &pars)
// {
//     float ret = 0.0f;

//     ret = pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]-pars.threshold;

//     return -ret;
// };

#ifdef AMSCLS_MANDELBROT
__host__ __device__ float main_function(cuvec3f pos, main_functionpars &pars)
{
    float ret = 0.0f;
    float wr,wtheta,wphi;
    cuvec3f w;
    int I;

    w = pos;

    for(I=0;I<pars.fractaliter;I++)
    {
        wr = cuvec3f_norm(w);
        wtheta = ::acos(w.y/wr);
        wphi = ::atan2(w.x,w.z);
        if(wr>pars.freezethresh) break;
        wr = ::pow(wr,8.0f);
        wtheta = wtheta*8.0f;
        wphi = wphi*8.0f;
        w = cuvec3f(wr*sin(wtheta)*sin(wphi),wr*cos(wtheta),wr*sin(wtheta)*cos(wphi));
        w = w + pos;
    }

    ret = cuvec3f_norm(w)-pars.threshold;

    return ret;
};
#endif

#ifdef AMSCLS_JULIA
__host__ __device__ float main_function(cuvec3f pos, main_functionpars &pars)
{
    float ret = 0.0f;

    return ret;
};
#endif

#ifdef AMSCLS_PPKFRACTAL
__host__ __device__ float main_function(cuvec3f pos, main_functionpars &pars)
{
    float ret = 0.0f;

    return ret;
};
#endif
    
};//end namespace fractallevelset
};// end namespace amscuda
