/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t}from"tslib";import{rad2deg as e,deg2rad as s}from"../../../../core/mathUtils.js";import{property as o,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{mul as n,fromTranslation as r,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 h}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import p from"../../webgl/RenderCamera.js";import{assert as m}from"./Util.js";let g=class extends p{constructor(){super(...arguments),this.sectionAngles=l()}get sectionAnglesDeg(){return h(this.sectionAngles.map(t=>e(t)))}set sectionAnglesDeg(t){this.sectionAngles=h(t.map(t=>s(t)))}get projectionMatrix(){return n(c(),this.sectionMatrix,this._projectionMatrixInternal)}get sectionMatrix(){const t=this.sectionAngles[0],e=this.sectionAngles[1],s=this.sectionAngles[2],o=this.sectionAngles[3];m(t<=e),m(s<=o);const i=2*Math.tan(this.fovX/2),l=2*Math.tan(this.fovY/2),h=Math.tan(t),p=Math.tan(e),g=Math.tan(s),M=p-h,f=Math.tan(o)-g,A=i/M,u=l/f,x=-(h+M/2)/i*2,j=-(g+f/2)/l*2,b=c();r(b,[x,j,0]);const v=c();a(v,[A,u,1]);const d=c();return n(d,v,b)}get _sectionRatioX(){const t=Math.tan(this.sectionAngles[0]),e=Math.tan(this.sectionAngles[1]),s=2*Math.tan(this.fovX/2);return Math.min(1,(e-t)/s)}setViewport(t,e){const s=e*this._sectionRatioX;return this.viewport=[t[0],t[1],s,e],s}};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([i("esri.views.3d.webgl-engine.lib.ViewshedFaceCamera")],g);export{g as ViewshedFaceCamera};
