qd-changjing/public/leaflet/libs/iClientfor3D/Workers/createSimplePolylineGeometr...

62 lines
141 KiB
JavaScript
Raw Normal View History

2022-07-05 16:56:29 +08:00
/**
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
*
* Copyright 2011-2017 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/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
*/
/**
@license
mersenne-twister.js - https://gist.github.com/banksean/300494
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
!function(){define("Core/defined",[],function(){"use strict";function e(e){return void 0!==e&&null!==e}return e}),define("Core/DeveloperError",["./defined"],function(e){"use strict";function t(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t}return e(Object.create)&&(t.prototype=Object.create(Error.prototype),t.prototype.constructor=t),t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("Core/Check",["./defined","./DeveloperError"],function(e,t){"use strict";function r(e){return e+" is required, actual value was undefined"}function n(e,t,r){return"Expected "+r+" to be typeof "+t+", actual typeof was "+e}var a={};return a.typeOf={},a.defined=function(n,a){if(!e(a))throw new t(r(n))},a.typeOf.func=function(e,r){if("function"!=typeof r)throw new t(n(typeof r,"function",e))},a.typeOf.string=function(e,r){if("string"!=typeof r)throw new t(n(typeof r,"string",e))},a.typeOf.number=function(e,r){if("number"!=typeof r)throw new t(n(typeof r,"number",e))},a.typeOf.number.lessThan=function(e,r,n){if(a.typeOf.number(e,r),r>=n)throw new t("Expected "+e+" to be less than "+n+", actual value was "+r)},a.typeOf.number.lessThanOrEquals=function(e,r,n){if(a.typeOf.number(e,r),r>n)throw new t("Expected "+e+" to be less than or equal to "+n+", actual value was "+r)},a.typeOf.number.greaterThan=function(e,r,n){if(a.typeOf.number(e,r),n>=r)throw new t("Expected "+e+" to be greater than "+n+", actual value was "+r)},a.typeOf.number.greaterThanOrEquals=function(e,r,n){if(a.typeOf.number(e,r),n>r)throw new t("Expected "+e+" to be greater than or equal to"+n+", actual value was "+r)},a.typeOf.object=function(e,r){if("object"!=typeof r)throw new t(n(typeof r,"object",e))},a.typeOf.bool=function(e,r){if("boolean"!=typeof r)throw new t(n(typeof r,"boolean",e))},a.typeOf.number.equals=function(e,r,n,o){if(a.typeOf.number(e,n),a.typeOf.number(r,o),n!==o)throw new t(e+" must be equal to "+r+", the actual values are "+n+" and "+o)},a}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";function t(e,t){return void 0!==e&&null!==e?e:t}return t.EMPTY_OBJECT=e({}),t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t,r,n){"use strict";var a={};a.Radious=6378137,a.EPSILON1=.1,a.EPSILON2=.01,a.EPSILON3=.001,a.EPSILON4=1e-4,a.EPSILON5=1e-5,a.EPSILON6=1e-6,a.EPSILON7=1e-7,a.EPSILON8=1e-8,a.EPSILON9=1e-9,a.EPSILON10=1e-10,a.EPSILON11=1e-11,a.EPSILON12=1e-12,a.EPSILON13=1e-13,a.EPSILON14
t.typeOf.object("result",n);var a=r.x,o=r.y,i=r.z,u=e[0]*a+e[3]*o+e[6]*i,s=e[1]*a+e[4]*o+e[7]*i,c=e[2]*a+e[5]*o+e[8]*i;return n.x=u,n.y=s,n.z=c,n},s.multiplyByScalar=function(e,r,n){return t.typeOf.object("matrix",e),t.typeOf.number("scalar",r),t.typeOf.object("result",n),n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7]*r,n[8]=e[8]*r,n},s.multiplyByScale=function(e,r,n){return t.typeOf.object("matrix",e),t.typeOf.object("scale",r),t.typeOf.object("result",n),n[0]=e[0]*r.x,n[1]=e[1]*r.x,n[2]=e[2]*r.x,n[3]=e[3]*r.y,n[4]=e[4]*r.y,n[5]=e[5]*r.y,n[6]=e[6]*r.z,n[7]=e[7]*r.z,n[8]=e[8]*r.z,n},s.negate=function(e,r){return t.typeOf.object("matrix",e),t.typeOf.object("result",r),r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r},s.transpose=function(e,r){t.typeOf.object("matrix",e),t.typeOf.object("result",r);var n=e[0],a=e[3],o=e[6],i=e[1],u=e[4],s=e[7],c=e[2],l=e[5],f=e[8];return r[0]=n,r[1]=a,r[2]=o,r[3]=i,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r};var d=[1,0,0],p=[2,2,1],_=new s,O=new s;return s.computeEigenDecomposition=function(e,r){t.typeOf.object("matrix",e);var a=u.EPSILON20,o=10,i=0,E=0;n(r)||(r={});for(var h=r.unitary=s.clone(s.IDENTITY,r.unitary),d=r.diagonal=s.clone(e,r.diagonal),p=a*c(d);o>E&&l(d)>p;)f(d,_),s.transpose(_,O),s.multiply(d,_,d),s.multiply(O,d,d),s.multiply(h,_,h),++i>2&&(++E,i=0);return r},s.abs=function(e,r){return t.typeOf.object("matrix",e),t.typeOf.object("result",r),r[0]=Math.abs(e[0]),r[1]=Math.abs(e[1]),r[2]=Math.abs(e[2]),r[3]=Math.abs(e[3]),r[4]=Math.abs(e[4]),r[5]=Math.abs(e[5]),r[6]=Math.abs(e[6]),r[7]=Math.abs(e[7]),r[8]=Math.abs(e[8]),r},s.determinant=function(e){t.typeOf.object("matrix",e);var r=e[0],n=e[3],a=e[6],o=e[1],i=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return r*(i*l-c*u)+o*(c*a-n*l)+s*(n*u-i*a)},s.inverse=function(e,r){t.typeOf.object("matrix",e),t.typeOf.object("result",r);var n=e[0],a=e[1],i=e[2],c=e[3],l=e[4],f=e[5],E=e[6],h=e[7],d=e[8],p=s.determinant(e);if(Math.abs(p)<=u.EPSILON15)throw new o("matrix is not invertible");r[0]=l*d-h*f,r[1]=h*i-a*d,r[2]=a*f-l*i,r[3]=E*f-c*d,r[4]=n*d-E*i,r[5]=c*i-n*f,r[6]=c*h-E*l,r[7]=E*a-n*h,r[8]=n*l-c*a;var _=1/p;return s.multiplyByScalar(r,_,r)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},s.equalsEpsilon=function(e,r,a){return t.typeOf.number("epsilon",a),e===r||n(e)&&n(r)&&Math.abs(e[0]-r[0])<=a&&Math.abs(e[1]-r[1])<=a&&Math.abs(e[2]-r[2])<=a&&Math.abs(e[3]-r[3])<=a&&Math.abs(e[4]-r[4])<=a&&Math.abs(e[5]-r[5])<=a&&Math.abs(e[6]-r[6])<=a&&Math.abs(e[7]-r[7])<=a&&Math.abs(e[8]-r[8])<=a},s.IDENTITY=i(new s(1,0,0,0,1,0,0,0,1)),s.ZERO=i(new s(0,0,0,0,0,0,0,0,0)),s.COLUMN0ROW0=0,s.COLUMN0ROW1=1,s.COLUMN0ROW2=2,s.COLUMN1ROW0=3,s.COLUMN1ROW1=4,s.COLUMN1ROW2=5,s.COLUMN2ROW0=6,s.COLUMN2ROW1=7,s.COLUMN2ROW2=8,a(s.prototype,{length:{get:function(){return s.packedLength}}}),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},s}),define("Core/Cartesian4",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,o){"use strict";function i(e,r,n,a){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(a,0)}i.fromElements=function(e,t,n,a,o){return r(o)?(o.x=e,o.y=t,o.z=n,o.w=a,o):new i(e,t,n,a)},i.fromColor=function(t,n){return e.typeOf.object("color",t),r(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new i(t.red,t.green,t.blue,t.alpha)},i.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new i(e.x,e.y,e.z,e.w):void 0},i.packe
},s.intersection=function(e,r,a){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r);var o=e.east,i=e.west,c=r.east,l=r.west;i>o&&c>0?o+=u.TWO_PI:l>c&&o>0&&(c+=u.TWO_PI),i>o&&0>l?l+=u.TWO_PI:l>c&&0>i&&(i+=u.TWO_PI);var f=u.negativePiToPi(Math.max(i,l)),E=u.negativePiToPi(Math.min(o,c));if(!((e.west<e.east||r.west<r.east)&&f>=E)){var h=Math.max(e.south,r.south),d=Math.min(e.north,r.north);if(!(h>=d))return n(a)?(a.west=f,a.south=h,a.east=E,a.north=d,a):new s(f,h,E,d)}},s.simpleIntersection=function(e,r,a){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r);var o=Math.max(e.west,r.west),i=Math.max(e.south,r.south),u=Math.min(e.east,r.east),c=Math.min(e.north,r.north);return i>=c||o>=u?void 0:n(a)?(a.west=o,a.south=i,a.east=u,a.north=c,a):new s(o,i,u,c)},s.union=function(e,r,a){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r),n(a)||(a=new s);var o=e.east,i=e.west,c=r.east,l=r.west;i>o&&c>0?o+=u.TWO_PI:l>c&&o>0&&(c+=u.TWO_PI),i>o&&0>l?l+=u.TWO_PI:l>c&&0>i&&(i+=u.TWO_PI);var f=u.convertLongitudeRange(Math.min(i,l)),E=u.convertLongitudeRange(Math.max(o,c));return a.west=f,a.south=Math.min(e.south,r.south),a.east=E,a.north=Math.max(e.north,r.north),a},s.expand=function(e,r,a){return t.typeOf.object("rectangle",e),t.typeOf.object("cartographic",r),n(a)||(a=new s),a.west=Math.min(e.west,r.longitude),a.south=Math.min(e.south,r.latitude),a.east=Math.max(e.east,r.longitude),a.north=Math.max(e.north,r.latitude),a},s.contains=function(e,r){t.typeOf.object("rectangle",e),t.typeOf.object("cartographic",r);var n=r.longitude,a=r.latitude,o=e.west,i=e.east;return o>i&&(i+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>o||u.equalsEpsilon(n,o,u.EPSILON14))&&(i>n||u.equalsEpsilon(n,i,u.EPSILON14))&&a>=e.south&&a<=e.north};var c=new e;return s.subsample=function(e,a,i,l){t.typeOf.object("rectangle",e),a=r(a,o.WGS84),i=r(i,0),n(l)||(l=[]);var f=0,E=e.north,h=e.south,d=e.east,p=e.west,_=c;_.height=i,_.longitude=p,_.latitude=E,l[f]=a.cartographicToCartesian(_,l[f]),f++,_.longitude=d,l[f]=a.cartographicToCartesian(_,l[f]),f++,_.latitude=h,l[f]=a.cartographicToCartesian(_,l[f]),f++,_.longitude=p,l[f]=a.cartographicToCartesian(_,l[f]),f++,0>E?_.latitude=E:h>0?_.latitude=h:_.latitude=0;for(var O=1;8>O;++O)_.longitude=-Math.PI+O*u.PI_OVER_TWO,s.contains(e,_)&&(l[f]=a.cartographicToCartesian(_,l[f]),f++);return 0===_.latitude&&(_.longitude=p,l[f]=a.cartographicToCartesian(_,l[f]),f++,_.longitude=d,l[f]=a.cartographicToCartesian(_,l[f]),f++),l.length=f,l},s.MAX_VALUE=i(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./Check","./defaultValue","./defined","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix3","./Matrix4","./Rectangle"],function(e,t,r,n,a,o,i,u,s,c,l,f){"use strict";function E(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)}var h=new e,d=new e,p=new e,_=new e,O=new e,m=new e,R=new e,T=new e,y=new e,A=new e,S=new e,N=new e;E.fromPoints=function(t,r){if(a(r)||(r=new E),!a(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var n,o=e.clone(t[0],R),i=e.clone(o,h),u=e.clone(o,d),s=e.clone(o,p),c=e.clone(o,_),l=e.clone(o,O),f=e.clone(o,m),C=t.length;for(n=1;C>n;n++){e.clone(t[n],o);var g=o.x,I=o.y,b=o.z;g<i.x&&e.clone(o,i),g>c.x&&e.clone(o,c),I<u.y&&e.clone(o,u),I>l.y&&e.clone(o,l),b<s.z&&e.clone(o,s),b>f.z&&e.clone(o,f)}var M=e.magnitudeSquared(e.subtract(c,i,T)),w=e.magnitudeSquared(e.subtract(l,u,T)),v=e.magnitudeSquared(e.subtract(f,s,T)),F=i,L=c,P=M;w>P&&(P=w,F=u,L=l),v>P&&(P=v,F=s,L=f);var U=y;U.x=.5*(F.x+L.x),U.y=.5*(F.y+L.y),U.z=.5*(F.z+L.z);var D=e.magnitudeSquared(e.subtract(L,U,T)),B=Math.sqrt(D),x=A;x.x=i.x,x.y=u.y,x.z=s.z;var G=S;G.x=c.x,G.y=l.y,G.z=f.z;var q=e.multiplyByScalar(e.add(x,G,T),.5,N),j=0;for(n=0;C>n;n++){e.clone(t[n],o);var z=e.magnitude(e.subtract(o,q,T));z>j&&(j=z);var H=e.magnitudeSquared(e.subtract(o,U,T));if(H>D){var V=Math.sqrt(H);B=.5*(B+V),D=B*B;var X=V-B;U.x=(B*U.x+X*o.x)/V,U.y=(B*U.y+X*o.y)/V,U.z=(B*U.z+X*o.z)/V}}return j>B?(e.clone(U,r.center),r.radius=B
STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:360
if(n(s)&&!(0>s))return n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u)};var y=new l;p.lineSegmentTriangle=function(t,r,o,i,u,s,c){if(!n(t))throw new a("v0 is required.");if(!n(r))throw new a("v1 is required.");if(!n(o))throw new a("p0 is required.");if(!n(i))throw new a("p1 is required.");if(!n(u))throw new a("p2 is required.");var l=y;e.clone(t,l.origin),e.subtract(r,t,l.direction),e.normalize(l.direction,l.direction);var f=p.rayTriangleParametric(l,o,i,u,s);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(c)||(c=new e),e.multiplyByScalar(l.direction,f,c),e.add(l.origin,c,c))};var A={root0:0,root1:0};p.raySphere=function(e,t,r){if(!n(e))throw new a("ray is required.");if(!n(t))throw new a("sphere is required.");return r=E(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var S=new l;p.lineSegmentSphere=function(t,r,o,i){if(!n(t))throw new a("p0 is required.");if(!n(r))throw new a("p1 is required.");if(!n(o))throw new a("sphere is required.");var u=S;e.clone(t,u.origin);var s=e.subtract(r,t,u.direction),c=e.magnitude(s);return e.normalize(s,s),i=E(u,o,i),!n(i)||i.stop<0||i.start>c?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,c),i)};var N=new e,C=new e;p.rayEllipsoid=function(t,r){if(!n(t))throw new a("ray is required.");if(!n(r))throw new a("ellipsoid is required.");var i,u,s,c,l,f=r.oneOverRadii,E=e.multiplyComponents(f,t.origin,N),h=e.multiplyComponents(f,t.direction,C),d=e.magnitudeSquared(E),p=e.dot(E,h);if(d>1){if(p>=0)return;var _=p*p;if(i=d-1,u=e.magnitudeSquared(h),s=u*i,s>_)return;if(_>s){c=p*p-s,l=-p+Math.sqrt(c);var O=l/u,m=i/l;return m>O?new o(O,m):{start:m,stop:O}}var R=Math.sqrt(i/u);return new o(R,R)}return 1>d?(i=d-1,u=e.magnitudeSquared(h),s=u*i,c=p*p-s,l=-p+Math.sqrt(c),new o(0,l/u)):0>p?(u=e.magnitudeSquared(h),new o(0,-p/u)):void 0};var g=new e,I=new e,b=new e,M=new e,w=new e,v=new u,F=new u,L=new u,P=new u,U=new u,D=new u,B=new u,x=new e,G=new e,q=new t;p.grazingAltitudeLocation=function(t,r){if(!n(t))throw new a("ray is required.");if(!n(r))throw new a("ellipsoid is required.");var o=t.origin,s=t.direction;if(!e.equals(o,e.ZERO)){var c=r.geodeticSurfaceNormal(o,g);if(e.dot(s,c)>=0)return o}var l=n(this.rayEllipsoid(t,r)),f=r.transformPositionToScaledSpace(s,g),E=e.normalize(f,f),h=e.mostOrthogonalAxis(f,M),p=e.normalize(e.cross(h,E,I),I),_=e.normalize(e.cross(E,p,b),b),O=v;O[0]=E.x,O[1]=E.y,O[2]=E.z,O[3]=p.x,O[4]=p.y,O[5]=p.z,O[6]=_.x,O[7]=_.y,O[8]=_.z;var m=u.transpose(O,F),R=u.fromScale(r.radii,L),T=u.fromScale(r.oneOverRadii,P),y=U;y[0]=0,y[1]=-s.z,y[2]=s.y,y[3]=s.z,y[4]=0,y[5]=-s.x,y[6]=-s.y,y[7]=s.x,y[8]=0;var A,S,N=u.multiply(u.multiply(m,T,D),y,D),C=u.multiply(u.multiply(N,R,B),O,B),j=u.multiplyByVector(N,o,w),z=d(C,e.negate(j,g),0,0,1),H=z.length;if(H>0){for(var V=e.clone(e.ZERO,G),X=Number.NEGATIVE_INFINITY,W=0;H>W;++W){A=u.multiplyByVector(R,u.multiplyByVector(O,z[W],x),x);var Y=e.normalize(e.subtract(A,o,M),M),K=e.dot(Y,s);K>X&&(X=K,V=e.clone(A,V))}var k=r.cartesianToCartographic(V,q);return X=i.clamp(X,0,1),S=e.magnitude(e.subtract(V,o,M))*Math.sqrt(1-X*X),S=l?-S:S,k.height=S,r.cartographicToCartesian(k,new e)}};var j=new e;return p.lineSegmentPlane=function(t,r,o,u){if(!n(t))throw new a("endPoint0 is required.");if(!n(r))throw new a("endPoint1 is required.");if(!n(o))throw new a("plane is required.");n(u)||(u=new e);var s=e.subtract(r,t,j),c=o.normal,l=e.dot(c,s);if(!(Math.abs(l)<i.EPSILON6)){var f=e.dot(c,t),E=-(o.distance+f)/l;if(!(0>E||E>1))return e.multiplyByScalar(s,E,u),e.add(t,u,u),u}},p.trianglePlaneIntersection=function(t,r,o,i){if(!(n(t)&&n(r)&&n(o)&&n(i)))throw new a("p0, p1, p2, and plane are required.");var u=i.normal,s=i.distance,c=e.dot(u,t)+s<0,l=e.dot(u,r)+s<0,f=e.dot(u,o)+s<0,E=0;E+=c?1:0,E+=l?1:0,E+=f?1:0;var h,d;if((1===E||2===E)&&(h=new e,d=new e),1===E){if(c)return p.lineSegmentPlane(t,r,i,h),p.lineSegmentPlane(t,o,i,d),{positions:[t,r,o,h,d],indices:[0,3,4,1,2,4,1,4,3]};if(l)return p.lineSegmentPlane(r,o,i,h),p.lineSegmentPlane(r,t,i,d),{positions:[t,r,o,h,d],indices:[1,3,4,2,0,4,2,4,3]};if(f)return p.lineSegmentPla