1 line
19 KiB
Plaintext
1 line
19 KiB
Plaintext
|
{"version":3,"file":"createBoxOutlineGeometry.js","sources":["../../../../Source/Core/BoxOutlineGeometry.js","../../../../Source/WorkersES6/createBoxOutlineGeometry.js"],"sourcesContent":["import arrayFill from \"./arrayFill.js\";\nimport BoundingSphere from \"./BoundingSphere.js\";\nimport Cartesian3 from \"./Cartesian3.js\";\nimport Check from \"./Check.js\";\nimport ComponentDatatype from \"./ComponentDatatype.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport DeveloperError from \"./DeveloperError.js\";\nimport Geometry from \"./Geometry.js\";\nimport GeometryAttribute from \"./GeometryAttribute.js\";\nimport GeometryAttributes from \"./GeometryAttributes.js\";\nimport GeometryOffsetAttribute from \"./GeometryOffsetAttribute.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\n\nconst diffScratch = new Cartesian3();\n\n/**\n * A description of the outline of a cube centered at the origin.\n *\n * @alias BoxOutlineGeometry\n * @constructor\n *\n * @param {Object} options Object with the following properties:\n * @param {Cartesian3} options.minimum The minimum x, y, and z coordinates of the box.\n * @param {Cartesian3} options.maximum The maximum x, y, and z coordinates of the box.\n *\n * @see BoxOutlineGeometry.fromDimensions\n * @see BoxOutlineGeometry.createGeometry\n * @see Packable\n *\n * @example\n * const box = new Cesium.BoxOutlineGeometry({\n * maximum : new Cesium.Cartesian3(250000.0, 250000.0, 250000.0),\n * minimum : new Cesium.Cartesian3(-250000.0, -250000.0, -250000.0)\n * });\n * const geometry = Cesium.BoxOutlineGeometry.createGeometry(box);\n */\nfunction BoxOutlineGeometry(options) {\n options = defaultValue(options, defaultValue.EMPTY_OBJECT);\n\n const min = options.minimum;\n const max = options.maximum;\n\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.object(\"min\", min);\n Check.typeOf.object(\"max\", max);\n if (\n defined(options.offsetAttribute) &&\n options.offsetAttribute === GeometryOffsetAttribute.TOP\n ) {\n throw new DeveloperError(\n \"GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.\"\n );\n }\n //>>includeEnd('debug');\n\n this._min = Cartesian3.clone(min);\n this._max = Cartesian3.clone(max);\n this._offsetAttribute = options.offsetAttribute;\n this._workerName = \"createBoxOutlineGeometry\";\n}\n\n/**\n * Creates an outline of a cube centered at the origin given its dimensions.\n *\n * @param {Object} options Object with the following properties:\n * @param {Cartesian3} options.dimensions The width, depth, and height of the box stored in the x, y, and z coordinates of the <code>Cartesian3</code>, respectively.\n * @returns {BoxOutlineGeometry}\n *\n * @exception {DeveloperError} All dimensions components must be greater than or equal to zero.\n *\n *\n * @example\n * const box = Cesium.BoxOutlineGeometry.fromDimensions({\n * dimensions : new Cesium.Cartesian3(500000.0, 500000.0, 500000.0)\n * });\n * const geometry = Cesium.BoxOutlineGeometry.createGeometry(box);\n *\n * @see BoxOutlineGeometry.createGeometry\n */\nBoxOutlineGeometry.fromDimensions = function (options) {\n options = defaultValue(options, defaultValue.EMPTY_OBJECT);\n const dimensions = options.dimensions;\n\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.object(\"dimensions\", dimensions);\n Check.typeOf.number.greaterThanOrEquals(\"dimensions.x\", dimensions.x, 0);\n Check.typeOf.number.greaterThanOrEquals(\"dimensions.y\", dimensions.y, 0);\n Check.typeOf.number.greaterThanOrEquals(\"dimensions.z\", dimensions.z, 0);\n //>>includeEnd('debug');\n\n const corner = Cartesian3.multiplyByScalar(dimensions, 0.5, new Cartesian3());\n\n return new BoxOutlineGeometry({\n minimum: Cartesian3.negate(corner, new Cartesian3()),\n maximum: corner,\n offsetAttribute: options.offsetAttribute,\n });\n};\n\n/**\n * Creates an outline of a cube from the dimensions of an AxisAlignedBoundingBox.\n *\n * @param {AxisAlignedBoundingBox} boundingBox A descript
|