#include <amscudafractallevelset/amscudafractallevelset.cuh>

namespace amscuda
{
namespace fractallevelset
{

    triangle::triangle()
    {
        return;
    }

    triangle::~triangle()
    {
        return;
    }

    cuvec3f triangle::normal() const
    {
        cuvec3f ret;
        ret = cuvec3f_cross(p1-p0,p2-p0);
        ret = cuvec3f_normalize(ret);
        return ret;
    }

    float triangle::area() const
    {
        float ret = 0.0f;
        cuvec3f nv = cuvec3f_cross(p1-p0,p2-p0);
        ret = cuvec3f_norm(nv)*0.5f;
        return ret;
    }

    tetrahedron::tetrahedron()
    {

    }

    tetrahedron::~tetrahedron()
    {

    }

    __device__ __host__ float tetrahedron::volume()
    {
        
        float ret = cuvec3f_dot(p3-p0,cuvec3f_cross(p1-p0,p2-p0))*(1.0f/6.0f);
        return ret;
    }

    __device__ __host__ int tetrahedron::volume_sign()
    {
        int ret = isignf(volume());
        return ret;
    }

    __device__ __host__ tetrahedron_feinds::tetrahedron_feinds()
    {
        index0 = 0;
        index1 = 0;
        index2 = 0;
        index3 = 0;
        eval0 = 0.0f;
        eval1 = 0.0f;
        eval2 = 0.0f;
        eval3 = 0.0f;
    }

    __device__ __host__ tetrahedron_feinds::~tetrahedron_feinds()
    {

    }


    
};//end namespace fractallevelset
};// end namespace amscuda
