示例#1
0
            public static IEnumerable <Pair <T> > Create(BasePartition <T> partition, ISpatialPartition <T> otherPartition)
            {
                var enumerable = Pool.Obtain();

                enumerable._partition      = partition;
                enumerable._otherPartition = otherPartition;
                enumerable._candidates     = partition.GetOverlaps(otherPartition.Aabb).GetEnumerator();
                return(enumerable);
            }
示例#2
0
            public static IEnumerable <T> Create(BasePartition <T> partition, T item)
            {
                var enumerable = Pool.Obtain();

                enumerable._partition = partition;
                enumerable._item      = item;
                Aabb aabb = partition.GetAabbForItem(item);

                enumerable._enumerator = partition.GetOverlaps(aabb).GetEnumerator();
                return(enumerable);
            }
示例#3
0
            public static IEnumerable <T> Create(BasePartition <T> partition, ref Ray ray)
            {
                var enumerable = Pool.Obtain();

                enumerable._partition           = partition;
                enumerable._ray                 = ray;
                enumerable._rayDirectionInverse = new Vector3(1 / ray.Direction.X,
                                                              1 / ray.Direction.Y,
                                                              1 / ray.Direction.Z);
                enumerable._epsilon = Numeric.EpsilonF * (1 + partition.Aabb.Extent.Length);

                Aabb rayAabb = new Aabb(ray.Origin, ray.Origin);

                rayAabb.Grow(ray.Origin + ray.Direction * ray.Length);
                enumerable._enumerator = partition.GetOverlaps(rayAabb).GetEnumerator();
                return(enumerable);
            }