/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{pathNumRoundCapExtrusionSubdivisions as e}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";class t{constructor(){this.numVertices=0,this.numIndices=0,this.type=0}rebuildCapGeometry(){}buildTopology(){}}class s{constructor(e,t){this._profile=e,this.type=t}get numVertices(){return this._profile.vertices.length}get numIndices(){return 3*this._profile.numSegments}rebuildCapGeometry(e){const t=this._profile;for(let s=0;s<t.vertices.length;++s)e(s,0,2)}buildTopology(e,t,s){const i=this._profile,r=s+i.indices[0],o=1===t;for(let l=1;l<i.numSegments;++l){const t=s+i.indices[2*l],n=s+i.indices[2*l+1];o?e(n,t,r):e(r,t,n)}}}class i{constructor(e,t){this._profile=e,this._breakNormals=t,this.type=3}get numVertices(){let t=this._profile.vertices.length*(e-1)+this._profile.poles.length;return this._breakNormals&&(t+=this._profile.vertices.length),t}get numIndices(){let t=0;const s=this._profile;t+=2*s.numSegments*(e-1);for(let e=0;e<s.numSegments;++e){const i=s.indices[2*e],r=s.indices[2*e+1];s.poleIndices[i]===s.poleIndices[r]?t+=1:t+=2}return 3*t}rebuildCapGeometry(t){const s=this._profile;for(let e=0;e<s.poles.length;++e)t(e,0,3);if(this._breakNormals)for(let e=0;e<s.vertices.length;++e)t(e,0,1);for(let i=0;i<e-1;++i)for(let e=0;e<s.vertices.length;++e)t(e,i,4)}buildTopology(t,s,i,r){const o=this._profile,l=this._breakNormals?i+o.poles.length:r,n=this._breakNormals?i+o.poles.length+o.vertices.length:i+o.poles.length,c=1===s;for(let h=0;h<o.numSegments;++h){const s=o.indices[2*h],r=o.indices[2*h+1],p=i+o.poleIndices[s],g=i+o.poleIndices[r];let m=l+s,u=l+r;for(let i=0;i<e-1;++i){const e=n+i*o.vertices.length+s,l=n+i*o.vertices.length+r;c?(t(e,u,m),t(u,e,l)):(t(m,u,e),t(l,e,u)),m=e,u=l}c?(t(p,u,m),p!==g&&t(p,g,u)):(t(m,u,p),p!==g&&t(u,g,p))}}}export{t as NoCapBuilder,i as RoundCapBuilder,s as TriangulationCapBuilder};
