Allocator2D
Description
- Derived from
-
AllocatorBase<Vec2I, Vec2I, Box2I> abstract
Helper class for allocating slot ranges in a two-dimensional square domain:
slots (X,Y) +---+---+---+---+ \ |0,0|1,0|2,0|3,0| | +---+---+---+---+ | |0,1|1,1|2,1|3,1| | +---+---+---+---+ | capacity |0,2|1,2|2,2|3,2| | (here 4) +---+---+---+---+ | |0,3|1,3|2,3|3,3| | +---+---+---+---+ / \_______________/ capacity (here 4)
For optimal results, the aspect ratio of the dimensions passed to IAllocator.Allocate should be close to one of the following values:
-
1 / 4 = 0.25; 4 / 1 = 4.00
-
1 / 3 = 0.33; 3 / 1 = 3.00
-
2 / 5 = 0.40; 5 / 2 = 2.50
-
1 / 2 = 0.50; 2 / 1 = 2.00
-
2 / 3 = 0.67; 3 / 2 = 1.50
-
3 / 4 = 0.75; 4 / 3 = 1.33
-
1 / 1 = 1.00
The slot ranges returned by IAllocator.Range may have dimensions that are greater then the dimensions that have been passed to IAllocator.Allocate. Also, the returned range may have transposed dimensions.