/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.98 * * 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. */define(["./defaultValue-50f7432c","./Matrix2-7dfd434a","./arrayRemoveDuplicates-fd3a3f4e","./BoundingRectangle-bd9fdbd8","./Transforms-f305a473","./ComponentDatatype-9b23164a","./PolylineVolumeGeometryLibrary-eb735769","./GeometryAttribute-4d82fade","./GeometryAttributes-8bab1b25","./GeometryPipeline-33e32ecb","./IndexDatatype-ceed713e","./PolygonPipeline-898e8861","./VertexFormat-fa0c27e8","./RuntimeError-48e1f06d","./combine-8462e002","./WebGLConstants-58abc51a","./EllipsoidTangentPlane-03ebf5f4","./AxisAlignedBoundingBox-a2ff9dfd","./IntersectionTests-4a7694f7","./Plane-3d30b188","./PolylinePipeline-92970340","./EllipsoidGeodesic-8f07d257","./EllipsoidRhumbLine-5454653c","./AttributeCompression-aa7855e7","./EncodedCartesian3-5efd45c3"],(function(e,t,n,o,i,a,r,l,s,p,c,d,u,m,y,g,f,h,b,P,E,_,k,v,V){"use strict";functionL(n){consto=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).polylinePositions,i=n.shapePositions;this._positions=o,this._shape=i,this._ellipsoid=t.Ellipsoid.clone(e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84)),this._cornerType=e.defaultValue(n.cornerType,r.CornerType.ROUNDED),this._vertexFormat=u.VertexFormat.clone(e.defaultValue(n.vertexFormat,u.VertexFormat.DEFAULT)),this._granularity=e.defaultValue(n.granularity,a.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";letl=1+o.length*t.Cartesian3.packedLength;l+=1+i.length*t.Cartesian2.packedLength,this.packedLength=l+t.Ellipsoid.packedLength+u.VertexFormat.packedLength+2}L.pack=function(n,o,i){leta;i=e.defaultValue(i,0);constr=n._positions;letl=r.length;for(o[i++]=l,a=0;a<l;++a,i+=t.Cartesian3.packedLength)t.Cartesian3.pack(r[a],o,i);consts=n._shape;for(l=s.length,o[i++]=l,a=0;a<l;++a,i+=t.Cartesian2.packedLength)t.Cartesian2.pack(s[a],o,i);returnt.Ellipsoid.pack(n._ellipsoid,o,i),i+=t.Ellipsoid.packedLength,u.VertexFormat.pack(n._vertexFormat,o,i),i+=u.VertexFormat.packedLength,o[i++]=n._cornerType,o[i]=n._granularity,o};constx=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),C=newu.VertexFormat,F={polylinePositions:void0,shapePositions:void0,ellipsoid:x,vertexFormat:C,cornerType:void0,granularity:void0};L.unpack=function(n,o,i){leta;o=e.defaultValue(o,0);letr=n[o++];constl=newArray(r);for(a=0;a<r;++a,o+=t.Cartesian3.packedLength)l[a]=t.Cartesian3.unpack(n,o);r=n[o++];consts=newArray(r);for(a=0;a<r;++a,o+=t.Cartesian2.packedLength)s[a]=t.Cartesian2.unpack(n,o);constp=t.Ellipsoid.unpack(n,o,x);o+=t.Ellipsoid.packedLength;constc=u.VertexFormat.unpack(n,o,C);o+=u.VertexFormat.packedLength;constd=n[o++],m=n[o];returne.defined(i)?(i._positions=l,i._shape=s,i._ellipsoid=t.Ellipsoid.clone(p,i._ellipsoid),i._vertexFormat=u.VertexFormat.clone(c,i._vertexFormat),i._cornerType=d,i._granularity=m,i):(F.polylinePositions=l,F.shapePositions=s,F.cornerType=d,F.granularity=m,newL(F))};constA=newo.BoundingRectangle;returnL.createGeometry=function(e){constu=e._positions,m=n.arrayRemoveDuplicates(u,t.Cartesian3.equalsEpsilon);lety=e._shape;if(y=r.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(y),m.length<2||y.length<3)return;d.PolygonPipeline.computeWindingOrder2D(y)===d.WindingOrder.CLOCKWISE&&y.reverse();constg=o.BoundingRectangle.fromPoints(y,A);returnfunction(e,t,n,o){constu=news.GeometryAttributes;o.position&&(u.position=newl.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}));constm=t.length,y=e.length/3,g=(y-2*m)/(2*m),f=d.PolygonPipeline.triangulate(t),h=(g-1)*m*6+2*f.length,b=c.IndexDatatype.createTypedArray(y,h);letP,E,_,k,v,V;constL=2*m;letx=0;for(P=0;P<g-1;P++){for(E=0;E<m-1;E++)_=2*E+P*m*2,V=_+L,k=_+1,v=k+L,b[x++]=k,b[x++]=_,b[x++]=v,b[x++]=v,b[x++]=_,b[x++]=V;_=2*m-2+P*m*2,k=_+1,v=k+L,V=_+L,b[x++]=k,b[x++]=_,b[x++]=v,b[x++]=v,b[x++]=_,b[x++]=V}if(o.st||o.tangent||o.bitangent){conste=newFloat32Array(2*y),o=1/(g-1),i=1/n.height,r=n.height/2;lets,p,c=0;for(P=0;P<g;P++){for(s=P*o,p=i*(t[0].y+r),e[c++]=s,e[c++]=p,E=1;E<m;E++)p=i*(t[E].y+r),e[c++]=s,e[c++]=p,e[c++]=s,e[c++]=p;p=i*(t[0].y+r),e[c++]=s,e[c++]=p}for(E=0;E<m;E++)s=0,p=i*(t[E].y+r),e[c++]=s,e[c++]=p;for(E=0;E<m;E++)s=(g-1)*o,p=i*(t[E].y+r),e[c++]=s,e[c++]=p;u.st=newl.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:newFloat32Array(e)})}constC=y-2*m;for(P=0;P<f.length;P+=3){conste=f[P]+C,t=f[P+1]+C,n=f[P+2]+C;b[x++]=e,b[x++]=t,b[x++]=n,b[x++]=n+m,b[x++]=t+m,b[x++]=e+m}letF=newl.Geometry({attributes:u,indices:b,boundingSphere:i.BoundingSphere.fromVertices(e),primitiveType:l.PrimitiveType.TRIANGLES});if(o.normal&&(F=p.GeometryPipeline.computeNormal(F)),o.tangent||o.bitangent){try{F=p.GeometryPipeline.computeTangentAndBitangent(F)}catch(e){r.oneTimeWarning("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}o.tangent||(F.attributes.tangent=void0),o.bitangent||(F.attributes.bitangent=void0),o.st||(F.attributes.st=void0)}returnF}(r.PolylineVolumeGeometryLibrary.computePositions(m,y,g,e,!0),y,g,e._vertexFormat)},function(n,o){returne.defined(o)&&(n=L.unpack(n,o)),n._ellipsoid=t.Ellipsoid.clone(n._ellipsoid),L.createGeometry(n)}}));