-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bounding volume computation improvements #79
Conversation
I did examine the computation of the oriented bounding boxes (for point clouds, and in general) a bit more. The reason for the bounding boxes not being very tight is that the current In the last commit, I replaced this function with one that computes the oriented bounding boxes using https://github.com/Esri/dito.ts For a test, I generated 5x5x5 "point clouds" with varying numbers of points (200....25000), randomly distributed within boxes, with different sizes and orientations. For each of them, I computed the OBB once with CesiumJS and once with dito.ts, measured the computation time and the volume of the box. The computation with dito.ts is noticably slower (very roughly by a factor of 6), but in nearly all cases, the bounding volumes are smaller (sometimes by a factor of nearly 3). The proof is in the pudding: Here's a visualization of the results: (the data is attached below). Overall, I think that it makes sense to use this function for the computation of the bounding volumes when creating a tileset JSON. The computation is not really "time-critical" in this case. And "bad bounding volumes" can lead to "bad runtime behavior". What remains to be done here:
The data (all GLBs with two tileset JSON files) is here: orientedBoundingBoxComparison-2023-11-07.zip Timing results:
|
Addresses #58 and #69 (and may eventually fix them).
(It builds on #75 , so that should be merged first, but there is not much "overlap", so the changes here could also be retargeted to another branch)
The
createTilesetJson
function takes a set of tile content files, and creates a tileset JSON file from them. Thus usually boiled down to computing the bounding box of a GLB, and eventually, creating an axis-aligned bounding box. As pointed out in #47 (comment) , this will usually not yield a very tight bounding volume.The
merge
function receives multiple tilesets, and creates a single tileset from them - basically by creating a new tileset where the root node refers to the root node of the other tileset as its children. As mentioned in #69 (comment) , this used some "legacy" functionality which created bounding spheres for the result.This PR adds a few new functions, mostly in the
BoundingVolumes
class (and corresponding updates in theTilesetJsonCreator
andTilesetMerger
) for better bounding volume computations. The summary is, roughly:TilesetJsonCreator
andTilesetMerger
). This basically means:Applied to the content that was provided by @sweco-sekrsv in #47 , this will yield better results;
The (single) test case for the
merge
operation does no longer create a bounding sphere:The test cases for
createTilesetJson
generally yield tighter bounding volumes:(There is not much difference for the point clouds, and one could expect better ones to be computed there - this still has to be reviewed...)