{"version":3,"file":"createCircleGeometry.js","sources":["../../../../Source/Core/CircleGeometry.js","../../../../Source/WorkersES6/createCircleGeometry.js"],"sourcesContent":["import Cartesian3 from \"./Cartesian3.js\";\nimport Check from \"./Check.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport EllipseGeometry from \"./EllipseGeometry.js\";\nimport Ellipsoid from \"./Ellipsoid.js\";\nimport VertexFormat from \"./VertexFormat.js\";\n\n/**\n * A description of a circle on the ellipsoid. Circle geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.\n *\n * @alias CircleGeometry\n * @constructor\n *\n * @param {Object} options Object with the following properties:\n * @param {Cartesian3} options.center The circle's center point in the fixed frame.\n * @param {Number} options.radius The radius in meters.\n * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid the circle will be on.\n * @param {Number} [options.height=0.0] The distance in meters between the circle and the ellipsoid surface.\n * @param {Number} [options.granularity=0.02] The angular distance between points on the circle in radians.\n * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.\n * @param {Number} [options.extrudedHeight=0.0] The distance in meters between the circle's extruded face and the ellipsoid surface.\n * @param {Number} [options.stRotation=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.\n *\n * @exception {DeveloperError} radius must be greater than zero.\n * @exception {DeveloperError} granularity must be greater than zero.\n *\n * @see CircleGeometry.createGeometry\n * @see Packable\n *\n * @example\n * // Create a circle.\n * const circle = new Cesium.CircleGeometry({\n * center : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),\n * radius : 100000.0\n * });\n * const geometry = Cesium.CircleGeometry.createGeometry(circle);\n */\nfunction CircleGeometry(options) {\n options = defaultValue(options, defaultValue.EMPTY_OBJECT);\n const radius = options.radius;\n\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.number(\"radius\", radius);\n //>>includeEnd('debug');\n\n const ellipseGeometryOptions = {\n center: options.center,\n semiMajorAxis: radius,\n semiMinorAxis: radius,\n ellipsoid: options.ellipsoid,\n height: options.height,\n extrudedHeight: options.extrudedHeight,\n granularity: options.granularity,\n vertexFormat: options.vertexFormat,\n stRotation: options.stRotation,\n shadowVolume: options.shadowVolume,\n };\n this._ellipseGeometry = new EllipseGeometry(ellipseGeometryOptions);\n this._workerName = \"createCircleGeometry\";\n}\n\n/**\n * The number of elements used to pack the object into an array.\n * @type {Number}\n */\nCircleGeometry.packedLength = EllipseGeometry.packedLength;\n\n/**\n * Stores the provided instance into the provided array.\n *\n * @param {CircleGeometry} 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 */\nCircleGeometry.pack = function (value, array, startingIndex) {\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.object(\"value\", value);\n //>>includeEnd('debug');\n return EllipseGeometry.pack(value._ellipseGeometry, array, startingIndex);\n};\n\nconst scratchEllipseGeometry = new EllipseGeometry({\n center: new Cartesian3(),\n semiMajorAxis: 1.0,\n semiMinorAxis: 1.0,\n});\nconst scratchOptions = {\n center: new Cartesian3(),\n radius: undefined,\n ellipsoid: Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),\n height: undefined,\n extrudedHeight: undefined,\n granularity: undefined,\n vertexFormat: new VertexFormat(),\n stRotation: undefined,\n semiMajorAxis: undefined,\n semiMinorAxis: undefined,\n shadowVolume: 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 {CircleGeometry} [result] The object into which to store the result.\n * @returns {CircleGeometry} The modified result parameter or a new CircleGeometry instance if one was not provided.\n */\nCircleGeometry.unpack = function (array, startingIndex, result) {\n const ellipseGeometry = EllipseGeometry.unpack(\n array,\n startingIndex,\n scratchEllipseGeometry\n );\n scratchOptions.center = Cartesian3.clone(\n ellipseGeometry._center,\n scratchOptions.center\n );\n scratchOptions.ellipsoid = Ellipsoid.clone(\n ellipseGeometry._ellipsoid,\n scratchOptions.ellipsoid\n );\n scratchOptions.height = ellipseGeometry._height;\n scratchOptions.extrudedHeight = ellipseGeometry._extrudedHeight;\n scratchOptions.granularity = ellipseGeometry._granularity;\n scratchOptions.vertexFormat = VertexFormat.clone(\n ellipseGeometry._vertexFormat,\n scratchOptions.vertexFormat\n );\n scratchOptions.stRotation = ellipseGeometry._stRotation;\n scratchOptions.shadowVolume = ellipseGeometry._shadowVolume;\n\n if (!defined(result)) {\n scratchOptions.radius = ellipseGeometry._semiMajorAxis;\n return new CircleGeometry(scratchOptions);\n }\n\n scratchOptions.semiMajorAxis = ellipseGeometry._semiMajorAxis;\n scratchOptions.semiMinorAxis = ellipseGeometry._semiMinorAxis;\n result._ellipseGeometry = new EllipseGeometry(scratchOptions);\n return result;\n};\n\n/**\n * Computes the geometric representation of a circle on an ellipsoid, including its vertices, indices, and a bounding sphere.\n *\n * @param {CircleGeometry} circleGeometry A description of the circle.\n * @returns {Geometry|undefined} The computed vertices and indices.\n */\nCircleGeometry.createGeometry = function (circleGeometry) {\n return EllipseGeometry.createGeometry(circleGeometry._ellipseGeometry);\n};\n\n/**\n * @private\n */\nCircleGeometry.createShadowVolume = function (\n circleGeometry,\n minHeightFunc,\n maxHeightFunc\n) {\n const granularity = circleGeometry._ellipseGeometry._granularity;\n const ellipsoid = circleGeometry._ellipseGeometry._ellipsoid;\n\n const minHeight = minHeightFunc(granularity, ellipsoid);\n const maxHeight = maxHeightFunc(granularity, ellipsoid);\n\n return new CircleGeometry({\n center: circleGeometry._ellipseGeometry._center,\n radius: circleGeometry._ellipseGeometry._semiMajorAxis,\n ellipsoid: ellipsoid,\n stRotation: circleGeometry._ellipseGeometry._stRotation,\n granularity: granularity,\n extrudedHeight: minHeight,\n height: maxHeight,\n vertexFormat: VertexFormat.POSITION_ONLY,\n shadowVolume: true,\n });\n};\n\nObject.defineProperties(CircleGeometry.prototype, {\n /**\n * @private\n */\n rectangle: {\n get: function () {\n return this._ellipseGeometry.rectangle;\n },\n },\n /**\n * For remapping texture coordinates when rendering CircleGeometries as GroundPrimitives.\n * @private\n */\n textureCoordinateRotationPoints: {\n get: function () {\n return this._ellipseGeometry.textureCoordinateRotationPoints;\n },\n },\n});\nexport default CircleGeometry;\n","import Cartesian3 from \"../Core/Cartesian3.js\";\nimport CircleGeometry from \"../Core/CircleGeometry.js\";\nimport defined from \"../Core/defined.js\";\nimport Ellipsoid from \"../Core/Ellipsoid.js\";\n\nfunction createCircleGeometry(circleGeometry, offset) {\n if (defined(offset)) {\n circleGeometry = CircleGeometry.unpack(circleGeometry, offset);\n }\n circleGeometry._ellipseGeometry._center = Cartesian3.clone(\n circleGeometry._ellipseGeometry._center\n );\n circleGeometry._ellipseGeometry._ellipsoid = Ellipsoid.clone(\n circleGeometry._ellipseGeometry._ellipsoid\n );\n return CircleGeometry.createGeometry(circleGeometry);\n}\nexport default createCircleGeometry;\n"],"names":["defaultValue","Check","EllipseGeometry","Cartesian3","Ellipsoid","VertexFormat","defined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAQA;EACA;EACA;EACA;EACA;EACA;EACA;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,OAAO,GAAGA,iBAAY,CAAC,OAAO,EAAEA,iBAAY,CAAC,YAAY,CAAC,CAAC;EAC7D,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AAChC;EACA;EACA,EAAEC,kBAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;EACxC;AACA;EACA,EAAE,MAAM,sBAAsB,GAAG;EACjC,IAAI,MAAM,EAAE,OAAO,CAAC,MAAM;EAC1B,IAAI,aAAa,EAAE,MAAM;EACzB,IAAI,aAAa,E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