Ejemplo n.º 1
0
    /*!
    \brief Initialize the generator
    \param func The repartition function
    \param min The minimum value
    \param max The maximum value
    \param step The step
       */
    public void init(repartitionFunc func, float min, float max, float step = 0.1f)
    {
        _min = min;
        _step = step;
        _tab = new float[(int)((max - min) / step) + 3];
        _sizeTab = (int)((max - min) / step) + 3;

        float last = 0f;
        float i = min;
        int j = 0;
        while (i < max)
          {
        _tab[j] = func(i, 0f, 0.3f) + last;
        last = _tab[j];
        j++;
        i += step;
          }
        _localMax = last;
    }
Ejemplo n.º 2
0
    /*!
     * \brief Initialize the generator
     * \param func The repartition function
     * \param min The minimum value
     * \param max The maximum value
     * \param step The step
     */
    public void init(repartitionFunc func, float min, float max, float step = 0.1f)
    {
        _min     = min;
        _step    = step;
        _tab     = new float[(int)((max - min) / step) + 3];
        _sizeTab = (int)((max - min) / step) + 3;

        float last = 0f;
        float i    = min;
        int   j    = 0;

        while (i < max)
        {
            _tab[j] = func(i, 0f, 0.3f) + last;
            last    = _tab[j];
            j++;
            i += step;
        }
        _localMax = last;
    }
Ejemplo n.º 3
0
    public void init(repartitionFunc func, float min, float max, float step = 0.1f)
    {
        _func = func;
        _max = max;
        _min = min;
        _step = step;
        _tab = new float[(int)((max - min) / step) + 2];
        _sizeTab = (int)((max - min) / step) + 2;

        float last = 0f;
        float i = min;
        int j = 0;
        while (i < max)
          {
        _tab[j] = func(i, 0f, 1f) + last;
        //         Debug.Log(_tab[j]);
        last = _tab[j];
        j++;
        i += step;
          }
        _localMax = last;
        //     Debug.Log(j + " != " + _sizeTab + " i = " + i);
        //     _tab[j] = last;
    }
Ejemplo n.º 4
0
 public NumberGenerator(repartitionFunc func, float min, float max, float step = 0.1f)
 {
     init(func, min, max, step);
 }
Ejemplo n.º 5
0
 //! Constructor
 public NumberGenerator(repartitionFunc func, float min, float max, float step = 0.1f)
 {
     init(func, min, max, step);
 }