3D: distance to a geoemtry

548
2
04-19-2021 04:56 AM
NorbertThoden
Occasional Contributor III

Hi!

How can i retrieve the distance (or something similar) of an object/geometry at my scene/sceneGraphicsView and the viewpoint/camera?

I want to use this distance to decide if the object has to be displayed in detail (it´s in front of my scene) or rough (it´s more or less far away at the horizon)....

I struggle using GeometryEngine::distance(gemeotry, currentViewpoint().targetGeometry)...

Can someone point me to the rigth direction?

Thx in advance!

Norbert

 

 

0 Kudos
2 Replies
by Anonymous User
Not applicable

Hi there Norbert.

Maybe try something like :

 

GeometryEngine::distance(geometry, currentViewpoint().camera().location());

 

to get the distance between your geometry and the camera position. I'm not sure targetGeometry is quite what you're looking for.

You might also consider using a Distance Composite Symbol for this instead, which might suit your purposes without you having to manually program in the distance checking code.

Hope that helps.

NorbertThoden
Occasional Contributor III

Hi Elliot!

Thanks for your quick answer.

Unfortuately i mixed degree and radiant, so my results were confusing 😞

The approach you are suggesting seems to be fine with one small modification: i´m using distanceGeodetic.

Thanks a lot!

Norbert