You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
12 KiB
27 lines
12 KiB
4 weeks ago
|
/**
|
||
|
* @license
|
||
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
* Version 1.128
|
||
|
*
|
||
|
* 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 st}from"./chunk-MWHUXN6D.js";import{b as xt,c as at,d as et}from"./chunk-D2WGDEJE.js";import{a as tt}from"./chunk-MCJA36VG.js";import{a,b as Y,c as g,d as gt}from"./chunk-KLDIEE7M.js";import{a as X}from"./chunk-BF7B4FIR.js";import{a as ft}from"./chunk-7SDYTY36.js";import{b as A}from"./chunk-IQDUXDOM.js";import{e as F}from"./chunk-GDY26PU3.js";var ct={CLOCKWISE:ft.CW,COUNTER_CLOCKWISE:ft.CCW};ct.validate=function(t){return t===ct.CLOCKWISE||t===ct.COUNTER_CLOCKWISE};var ht=Object.freeze(ct);function mt(t,n,e=2){let o=n&&n.length,r=o?n[0]*e:t.length,s=wt(t,0,r,e,!0),i=[];if(!s||s.next===s.prev)return i;let c,x,u;if(o&&(s=It(t,n,s,e)),t.length>80*e){c=1/0,x=1/0;let p=-1/0,y=-1/0;for(let b=e;b<r;b+=e){let S=t[b],h=t[b+1];S<c&&(c=S),h<x&&(x=h),S>p&&(p=S),h>y&&(y=h)}u=Math.max(p-c,y-x),u=u!==0?32767/u:0}return rt(s,i,e,c,x,u,0),i}function wt(t,n,e,o,r){let s;if(r===Vt(t,n,e,o)>0)for(let i=n;i<e;i+=o)s=vt(i/o|0,t[i],t[i+1],s);else for(let i=e-o;i>=n;i-=o)s=vt(i/o|0,t[i],t[i+1],s);return s&&K(s,s.next)&&(ot(s),s=s.next),s}function N(t,n){if(!t)return t;n||(n=t);let e=t,o;do if(o=!1,!e.steiner&&(K(e,e.next)||w(e.prev,e,e.next)===0)){if(ot(e),e=n=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==n);return n}function rt(t,n,e,o,r,s,i){if(!t)return;!i&&s&&Nt(t,o,r,s);let c=t;for(;t.prev!==t.next;){let x=t.prev,u=t.next;if(s?Rt(t,o,r,s):Pt(t)){n.push(x.i,t.i,u.i),ot(t),t=u.next,c=u.next;continue}if(t=u,t===c){i?i===1?(t=zt(N(t),n),rt(t,n,e,o,r,s,2)):i===2&&Bt(t,n,e,o,r,s):rt(N(t),n,e,o,r,s,1);break}}}function Pt(t){let n=t.prev,e=t,o=t.next;if(w(n,e,o)>=0)return!1;let r=n.x,s=e.x,i=o.x,c=n.y,x=e.y,u=o.y,p=Math.min(r,s,i),y=Math.min(c,x,u),b=Math.max(r,s,i),S=Math.max(c,x,u),h=o.next;for(;h!==n;){if(h.x>=p&&h.x<=b&&h.y>=y&&h.y<=S&&nt(r,c,s,x,i,u,h.x,h.y)&&w(h.prev,h,h.next)>=0)return!1;h=h.next}return!0}function Rt(t,n,e,o){let r=t.prev,s=t,i=t.next;if(w(r,s,i)>=0)return!1;let c=r.x,x=s.x,u=i.x,p=r.y,y=s.y,b=i.y,S=Math.min(c,x,u),h=Math.min(p,y,b),T=Math.max(c,x,u),L=Math.max(p,y,b),z=pt(S,h,n,e,o),D=pt(T,L,n,e,o),l=t.prevZ,f=t.nextZ;for(;l&&l.z>=z&&f&&f.z<=D;){if(l.x>=S&&l.x<=T&&l.y>=h&&l.y<=L&&l!==r&&l!==i&&nt(c,p,x,y,u,b,l.x,l.y)&&w(l.prev,l,l.next)>=0||(l=l.prevZ,f.x>=S&&f.x<=T&&f.y>=h&&f.y<=L&&f!==r&&f!==i&&nt(c,p,x,y,u,b,f.x,f.y)&&w(f.prev,f,f.next)>=0))return!1;f=f.nextZ}for(;l&&l.z>=z;){if(l.x>=S&&l.x<=T&&l.y>=h&&l.y<=L&&l!==r&&l!==i&&nt(c,p,x,y,u,b,l.x,l.y)&&w(l.prev,l,l.next)>=0)return!1;l=l.prevZ}for(;f&&f.z<=D;){if(f.x>=S&&f.x<=T&&f.y>=h&&f.y<=L&&f!==r&&f!==i&&nt(c,p,x,y,u,b,f.x,f.y)&&w(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function zt(t,n){let e=t;do{let o=e.prev,r=e.next.next;!K(o,r)&&bt(o,e,e.next,r)&&it(o,r)&&it(r,o)&&(n.push(o.i,e.i,r.i),ot(e),ot(e.next),e=t=r),e=e.next}while(e!==t);return N(e)}function Bt(t,n,e,o,r,s){let i=t;do{let c=i.next.next;for(;c!==i.prev;){if(i.i!==c.i&&_t(i,c)){let x=Mt(i,c);i=N(i,i.next),x=N(x,x.next),rt(i,n,e,o,r,s,0),rt(x,n,e,o,r,s,0);return}c=c.next}i=i.next}while(i!==t)}function It(t,n,e,o){let r=[];for(let s=0,i=n.length;s<i;s++){let c=n[s]*o,x=s<i-1?n[s+1]*o:t.length,u=wt(t,c,x,o,!1);u===u.next&&(u.steiner=!0),r.push(Ut(u))}r.sort(Wt);for(let s=0;s<r.length;s++)e=$t(r[s],e);return e}function Wt(t,n){let e=t.x-n.x;if(e===0&&(e=t.y-n.y,e===0)){let o=(t.next.y-t.y)/(t.next.x-t.x),r=(n.next.y-n.y)/(n.next.x-n.x);e=o-r}return e}function $t(t,n){let e=Gt(t,n);if(!e)return n;let o=Mt(e,t);return N(o,o.next),N(e,e.next)}function Gt(t,n){let e=n,o=t.x,r=t.y,s=-1/0,i;if(K(t,e))return e;do{if(K(t,e.next))return e.next;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<=o&&y>s&&(s=y,i=e.x<e.next.x?e:e.next,y===o))return i}e=e.next}while(e!==n);if(!i)return null;let c=i,x=i.x,u=i.y,p=1/0;e=i;do{if(o>=e.x&&e.x>=x&&o!==e.x&&St(r<u?o:s,r,x,u,r<u?s:o,r,e.x,e.y)){let y=Math.abs(r-e.y)/(o-e.x);it(e,t)&&(y<p||y===p&&(e.x>i.x||e.x===i.x&&Ht(i,e)))&&(i=e,p=y)}e=e.next}while(e!==c);return i}function Ht(t,n){return w(t.prev,t,n.prev)<0&&w(n.next,t,t.next)<0}function Nt(t,n,e,o){let r=t;do r.z===0&&(r.z=pt(r.x,r.y,n,e,o)),r.prevZ=r.prev,r.
|