define(["./arrayRemoveDuplicates-216006b0","./Transforms-e9dbfb40","./Cartesian2-49b1de22","./Check-6c0211bc","./ComponentDatatype-6d99a1ee","./CoplanarPolygonGeometryLibrary-f7abbc89","./when-54c2dc71","./GeometryAttribute-669569db","./GeometryAttributes-4fcfcf40","./GeometryInstance-6d66d24e","./GeometryPipeline-39e647e8","./IndexDatatype-46306178","./PolygonGeometryLibrary-2ed36c92","./Math-44e92d6b","./RuntimeError-2109023a","./WebGLConstants-76bb35d1","./OrientedBoundingBox-3669ebd4","./EllipsoidTangentPlane-c4704d0f","./IntersectionTests-6ead8677","./Plane-8f7e53d1","./AttributeCompression-8ecc041c","./EncodedCartesian3-7ff81df8","./ArcType-dc1c5aee","./EllipsoidRhumbLine-9b557f71","./PolygonPipeline-72c97573"],function(a,y,c,e,l,p,o,s,u,d,m,f,g,t,r,n,i,b,h,P,G,v,L,C,T){"use strict";function E(e){e=(e=o.defaultValue(e,o.defaultValue.EMPTY_OBJECT)).polygonHierarchy;this._polygonHierarchy=e,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=g.PolygonGeometryLibrary.computeHierarchyPackedLength(e)+1}E.fromPositions=function(e){return new E({polygonHierarchy:{positions:(e=o.defaultValue(e,o.defaultValue.EMPTY_OBJECT)).positions}})},E.pack=function(e,t,r){return r=o.defaultValue(r,0),t[r=g.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,r)]=e.packedLength,t};var k={polygonHierarchy:{}};return E.unpack=function(e,t,r){t=o.defaultValue(t,0);var n=g.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=n.startingIndex,delete n.startingIndex;t=e[t];return(r=!o.defined(r)?new E(k):r)._polygonHierarchy=n,r.packedLength=t,r},E.createGeometry=function(e){var t=e._polygonHierarchy,e=t.positions,e=a.arrayRemoveDuplicates(e,c.Cartesian3.equalsEpsilon,!0);if(!(e.length<3)&&p.CoplanarPolygonGeometryLibrary.validOutline(e)){var r=g.PolygonGeometryLibrary.polygonOutlinesFromHierarchy(t,!1);if(0!==r.length){for(var n=[],o=0;o<r.length;o++){var i=new d.GeometryInstance({geometry:function(e){for(var t=e.length,r=new Float64Array(3*t),n=f.IndexDatatype.createTypedArray(t,2*t),o=0,i=0,a=0;a<t;a++){var y=e[a];r[o++]=y.x,r[o++]=y.y,r[o++]=y.z,n[i++]=a,n[i++]=(a+1)%t}var c=new u.GeometryAttributes({position:new s.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:r})});return new s.Geometry({attributes:c,indices:n,primitiveType:s.PrimitiveType.LINES})}(r[o])});n.push(i)}e=m.GeometryPipeline.combineInstances(n)[0],t=y.BoundingSphere.fromPoints(t.positions);return new s.Geometry({attributes:e.attributes,indices:e.indices,primitiveType:e.primitiveType,boundingSphere:t})}}},function(e,t){return(e=o.defined(t)?E.unpack(e,t):e)._ellipsoid=c.Ellipsoid.clone(e._ellipsoid),E.createGeometry(e)}});
