How to calculate boundingbox of entity?

Dear all,
I want to draw a box around an object when it has picked on map. But I don't know how to calculate bounding box of this object. I think we should have some calculation from model matrix. Does anyone have any suggestion for this task?
Thank all.

The model matrix mostly describes the position, orientation and scale applied to a model or entity, not necessarily the dimensions of the geometry itself. What kind of entity is it? I think there’s different ways to do this depending on what kind of geometry type it is, or if it’s a billboard etc.

Although, taking another look, it looks like there does exist a private function DataSourceDisplay.getBoundingSphere that can compute this for any given entity. This is what the viewer uses to figure out how to fly to/zoom to an entity. You can look at the code for it to see how it does it, or try to call it directly.

Let me know if you figure out a good way to do this!

Entity in my question is billboard, polyline, polygon, 3D model. I try to enable boundingsphere of billboard but it’s look to large. Could you give me some examples how to use
DataSourceDisplay.getBoundingSphere? Thank for your support.
This image show what i want to do.

Vào Th 5, 13 thg 6, 2019 vào lúc 01:23 Omar Shehata omar.sameh.shehata@gmail.com đã viết:

Hi,
I’m using DataSourceDisplay.getBoundingSphere to calculate bounding sphere. This is result, i use circle to draw bounding on map.

It’s look good but i want to calculate bounding rectangle. How could i do it?

Vào Th 5, 13 thg 6, 2019 vào lúc 15:36 Pham Long long3009@gmail.com đã viết:

I'm using third party to calculate bounding rectangle. Now, it's work properly.
Thank for your support.

In case anyone else runs into the same issue, can you post what you used to calculate the bounding rectangle?

Hi,
I already sad above post. I used third party to calculate the bounding box of entity. I my case I use JSTS library to calculate boundingbox (getEnvelope function).

Vào Th 4, 10 thg 7, 2019 vào lúc 01:17 Omar Shehata omar.sameh.shehata@gmail.com đã viết:

Dear all,
I want to get orientedBoundingBox of entity,entity in my question is .polygon,.glb/gltf model, Does anyone have any suggestion for this task? many thx