Exemple #1
0
        /// <summary>
        /// Extend this node to contain a new point.
        /// </summary>
        /// <param name="tPoint">The point to contain.</param>
        private void ExtendBounds(DomainType[] tPoint)
        {
            // If we don't have bounds, create them using the new point then bail.
            if (tMinBound == null)
            {
                tMinBound = new DomainType[d_dimension_count];
                tMaxBound = new DomainType[d_dimension_count];
                Array.Copy(tPoint, tMinBound, d_dimension_count);
                Array.Copy(tPoint, tMaxBound, d_dimension_count);
                return;
            }

            // For each dimension.
            for (int i = 0; i < d_dimension_count; ++i)
            {
                if (d_algebra.IsNaN(tPoint[i]))
                {
                    if (!d_algebra.IsNaN(tMinBound[i]) || !d_algebra.IsNaN(tMaxBound[i]))
                    {
                        bSinglePoint = false;
                    }
                    tMinBound[i] = d_algebra.NaN;
                    tMaxBound[i] = d_algebra.NaN;
                }
                else if (tMinBound[i].CompareTo(tPoint[i]) == 1)
                {
                    tMinBound[i] = tPoint[i];
                    bSinglePoint = false;
                }
                else if (tMaxBound[i].CompareTo(tPoint[i]) == -1)
                {
                    tMaxBound[i] = tPoint[i];
                    bSinglePoint = false;
                }
            }
        }