/* 2020-9-22 15:23:25 | 版权所有 军懋国兴 */ define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./AttributeCompression-ea810287","./EncodedCartesian3-29a09d7b","./IndexDatatype-79bb407c","./IntersectionTests-459f6f08","./Plane-46b5436f"],function(e,F,M,_,U,Y,q,R,E,l,x,Z,i){"use strict";var A=new U.Cartesian3,D=new U.Cartesian3,P=new U.Cartesian3;var o={calculateACMR:function(e){var t=(e=F.defaultValue(e,F.defaultValue.EMPTY_OBJECT)).indices,r=e.maximumIndex,i=F.defaultValue(e.cacheSize,24);if(!F.defined(t))throw new M.DeveloperError("indices is required.");var a=t.length;if(a<3||a%3!=0)throw new M.DeveloperError("indices length must be a multiple of three.");if(r<=0)throw new M.DeveloperError("maximumIndex must be greater than zero.");if(i<3)throw new M.DeveloperError("cacheSize must be greater than two.");if(!F.defined(r))for(var n=r=0,o=t[n];ni&&(s[t[d]]=p,++p);return(p-i+1)/(a/3)}};o.tipsify=function(e){var t=(e=F.defaultValue(e,F.defaultValue.EMPTY_OBJECT)).indices,r=e.maximumIndex,i=F.defaultValue(e.cacheSize,24);function a(e,t,r,i,a,n,o){for(var s,u=-1,p=-1,d=0;di&&(v.timeStamp=C,++C),++s}h=a(0,i,w,d,C,g,o)}return A};var t={};function s(e,t,r,i,a){e[t++]=r,e[t++]=i,e[t++]=i,e[t++]=a,e[t++]=a,e[t]=r}function m(e){var t,r,i={};for(t in e){e.hasOwnProperty(t)&&F.defined(e[t])&&F.defined(e[t].values)&&(r=e[t],i[t]=new R.GeometryAttribute({componentDatatype:r.componentDatatype,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize,values:[]}))}return i}t.toWireframe=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");var t=e.indices;if(F.defined(t)){switch(e.primitiveType){case R.PrimitiveType.TRIANGLES:e.indices=function(e){for(var t=e.length,r=t/3*6,i=x.IndexDatatype.createTypedArray(t,r),a=0,n=0;na&&(a=r[n]);e.indices=o.tipsify({indices:r,maximumIndex:a,cacheSize:t})}return e},t.fitToUnsignedShortIndices=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");if(F.defined(e.indices)&&e.primitiveType!==R.PrimitiveType.TRIANGLES&&e.primitiveType!==R.PrimitiveType.LINES&&e.primitiveType!==R.PrimitiveType.POINTS)throw new M.DeveloperError("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");var t=[],r=R.Geometry.computeNumberOfVertices(e);if(F.defined(e.indices)&&r>=_.CesiumMath.SIXTY_FOUR_KILOBYTES){var i,a=[],n=[],o=0,s=m(e.attributes),u=e.indices,p=u.length;e.primitiveType===R.PrimitiveType.TRIANGLES?i=3:e.primitiveType===R.PrimitiveType.LINES?i=2:e.primitiveType===R.PrimitiveType.POINTS&&(i=1);for(var d=0;d=_.CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(new R.Geometry({attributes:s,indices:n,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],n=[],o=0,s=m(e.attributes))}0!==n.length&&t.push(new R.Geometry({attributes:s,indices:n,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var y=new U.Cartesian3,c=new U.Cartographic;t.projectTo2D=function(e,t,r,i,a){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");if(!F.defined(t))throw new M.DeveloperError("attributeName is required.");if(!F.defined(r))throw new M.DeveloperError("attributeName3D is required.");if(!F.defined(i))throw new M.DeveloperError("attributeName2D is required.");if(!F.defined(e.attributes[t]))throw new M.DeveloperError("geometry must have attribute matching the attributeName argument: "+t+".");if(e.attributes[t].componentDatatype!==q.ComponentDatatype.DOUBLE)throw new M.DeveloperError("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");for(var n=e.attributes[t],o=(a=F.defined(a)?a:new Y.GeographicProjection).ellipsoid,s=n.values,u=new Float64Array(s.length),p=0,d=0;d_.CesiumMath.EPSILON6?1:0},oe=new U.Cartesian3,se=new U.Cartesian3,ue=new U.Cartesian3,pe=new U.Cartesian3;function de(e,t,r,i,a,n,o,s,u,p,d,l,f,v,m,y){if(F.defined(n)||F.defined(o)||F.defined(s)||F.defined(u)||F.defined(p)||0!==v){var c,h,C,b,w=function(e,t,r,i,a){var n,o,s,u,p,d,l,f;if(M.Check.defined("point",e),M.Check.defined("p0",t),M.Check.defined("p1",r),M.Check.defined("p2",i),F.defined(a)||(a=new U.Cartesian3),F.defined(t.z)){if(U.Cartesian3.equalsEpsilon(e,t,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_X,a);if(U.Cartesian3.equalsEpsilon(e,r,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_Y,a);if(U.Cartesian3.equalsEpsilon(e,i,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_Z,a);n=U.Cartesian3.subtract(r,t,A),o=U.Cartesian3.subtract(i,t,D),s=U.Cartesian3.subtract(e,t,P),u=U.Cartesian3.dot(n,n),p=U.Cartesian3.dot(n,o),d=U.Cartesian3.dot(n,s),l=U.Cartesian3.dot(o,o),f=U.Cartesian3.dot(o,s)}else{if(U.Cartesian2.equalsEpsilon(e,t,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_X,a);if(U.Cartesian2.equalsEpsilon(e,r,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_Y,a);if(U.Cartesian2.equalsEpsilon(e,i,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_Z,a);n=U.Cartesian2.subtract(r,t,A),o=U.Cartesian2.subtract(i,t,D),s=U.Cartesian2.subtract(e,t,P),u=U.Cartesian2.dot(n,n),p=U.Cartesian2.dot(n,o),d=U.Cartesian2.dot(n,s),l=U.Cartesian2.dot(o,o),f=U.Cartesian2.dot(o,s)}a.y=l*d-p*f,a.z=u*f-p*d;var v=u*l-p*p;return 0!==a.y&&(a.y/=v),0!==a.z&&(a.z/=v),a.x=1-a.y-a.z,a}(i,U.Cartesian3.fromArray(a,3*e,oe),U.Cartesian3.fromArray(a,3*t,se),U.Cartesian3.fromArray(a,3*r,ue),pe);if(F.defined(n)&&ie(e,t,r,w,n,l.normal.values,y,!0),F.defined(p)&&(c=U.Cartesian3.fromArray(p,3*e,oe),h=U.Cartesian3.fromArray(p,3*t,se),C=U.Cartesian3.fromArray(p,3*r,ue),U.Cartesian3.multiplyByScalar(c,w.x,c),U.Cartesian3.multiplyByScalar(h,w.y,h),U.Cartesian3.multiplyByScalar(C,w.z,C),U.Cartesian3.equals(c,U.Cartesian3.ZERO)&&U.Cartesian3.equals(h,U.Cartesian3.ZERO)&&U.Cartesian3.equals(C,U.Cartesian3.ZERO)?((b=oe).x=0,b.y=0,b.z=0):(b=U.Cartesian3.add(c,h,c),U.Cartesian3.add(b,C,b),U.Cartesian3.normalize(b,b)),U.Cartesian3.pack(b,l.extrudeDirection.values,3*y)),F.defined(d)&&ne(e,t,r,w,d,l.applyOffset.values,y),F.defined(o)&&ie(e,t,r,w,o,l.tangent.values,y,!0),F.defined(s)&&ie(e,t,r,w,s,l.bitangent.values,y,!0),F.defined(u)&&ae(e,t,r,w,u,l.st.values,y),0