1 line
69 KiB
Plaintext
1 line
69 KiB
Plaintext
|
{"version":3,"file":"TerrainEncoding-82b55fe0.js","sources":["../../../../Source/Core/EllipsoidalOccluder.js","../../../../Source/Core/TerrainExaggeration.js","../../../../Source/Core/TerrainQuantization.js","../../../../Source/Core/TerrainEncoding.js"],"sourcesContent":["import BoundingSphere from \"./BoundingSphere.js\";\nimport Cartesian3 from \"./Cartesian3.js\";\nimport Check from \"./Check.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport Ellipsoid from \"./Ellipsoid.js\";\nimport Rectangle from \"./Rectangle.js\";\n\n/**\n * Determine whether or not other objects are visible or hidden behind the visible horizon defined by\n * an {@link Ellipsoid} and a camera position. The ellipsoid is assumed to be located at the\n * origin of the coordinate system. This class uses the algorithm described in the\n * {@link https://cesium.com/blog/2013/04/25/Horizon-culling/|Horizon Culling} blog post.\n *\n * @alias EllipsoidalOccluder\n *\n * @param {Ellipsoid} ellipsoid The ellipsoid to use as an occluder.\n * @param {Cartesian3} [cameraPosition] The coordinate of the viewer/camera. If this parameter is not\n * specified, {@link EllipsoidalOccluder#cameraPosition} must be called before\n * testing visibility.\n *\n * @constructor\n *\n * @example\n * // Construct an ellipsoidal occluder with radii 1.0, 1.1, and 0.9.\n * const cameraPosition = new Cesium.Cartesian3(5.0, 6.0, 7.0);\n * const occluderEllipsoid = new Cesium.Ellipsoid(1.0, 1.1, 0.9);\n * const occluder = new Cesium.EllipsoidalOccluder(occluderEllipsoid, cameraPosition);\n *\n * @private\n */\nfunction EllipsoidalOccluder(ellipsoid, cameraPosition) {\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.object(\"ellipsoid\", ellipsoid);\n //>>includeEnd('debug');\n\n this._ellipsoid = ellipsoid;\n this._cameraPosition = new Cartesian3();\n this._cameraPositionInScaledSpace = new Cartesian3();\n this._distanceToLimbInScaledSpaceSquared = 0.0;\n\n // cameraPosition fills in the above values\n if (defined(cameraPosition)) {\n this.cameraPosition = cameraPosition;\n }\n}\n\nObject.defineProperties(EllipsoidalOccluder.prototype, {\n /**\n * Gets the occluding ellipsoid.\n * @memberof EllipsoidalOccluder.prototype\n * @type {Ellipsoid}\n */\n ellipsoid: {\n get: function () {\n return this._ellipsoid;\n },\n },\n /**\n * Gets or sets the position of the camera.\n * @memberof EllipsoidalOccluder.prototype\n * @type {Cartesian3}\n */\n cameraPosition: {\n get: function () {\n return this._cameraPosition;\n },\n set: function (cameraPosition) {\n // See https://cesium.com/blog/2013/04/25/Horizon-culling/\n const ellipsoid = this._ellipsoid;\n const cv = ellipsoid.transformPositionToScaledSpace(\n cameraPosition,\n this._cameraPositionInScaledSpace\n );\n const vhMagnitudeSquared = Cartesian3.magnitudeSquared(cv) - 1.0;\n\n Cartesian3.clone(cameraPosition, this._cameraPosition);\n this._cameraPositionInScaledSpace = cv;\n this._distanceToLimbInScaledSpaceSquared = vhMagnitudeSquared;\n },\n },\n});\n\nconst scratchCartesian = new Cartesian3();\n\n/**\n * Determines whether or not a point, the <code>occludee</code>, is hidden from view by the occluder.\n *\n * @param {Cartesian3} occludee The point to test for visibility.\n * @returns {Boolean} <code>true</code> if the occludee is visible; otherwise <code>false</code>.\n *\n * @example\n * const cameraPosition = new Cesium.Cartesian3(0, 0, 2.5);\n * const ellipsoid = new Cesium.Ellipsoid(1.0, 1.1, 0.9);\n * const occluder = new Cesium.EllipsoidalOccluder(ellipsoid, cameraPosition);\n * const point = new Cesium.Cartesian3(0, -3, -3);\n * occluder.isPointVisible(point); //returns true\n */\nEllipsoidalOccluder.prototype.isPointVisible = function (occludee) {\n const ellipsoid = this._ellipsoid;\n const occludeeScaledSpacePosition = ellipsoid.transformPositionToScaledSpace(\n occludee,\n scratchCartesian\n );\n return isScaledSpaceP
|