|
|
/** * @license * Cesium - https://github.com/CesiumGS/cesium
* Version 1.140.0 * * Copyright 2011-2022 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import{a as ot}from"./chunk-3BFV72N7.js";import{b as xt,c as ht,d as et}from"./chunk-II4OPXPA.js";import{a as tt}from"./chunk-TOK3PZ73.js";import{a as ft}from"./chunk-65MI2E3A.js";import{a as Y,b as v,c as gt}from"./chunk-QQJ4EFK2.js";import{a}from"./chunk-XXWWJ3QU.js";import{a as X}from"./chunk-N6SIW7ZL.js";import{b as C}from"./chunk-K35RPNUR.js";import{e as D}from"./chunk-RTRJ3LVQ.js";var st={CLOCKWISE:ft.CW,COUNTER_CLOCKWISE:ft.CCW};st.validate=function(t){return t===st.CLOCKWISE||t===st.COUNTER_CLOCKWISE};var at=Object.freeze(st);function mt(t,n,e=2){let c=n&&n.length,r=c?n[0]*e:t.length,o=wt(t,0,r,e,!0),i=[];if(!o||o.next===o.prev)return i;let s,f,u;if(c&&(o=Bt(t,n,o,e)),t.length>80*e){s=1/0,f=1/0;let h=-1/0,y=-1/0;for(let d=e;d<r;d+=e){let S=t[d],p=t[d+1];S<s&&(s=S),p<f&&(f=p),S>h&&(h=S),p>y&&(y=p)}u=Math.max(h-s,y-f),u=u!==0?32767/u:0}return nt(o,i,e,s,f,u,0),i}function wt(t,n,e,c,r){let o;if(r===jt(t,n,e,c)>0)for(let i=n;i<e;i+=c)o=vt(i/c|0,t[i],t[i+1],o);else for(let i=e-c;i>=n;i-=c)o=vt(i/c|0,t[i],t[i+1],o);return o&<(o,o.next)&&(it(o),o=o.next),o}function N(t,n){if(!t)return t;n||(n=t);let e=t,c;do if(c=!1,!e.steiner&&(lt(e,e.next)||b(e.prev,e,e.next)===0)){if(it(e),e=n=e.prev,e===e.next)break;c=!0}else e=e.next;while(c||e!==n);return n}function nt(t,n,e,c,r,o,i){if(!t)return;!i&&o&&Ht(t,c,r,o);let s=t;for(;t.prev!==t.next;){let f=t.prev,u=t.next;if(o?Pt(t,c,r,o):Ft(t)){n.push(f.i,t.i,u.i),it(t),t=u.next,s=u.next;continue}if(t=u,t===s){i?i===1?(t=Rt(N(t),n),nt(t,n,e,c,r,o,2)):i===2&&zt(t,n,e,c,r,o):nt(N(t),n,e,c,r,o,1);break}}}function Ft(t){let n=t.prev,e=t,c=t.next;if(b(n,e,c)>=0)return!1;let r=n.x,o=e.x,i=c.x,s=n.y,f=e.y,u=c.y,h=r<o?r<i?r:i:o<i?o:i,y=s<f?s<u?s:u:f<u?f:u,d=r>o?r>i?r:i:o>i?o:i,S=s>f?s>u?s:u:f>u?f:u,p=c.next;for(;p!==n;){if(p.x>=h&&p.x<=d&&p.y>=y&&p.y<=S&&K(r,s,o,f,i,u,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Pt(t,n,e,c){let r=t.prev,o=t,i=t.next;if(b(r,o,i)>=0)return!1;let s=r.x,f=o.x,u=i.x,h=r.y,y=o.y,d=i.y,S=s<f?s<u?s:u:f<u?f:u,p=h<y?h<d?h:d:y<d?y:d,T=s>f?s>u?s:u:f>u?f:u,L=h>y?h>d?h:d:y>d?y:d,z=pt(S,p,n,e,c),F=pt(T,L,n,e,c),l=t.prevZ,x=t.nextZ;for(;l&&l.z>=z&&x&&x.z<=F;){if(l.x>=S&&l.x<=T&&l.y>=p&&l.y<=L&&l!==r&&l!==i&&K(s,h,f,y,u,d,l.x,l.y)&&b(l.prev,l,l.next)>=0||(l=l.prevZ,x.x>=S&&x.x<=T&&x.y>=p&&x.y<=L&&x!==r&&x!==i&&K(s,h,f,y,u,d,x.x,x.y)&&b(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;l&&l.z>=z;){if(l.x>=S&&l.x<=T&&l.y>=p&&l.y<=L&&l!==r&&l!==i&&K(s,h,f,y,u,d,l.x,l.y)&&b(l.prev,l,l.next)>=0)return!1;l=l.prevZ}for(;x&&x.z<=F;){if(x.x>=S&&x.x<=T&&x.y>=p&&x.y<=L&&x!==r&&x!==i&&K(s,h,f,y,u,d,x.x,x.y)&&b(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Rt(t,n){let e=t;do{let c=e.prev,r=e.next.next;!lt(c,r)&&bt(c,e,e.next,r)&&rt(c,r)&&rt(r,c)&&(n.push(c.i,e.i,r.i),it(e),it(e.next),e=t=r),e=e.next}while(e!==t);return N(e)}function zt(t,n,e,c,r,o){let i=t;do{let s=i.next.next;for(;s!==i.prev;){if(i.i!==s.i&&Ut(i,s)){let f=St(i,s);i=N(i,i.next),f=N(f,f.next),nt(i,n,e,c,r,o,0),nt(f,n,e,c,r,o,0);return}s=s.next}i=i.next}while(i!==t)}function Bt(t,n,e,c){let r=[];for(let o=0,i=n.length;o<i;o++){let s=n[o]*c,f=o<i-1?n[o+1]*c:t.length,u=wt(t,s,f,c,!1);u===u.next&&(u.steiner=!0),r.push(kt(u))}r.sort(It);for(let o=0;o<r.length;o++)e=Wt(r[o],e);return e}function It(t,n){return t.x-n.x}function Wt(t,n){let e=$t(t,n);if(!e)return n;let c=St(e,t);return N(c,c.next),N(e,e.next)}function $t(t,n){let e=n,c=t.x,r=t.y,o=-1/0,i;do{if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){let y=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(y<=c&&y>o&&(o=y,i=e.x<e.next.x?e:e.next,y===c))return i}e=e.next}while(e!==n);if(!i)return null;let s=i,f=i.x,u=i.y,h=1/0;e=i;do{if(c>=e.x&&e.x>=f&&c!==e.x&&K(r<u?c:o,r,f,u,r<u?o:c,r,e.x,e.y)){let y=Math.abs(r-e.y)/(c-e.x);rt(e,t)&&(y<h||y===h&&(e.x>i.x||e.x===i.x&&Gt(i,e)))&&(i=e,h=y)}e=e.next}while(e!==s);return i}function Gt(t,n){return b(t.prev,t,n.prev)<0&&b(n.next,t,t.next)<0}function Ht(t,n,e,c){let r=t;do r.z===0&&(r.z=pt(r.x,r.y,n,e,c)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,Nt(r)}function Nt(t){let n,e=1
|