{"version":3,"file":"createSphereGeometry.js","sources":["../../../../Source/Core/SphereGeometry.js","../../../../Source/WorkersES6/createSphereGeometry.js"],"sourcesContent":["import Cartesian3 from \"./Cartesian3.js\";\nimport Check from \"./Check.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport EllipsoidGeometry from \"./EllipsoidGeometry.js\";\nimport VertexFormat from \"./VertexFormat.js\";\n\n/**\n * A description of a sphere centered at the origin.\n *\n * @alias SphereGeometry\n * @constructor\n *\n * @param {Object} [options] Object with the following properties:\n * @param {Number} [options.radius=1.0] The radius of the sphere.\n * @param {Number} [options.stackPartitions=64] The number of times to partition the ellipsoid into stacks.\n * @param {Number} [options.slicePartitions=64] The number of times to partition the ellipsoid into radial slices.\n * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.\n *\n * @exception {DeveloperError} options.slicePartitions cannot be less than three.\n * @exception {DeveloperError} options.stackPartitions cannot be less than three.\n *\n * @see SphereGeometry#createGeometry\n *\n * @example\n * const sphere = new Cesium.SphereGeometry({\n * radius : 100.0,\n * vertexFormat : Cesium.VertexFormat.POSITION_ONLY\n * });\n * const geometry = Cesium.SphereGeometry.createGeometry(sphere);\n */\nfunction SphereGeometry(options) {\n const radius = defaultValue(options.radius, 1.0);\n const radii = new Cartesian3(radius, radius, radius);\n const ellipsoidOptions = {\n radii: radii,\n stackPartitions: options.stackPartitions,\n slicePartitions: options.slicePartitions,\n vertexFormat: options.vertexFormat,\n };\n\n this._ellipsoidGeometry = new EllipsoidGeometry(ellipsoidOptions);\n this._workerName = \"createSphereGeometry\";\n}\n\n/**\n * The number of elements used to pack the object into an array.\n * @type {Number}\n */\nSphereGeometry.packedLength = EllipsoidGeometry.packedLength;\n\n/**\n * Stores the provided instance into the provided array.\n *\n * @param {SphereGeometry} value The value to pack.\n * @param {Number[]} array The array to pack into.\n * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.\n *\n * @returns {Number[]} The array that was packed into\n */\nSphereGeometry.pack = function (value, array, startingIndex) {\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.object(\"value\", value);\n //>>includeEnd('debug');\n\n return EllipsoidGeometry.pack(value._ellipsoidGeometry, array, startingIndex);\n};\n\nconst scratchEllipsoidGeometry = new EllipsoidGeometry();\nconst scratchOptions = {\n radius: undefined,\n radii: new Cartesian3(),\n vertexFormat: new VertexFormat(),\n stackPartitions: undefined,\n slicePartitions: undefined,\n};\n\n/**\n * Retrieves an instance from a packed array.\n *\n * @param {Number[]} array The packed array.\n * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.\n * @param {SphereGeometry} [result] The object into which to store the result.\n * @returns {SphereGeometry} The modified result parameter or a new SphereGeometry instance if one was not provided.\n */\nSphereGeometry.unpack = function (array, startingIndex, result) {\n const ellipsoidGeometry = EllipsoidGeometry.unpack(\n array,\n startingIndex,\n scratchEllipsoidGeometry\n );\n scratchOptions.vertexFormat = VertexFormat.clone(\n ellipsoidGeometry._vertexFormat,\n scratchOptions.vertexFormat\n );\n scratchOptions.stackPartitions = ellipsoidGeometry._stackPartitions;\n scratchOptions.slicePartitions = ellipsoidGeometry._slicePartitions;\n\n if (!defined(result)) {\n scratchOptions.radius = ellipsoidGeometry._radii.x;\n return new SphereGeometry(scratchOptions);\n }\n\n Cartesian3.clone(ellipsoidGeometry._radii, scratchOptions.radii);\n result._ellipsoidGeometry = new EllipsoidGeometry(scratchOptions);\n return result;\n};\n\n/**\n * Computes the geometric representation of a sphere, including its vertices, indices, and a bounding sphere.\n *\n * @param {SphereGeometry} sphereGeometry A description of the sphere.\n * @returns {Geometry|undefined} The computed vertices and indices.\n */\nSphereGeometry.createGeometry = function (sphereGeometry) {\n return EllipsoidGeometry.createGeometry(sphereGeometry._ellipsoidGeometry);\n};\nexport default SphereGeometry;\n","import defined from \"../Core/defined.js\";\nimport SphereGeometry from \"../Core/SphereGeometry.js\";\n\nfunction createSphereGeometry(sphereGeometry, offset) {\n if (defined(offset)) {\n sphereGeometry = SphereGeometry.unpack(sphereGeometry, offset);\n }\n return SphereGeometry.createGeometry(sphereGeometry);\n}\nexport default createSphereGeometry;\n"],"names":["defaultValue","Cartesian3","EllipsoidGeometry","Check","VertexFormat","defined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAOA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,cAAc,CAAC,OAAO,EAAE;EACjC,EAAE,MAAM,MAAM,GAAGA,iBAAY,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;EACnD,EAAE,MAAM,KAAK,GAAG,IAAIC,kBAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;EACvD,EAAE,MAAM,gBAAgB,GAAG;EAC3B,IAAI,KAAK,EAAE,KAAK;EAChB,IAAI,eAAe,EAAE,OAAO,CAAC,eAAe;EAC5C,IAAI,eAAe,EAAE,OAAO,CAAC,eAAe;EAC5C,IAAI,YAAY,EAAE,OAAO,CAAC,YAAY;EACtC,GAAG,CAAC;AACJ;EACA,EAAE,IAAI,CAAC,kBAAkB,GAAG,IAAIC,mCAAiB,CAAC,gBAAgB,CAAC,CAAC;EACpE,EAAE,IAAI,CAAC,WAAW,GAAG,sBAAsB,CAAC;EAC5C,CAAC;AACD;EACA;EACA;EACA;EACA;EACA,cAAc,CAAC,YAAY,GAAGA,mCAAiB,CAAC,YAAY,CAAC;AAC7D;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc,CAAC,IAAI,GAAG,UAAU,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE;EAC7D;EACA,EAAEC,kBAAK,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;EACtC;AACA;EACA,EAAE,OAAOD,mCAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAk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