I have a pointcloud of points :
22761.087002 -44053.867001 5.962000
22812.406998 -44102.647003 3.102000
22788.186996 -44075.726997 4.282000
22798.046997 -44052.957001 3.722000
22848.367004 -44075.647003 3.252000
22760.997002 -44045.387001 3.842000
22751.637001 -44033.527000 3.762000
…
When I load the tileset using url, I get the tileset with root. If root has children then, I can calculate the combined matrix like this:
const computedMatrix = Matrix4.multiply(tileSet.root.computedTransform, tileSet.root.children[0].transform, new Matrix4);
And I can calculate inverse transformation matrix to transform any data I get from cesium to transform to original data space (local coordinate).
const inverseTransform = Matrix4.inverse(tileSetData.computedTransform, new Matrix4);
This is the result I get, after applying the inverse transform to the points of polygon that I draw in cesium. And this is in the local space of point cloud.
34381.958484849005, -117913.69902407628, 29.523734231479466
34390.443633324045, -117874.04395654955, 28.2258776454255
34432.90450144377, -117874.6362562456, 30.12187748309225
34454.30669785621, -117909.00864487159, 31.794888480566442
34421.19791117641, -117928.21807036008, 30.219753425568342
But if the root does not have children, then only option is to use the inverse of the transform of computedTransform of root, then the data gets transformed around the origin. This is the inverse-transformed polygon created in cesium.
-5.3141489599505025, 19.25405962415607, 3.2960915258154273
-21.74681983028069, -6.117180594945239, 7.200840308330953
-5.172211614684161, -27.57846768456875, 3.644615152850747
7.337120309690985, -4.773393628423946, 3.571008182130754
How can I calculate accurate combined transform?
And, these data are from the same file loaded in different cesium Ion account, When loading one has root with children and other does not. I was wondering, what determines the root to have children or not.