How to draw frustum graphic on Scene from JavaScript SDK.

421
3
04-19-2023 06:03 AM
jauhari_mani
Occasional Contributor

I possess metadata for an image, and I wish to create a frustum that displays the camera's field of view extending to the ground, similar to the image attached. However, I'm having difficulty determining the appropriate graphic to use when drawing the frustum within the scene view.

jauhari_mani_0-1681909332085.png

 

Tags (3)
0 Kudos
3 Replies
JamesIng
New Contributor III

Potentially look at using 3D mesh primitives for generating the frustum geometry.
https://developers.arcgis.com/javascript/latest/sample-code/geometry-mesh-primitives/

You'll need manually calculate the camera field of view into a given set of co-ordinates for the mesh.

James from www.landkind.com
0 Kudos
jauhari_mani
Occasional Contributor

I appreciate your response. Is it possible for you to provide me with some documentation that I can consult in order to create a frustum ?

0 Kudos
JamesIng
New Contributor III

You'll want to look into these resources.
The Mesh itself:
https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html
Which you can manually create by supplying a set of co-ordinates for each point of the fulcrum.
The fulcrum itself is reall just a pyramid that is representation of the camera viewport.

This means we can also make use of other helper functions like screenToMap:
https://developers.arcgis.com/javascript/latest/api-reference/esri-views-draw-DrawAction.html#screen...

This coverts a given screen point into a map point. If you run this on each corner of the screen it'll return the four points of the base of the pyramid. Withe the top of the pyramid being the existing camera point location.


Hopefully this gives you a helping hand in getting started.

James from www.landkind.com
0 Kudos