createCorridorGeometry.js 17 KB

12345678910111213141516171819202122232425
  1. /**
  2. * @license
  3. * Cesium - https://github.com/CesiumGS/cesium
  4. * Version 1.99
  5. *
  6. * Copyright 2011-2022 Cesium Contributors
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. *
  20. * Columbus View (Pat. Pend.)
  21. *
  22. * Portions licensed separately.
  23. * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
  24. */
  25. define(["./arrayRemoveDuplicates-d35f503f","./Transforms-3ea76111","./Matrix3-edb29a7e","./ComponentDatatype-e86a9f87","./PolylineVolumeGeometryLibrary-5450bad0","./CorridorGeometryLibrary-ba1588b6","./defaultValue-135942ca","./GeometryAttribute-dacddb3f","./GeometryAttributes-899f8bd0","./GeometryOffsetAttribute-d3a42805","./IndexDatatype-3a8ea78f","./Math-a304e2d6","./PolygonPipeline-92a50571","./Matrix2-7a2bab7e","./VertexFormat-7d5b4d7e","./combine-462d91dd","./RuntimeError-f0dada00","./WebGLConstants-fcb70ee3","./EllipsoidTangentPlane-46a19c1a","./AxisAlignedBoundingBox-5f8053d3","./IntersectionTests-f3382f21","./Plane-5bea24eb","./PolylinePipeline-6bbc2d22","./EllipsoidGeodesic-048356f7","./EllipsoidRhumbLine-5519960c"],(function(t,e,r,a,i,o,n,s,l,d,u,m,c,f,y,p,g,h,b,C,A,_,w,v,T){"use strict";const G=new r.Cartesian3,E=new r.Cartesian3,V=new r.Cartesian3,x=new r.Cartesian3,L=new r.Cartesian3,P=new r.Cartesian3,F=new r.Cartesian3,N=new r.Cartesian3;function M(t,e){for(let r=0;r<t.length;r++)t[r]=e.scaleToGeodeticSurface(t[r],t[r]);return t}function D(t,e,a,i,n,s){const l=t.normals,d=t.tangents,u=t.bitangents,m=r.Cartesian3.normalize(r.Cartesian3.cross(a,e,F),F);s.normal&&o.CorridorGeometryLibrary.addAttribute(l,e,i,n),s.tangent&&o.CorridorGeometryLibrary.addAttribute(d,m,i,n),s.bitangent&&o.CorridorGeometryLibrary.addAttribute(u,a,i,n)}function O(t,e,i){const d=t.positions,c=t.corners,f=t.endPositions,y=t.lefts,p=t.normals,g=new l.GeometryAttributes;let h,b,C,A=0,_=0,w=0;for(b=0;b<d.length;b+=2)C=d[b].length-3,A+=C,w+=2*C,_+=d[b+1].length-3;for(A+=3,_+=3,b=0;b<c.length;b++){h=c[b];const t=c[b].leftPositions;n.defined(t)?(C=t.length,A+=C,w+=C):(C=c[b].rightPositions.length,_+=C,w+=C)}const v=n.defined(f);let T;v&&(T=f[0].length-3,A+=T,_+=T,T/=3,w+=6*T);const L=A+_,M=new Float64Array(L),O={normals:e.normal?new Float32Array(L):void 0,tangents:e.tangent?new Float32Array(L):void 0,bitangents:e.bitangent?new Float32Array(L):void 0};let I,S,R,k,H,z,B=0,U=L-1,Y=G,W=E;const q=T/2,J=u.IndexDatatype.createTypedArray(L/3,w);let j=0;if(v){z=V,H=x;const t=f[0];for(Y=r.Cartesian3.fromArray(p,0,Y),W=r.Cartesian3.fromArray(y,0,W),b=0;b<q;b++)z=r.Cartesian3.fromArray(t,3*(q-1-b),z),H=r.Cartesian3.fromArray(t,3*(q+b),H),o.CorridorGeometryLibrary.addAttribute(M,H,B),o.CorridorGeometryLibrary.addAttribute(M,z,void 0,U),D(O,Y,W,B,U,e),S=B/3,k=S+1,I=(U-2)/3,R=I-1,J[j++]=I,J[j++]=S,J[j++]=R,J[j++]=R,J[j++]=S,J[j++]=k,B+=3,U-=3}let K,Q,X=0,Z=0,$=d[X++],tt=d[X++];for(M.set($,B),M.set(tt,U-tt.length+1),W=r.Cartesian3.fromArray(y,Z,W),C=tt.length-3,b=0;b<C;b+=3)K=i.geodeticSurfaceNormal(r.Cartesian3.fromArray($,b,F),F),Q=i.geodeticSurfaceNormal(r.Cartesian3.fromArray(tt,C-b,N),N),Y=r.Cartesian3.normalize(r.Cartesian3.add(K,Q,Y),Y),D(O,Y,W,B,U,e),S=B/3,k=S+1,I=(U-2)/3,R=I-1,J[j++]=I,J[j++]=S,J[j++]=R,J[j++]=R,J[j++]=S,J[j++]=k,B+=3,U-=3;for(K=i.geodeticSurfaceNormal(r.Cartesian3.fromArray($,C,F),F),Q=i.geodeticSurfaceNormal(r.Cartesian3.fromArray(tt,C,N),N),Y=r.Cartesian3.normalize(r.Cartesian3.add(K,Q,Y),Y),Z+=3,b=0;b<c.length;b++){let t;h=c[b];const a=h.leftPositions,s=h.rightPositions;let l,u,m=P,f=V,g=x;if(Y=r.Cartesian3.fromArray(p,Z,Y),n.defined(a)){for(D(O,Y,W,void 0,U,e),U-=3,l=k,u=R,t=0;t<a.length/3;t++)m=r.Cartesian3.fromArray(a,3*t,m),J[j++]=l,J[j++]=u-t-1,J[j++]=u-t,o.CorridorGeometryLibrary.addAttribute(M,m,void 0,U),f=r.Cartesian3.fromArray(M,3*(u-t-1),f),g=r.Cartesian3.fromArray(M,3*l,g),W=r.Cartesian3.normalize(r.Cartesian3.subtract(f,g,W),W),D(O,Y,W,void 0,U,e),U-=3;m=r.Cartesian3.fromArray(M,3*l,m),f=r.Cartesian3.subtract(r.Cartesian3.fromArray(M,3*u,f),m,f),g=r.Cartesian3.subtract(r.Cartesian3.fromArray(M,3*(u-t),g),m,g),W=r.Cartesian3.normalize(r.Cartesian3.add(f,g,W),W),D(O,Y,W,B,void 0,e),B+=3}else{for(D(O,Y,W,B,void 0,e),B+=3,l=R,u=k,t=0;t<s.length/3;t++)m=r.Cartesian3.fromArray(s,3*t,m),J[j++]=l,J[j++]=u+t,J[j++]=u+t+1,o.CorridorGeometryLibrary.addAttribute(M,m,B),f=r.Cartesian3.fromArray(M,3*l,f),g=r.Cartesian3.fromArray(M,3*(u+t),g),W=r.Cartesian3.normalize(r.Cartesian3.subtract(f,g,W),W),D(O,Y,W,B,void 0,e),B+=3;m=r.Cartesian3.fromArray(M,3*l,m),f=r.Cartesian3.subtract(r.Cartesian3.fromArray(M,3*(u+t),f),m,f),g=r.Cartesian3.subtract(r.Cartesian3.fromArray(M,3*u,g),m,g),W=r.Cartesian3.normalize(r.Cartesian3.negate(r.Cartesian3.add(g,f,W),W),W),D(O,Y,W,void 0,U,e),U-=3}for($=d[X++],tt=d[X++],$.splice(0,3),tt.splice(tt.length-3,3),M.set($,B),M.set(tt,U-tt.length+1),C=tt.length-3,Z+=3,W=r.Cartesian3.fromArray(y,Z,W),t=0;t<tt.length;t+=3)K=i.geodeticSurfaceNormal(r.Cartesian3.fromArray($,t,F),F),Q=i.geodeticSurfaceNormal(r.Cartesian3.fromArray(tt,C-t,N),N),Y=r.Cartesian3.normalize(r.Cartesian3.add(K,Q,Y),Y),D(O,Y,W,B,U,e),k=B/3,S=k-1,R=(U-2)/3,I=R+1,J[j++]=I,J[j++]=S,J[j++]=R,J[j++]=R,J[j++]=S,J[j++]=k,B+=3,U-=3;B-=3,U+=3}if(Y=r.Cartesian3.fromArray(p,p.length-3,Y),D(O,Y,W,B,U,e),v){B+=3,U-=3,z=V,H=x;const t=f[1];for(b=0;b<q;b++)z=r.Cartesian3.fromArray(t,3*(T-b-1),z),H=r.Cartesian3.fromArray(t,3*b,H),o.CorridorGeometryLibrary.addAttribute(M,z,void 0,U),o.CorridorGeometryLibrary.addAttribute(M,H,B),D(O,Y,W,B,U,e),k=B/3,S=k-1,R=(U-2)/3,I=R+1,J[j++]=I,J[j++]=S,J[j++]=R,J[j++]=R,J[j++]=S,J[j++]=k,B+=3,U-=3}if(g.position=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:M}),e.st){const t=new Float32Array(L/3*2);let e,r,i=0;if(v){A/=3,_/=3;const a=Math.PI/(T+1);let o;r=1/(A-T+1),e=1/(_-T+1);const n=T/2;for(b=n+1;b<T+1;b++)o=m.CesiumMath.PI_OVER_TWO+a*b,t[i++]=e*(1+Math.cos(o)),t[i++]=.5*(1+Math.sin(o));for(b=1;b<_-T+1;b++)t[i++]=b*e,t[i++]=0;for(b=T;b>n;b--)o=m.CesiumMath.PI_OVER_TWO-b*a,t[i++]=1-e*(1+Math.cos(o)),t[i++]=.5*(1+Math.sin(o));for(b=n;b>0;b--)o=m.CesiumMath.PI_OVER_TWO-a*b,t[i++]=1-r*(1+Math.cos(o)),t[i++]=.5*(1+Math.sin(o));for(b=A-T;b>0;b--)t[i++]=b*r,t[i++]=1;for(b=1;b<n+1;b++)o=m.CesiumMath.PI_OVER_TWO+a*b,t[i++]=r*(1+Math.cos(o)),t[i++]=.5*(1+Math.sin(o))}else{for(A/=3,_/=3,r=1/(A-1),e=1/(_-1),b=0;b<_;b++)t[i++]=b*e,t[i++]=0;for(b=A;b>0;b--)t[i++]=(b-1)*r,t[i++]=1}g.st=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:t})}return e.normal&&(g.normal=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:O.normals})),e.tangent&&(g.tangent=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:O.tangents})),e.bitangent&&(g.bitangent=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:O.bitangents})),{attributes:g,indices:J}}function I(t,e,r){r[e++]=t[0],r[e++]=t[1],r[e++]=t[2];for(let a=3;a<t.length;a+=3){const i=t[a],o=t[a+1],n=t[a+2];r[e++]=i,r[e++]=o,r[e++]=n,r[e++]=i,r[e++]=o,r[e++]=n}return r[e++]=t[0],r[e++]=t[1],r[e++]=t[2],r}function S(t,e){const i=new y.VertexFormat({position:e.position,normal:e.normal||e.bitangent||t.shadowVolume,tangent:e.tangent,bitangent:e.normal||e.bitangent,st:e.st}),l=t.ellipsoid,m=O(o.CorridorGeometryLibrary.computePositions(t),i,l),f=t.height,p=t.extrudedHeight;let g=m.attributes;const h=m.indices;let b=g.position.values,C=b.length;const A=new Float64Array(6*C);let _=new Float64Array(C);_.set(b);let w,v=new Float64Array(4*C);b=c.PolygonPipeline.scaleToGeodeticHeight(b,f,l),v=I(b,0,v),_=c.PolygonPipeline.scaleToGeodeticHeight(_,p,l),v=I(_,2*C,v),A.set(b),A.set(_,C),A.set(v,2*C),g.position.values=A,g=function(t,e){if(!(e.normal||e.tangent||e.bitangent||e.st))return t;const a=t.position.values;let i,n;(e.normal||e.bitangent)&&(i=t.normal.values,n=t.bitangent.values);const s=t.position.values.length/18,l=3*s,d=2*s,u=2*l;let m;if(e.normal||e.bitangent||e.tangent){const s=e.normal?new Float32Array(6*l):void 0,d=e.tangent?new Float32Array(6*l):void 0,c=e.bitangent?new Float32Array(6*l):void 0;let f=G,y=E,p=V,g=x,h=L,b=P,C=u;for(m=0;m<l;m+=3){const t=C+u;f=r.Cartesian3.fromArray(a,m,f),y=r.Cartesian3.fromArray(a,m+l,y),p=r.Cartesian3.fromArray(a,(m+3)%l,p),y=r.Cartesian3.subtract(y,f,y),p=r.Cartesian3.subtract(p,f,p),g=r.Cartesian3.normalize(r.Cartesian3.cross(y,p,g),g),e.normal&&(o.CorridorGeometryLibrary.addAttribute(s,g,t),o.CorridorGeometryLibrary.addAttribute(s,g,t+3),o.CorridorGeometryLibrary.addAttribute(s,g,C),o.CorridorGeometryLibrary.addAttribute(s,g,C+3)),(e.tangent||e.bitangent)&&(b=r.Cartesian3.fromArray(i,m,b),e.bitangent&&(o.CorridorGeometryLibrary.addAttribute(c,b,t),o.CorridorGeometryLibrary.addAttribute(c,b,t+3),o.CorridorGeometryLibrary.addAttribute(c,b,C),o.CorridorGeometryLibrary.addAttribute(c,b,C+3)),e.tangent&&(h=r.Cartesian3.normalize(r.Cartesian3.cross(b,g,h),h),o.CorridorGeometryLibrary.addAttribute(d,h,t),o.CorridorGeometryLibrary.addAttribute(d,h,t+3),o.CorridorGeometryLibrary.addAttribute(d,h,C),o.CorridorGeometryLibrary.addAttribute(d,h,C+3))),C+=6}if(e.normal){for(s.set(i),m=0;m<l;m+=3)s[m+l]=-i[m],s[m+l+1]=-i[m+1],s[m+l+2]=-i[m+2];t.normal.values=s}else t.normal=void 0;if(e.bitangent?(c.set(n),c.set(n,l),t.bitangent.values=c):t.bitangent=void 0,e.tangent){const e=t.tangent.values;d.set(e),d.set(e,l),t.tangent.values=d}}if(e.st){const e=t.st.values,r=new Float32Array(6*d);r.set(e),r.set(e,d);let a=2*d;for(let t=0;t<2;t++){for(r[a++]=e[0],r[a++]=e[1],m=2;m<d;m+=2){const t=e[m],i=e[m+1];r[a++]=t,r[a++]=i,r[a++]=t,r[a++]=i}r[a++]=e[0],r[a++]=e[1]}t.st.values=r}return t}(g,e);const T=C/3;if(t.shadowVolume){const t=g.normal.values;C=t.length;let r=new Float32Array(6*C);for(w=0;w<C;w++)t[w]=-t[w];r.set(t,C),r=I(t,4*C,r),g.extrudeDirection=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:r}),e.normal||(g.normal=void 0)}if(n.defined(t.offsetAttribute)){let e=new Uint8Array(6*T);if(t.offsetAttribute===d.GeometryOffsetAttribute.TOP)e=e.fill(1,0,T).fill(1,2*T,4*T);else{const r=t.offsetAttribute===d.GeometryOffsetAttribute.NONE?0:1;e=e.fill(r)}g.applyOffset=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}const F=h.length,N=T+T,M=u.IndexDatatype.createTypedArray(A.length/3,2*F+3*N);M.set(h);let D,S,R,k,H=F;for(w=0;w<F;w+=3){const t=h[w],e=h[w+1],r=h[w+2];M[H++]=r+T,M[H++]=e+T,M[H++]=t+T}for(w=0;w<N;w+=2)D=w+N,S=D+N,R=D+1,k=S+1,M[H++]=D,M[H++]=S,M[H++]=R,M[H++]=R,M[H++]=S,M[H++]=k;return{attributes:g,indices:M}}const R=new r.Cartesian3,k=new r.Cartesian3,H=new r.Cartographic;function z(t,e,a,i,o,n){const s=r.Cartesian3.subtract(e,t,R);r.Cartesian3.normalize(s,s);const l=a.geodeticSurfaceNormal(t,k),d=r.Cartesian3.cross(s,l,R);r.Cartesian3.multiplyByScalar(d,i,d);let u=o.latitude,m=o.longitude,c=n.latitude,f=n.longitude;r.Cartesian3.add(t,d,k),a.cartesianToCartographic(k,H);let y=H.latitude,p=H.longitude;u=Math.min(u,y),m=Math.min(m,p),c=Math.max(c,y),f=Math.max(f,p),r.Cartesian3.subtract(t,d,k),a.cartesianToCartographic(k,H),y=H.latitude,p=H.longitude,u=Math.min(u,y),m=Math.min(m,p),c=Math.max(c,y),f=Math.max(f,p),o.latitude=u,o.longitude=m,n.latitude=c,n.longitude=f}const B=new r.Cartesian3,U=new r.Cartesian3,Y=new r.Cartographic,W=new r.Cartographic;function q(e,a,o,s,l){e=M(e,a);const d=t.arrayRemoveDuplicates(e,r.Cartesian3.equalsEpsilon),u=d.length;if(u<2||o<=0)return new f.Rectangle;const m=.5*o;let c,y;if(Y.latitude=Number.POSITIVE_INFINITY,Y.longitude=Number.POSITIVE_INFINITY,W.latitude=Number.NEGATIVE_INFINITY,W.longitude=Number.NEGATIVE_INFINITY,s===i.CornerType.ROUNDED){const t=d[0];r.Cartesian3.subtract(t,d[1],B),r.Cartesian3.normalize(B,B),r.Cartesian3.multiplyByScalar(B,m,B),r.Cartesian3.add(t,B,U),a.cartesianToCartographic(U,H),c=H.latitude,y=H.longitude,Y.latitude=Math.min(Y.latitude,c),Y.longitude=Math.min(Y.longitude,y),W.latitude=Math.max(W.latitude,c),W.longitude=Math.max(W.longitude,y)}for(let t=0;t<u-1;++t)z(d[t],d[t+1],a,m,Y,W);const p=d[u-1];r.Cartesian3.subtract(p,d[u-2],B),r.Cartesian3.normalize(B,B),r.Cartesian3.multiplyByScalar(B,m,B),r.Cartesian3.add(p,B,U),z(p,U,a,m,Y,W),s===i.CornerType.ROUNDED&&(a.cartesianToCartographic(U,H),c=H.latitude,y=H.longitude,Y.latitude=Math.min(Y.latitude,c),Y.longitude=Math.min(Y.longitude,y),W.latitude=Math.max(W.latitude,c),W.longitude=Math.max(W.longitude,y));const g=n.defined(l)?l:new f.Rectangle;return g.north=W.latitude,g.south=Y.latitude,g.east=W.longitude,g.west=Y.longitude,g}function J(t){const e=(t=n.defaultValue(t,n.defaultValue.EMPTY_OBJECT)).positions,a=t.width,o=n.defaultValue(t.height,0),s=n.defaultValue(t.extrudedHeight,o);this._positions=e,this._ellipsoid=r.Ellipsoid.clone(n.defaultValue(t.ellipsoid,r.Ellipsoid.WGS84)),this._vertexFormat=y.VertexFormat.clone(n.defaultValue(t.vertexFormat,y.VertexFormat.DEFAULT)),this._width=a,this._height=Math.max(o,s),this._extrudedHeight=Math.min(o,s),this._cornerType=n.defaultValue(t.cornerType,i.CornerType.ROUNDED),this._granularity=n.defaultValue(t.granularity,m.CesiumMath.RADIANS_PER_DEGREE),this._shadowVolume=n.defaultValue(t.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=t.offsetAttribute,this._rectangle=void 0,this.packedLength=1+e.length*r.Cartesian3.packedLength+r.Ellipsoid.packedLength+y.VertexFormat.packedLength+7}J.pack=function(t,e,a){a=n.defaultValue(a,0);const i=t._positions,o=i.length;e[a++]=o;for(let t=0;t<o;++t,a+=r.Cartesian3.packedLength)r.Cartesian3.pack(i[t],e,a);return r.Ellipsoid.pack(t._ellipsoid,e,a),a+=r.Ellipsoid.packedLength,y.VertexFormat.pack(t._vertexFormat,e,a),a+=y.VertexFormat.packedLength,e[a++]=t._width,e[a++]=t._height,e[a++]=t._extrudedHeight,e[a++]=t._cornerType,e[a++]=t._granularity,e[a++]=t._shadowVolume?1:0,e[a]=n.defaultValue(t._offsetAttribute,-1),e};const j=r.Ellipsoid.clone(r.Ellipsoid.UNIT_SPHERE),K=new y.VertexFormat,Q={positions:void 0,ellipsoid:j,vertexFormat:K,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};return J.unpack=function(t,e,a){e=n.defaultValue(e,0);const i=t[e++],o=new Array(i);for(let a=0;a<i;++a,e+=r.Cartesian3.packedLength)o[a]=r.Cartesian3.unpack(t,e);const s=r.Ellipsoid.unpack(t,e,j);e+=r.Ellipsoid.packedLength;const l=y.VertexFormat.unpack(t,e,K);e+=y.VertexFormat.packedLength;const d=t[e++],u=t[e++],m=t[e++],c=t[e++],f=t[e++],p=1===t[e++],g=t[e];return n.defined(a)?(a._positions=o,a._ellipsoid=r.Ellipsoid.clone(s,a._ellipsoid),a._vertexFormat=y.VertexFormat.clone(l,a._vertexFormat),a._width=d,a._height=u,a._extrudedHeight=m,a._cornerType=c,a._granularity=f,a._shadowVolume=p,a._offsetAttribute=-1===g?void 0:g,a):(Q.positions=o,Q.width=d,Q.height=u,Q.extrudedHeight=m,Q.cornerType=c,Q.granularity=f,Q.shadowVolume=p,Q.offsetAttribute=-1===g?void 0:g,new J(Q))},J.computeRectangle=function(t,e){const a=(t=n.defaultValue(t,n.defaultValue.EMPTY_OBJECT)).positions,o=t.width;return q(a,n.defaultValue(t.ellipsoid,r.Ellipsoid.WGS84),o,n.defaultValue(t.cornerType,i.CornerType.ROUNDED),e)},J.createGeometry=function(i){let l=i._positions;const u=i._width,f=i._ellipsoid;l=M(l,f);const y=t.arrayRemoveDuplicates(l,r.Cartesian3.equalsEpsilon);if(y.length<2||u<=0)return;const p=i._height,g=i._extrudedHeight,h=!m.CesiumMath.equalsEpsilon(p,g,0,m.CesiumMath.EPSILON2),b=i._vertexFormat,C={ellipsoid:f,positions:y,width:u,cornerType:i._cornerType,granularity:i._granularity,saveAttributes:!0};let A;if(h)C.height=p,C.extrudedHeight=g,C.shadowVolume=i._shadowVolume,C.offsetAttribute=i._offsetAttribute,A=S(C,b);else{if(A=O(o.CorridorGeometryLibrary.computePositions(C),b,f),A.attributes.position.values=c.PolygonPipeline.scaleToGeodeticHeight(A.attributes.position.values,p,f),n.defined(i._offsetAttribute)){const t=i._offsetAttribute===d.GeometryOffsetAttribute.NONE?0:1,e=A.attributes.position.values.length,r=new Uint8Array(e/3).fill(t);A.attributes.applyOffset=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:r})}}const _=A.attributes,w=e.BoundingSphere.fromVertices(_.position.values,void 0,3);return b.position||(A.attributes.position.values=void 0),new s.Geometry({attributes:_,indices:A.indices,primitiveType:s.PrimitiveType.TRIANGLES,boundingSphere:w,offsetAttribute:i._offsetAttribute})},J.createShadowVolume=function(t,e,r){const a=t._granularity,i=t._ellipsoid,o=e(a,i),n=r(a,i);return new J({positions:t._positions,width:t._width,cornerType:t._cornerType,ellipsoid:i,granularity:a,extrudedHeight:o,height:n,vertexFormat:y.VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(J.prototype,{rectangle:{get:function(){return n.defined(this._rectangle)||(this._rectangle=q(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}}),function(t,e){return n.defined(e)&&(t=J.unpack(t,e)),t._ellipsoid=r.Ellipsoid.clone(t._ellipsoid),J.createGeometry(t)}}));