## Code Excerpt for Texture Model Grid

    Scalar Density; // in [0 .. 1] stepsize 0.01
    Scalar GridH;   // in [0 .. 0.25] stepsize 0.01
    Scalar GridV;   // in [0 .. 0.25] stepsize 0.01
    Scalar Shape;   // in [0 .. 1] stepsize 0.05

    void TextureGrid::setupParameter(const std::vector<Scalar> &parameter){

        cell_ = 0.02 + (Density * 0.25);
        grid_h_ = GridH;
        grid_v_ = GridV;
        norm_ = pow (2.0, (Shape * 4 ));

    }

    Scalar TextureGrid::evaluate(const Scalar &x_norm, const Scalar &y_norm) {

        Scalar value = 0.0;

        Scalar cell_grid_h = cell_+grid_h_;
        Scalar cell_grid_v = cell_+grid_v_;

        Scalar x = x_norm / (Scalar) cell_grid_h;
        Scalar x_frac = x - floor(x);
        x_frac = (x_frac) * cell_grid_h / cell_;

        Scalar y = y_norm / (Scalar) cell_grid_v;
        Scalar y_frac = y - floor(y);
        y_frac = (y_frac) * cell_grid_v / cell_;

        x_frac = (x_frac - 0.5) * 2.0;
        y_frac = (y_frac - 0.5) * 2.0;

        Scalar distance = pow(fabs(x_frac),norm_) + pow(fabs(y_frac),norm_);

        value = (distance > 1.0 ? 0.0 : 1.0);

        return value;

    }