define(["exports","./Matrix2-ccd5b911","./RuntimeError-346a3079","./when-4bbc8319","./WebGLConstants-1c8239cc","./Transforms-d5c6ad6e"],function(t,d,e,n,a,x){"use strict";var r=Object.freeze({NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3}),i={POINTS:a.WebGLConstants.POINTS,LINES:a.WebGLConstants.LINES,LINE_LOOP:a.WebGLConstants.LINE_LOOP,LINE_STRIP:a.WebGLConstants.LINE_STRIP,TRIANGLES:a.WebGLConstants.TRIANGLES,TRIANGLE_STRIP:a.WebGLConstants.TRIANGLE_STRIP,TRIANGLE_FAN:a.WebGLConstants.TRIANGLE_FAN,validate:function(t){return t===i.POINTS||t===i.LINES||t===i.LINE_LOOP||t===i.LINE_STRIP||t===i.TRIANGLES||t===i.TRIANGLE_STRIP||t===i.TRIANGLE_FAN}},o=Object.freeze(i);function s(t){t=n.defaultValue(t,n.defaultValue.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=n.defaultValue(t.primitiveType,o.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=n.defaultValue(t.geometryType,r.NONE),this.boundingSphereCV=t.boundingSphereCV,this.offsetAttribute=t.offsetAttribute}s.computeNumberOfVertices=function(t){var e,a,r=-1;for(e in t.attributes)t.attributes.hasOwnProperty(e)&&n.defined(t.attributes[e])&&n.defined(t.attributes[e].values)&&(r=(a=t.attributes[e]).values.length/a.componentsPerAttribute);return r};var A=new d.Cartographic,P=new d.Cartesian3,S=new d.Matrix4,G=[new d.Cartographic,new d.Cartographic,new d.Cartographic],w=[new d.Cartesian2,new d.Cartesian2,new d.Cartesian2],R=[new d.Cartesian2,new d.Cartesian2,new d.Cartesian2],O=new d.Cartesian3,_=new x.Quaternion,g=new d.Matrix4,v=new d.Matrix2;s._textureCoordinateRotationPoints=function(t,e,a,r){var n=d.Rectangle.center(r,A),i=d.Cartographic.toCartesian(n,a,P),n=x.Transforms.eastNorthUpToFixedFrame(i,a,S),o=d.Matrix4.inverse(n,S),s=w,u=G;u[0].longitude=r.west,u[0].latitude=r.south,u[1].longitude=r.west,u[1].latitude=r.north,u[2].longitude=r.east,u[2].latitude=r.south;for(var I=O,N=0;N<3;N++)d.Cartographic.toCartesian(u[N],a,I),I=d.Matrix4.multiplyByPointAsVector(o,I,I),s[N].x=I.x,s[N].y=I.y;var i=x.Quaternion.fromAxisAngle(d.Cartesian3.UNIT_Z,-e,_),T=d.Matrix3.fromQuaternion(i,g),c=t.length,l=Number.POSITIVE_INFINITY,m=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,b=Number.NEGATIVE_INFINITY;for(N=0;N<c;N++)I=d.Matrix4.multiplyByPointAsVector(o,t[N],I),I=d.Matrix3.multiplyByVector(T,I,I),l=Math.min(l,I.x),m=Math.min(m,I.y),p=Math.max(p,I.x),b=Math.max(b,I.y);var y=d.Matrix2.fromRotation(e,v),E=R;E[0].x=l,E[0].y=m,E[1].x=l,E[1].y=b,E[2].x=p,E[2].y=m;var L=s[0],h=s[2].x-L.x,C=s[1].y-L.y;for(N=0;N<3;N++){var f=E[N];d.Matrix2.multiplyByVector(y,f,f),f.x=(f.x-L.x)/h,f.y=(f.y-L.y)/C}n=E[0],r=E[1],i=E[2],e=new Array(6);return d.Cartesian2.pack(n,e),d.Cartesian2.pack(r,e,2),d.Cartesian2.pack(i,e,4),e},t.Geometry=s,t.GeometryAttribute=function(t){t=n.defaultValue(t,n.defaultValue.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=n.defaultValue(t.normalize,!1),this.values=t.values},t.GeometryType=r,t.PrimitiveType=o});
