allen-cell-animated / volume-viewer

https://allen-cell-animated.github.io/volume-viewer/
Other
90 stars 7 forks source link

Subregion type part 2: `VolumeCache` #137

Closed frasercl closed 1 year ago

frasercl commented 1 year ago

Addresses #132: there are currently two unconnected areas of the app that care about subregions of the volume, and they use unrelated types to express these subregions. Eventually we will connect these two systems, and it would be nice if they both spoke the same language when we do. This PR and its counterpart (#136) convert both to use three.js's native Box3 type.

This PR adapts the (as yet unused) VolumeCache class to use Box3 rather than a custom subregion type, and updates its tests. Note that it also introduces a minor behavior change: ranges were previously treated as inclusive on both ends (i.e. a range with an x min of 1 and max of 2 would be understood as a subregion containing rows 1 and 2 of the volume), but are now inclusive in min and exclusive in max (i.e. x min of 1 and max of 2 means a volume containing only row 1).