26 lines
13 KiB
JavaScript
26 lines
13 KiB
JavaScript
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
|
* Version 1.95
|
||
|
|
*
|
||
|
|
* 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.
|
||
|
|
*/
|
||
|
|
define(["exports","./Matrix2-6555478a","./RuntimeError-d45af186","./ComponentDatatype-43ab226f","./defaultValue-ac2201bb","./EllipsoidRhumbLine-e7a75836","./GeometryAttribute-a34d86d0","./WebGLConstants-e12cdc8a"],(function(e,t,n,r,a,i,u,o){"use strict";var s=p,x=p;function p(e,t,n){n=n||2;var r,a,i,u,o,s,x,p=t&&t.length,f=p?t[0]*n:e.length,c=l(e,0,f,n,!0),v=[];if(!c||c.next===c.prev)return v;if(p&&(c=function(e,t,n,r){var a,i,u,o=[];for(a=0,i=t.length;a<i;a++)(u=l(e,t[a]*r,a<i-1?t[a+1]*r:e.length,r,!1))===u.next&&(u.steiner=!0),o.push(b(u));for(o.sort(m),a=0;a<o.length;a++)n=y(n=C(o[a],n),n.next);return n}(e,t,c,n)),e.length>80*n){r=i=e[0],a=u=e[1];for(var d=n;d<f;d+=n)(o=e[d])<r&&(r=o),(s=e[d+1])<a&&(a=s),o>i&&(i=o),s>u&&(u=s);x=0!==(x=Math.max(i-r,u-a))?1/x:0}return h(c,v,n,r,a,x),v}function l(e,t,n,r,a){var i,u;if(a===B(e,t,n,r)>0)for(i=t;i<n;i+=r)u=G(i,e[i],e[i+1],u);else for(i=n-r;i>=t;i-=r)u=G(i,e[i],e[i+1],u);return u&&M(u,u.next)&&(O(u),u=u.next),u}function y(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==E(r.prev,r,r.next))r=r.next;else{if(O(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function h(e,t,n,r,a,i,u){if(e){!u&&i&&function(e,t,n,r){var a=e;do{null===a.z&&(a.z=w(a.x,a.y,t,n,r)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,function(e){var t,n,r,a,i,u,o,s,x=1;do{for(n=e,e=null,i=null,u=0;n;){for(u++,r=n,o=0,t=0;t<x&&(o++,r=r.nextZ);t++);for(s=x;o>0||s>0&&r;)0!==o&&(0===s||!r||n.z<=r.z)?(a=n,n=n.nextZ,o--):(a=r,r=r.nextZ,s--),i?i.nextZ=a:e=a,a.prevZ=i,i=a;n=r}i.nextZ=null,x*=2}while(u>1)}(a)}(e,r,a,i);for(var o,s,x=e;e.prev!==e.next;)if(o=e.prev,s=e.next,i?c(e,r,a,i):f(e))t.push(o.i/n),t.push(e.i/n),t.push(s.i/n),O(e),e=s.next,x=s.next;else if((e=s)===x){u?1===u?h(e=v(y(e),t,n),t,n,r,a,i,2):2===u&&d(e,t,n,r,a,i):h(y(e),t,n,r,a,i,1);break}}}function f(e){var t=e.prev,n=e,r=e.next;if(E(t,n,r)>=0)return!1;for(var a=e.next.next;a!==e.prev;){if(A(t.x,t.y,n.x,n.y,r.x,r.y,a.x,a.y)&&E(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function c(e,t,n,r){var a=e.prev,i=e,u=e.next;if(E(a,i,u)>=0)return!1;for(var o=a.x<i.x?a.x<u.x?a.x:u.x:i.x<u.x?i.x:u.x,s=a.y<i.y?a.y<u.y?a.y:u.y:i.y<u.y?i.y:u.y,x=a.x>i.x?a.x>u.x?a.x:u.x:i.x>u.x?i.x:u.x,p=a.y>i.y?a.y>u.y?a.y:u.y:i.y>u.y?i.y:u.y,l=w(o,s,t,n,r),y=w(x,p,t,n,r),h=e.prevZ,f=e.nextZ;h&&h.z>=l&&f&&f.z<=y;){if(h!==e.prev&&h!==e.next&&A(a.x,a.y,i.x,i.y,u.x,u.y,h.x,h.y)&&E(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,f!==e.prev&&f!==e.next&&A(a.x,a.y,i.x,i.y,u.x,u.y,f.x,f.y)&&E(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;h&&h.z>=l;){if(h!==e.prev&&h!==e.next&&A(a.x,a.y,i.x,i.y,u.x,u.y,h.x,h.y)&&E(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;f&&f.z<=y;){if(f!==e.prev&&f!==e.next&&A(a.x,a.y,i.x,i.y,u.x,u.y,f.x,f.y)&&E(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function v(e,t,n){var r=e;do{var a=r.prev,i=r.next.next;!M(a,i)&&Z(a,r,r.next,i)&&R(a,i)&&R(i,a)&&(t.push(a.i/n),t.push(r.i/n),t.push(i.i/n),O(r),O(r.next),r=e=i),r=r.next}while(r!==e);return y(r)}function d(e,t,n,r,a,i){var u=e;do{for(var o=u.next.next;o!==u.prev;){if(u.i!==o.i&&S(u,o)){var s=D(u,o);return u=y(u,u.next),s=y(s,s.next),h(u,t,n,r,a,i),void h(s,t,n,r,a,i)}o=o.next}u=u.next}while(u!==e)}function m(e,t){return e.x-t.x}function C(e,t){var n=function(e,t){var n,r=t,a=e.x,i=e.y,u=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var o=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=a&&o>u){if(u=o,o===a){if(i===r.y)return r;if(i===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(a===u)return n;var s,x=n,p=n.x,l=n.y,y=1/0;r=n;do{a>=r.x&&r.x>=p&&a!==r.x&&A(i<l?a:u,i,p,l,i<l?u:a,i,r.x,r.y)&&(s=Math.abs(i-r.y)/(a-r.x),R(r,e)&&(s<y||s===y&&(r.x>n.x||r.x===n.x&&g(n,r)))&&(n=r,y=s)),r=r.next}while(r!==x);return n}(e,t);if(!n)return t;var r=D(n,e),a=y(n,n.next);return y(r,r.next),t===n?a:t}function g(e,t){return E(e.prev,e,t.prev)<0&&E(t.next,e,e.next)<0}function w(e,t,n,r,a){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*a)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&(
|