UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.28 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import t from"../../Graphic.js";import e from"../../core/Collection.js";import{rad2deg as r,deg2rad as o}from"../../core/mathUtils.js";import s from"../../geometry/Mesh.js";import m from"../../geometry/support/MeshMaterial.js";import n from"../../geometry/support/MeshTexture.js";import i from"../../symbols/FillSymbol3DLayer.js";import u from"../../symbols/MeshSymbol3D.js";import{defaultImageSphereCenter as a,defaultImageSphereSize as c}from"./constants.js";function l(t,e=a,r=c){const o=e.clone();o.z=-500;const i=s.createSphere(o,{size:r,densificationFactor:2,vertexSpace:"georeferenced",material:new m({colorTexture:new n({data:t})})});if(i.components[0].trustSourceNormals=!0,i.vertexAttributes.uv){const t=i.vertexAttributes.uv.length??0;for(let e=0;e<t;e++)i.vertexAttributes.uv[2*e+0]=1-i.vertexAttributes.uv[2*e+0],i.vertexAttributes.uv[2*e+1]=i.vertexAttributes.uv[2*e+1]}return i.centerAt(o),i}function p(r){return new t({geometry:r,symbol:new u({symbolLayers:new e([new i])})})}function f(t,e){return 2*r(Math.atan(Math.tan(o(t/2))*Math.sqrt(e**2+1)))}export{l as createImageSphere,f as findDiagonalFOV,p as meshToGraphic};