27 lines
12 KiB
JavaScript
27 lines
12 KiB
JavaScript
![]() |
/**
|
||
|
* @license
|
||
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
* Version 1.124
|
||
|
*
|
||
|
* 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-RDAVO5OM.js";import{b as at,c as ht,d as nt}from"./chunk-LH3SUUXG.js";import{a as et}from"./chunk-D5HNP2LB.js";import{a as h,b as tt,c as v,d as vt}from"./chunk-S4VBGY2U.js";import{a as Y}from"./chunk-UCTPWOTZ.js";import{a as xt}from"./chunk-54PMPXZ4.js";import{a as K}from"./chunk-N3A5CZ2S.js";import{b as C}from"./chunk-G75U3WZT.js";import{e as D}from"./chunk-3THTQ4QB.js";var ct={CLOCKWISE:xt.CW,COUNTER_CLOCKWISE:xt.CCW};ct.validate=function(t){return t===ct.CLOCKWISE||t===ct.COUNTER_CLOCKWISE};var pt=Object.freeze(ct);function dt(t,n,e=2){let c=n&&n.length,r=c?n[0]*e:t.length,o=bt(t,0,r,e,!0),i=[];if(!o||o.next===o.prev)return i;let s,f,u;if(c&&(o=It(t,n,o,e)),t.length>80*e){s=1/0,f=1/0;let a=-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>a&&(a=S),p>y&&(y=p)}u=Math.max(a-s,y-f),u=u!==0?32767/u:0}return rt(o,i,e,s,f,u,0),i}function bt(t,n,e,c,r){let o;if(r===jt(t,n,e,c)>0)for(let i=n;i<e;i+=c)o=wt(i/c|0,t[i],t[i+1],o);else for(let i=e-c;i>=n;i-=c)o=wt(i/c|0,t[i],t[i+1],o);return o&&ft(o,o.next)&&(ot(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&&(ft(e,e.next)||b(e.prev,e,e.next)===0)){if(ot(e),e=n=e.prev,e===e.next)break;c=!0}else e=e.next;while(c||e!==n);return n}function rt(t,n,e,c,r,o,i){if(!t)return;!i&&o&&Nt(t,c,r,o);let s=t;for(;t.prev!==t.next;){let f=t.prev,u=t.next;if(o?Rt(t,c,r,o):Pt(t)){n.push(f.i,t.i,u.i),ot(t),t=u.next,s=u.next;continue}if(t=u,t===s){i?i===1?(t=zt(N(t),n),rt(t,n,e,c,r,o,2)):i===2&&Bt(t,n,e,c,r,o):rt(N(t),n,e,c,r,o,1);break}}}function Pt(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,a=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>=a&&p.x<=d&&p.y>=y&&p.y<=S&&V(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 Rt(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,a=r.y,y=o.y,d=i.y,S=s<f?s<u?s:u:f<u?f:u,p=a<y?a<d?a:d:y<d?y:d,T=s>f?s>u?s:u:f>u?f:u,L=a>y?a>d?a:d:y>d?y:d,z=yt(S,p,n,e,c),F=yt(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&&V(s,a,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&&V(s,a,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&&V(s,a,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&&V(s,a,f,y,u,d,x.x,x.y)&&b(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function zt(t,n){let e=t;do{let c=e.prev,r=e.next.next;!ft(c,r)&&St(c,e,e.next,r)&&it(c,r)&&it(r,c)&&(n.push(c.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,c,r,o){let i=t;do{let s=i.next.next;for(;s!==i.prev;){if(i.i!==s.i&&_t(i,s)){let f=At(i,s);i=N(i,i.next),f=N(f,f.next),rt(i,n,e,c,r,o,0),rt(f,n,e,c,r,o,0);return}s=s.next}i=i.next}while(i!==t)}function It(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=bt(t,s,f,c,!1);u===u.next&&(u.steiner=!0),r.push(Ut(u))}r.sort(Wt);for(let o=0;o<r.length;o++)e=$t(r[o],e);return e}function Wt(t,n){return t.x-n.x}function $t(t,n){let e=Gt(t,n);if(!e)return n;let c=At(e,t);return N(c,c.next),N(e,e.next)}function Gt(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,a=1/0;e=i;do{if(c>=e.x&&e.x>=f&&c!==e.x&&V(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);it(e,t)&&(y<a||y===a&&(e.x>i.x||e.x===i.x&&Ht(i,e)))&&(i=e,a=y)}e=e.next}while(e!==s);return i}function Ht(t,n){return b(t.prev,t,n.prev)<0&&b(n.next,t,t.next)<0}function Nt(t,n,e,c){let r=t;do r.z===0&&(r.z=yt(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,kt(r)}function kt
|