UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.12 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as t}from"../../../../chunks/tslib.es6.js";import{rad2deg as s,deg2rad as e}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{mul as i,fromTranslation as n,fromScaling as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as l,fromArray as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import m from"../../webgl/RenderCamera.js";import{assert as h}from"./Util.js";let g=class extends m{constructor(){super(...arguments),this.sectionAngles=l()}get sectionAnglesDeg(){return p(this.sectionAngles.map((t=>s(t))))}set sectionAnglesDeg(t){this.sectionAngles=p(t.map((t=>e(t))))}get projectionMatrix(){return i(c(),this.sectionMatrix,this._projectionMatrixInternal)}get sectionMatrix(){const t=this.sectionAngles[0],s=this.sectionAngles[1],e=this.sectionAngles[2],o=this.sectionAngles[3];h(t<=s),h(e<=o);const r=2*Math.tan(this.fovX/2),l=2*Math.tan(this.fovY/2),p=Math.tan(t),m=Math.tan(s),g=Math.tan(e),f=m-p,M=Math.tan(o)-g,j=r/f,u=l/M,A=-(p+f/2)/r*2,x=-(g+M/2)/l*2,b=c();n(b,[A,x,0]);const d=c();a(d,[j,u,1]);const v=c();return i(v,d,b)}get _sectionRatioX(){const t=Math.tan(this.sectionAngles[0]),s=Math.tan(this.sectionAngles[1]),e=2*Math.tan(this.fovX/2);return Math.min(1,(s-t)/e)}setViewport(t,s){const e=s*this._sectionRatioX;return this.viewport=[t[0],t[1],e,s],e}};t([o()],g.prototype,"sectionAngles",void 0),t([o()],g.prototype,"sectionAnglesDeg",null),t([o()],g.prototype,"projectionMatrix",null),t([o()],g.prototype,"sectionMatrix",null),t([o()],g.prototype,"_sectionRatioX",null),g=t([r("esri.views.3d.webgl-engine.lib.ViewshedFaceCamera")],g);export{g as ViewshedFaceCamera};