protected override void OnRecycle() { _partition = null; _enumerator.Dispose(); _enumerator = null; Pool.Recycle(this); }
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); }
/// <inheritdoc/> protected override void CloneCore(BasePartition <T> source) { // Clone BasePartition<T> properties. base.CloneCore(source); // Clone DualPartition<T> properties. var sourceTyped = (DualPartition <T>)source; sourceTyped.StaticPartition = sourceTyped.StaticPartition.Clone(); sourceTyped.DynamicPartition = sourceTyped.DynamicPartition.Clone(); }
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); }
/// <inheritdoc/> protected override void CloneCore(BasePartition <T> source) { // Clone BasePartition<T> properties. base.CloneCore(source); // Clone DynamicAabbTree<T> properties. var sourceTyped = (DynamicAabbTree <T>)source; EnableMotionPrediction = sourceTyped.EnableMotionPrediction; MotionPrediction = sourceTyped.MotionPrediction; OptimizationPerFrame = sourceTyped.OptimizationPerFrame; RelativeMargin = sourceTyped.RelativeMargin; }
protected override void OnRecycle() { _partition = null; _otherPartition = null; _candidates.Dispose(); _candidates = null; if (_otherCandidates != null) { _otherCandidates.Dispose(); _otherCandidates = null; } Pool.Recycle(this); }
public static IEnumerable <Pair <T> > Create(BasePartition <T> partition, ISpatialPartition <T> otherPartition, IEnumerable <T> candidates, ref Vector3F scale, ref Vector3F otherScaleInverse, ref Pose toOther) { var enumerable = Pool.Obtain(); enumerable._partition = partition; enumerable._otherPartition = otherPartition; enumerable._candidates = candidates.GetEnumerator(); enumerable._scale = scale; enumerable._otherScaleInverse = otherScaleInverse; enumerable._toOther = toOther; return(enumerable); }
public static IEnumerable <T> Create(BasePartition <T> partition, ref Ray ray) { var enumerable = Pool.Obtain(); enumerable._partition = partition; enumerable._ray = ray; enumerable._rayDirectionInverse = new Vector3F(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); }
/// <inheritdoc/> protected override void CloneCore(BasePartition <T> source) { base.CloneCore(source); }
protected virtual void CloneCore(BasePartition <T> source) { EnableSelfOverlaps = source.EnableSelfOverlaps; Filter = source.Filter; GetAabbForItem = source.GetAabbForItem; }