/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.122
 *
 * Copyright 2011-2022 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
 */
import{a as B}from"./chunk-HXS2AAIR.js";import"./chunk-S4UG323U.js";import"./chunk-ZYB4DKDQ.js";import"./chunk-ZIUWYBT3.js";import"./chunk-45FCQ3FJ.js";import"./chunk-354SKS6C.js";import"./chunk-H5GL2A6Z.js";import{a as W}from"./chunk-UGB43LJM.js";import{a as N}from"./chunk-WFZLZ2P5.js";import{b as R,c as S,d as M}from"./chunk-N72XKOXM.js";import{d as D}from"./chunk-EWTFJ46X.js";import"./chunk-5IUXF6I3.js";import{a as q}from"./chunk-27UWHT4D.js";import{a as p,d as l}from"./chunk-RFPX772U.js";import{a as O}from"./chunk-RAYRECQS.js";import"./chunk-2NAI7YQ3.js";import"./chunk-QE3ZUOZY.js";import{a as d}from"./chunk-6KLVDWWE.js";import{a as _}from"./chunk-6P5KAIBX.js";import{e as m}from"./chunk-4FSVUTPL.js";var U=new p,z=new p;function w(i){let t=(i=d(i,d.EMPTY_OBJECT)).positions,e=i.maximumHeights,o=i.minimumHeights;if(!m(t))throw new _("options.positions is required.");if(m(e)&&e.length!==t.length)throw new _("options.positions and options.maximumHeights must have the same length.");if(m(o)&&o.length!==t.length)throw new _("options.positions and options.minimumHeights must have the same length.");let n=d(i.granularity,O.RADIANS_PER_DEGREE),r=d(i.ellipsoid,l.default);this._positions=t,this._minimumHeights=o,this._maximumHeights=e,this._granularity=n,this._ellipsoid=l.clone(r),this._workerName="createWallOutlineGeometry";let s=1+t.length*p.packedLength+2;m(o)&&(s+=o.length),m(e)&&(s+=e.length),this.packedLength=s+l.packedLength+1}w.pack=function(i,t,e){if(!m(i))throw new _("value is required");if(!m(t))throw new _("array is required");e=d(e,0);let o,n=i._positions,r=n.length;for(t[e++]=r,o=0;o<r;++o,e+=p.packedLength)p.pack(n[o],t,e);let s=i._minimumHeights;if(r=m(s)?s.length:0,t[e++]=r,m(s))for(o=0;o<r;++o)t[e++]=s[o];let a=i._maximumHeights;if(r=m(a)?a.length:0,t[e++]=r,m(a))for(o=0;o<r;++o)t[e++]=a[o];return l.pack(i._ellipsoid,t,e),t[e+=l.packedLength]=i._granularity,t};var G=l.clone(l.UNIT_SPHERE),b={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:G,granularity:void 0};w.unpack=function(i,t,e){if(!m(i))throw new _("array is required");t=d(t,0);let o,n,r,s=i[t++],a=new Array(s);for(o=0;o<s;++o,t+=p.packedLength)a[o]=p.unpack(i,t);if(s=i[t++],s>0)for(n=new Array(s),o=0;o<s;++o)n[o]=i[t++];if(s=i[t++],s>0)for(r=new Array(s),o=0;o<s;++o)r[o]=i[t++];let h=l.unpack(i,t,G),u=i[t+=l.packedLength];return m(e)?(e._positions=a,e._minimumHeights=n,e._maximumHeights=r,e._ellipsoid=l.clone(h,e._ellipsoid),e._granularity=u,e):(b.positions=a,b.minimumHeights=n,b.maximumHeights=r,b.granularity=u,new w(b))},w.fromConstantHeights=function(i){let t=(i=d(i,d.EMPTY_OBJECT)).positions;if(!m(t))throw new _("options.positions is required.");let e,o,n=i.minimumHeight,r=i.maximumHeight,s=m(n),a=m(r);if(s||a){let i=t.length;e=s?new Array(i):void 0,o=a?new Array(i):void 0;for(let t=0;t<i;++t)s&&(e[t]=n),a&&(o[t]=r)}return new w({positions:t,maximumHeights:o,minimumHeights:e,ellipsoid:i.ellipsoid})},w.createGeometry=function(i){let t=i._positions,e=i._minimumHeights,o=i._maximumHeights,n=i._granularity,r=i._ellipsoid,s=B.computePositions(r,t,o,e,n,!1);if(!m(s))return;let a,l=s.bottomPositions,h=s.topPositions,u=h.length,c=2*u,g=new Float64Array(c),d=0;for(u/=3,a=0;a<u;++a){let i=3*a,t=p.fromArray(h,i,U),e=p.fromArray(l,i,z);g[d++]=e.x,g[d++]=e.y,g[d++]=e.z,g[d++]=t.x,g[d++]=t.y,g[d++]=t.z}let f=new N({position:new M({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:g})}),w=c/3;c=2*w-4+w;let _=W.createTypedArray(w,c),k=0;for(a=0;a<w-2;a+=2){let i=a,t=a+2,e=p.fromArray(g,3*i,U),o=p.fromArray(g,3*t,z);if(p.equalsEpsilon(e,o,O.EPSILON10))continue;let n=a+1,r=a+3;_[k++]=n,_[k++]=i,_[k++]=n,_[k++]=r,_[k++]=i,_[k++]=t}return _[k++]=w-2,_[k++]=w-1,new S({attributes:f,indices:_,primitiveType:R.LINES,boundingSphere:new D.fromVertices(g)})};var C=w;function J(i,t){return m(t)&&(i=C.unpack(i,t)),i._ellipsoid=l.clone(i._ellipsoid),C.createGeometry(i)}var pi=J;export{pi as default};