1 line
28 KiB
Plaintext
1 line
28 KiB
Plaintext
|
{"version":3,"file":"EllipseOutlineGeometry-7293c691.js","sources":["../../../../Source/Core/EllipseOutlineGeometry.js"],"sourcesContent":["import arrayFill from \"./arrayFill.js\";\nimport BoundingSphere from \"./BoundingSphere.js\";\nimport Cartesian3 from \"./Cartesian3.js\";\nimport ComponentDatatype from \"./ComponentDatatype.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport DeveloperError from \"./DeveloperError.js\";\nimport EllipseGeometryLibrary from \"./EllipseGeometryLibrary.js\";\nimport Ellipsoid from \"./Ellipsoid.js\";\nimport Geometry from \"./Geometry.js\";\nimport GeometryAttribute from \"./GeometryAttribute.js\";\nimport GeometryAttributes from \"./GeometryAttributes.js\";\nimport GeometryOffsetAttribute from \"./GeometryOffsetAttribute.js\";\nimport IndexDatatype from \"./IndexDatatype.js\";\nimport CesiumMath from \"./Math.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\n\nconst scratchCartesian1 = new Cartesian3();\nlet boundingSphereCenter = new Cartesian3();\n\nfunction computeEllipse(options) {\n const center = options.center;\n boundingSphereCenter = Cartesian3.multiplyByScalar(\n options.ellipsoid.geodeticSurfaceNormal(center, boundingSphereCenter),\n options.height,\n boundingSphereCenter\n );\n boundingSphereCenter = Cartesian3.add(\n center,\n boundingSphereCenter,\n boundingSphereCenter\n );\n const boundingSphere = new BoundingSphere(\n boundingSphereCenter,\n options.semiMajorAxis\n );\n const positions = EllipseGeometryLibrary.computeEllipsePositions(\n options,\n false,\n true\n ).outerPositions;\n\n const attributes = new GeometryAttributes({\n position: new GeometryAttribute({\n componentDatatype: ComponentDatatype.DOUBLE,\n componentsPerAttribute: 3,\n values: EllipseGeometryLibrary.raisePositionsToHeight(\n positions,\n options,\n false\n ),\n }),\n });\n\n const length = positions.length / 3;\n const indices = IndexDatatype.createTypedArray(length, length * 2);\n let index = 0;\n for (let i = 0; i < length; ++i) {\n indices[index++] = i;\n indices[index++] = (i + 1) % length;\n }\n\n return {\n boundingSphere: boundingSphere,\n attributes: attributes,\n indices: indices,\n };\n}\n\nconst topBoundingSphere = new BoundingSphere();\nconst bottomBoundingSphere = new BoundingSphere();\nfunction computeExtrudedEllipse(options) {\n const center = options.center;\n const ellipsoid = options.ellipsoid;\n const semiMajorAxis = options.semiMajorAxis;\n let scaledNormal = Cartesian3.multiplyByScalar(\n ellipsoid.geodeticSurfaceNormal(center, scratchCartesian1),\n options.height,\n scratchCartesian1\n );\n topBoundingSphere.center = Cartesian3.add(\n center,\n scaledNormal,\n topBoundingSphere.center\n );\n topBoundingSphere.radius = semiMajorAxis;\n\n scaledNormal = Cartesian3.multiplyByScalar(\n ellipsoid.geodeticSurfaceNormal(center, scaledNormal),\n options.extrudedHeight,\n scaledNormal\n );\n bottomBoundingSphere.center = Cartesian3.add(\n center,\n scaledNormal,\n bottomBoundingSphere.center\n );\n bottomBoundingSphere.radius = semiMajorAxis;\n\n let positions = EllipseGeometryLibrary.computeEllipsePositions(\n options,\n false,\n true\n ).outerPositions;\n const attributes = new GeometryAttributes({\n position: new GeometryAttribute({\n componentDatatype: ComponentDatatype.DOUBLE,\n componentsPerAttribute: 3,\n values: EllipseGeometryLibrary.raisePositionsToHeight(\n positions,\n options,\n true\n ),\n }),\n });\n\n positions = attributes.position.values;\n const boundingSphere = BoundingSphere.union(\n topBoundingSphere,\n bottomBoundingSphere\n );\n let length = positions.length / 3;\n\n if (defined(options.offsetAttribute)) {\n let applyOffset = new Uint8Array(length);\n if (options.offsetAttribute === GeometryOffsetAttribute.TOP) {\n applyOffset = arrayFill(applyOffset, 1, 0, length
|