Exemple #1
0
    public float Confidence()
    {
        int xCount = m_xValues.Length;
        int yCount = m_yValues.Length;
        //float[] deltas = new float[xCount * yCount];
        float averageError = 0;

        for (int i = 0; i < xCount; i++)
        {
            for (int j = 1; j < yCount; j++)
            {
                float originalValue     = m_zValues[i][j];
                float interpolatedValue = m_polynome2D.Calculate(m_xValues[i], m_yValues[j]);

                float delta = originalValue - interpolatedValue;
                if (interpolatedValue == 0)
                {
                    if (originalValue != 0)
                    {
                        averageError += Mathf.Abs(delta / originalValue);
                    }
                }
                else
                {
                    averageError += Mathf.Abs(delta / interpolatedValue);
                }


                //deltas[i * yCount + j] = delta;
            }
        }

        averageError /= xCount * yCount;
        return(1 - averageError);
    }
Exemple #2
0
    virtual protected void UpdateHeight()
    {
        float angle = Vector3.Angle(transform.forward, Vector3.up);

        m_height = m_heightFormula.Calculate(angle, m_currentVolume / m_scaleFactor) * transform.lossyScale.y;
    }