27 lines
12 KiB
JavaScript
27 lines
12 KiB
JavaScript
![]() |
/**
|
||
|
* @license
|
||
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
* Version 1.125
|
||
|
*
|
||
|
* 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 ct}from"./chunk-ZBEWS6NN.js";import{b as at,c as ht,d as nt}from"./chunk-NW2YE576.js";import{a as et}from"./chunk-QHHYYTCM.js";import{a,b as tt,c as g,d as vt}from"./chunk-RH3GFHG2.js";import{a as Y}from"./chunk-FRWNWNYJ.js";import{a as xt}from"./chunk-UKWFHLUK.js";import{a as K}from"./chunk-TA3RE4KQ.js";import{b as A}from"./chunk-RTY3VPG6.js";import{e as F}from"./chunk-LRNH5AEO.js";var ut={CLOCKWISE:xt.CW,COUNTER_CLOCKWISE:xt.CCW};ut.validate=function(t){return t===ut.CLOCKWISE||t===ut.COUNTER_CLOCKWISE};var pt=Object.freeze(ut);function dt(t,n,e=2){let o=n&&n.length,r=o?n[0]*e:t.length,s=St(t,0,r,e,!0),i=[];if(!s||s.next===s.prev)return i;let c,x,u;if(o&&(s=Wt(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 it(s,i,e,c,x,u,0),i}function St(t,n,e,o,r){let s;if(r===qt(t,n,e,o)>0)for(let i=n;i<e;i+=o)s=wt(i/o|0,t[i],t[i+1],s);else for(let i=e-o;i>=n;i-=o)s=wt(i/o|0,t[i],t[i+1],s);return s&&V(s,s.next)&&(st(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&&(V(e,e.next)||w(e.prev,e,e.next)===0)){if(st(e),e=n=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==n);return n}function it(t,n,e,o,r,s,i){if(!t)return;!i&&s&&kt(t,o,r,s);let c=t;for(;t.prev!==t.next;){let x=t.prev,u=t.next;if(s?zt(t,o,r,s):Rt(t)){n.push(x.i,t.i,u.i),st(t),t=u.next,c=u.next;continue}if(t=u,t===c){i?i===1?(t=Bt(N(t),n),it(t,n,e,o,r,s,2)):i===2&&It(t,n,e,o,r,s):it(N(t),n,e,o,r,s,1);break}}}function Rt(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&&rt(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 zt(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=yt(S,h,n,e,o),D=yt(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&&rt(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&&rt(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&&rt(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&&rt(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 Bt(t,n){let e=t;do{let o=e.prev,r=e.next.next;!V(o,r)&&Mt(o,e,e.next,r)&&ot(o,r)&&ot(r,o)&&(n.push(o.i,e.i,r.i),st(e),st(e.next),e=t=r),e=e.next}while(e!==t);return N(e)}function It(t,n,e,o,r,s){let i=t;do{let c=i.next.next;for(;c!==i.prev;){if(i.i!==c.i&&Kt(i,c)){let x=At(i,c);i=N(i,i.next),x=N(x,x.next),it(i,n,e,o,r,s,0),it(x,n,e,o,r,s,0);return}c=c.next}i=i.next}while(i!==t)}function Wt(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=St(t,c,x,o,!1);u===u.next&&(u.steiner=!0),r.push(_t(u))}r.sort($t);for(let s=0;s<r.length;s++)e=Gt(r[s],e);return e}function $t(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 Gt(t,n){let e=Ht(t,n);if(!e)return n;let o=At(e,t);return N(o,o.next),N(e,e.next)}function Ht(t,n){let e=n,o=t.x,r=t.y,s=-1/0,i;if(V(t,e))return e;do{if(V(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&&bt(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);ot(e,t)&&(y<p||y===p&&(e.x>i.x||e.x===i.x&&Nt(i,e)))&&(i=e,p=y)}e=e.next}while(e!==c);return i}function Nt(t,n){return w(t.prev,t,n.prev)<0&&w(n.next,t,t.next)<0}function kt(t,n,e,o){let r=t;do r.z===0&&
|