Exemplo n.º 1
0
        /// <summary>
        /// Adds a point to the tree.
        /// </summary>
        /// <param name="value"></param>
        public void Add(PointType value)
        {
            double value_dimension = value[_dimension];

            if (value_dimension < _value[_dimension])
            { // add to the lesser side.
                if (_lesser == null)
                {
                    _lesser = new Tree2DNode <PointType>(_distance_delegate, value, _dimension + 1 % 2);
                }
                else
                {
                    _lesser.Add(value);
                }
            }
            else
            { // add to the bigger side.
                if (_bigger == null)
                {
                    _bigger = new Tree2DNode <PointType>(_distance_delegate, value, _dimension + 1 % 2);
                }
                else
                {
                    _bigger.Add(value);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds a point to this tree.
 /// </summary>
 /// <param name="point"></param>
 public void Add(PointType point)
 {
     _root.Add(point);
 }