function() { class e extends r.ObjectGroup { constructor(e) { super(r.ObjectGroupType.VIEWSHED, { priority: 20 }), e = e || {}, this._position = new THREE.Vector3(0,0,0), this._direction = new THREE.Vector3(0,0,-1), this._visibleAreaColor = new THREE.Vector4(0,255,0,.8), this._hiddenAreaColor = new THREE.Vector4(255,0,0,.8), this._distance = null != e.distance ? e.distance : 200, this._horizontalFov = null != e.horizontalFov ? e.horizontalFov : 2 * Math.PI / 3, this._verticalFov = null != e.verticalFov ? e.verticalFov : Math.PI / 2, this._translucenceAvailable = !1 !== e.translucenceAvailable, this._frustumVisible = e.frustumVisible, this._effectVisible = !0, this.visible = this._frustumVisible, this._up = new THREE.Vector3(0,1,0), this._right = new THREE.Vector3(1,0,0), this._unitAngle = 5, this._cornerLeftTop = new THREE.Vector3, this._cornerRightTop = new THREE.Vector3, this._cornerLeftBottom = new THREE.Vector3, this._cornerRightBottom = new THREE.Vector3, this._viewer = null, this._lineGeometry = new THREE.BufferGeometry, this._lineMaterial = new THREE.LineBasicMaterial({ color: 16777215 }), this._lineMesh = new THREE.LineSegments(this._lineGeometry,this._lineMaterial), this._sphereGeometry = new THREE.BufferGeometry, this._sphereMaterial = new THREE.MeshBasicMaterial({ color: 16777215, side: THREE.DoubleSide }), this._sphereMesh = new THREE.Mesh(this._sphereGeometry,this._sphereMaterial), this._sphereMesh.visible = !1, this.camera = new THREE.PerspectiveCamera, this.viewMatrix = new THREE.Matrix4, this.viewProjMatrix = new THREE.Matrix4, this.depthRenderTarget = new THREE.WebGLRenderTarget(1024,1024,{ minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter }); var t = new THREE.Vector3; this.updateViewMatrix = function() { t.copy(this._position), t.add(this._direction), this.camera.position.copy(this._position), this.camera.lookAt(t), this.camera.updateMatrixWorld(!0), this.viewMatrix.copy(this.camera.matrixWorld).invert() } ; var i = new THREE.Vector3; new THREE.Vector3; this.updateProjMatrix = function() { var e = Math.cos(this._horizontalFov / 2) , t = Math.tan(this._verticalFov / 2) , r = Math.atan(e * t) , a = this._distance * Math.cos(r) * Math.cos(this._horizontalFov / 2); i.copy(this._position), i.addScaledVector(this._direction, a); var n = a * Math.tan(this._horizontalFov / 2) , s = a * Math.tan(this._verticalFov / 2); this._cornerLeftTop.copy(i), this._cornerLeftTop.addScaledVector(this._right, -n), this._cornerLeftTop.addScaledVector(this._up, s), this._cornerRightTop.copy(i), this._cornerRightTop.addScaledVector(this._right, n), this._cornerRightTop.addScaledVector(this._up, s), this._cornerLeftBottom.copy(i), this._cornerLeftBottom.addScaledVector(this._right, -n), this._cornerLeftBottom.addScaledVector(this._up, -s), this._cornerRightBottom.copy(i), this._cornerRightBottom.addScaledVector(this._right, n), this._cornerRightBottom.addScaledVector(this._up, -s); var o = Math.tan(.5 * this._horizontalFov) / Math.tan(.5 * this._verticalFov); this.camera.fov = THREE.Math.radToDeg(this._verticalFov), this.camera.aspect = o, this.camera.near = .01, this.camera.far = Math.max(this._distance), this.camera.updateProjectionMatrix() } , this.getViewProjMatrix = function() { return this.viewProjMatrix.multiplyMatrices(this.camera.projectionMatrix, this.viewMatrix), this.viewProjMatrix } , this.createSideLines = function() { for (var e = [], t = [this._cornerLeftBottom, this._cornerRightBottom, this._cornerRightTop, this._cornerLeftTop], i = 0; i < t.length; i++) e.push(this._position.x, this._position.y, this._position.z), e.push(t[i].x, t[i].y, t[i].z); return e } ; var a = new THREE.Vector3 , n = new THREE.Vector3 , s = new THREE.Vector3 , o = new THREE.Vector3 , l = [] , d = this; this.createTopSideLines = function() { var e = []; function t(e, t, i) { var r = []; if (i) { for (var a = e; a < t; ) if (r.push(a), (a += d._unitAngle) >= t) { r.push(t); break } } else for (a = t; a > e; ) if (r.push(a), (a -= d._unitAngle) <= e) { r.push(e); break } return r } a.copy(this._cornerLeftTop), a.sub(this._position), n.copy(this._cornerRightTop), n.sub(this._position), s.copy(this._cornerRightBottom), s.sub(this._position); var i, r, h = THREE.Math.radToDeg(n.angleTo(s)), c = THREE.Math.radToDeg(a.angleTo(n)), u = [{ axis: "up", outerAngle: -this._horizontalFov / 2, innerAngles: t(-h / 2, h / 2, !0) }, { axis: "right", outerAngle: this._verticalFov / 2, innerAngles: t(-c / 2, c / 2, !0) }, { axis: "up", outerAngle: this._horizontalFov / 2, innerAngles: t(-h / 2, h / 2, !1) }, { axis: "right", outerAngle: -this._verticalFov / 2, innerAngles: t(-c / 2, c / 2, !1) }]; l = []; for (var p = 0; p < u.length; p++) { "up" == u[p].axis ? (i = this._up, r = this._right) : "right" == u[p].axis && (i = this._right, r = this._up); for (var m = [], f = 0; f < u[p].innerAngles.length; f++) { o.copy(this._direction), o.applyAxisAngle(r, THREE.Math.degToRad(u[p].innerAngles[f])), o.applyAxisAngle(i, u[p].outerAngle), o.multiplyScalar(this._distance); var g = new THREE.Vector3; g.copy(this._position), g.add(o), m.push(g), l.push(g) } for (f = 0; f < m.length - 1; f++) e.push(m[f].x, m[f].y, m[f].z), e.push(m[f + 1].x, m[f + 1].y, m[f + 1].z) } return e } ; var h = new THREE.Vector3 , c = new THREE.Vector3 , u = new THREE.Vector3 , p = new THREE.Vector3 , m = new THREE.Quaternion; this.createTopLines = function() { var e = []; h.copy(this._position), h.addScaledVector(this._direction, this._distance), c.copy(h), c.sub(this._position), c.normalize(); for (var t = [], i = 0, r = 0; r < l.length; r++) { p.copy(l[r]), p.sub(this._position), p.normalize(), u.copy(c), u.cross(p), u.normalize(); for (var a = THREE.Math.radToDeg(c.angleTo(p)), n = [], s = 0; ; s += this._unitAngle) { s >= a && (s = a), m.setFromAxisAngle(u, THREE.Math.degToRad(s)), o.copy(c), o.applyQuaternion(m); var d = new THREE.Vector3; if (d.copy(this._position), d.addScaledVector(o, this._distance), n.push(d), s >= a) break } i = Math.max(i, n.length), t.push(n) } for (r = 0; r < t.length; r++) for (s = 0; s < t[r].length - 1; s++) e.push(t[r][s].x, t[r][s].y, t[r][s].z), e.push(t[r][s + 1].x, t[r][s + 1].y, t[r][s + 1].z); for (r = 1; r < i; r++) for (s = 0; s < t.length - 1; s++) t[s][r] && t[s + 1][r] && (e.push(t[s][r].x, t[s][r].y, t[s][r].z), e.push(t[s + 1][r].x, t[s + 1][r].y, t[s + 1][r].z)); return e } , this.updateMeshGeometry = function() { this.updateViewMatrix(), this.updateProjMatrix(), this._sphereGeometry = new THREE.SphereGeometry(this._distance,40,40), this._sphereGeometry.translate(this._position.x, this._position.y, this._position.z); var e = []; return e = (e = (e = e.concat(this.createSideLines())).concat(this.createTopSideLines())).concat(this.createTopLines()), this._lineGeometry.deleteAttribute("position"), this._lineGeometry.setAttribute("position", new THREE.BufferAttribute(new Float32Array(e),3)), this._lineGeometry } , this.initPrimitive = function() { this.updateMeshGeometry(), this._lineMesh.geometry = this._lineGeometry, this.add(this._lineMesh), this._sphereMesh.geometry = this._sphereGeometry, this.add(this._sphereMesh) } , this.updatePrimitive = function() { this.updateMeshGeometry(), this._lineMesh.geometry = this._lineGeometry, this._sphereMesh.geometry = this._sphereGeometry } , r.Viewshed.prototype.getId = function() { return this.uuid } ; var f = { x: 0, y: 0, z: 0 }; r.Viewshed.prototype.getPositon = function() { return f.x = this._position.x, f.y = this._position.y, f.z = this._position.z, f } ; var g = new THREE.Vector3; r.Viewshed.prototype.setPosition = function(e) { g.x = e.x, g.y = e.y, g.z = e.z, this._position != g && (this._position.copy(g), this.updatePrimitive()) } ; var v = { x: 0, y: 0, z: 0 }; r.Viewshed.prototype.getDirection = function() { return v.x = this._direction.x, v.y = this._direction.y, v.z = this._direction.z, v } ; var y = new THREE.Vector3(0,1,0) , M = new THREE.Vector3; r.Viewshed.prototype.setDirection = function(e) { M.x = e.x, M.y = e.y, M.z = e.z, M.normalize(), this._direction != M && (0 !== M.lengthSq() ? (this._direction.copy(M), this._right.crossVectors(y, M), 0 === this._right.lengthSq() && (1 === Math.abs(y.z) ? M.x += 1e-4 : M.z += 1e-4, M.normalize(), this._right.crossVectors(y, M)), this._right.normalize(), this._up.crossVectors(M, this._right), this.updatePrimitive()) : r.Logger.warn("WARNING: Invalid direction when CLOUD.Viewshed.prototype.setDirection()")) } ; var E = { x: 0, y: 0, z: 0, w: 0 }; r.Viewshed.prototype.getVisibleAreaColor = function() { return E.x = this._visibleAreaColor.x, E.y = this._visibleAreaColor.y, E.z = this._visibleAreaColor.z, E.w = this._visibleAreaColor.w, E } ; var I = new THREE.Vector4; r.Viewshed.prototype.setVisibleAreaColor = function(e) { I.x = e.red || e.x ? e.red || e.x : 0, I.y = e.green || e.y ? e.green || e.y : 0, I.z = e.blue || e.z ? e.blue || e.z : 0, I.w = e.alpha || e.w ? e.alpha || e.w : 0, this._visibleAreaColor != I && (this._visibleAreaColor.copy(I), this.updatePrimitive()) } ; var b = { x: 0, y: 0, z: 0, w: 0 }; r.Viewshed.prototype.getHiddenAreaColor = function() { return b.x = this._hiddenAreaColor.x, b.y = this._hiddenAreaColor.y, b.z = this._hiddenAreaColor.z, b.w = this._hiddenAreaColor.w, b } ; var x = new THREE.Vector4; r.Viewshed.prototype.setHiddenAreaColor = function(e) { x.x = e.red || e.x ? e.red || e.x : 0, x.y = e.green || e.y ? e.green || e.y : 0, x.z = e.blue || e.z ? e.blue || e.z : 0, x.w = e.alpha || e.w ? e.alpha || e.w : 0, this._hiddenAreaColor != x && (this._hiddenAreaColor.copy(x), this.updatePrimitive()) } , r.Viewshed.prototype.getDistance = function() { return this._distance } , r.Viewshed.prototype.setDistance = function(e) { this._distance != e && (this._distance = e, this.updatePrimitive()) } , r.Viewshed.prototype.getHorizontalFov = function() { return this._horizontalFov } , r.Viewshed.prototype.setHorizontalFov = function(e) { this._horizontalFov != e && (this._horizontalFov = e, this.updatePrimitive()) } , r.Viewshed.prototype.getVerticalFov = function() { return this._verticalFov } , r.Viewshed.prototype.setVerticalFov = function(e) { this._verticalFov != e && (this._verticalFov = e, this.updatePrimitive()) } , r.Viewshed.prototype.setTranslucenceAvailable = e=>{ this._translucenceAvailable = e } , r.Viewshed.prototype.getTranslucenceAvailable = ()=>this._translucenceAvailable, r.Viewshed.prototype.show = function() { this._effectVisible = !0, this._frustumVisible && (this.visible = !0), this._viewer && this._viewer.viewshedManager.update() } , r.Viewshed.prototype.hide = function() { this._effectVisible = !1, this.visible = !1, this._viewer && this._viewer.viewshedManager.update() } , r.Viewshed.prototype.setFrustumVisible = function(e) { this._frustumVisible = e, this.visible = e, this._viewer && this._viewer.viewshedManager.update() } , r.Viewshed.prototype.isFrustumVisible = function() { return this._frustumVisible } , r.Viewshed.prototype.isEffectVisible = function() { return !0 === this._effectVisible } , this.setPosition(null != e.position ? e.position : this._position), this.setDirection(null != e.direction ? e.direction : this._direction), this.setVisibleAreaColor(null != e.visibleAreaColor ? e.visibleAreaColor : this._visibleAreaColor), this.setHiddenAreaColor(null != e.hiddenAreaColor ? e.hiddenAreaColor : this._hiddenAreaColor), this.initPrimitive() } } r.Viewshed = e }()
#####################