define(["./arrayRemoveDuplicates-18786327","./BoundingRectangle-2b0e1a9b","./Transforms-d5c6ad6e","./Matrix2-ccd5b911","./RuntimeError-346a3079","./ComponentDatatype-93750d1a","./CoplanarPolygonGeometryLibrary-54c559e2","./when-4bbc8319","./GeometryAttribute-c30799b8","./GeometryAttributes-7827a6c2","./GeometryInstance-5f4fe82b","./GeometryPipeline-548e76d2","./IndexDatatype-b7d979a6","./PolygonGeometryLibrary-d35c292d","./PolygonPipeline-83fb62b0","./VertexFormat-71718faa","./combine-83860057","./WebGLConstants-1c8239cc","./OrientedBoundingBox-0a826a8b","./EllipsoidTangentPlane-e000bae1","./AxisAlignedBoundingBox-883f9c89","./IntersectionTests-4d6f5c54","./Plane-18bb00f8","./AttributeCompression-1f045b73","./EncodedCartesian3-08b8d980","./ArcType-98ec98bf","./EllipsoidRhumbLine-aa9e6266"],function(h,e,L,E,t,T,v,l,D,_,x,C,V,f,k,s,n,a,r,o,i,p,y,c,m,u,d){"use strict";var R=new E.Cartesian3,P=new e.BoundingRectangle,I=new E.Cartesian2,M=new E.Cartesian2,A=new E.Cartesian3,w=new E.Cartesian3,F=new E.Cartesian3,G=new E.Cartesian3,B=new E.Cartesian3,H=new E.Cartesian3,O=new L.Quaternion,z=new E.Matrix3,S=new E.Matrix3,N=new E.Cartesian3;function g(e){var t=(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).polygonHierarchy,n=l.defaultValue(e.vertexFormat,s.VertexFormat.DEFAULT);this._vertexFormat=s.VertexFormat.clone(n),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=f.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,n){return n=l.defaultValue(n,0),n=f.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,n),E.Ellipsoid.pack(e._ellipsoid,t,n),n+=E.Ellipsoid.packedLength,s.VertexFormat.pack(e._vertexFormat,t,n),n+=s.VertexFormat.packedLength,t[n++]=e._stRotation,t[n]=e.packedLength,t};var b=E.Ellipsoid.clone(E.Ellipsoid.UNIT_SPHERE),Q=new s.VertexFormat,j={polygonHierarchy:{}};return g.unpack=function(e,t,n){t=l.defaultValue(t,0);var a=f.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=a.startingIndex,delete a.startingIndex;var r=E.Ellipsoid.unpack(e,t,b);t+=E.Ellipsoid.packedLength;var o=s.VertexFormat.unpack(e,t,Q);t+=s.VertexFormat.packedLength;var i=e[t++],t=e[t];return(n=!l.defined(n)?new g(j):n)._polygonHierarchy=a,n._ellipsoid=E.Ellipsoid.clone(r,n._ellipsoid),n._vertexFormat=s.VertexFormat.clone(o,n._vertexFormat),n._stRotation=i,n.packedLength=t,n},g.createGeometry=function(e){var t=e._vertexFormat,n=e._polygonHierarchy,a=e._stRotation,r=n.positions;if(!((r=h.arrayRemoveDuplicates(r,E.Cartesian3.equalsEpsilon,!0)).length<3)){var o=A,i=w,l=F,s=B,p=H;if(v.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,T.CesiumMath.EPSILON6)||(y=e._ellipsoid.geodeticSurfaceNormal(G,N),E.Cartesian3.dot(o,y)<0&&(o=E.Cartesian3.negate(o,o),s=E.Cartesian3.negate(s,s)));var y=v.CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction(G,s,p),c=v.CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction(G,s,p);t.tangent&&(i=E.Cartesian3.clone(s,i)),t.bitangent&&(l=E.Cartesian3.clone(p,l));var n=f.PolygonGeometryLibrary.polygonsFromHierarchy(n,y,!1),y=n.hierarchy,m=n.polygons;if(0!==y.length){for(var r=y[0].outerRing,n=L.BoundingSphere.fromPoints(r),u=f.PolygonGeometryLibrary.computeBoundingRectangle(o,c,r,a,P),d=[],g=0;g