define(["./arrayRemoveDuplicates-3a9a9480","./BoundingRectangle-67be6fe0","./Transforms-73e77b72","./Cartesian2-b4b7b0b3","./Check-5e798bbf","./ComponentDatatype-2da3a966","./CoplanarPolygonGeometryLibrary-6d76da75","./when-208fe5b0","./GeometryAttribute-b541caa6","./GeometryAttributes-b0b294d8","./GeometryInstance-411ead1b","./GeometryPipeline-86615bad","./IndexDatatype-3bc916b1","./Math-8386669c","./PolygonGeometryLibrary-9fe00cbc","./PolygonPipeline-b445e3f3","./VertexFormat-7e57a3bd","./RuntimeError-7f634f5d","./WebGLConstants-5e2a49ab","./OrientedBoundingBox-2e9d8f93","./EllipsoidTangentPlane-69cc10ff","./AxisAlignedBoundingBox-122de82b","./IntersectionTests-40db2afa","./Plane-b91bfb59","./AttributeCompression-9711314b","./EncodedCartesian3-21af0f3b","./ArcType-dc1c5aee","./EllipsoidRhumbLine-73a4e3eb"],function(h,e,L,E,t,T,f,l,D,_,C,v,k,V,x,R,s,a,n,r,o,i,p,y,c,u,m,d){"use strict";var I=new E.Cartesian3,P=new e.BoundingRectangle,M=new E.Cartesian2,B=new E.Cartesian2,A=new E.Cartesian3,w=new E.Cartesian3,F=new E.Cartesian3,G=new E.Cartesian3,H=new E.Cartesian3,O=new E.Cartesian3,z=new L.Quaternion,S=new L.Matrix3,N=new L.Matrix3,Q=new E.Cartesian3;function g(e){var t=(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).polygonHierarchy,a=l.defaultValue(e.vertexFormat,s.VertexFormat.DEFAULT);this._vertexFormat=s.VertexFormat.clone(a),this._polygonHierarchy=t,this._stRotation=l.defaultValue(e.stRotation,0),this._ellipsoid=E.Ellipsoid.clone(l.defaultValue(e.ellipsoid,E.Ellipsoid.WGS84)),this._workerName="createCoplanarPolygonGeometry",this.packedLength=x.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+s.VertexFormat.packedLength+E.Ellipsoid.packedLength+2}g.fromPositions=function(e){return new g({polygonHierarchy:{positions:(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid})},g.pack=function(e,t,a){return a=l.defaultValue(a,0),a=x.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,a),E.Ellipsoid.pack(e._ellipsoid,t,a),a+=E.Ellipsoid.packedLength,s.VertexFormat.pack(e._vertexFormat,t,a),a+=s.VertexFormat.packedLength,t[a++]=e._stRotation,t[a]=e.packedLength,t};var b=E.Ellipsoid.clone(E.Ellipsoid.UNIT_SPHERE),j=new s.VertexFormat,U={polygonHierarchy:{}};return g.unpack=function(e,t,a){t=l.defaultValue(t,0);var n=x.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=n.startingIndex,delete n.startingIndex;var r=E.Ellipsoid.unpack(e,t,b);t+=E.Ellipsoid.packedLength;var o=s.VertexFormat.unpack(e,t,j);t+=s.VertexFormat.packedLength;var i=e[t++],t=e[t];return(a=!l.defined(a)?new g(U):a)._polygonHierarchy=n,a._ellipsoid=E.Ellipsoid.clone(r,a._ellipsoid),a._vertexFormat=s.VertexFormat.clone(o,a._vertexFormat),a._stRotation=i,a.packedLength=t,a},g.createGeometry=function(e){var t=e._vertexFormat,a=e._polygonHierarchy,n=e._stRotation,r=a.positions;if(!((r=h.arrayRemoveDuplicates(r,E.Cartesian3.equalsEpsilon,!0)).length<3)){var o=A,i=w,l=F,s=H,p=O;if(f.CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments(r,G,s,p)){o=E.Cartesian3.cross(s,p,o);o=E.Cartesian3.normalize(o,o),E.Cartesian3.equalsEpsilon(G,E.Cartesian3.ZERO,V.CesiumMath.EPSILON6)||(y=e._ellipsoid.geodeticSurfaceNormal(G,Q),E.Cartesian3.dot(o,y)<0&&(o=E.Cartesian3.negate(o,o),s=E.Cartesian3.negate(s,s)));var y=f.CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction(G,s,p),c=f.CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction(G,s,p);t.tangent&&(i=E.Cartesian3.clone(s,i)),t.bitangent&&(l=E.Cartesian3.clone(p,l));var a=x.PolygonGeometryLibrary.polygonsFromHierarchy(a,y,!1),y=a.hierarchy,u=a.polygons;if(0!==y.length){for(var r=y[0].outerRing,a=L.BoundingSphere.fromPoints(r),m=x.PolygonGeometryLibrary.computeBoundingRectangle(o,c,r,n,P),d=[],g=0;g