public NearestNeighbourList(ITypeMath <TDistance> distanceMath) { this.maxCapacity = int.MaxValue; this.distanceMath = distanceMath; queue = new PriorityQueue <TItem, TDistance>(distanceMath); }
public NearestNeighbourList(int maxCapacity, ITypeMath <TDistance> distanceMath) { this.maxCapacity = maxCapacity; this.distanceMath = distanceMath; queue = new PriorityQueue <TItem, TDistance>(maxCapacity, distanceMath); }
///<remarks> ///This constructor will use a default capacity of 4. ///</remarks> public PriorityQueue(ITypeMath <TPriority> priorityMath) { this.capacity = 4; queue = new ItemPriority <TItem, TPriority> [capacity]; this.priorityMath = priorityMath; }
public PriorityQueue(int capacity, ITypeMath <TPriority> priorityMath) { if (capacity <= 0) { throw new ArgumentException("Capacity must be greater than zero"); } this.capacity = capacity; queue = new ItemPriority <TItem, TPriority> [capacity]; this.priorityMath = priorityMath; }
public static HyperRect <T> Infinite(int dimensions, ITypeMath <T> math) { 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); }
public T[] GetClosestPoint(T[] toPoint, ITypeMath <T> math) { T[] closest = new T[toPoint.Length]; for (var dimension = 0; dimension < toPoint.Length; dimension++) { if (math.Compare(minPoint[dimension], toPoint[dimension]) > 0) { closest[dimension] = minPoint[dimension]; } else if (math.Compare(maxPoint[dimension], toPoint[dimension]) < 0) { closest[dimension] = maxPoint[dimension]; } else { // Point is within rectangle, at least on this dimension closest[dimension] = toPoint[dimension]; } } return(closest); }
public KdTree(int dimensions, ITypeMath <TKey> typeMath, AddDuplicateBehavior addDuplicateBehavior) : this(dimensions, typeMath) { AddDuplicateBehavior = addDuplicateBehavior; }
public KdTree(int dimensions, ITypeMath <TKey> typeMath) { this.dimensions = dimensions; this.typeMath = typeMath; Count = 0; }
public static void Register <DataType>(ITypeMath <DataType> math) { registeredMath.Add(typeof(DataType), math); }
public TypesComparer(ITypeMath <TKey> typeMath, int byDimension) { this.typeComparer = typeMath; this.byDimension = byDimension; }
public KdTree(int dimensions, ITypeMath <TKey> typeMath, AddDuplicateBehavior addDuplicateBehavior, onUpdateDelegate onNodeUpdate) : this(dimensions, typeMath, addDuplicateBehavior) { OnNodeUpdate = onNodeUpdate; }
public PriorityQueue2(ITypeMath <TPriority> priorityMath, int capacity = 512) { this.priorityMath = priorityMath; //maxPriority = priorityMath.Max; Initialize(capacity); }
/// <summary> /// Initializes a new instance of the <see cref="T:com.kiranpatel.crimecluster.framework.KdTreeWrapper`2"/> class. /// </summary> /// <param name="mathType">Math type.</param> public KdTreeWrapper(ITypeMath <TKey> mathType) { this._kdTree = new KdTree <TKey, TVal>(2, mathType); }