Files
4.0/dist/electron/static/sdk/Cesium/Workers/EllipseGeometry-489315a9.js

26 lines
16 KiB
JavaScript
Raw Normal View History

2025-07-31 09:31:31 +08:00
/**
* @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(["exports","./Transforms-7ac1f9ee","./Matrix2-cf4c6e69","./ComponentDatatype-9b23164a","./defaultValue-50f7432c","./EllipseGeometryLibrary-446608af","./GeometryAttribute-10955f8d","./GeometryAttributes-8bab1b25","./GeometryInstance-a6a77e5a","./GeometryOffsetAttribute-490bc2c9","./GeometryPipeline-51ce1008","./IndexDatatype-ceed713e","./VertexFormat-fa0c27e8"],(function(t,e,i,r,n,o,a,s,l,u,m,c,p){"use strict";const y=new i.Cartesian3,d=new i.Cartesian3,f=new i.Cartesian3,A=new i.Cartesian3,x=new i.Cartesian2,h=new i.Matrix3,g=new i.Matrix3,_=new e.Quaternion,b=new i.Cartesian3,C=new i.Cartesian3,w=new i.Cartesian3,M=new i.Cartographic,E=new i.Cartesian3,I=new i.Cartesian2,T=new i.Cartesian2;function G(t,l,m){const c=l.vertexFormat,p=l.center,A=l.semiMajorAxis,G=l.semiMinorAxis,N=l.ellipsoid,P=l.stRotation,v=m?t.length/3*2:t.length/3,V=l.shadowVolume,F=c.st?new Float32Array(2*v):void 0,D=c.normal?new Float32Array(3*v):void 0,O=c.tangent?new Float32Array(3*v):void 0,S=c.bitangent?new Float32Array(3*v):void 0,L=V?new Float32Array(3*v):void 0;let R=0,j=b,z=C,k=w;const B=new e.GeographicProjection(N),Y=B.project(N.cartesianToCartographic(p,M),E),H=N.scaleToGeodeticSurface(p,y);N.geodeticSurfaceNormal(H,H);let U=h,Q=g;if(0!==P){let t=e.Quaternion.fromAxisAngle(H,P,_);U=i.Matrix3.fromQuaternion(t,U),t=e.Quaternion.fromAxisAngle(H,-P,_),Q=i.Matrix3.fromQuaternion(t,Q)}else U=i.Matrix3.clone(i.Matrix3.IDENTITY,U),Q=i.Matrix3.clone(i.Matrix3.IDENTITY,Q);const W=i.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,I),J=i.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,T);let q=t.length;const Z=m?q:0,K=Z/3*2;for(let e=0;e<q;e+=3){const r=e+1,n=e+2,o=i.Cartesian3.fromArray(t,e,y);if(c.st){const t=i.Matrix3.multiplyByVector(U,o,d),e=B.project(N.cartesianToCartographic(t,M),f);i.Cartesian3.subtract(e,Y,e),x.x=(e.x+A)/(2*A),x.y=(e.y+G)/(2*G),W.x=Math.min(x.x,W.x),W.y=Math.min(x.y,W.y),J.x=Math.max(x.x,J.x),J.y=Math.max(x.y,J.y),m&&(F[R+K]=x.x,F[R+1+K]=x.y),F[R++]=x.x,F[R++]=x.y}(c.normal||c.tangent||c.bitangent||V)&&(j=N.geodeticSurfaceNormal(o,j),V&&(L[e+Z]=-j.x,L[r+Z]=-j.y,L[n+Z]=-j.z),(c.normal||c.tangent||c.bitangent)&&((c.tangent||c.bitangent)&&(z=i.Cartesian3.normalize(i.Cartesian3.cross(i.Cartesian3.UNIT_Z,j,z),z),i.Matrix3.multiplyByVector(Q,z,z)),c.normal&&(D[e]=j.x,D[r]=j.y,D[n]=j.z,m&&(D[e+Z]=-j.x,D[r+Z]=-j.y,D[n+Z]=-j.z)),c.tangent&&(O[e]=z.x,O[r]=z.y,O[n]=z.z,m&&(O[e+Z]=-z.x,O[r+Z]=-z.y,O[n+Z]=-z.z)),c.bitangent&&(k=i.Cartesian3.normalize(i.Cartesian3.cross(j,z,k),k),S[e]=k.x,S[r]=k.y,S[n]=k.z,m&&(S[e+Z]=k.x,S[r+Z]=k.y,S[n+Z]=k.z))))}if(c.st){q=F.length;for(let t=0;t<q;t+=2)F[t]=(F[t]-W.x)/(J.x-W.x),F[t+1]=(F[t+1]-W.y)/(J.y-W.y)}const X=new s.GeometryAttributes;if(c.position){const e=o.EllipseGeometryLibrary.raisePositionsToHeight(t,l,m);X.position=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e})}if(c.st&&(X.st=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:F})),c.normal&&(X.normal=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:D})),c.tangent&&(X.tangent=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:O})),c.bitangent&&(X.bitangent=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:S})),V&&(X.extrudeDirection=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),m&&n.defined(l.offsetAttribute)){let t=new Uint8Array(v);if(l.offsetAttribute===u.GeometryOffsetAttribute.TOP)t=t.fill(1,0,v/2);else{const e=l.offsetAttribute===u.GeometryOffsetAttribute.NONE?0:1;t=t.fill(e)}X.applyOffset=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}return X}function N(t){const e=new Array(t*(t+1)*12-6);let i,r,n,o,a,s=0;for(i=0,n=1,o=0;o<3;o++)e[s++]=n++,e[s++]=i,e[s++]=n;for(o=2;o<t+1;++o){for(n=o*(o+1)-1,i=(o-