Exemplo n.º 1
0
        public PriorityQueue2(int capacity = 512)
        {
            priorityMath = TypeMath <TPriority> .GetMath();

            maxPriority = priorityMath.Max;
            Initialize(capacity);
        }
Exemplo n.º 2
0
        public KdTree(int dimensions)
        {
            this.dimensions = dimensions;
            this.typeMath   = TypeMath <TKey> .GetMath();

            Count = 0;
        }
Exemplo n.º 3
0
        public PriorityQueue(int capacity, ITypeMath <TPriority> priorityMath = null)
        {
            if (capacity <= 0)
            {
                throw new ArgumentException("Capacity must be greater than zero");
            }

            this.capacity = capacity;
            queue         = new ItemPriority <TItem, TPriority> [capacity];

            if (priorityMath != null)
            {
                this.priorityMath = priorityMath;
            }
            else
            {
                this.priorityMath = TypeMath <TPriority> .GetMath();
            }
        }
Exemplo n.º 4
0
        public static HyperRect <T> Infinite(int dimensions, ITypeMath <T> math = null)
        {
            if (math == null)
            {
                math = TypeMath <T> .GetMath();
            }

            var rect = new HyperRect <T>();

            rect.MinPoint = new T[dimensions];
            rect.MaxPoint = new T[dimensions];

            for (var dimension = 0; dimension < dimensions; dimension++)
            {
                rect.MinPoint[dimension] = math.NegativeInfinity;
                rect.MaxPoint[dimension] = math.PositiveInfinity;
            }

            return(rect);
        }
Exemplo n.º 5
0
 static DoubleMath()
 {
     // Make sure we register ourselves!
     TypeMath <double> .Register(new DoubleMath());
 }