@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 8.04 kB
JavaScript
import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{isNone as a}from"../../../../core/maybe.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{d as s,j as c,m,e as l}from"../../../../chunks/mat4.js";import{I as u,c as p}from"../../../../chunks/mat4f64.js";import{s as f}from"../../../../chunks/vec2.js";import{a as h}from"../../../../chunks/vec2f64.js";import{b as M,m as y,a as g,l as d,g as b,h as j,s as v,n as z,e as x,d as P,c as I,f as k}from"../../../../chunks/vec3.js";import{c as w}from"../../../../chunks/vec3f64.js";import{create as S,axis as E,fromPoints as A,wrapAxisAngle as H}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as U,vectorCoordinates as G}from"../../../../geometry/support/coordinateSystem.js";import{create as q,intersectRay as C,fromNormalAndOffset as F}from"../../../../geometry/support/plane.js";import{b as R,i as V,c as T}from"../../../../chunks/sphere.js";import{angle as O}from"../../../../geometry/support/vector.js";import{sm4d as W,sv3d as B}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as D,fromScreenAtEye as J}from"../../support/geometryUtils/ray.js";import{intersectScreen as K}from"../../support/geometryUtils/sphere.js";import{Camera as L}from"../../webgl-engine/lib/Camera.js";import{TERRAIN_ID as N}from"../../webgl-engine/lib/verticalOffsetUtils.js";var Q;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(Q||(Q={}));const X=30,Y=[1,3e8],Z=80,$=8,_=200,tt=1508e5,et=5,nt=50,ot=5,rt=10,at=90,it={exclude:new Set([N])};function st(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ct(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function mt(t,e,n){const o=s(W.get(),n[3],E(n));a(o)||c(o,u)||(M(re,t.eye,e),y(re,re,o),t.eye=g(re,re,e),M(re,t.center,e),y(re,re,o),t.center=g(re,re,e),t.up=y(re,t.up,o))}function lt(t,e,n,o){return C(t,D(e,n,me),o)}function ut(t,e,n,o){return C(t,J(e,n,me),o)}function pt(t,e,n,o){const r=B.get();let a=1-n;M(r,e,t.eye);const i=d(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(b(r,r,a),t.eye=g(re,t.eye,r),t.center=j(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(ht),K(t,e,ht,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=b(B.get(),e.viewForward,r);e.eye=M(re,e.center,a)}const ht=i();function Mt(t,e){v(e,0,0,0);for(const n of t)g(e,e,n);b(e,e,1/t.length)}function yt(t,e,n,o){return Math.sin(t/d(e))*(n+o.radius)}function gt(t,e,n,o){return yt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var dt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(dt||(dt={}));const bt={Elevation:3e4,Angle:e(16)},jt={Pole:.95,Angle:e(18),Tilt:45},vt=e(80);function zt(t,e,n,o,r,a){const i=w(),s=T();let c=!0,m=!0;return t.intersectScreen(n,i,a)?s[3]=d(i):(m=!1,e.aboveGround&&r!==Q.Ellipsoid?s[3]=Math.max(d(e.center),.9*o.radius):s[3]=d(e.eye)-e.relativeElevation,r===Q.Silhouette?kt(s,e,n,i):c=K(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:m}}function xt(t,e,n){if(d(t.eye)-n.radius>bt.Elevation)return dt.Horizontal;J(t,e,le);return-Math.sign(t.relativeElevation)*(.5*Math.PI+O(t.eye,le.direction))<bt.Angle?dt.Vertical:dt.Horizontal}function Pt(t,e,n){M(It,n,e),t.eye=M(re,t.eye,It),t.center=M(re,t.center,It)}const It=w();function kt(t,e,n,o){const r=J(e,n,me);return!a(r)&&(R(t,r,wt),V(t,r,o)?!(P(wt,r.origin)<P(o,r.origin))||(I(o,wt),!1):(M(St,e.eye,e.center),z(St,St),F(St,-x(z(St,St),wt),Et),C(Et,r,o),!1))}const wt=w(),St=w(),Et=q();function At(a,i,s,c,m,l){let u=0;if(k(se,a,i),M(ae,a,i),d(a)<=m||!c.aboveGround){k(s,ae,c.eye);const p=x(a,i)/(d(a)*d(i));if(p<.9999)u=o(p);else{const t=d(k(w(),a,i))/(d(a)*d(i));u=r(t)}const f=Math.cos(n(t.normalize(e(l)),0,vt));u=-u-Math.max(0,d(i)-m)/(f*m)}else M(Ht,c.eye,c.center),k(s,ae,Ht),u=-d(ae)/m;return z(s,s),b(s,s,d(se)),u}const Ht=w();function Ut(r,a,i,s){let c,m;const l=Math.cos(n(t.normalize(e(s)),0,vt));return c=a>i?-(a-i)/(l*i):a<-i?Math.PI-(a+i)/(l*i):o(a/i),m=r>i?-(r-i)/(l*i):r<-i?Math.PI-(r+i)/(l*i):o(r/i),(m-c)*i}function Gt(t,e,n,o,r,a,i,s,c,m){const l=Ut(t[2],e[2],a[3],s),u=c?Ut(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(i)*u-Math.cos(i)*l,h=Math.cos(i)*u+Math.sin(i)*l;z(re,r);const M=c?p/Math.sqrt(Math.abs(a[3]**2-x(n,re)**2)):p/a[3],y=h/Math.sqrt(Math.abs(a[3]**2-x(n,o)**2));f(m,M,y)}function qt(t,e,n,o,r,a,i,s,c,m){k(se,t,e),U(a.up,a.eye,Nt,Qt,Xt),U([0,0,1],a.eye,Jt,Kt,Lt),I(n,Kt),I(o,Jt),z(n,n),b(n,n,d(se)),G(t,z(Qt,Qt),z(Xt,Xt),z(Nt,Nt),Yt),G(e,Qt,Xt,Nt,Zt),Gt(Yt,Zt,t,Jt,Kt,i,s,c,m,r)}function Ct(t,e,n,o,r,a,i){s(te,r,o),s(ee,i,a),m(ne,te,ee),M(e,t,n),y(e,e,ne),g(e,e,n)}function Ft(t,e,n,o,r,a){s(te,o,n),s(ee,a,r),m(ne,te,ee),M(re,t.eye,e),y(re,re,ne),t.eye=g(re,re,e),M(re,t.center,e),y(re,re,ne),t.center=g(re,re,e),M(re,t.up,e),y(re,re,ne),t.up=g(re,re,e)}function Rt(t,e,n,o,r,a){return(Math.abs(o)>Math.PI-jt.Angle||Math.abs(o)<jt.Angle)&&(Math.abs(t[2])<n*jt.Pole||Math.abs(e)>n)&&a.aboveGround&&r<jt.Tilt}function Vt(t,e,n,o,r,a){if(a)A(n,o,_t),mt(e,t,_t);else{const a=At(n,o,ce,e,t[3],r);mt(e,t,H(ce,a))}}function Tt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let m,l;I(oe,o),ie.copyFrom(e);for(let u=0;u<s&&P(n,oe)>c&&(m=P(n,oe),qt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Ft(ie,t,Jt,$t[1],Kt,$t[0]),Ct(oe,oe,t,Jt,$t[1],Kt,$t[0]),l=P(n,oe),l<m||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Rt(r,x(o.up,r),n[3],-t.normalize(e(i)),s,o)?Tt(n,o,r,a,-t.normalize(e(i)),s,c):Vt(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;U([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,c="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-x(t.center,Jt)**2/d(t.center)**2)),.5),u=(Math.sin(a)*c+Math.cos(a)*s)/m,p=-Math.cos(a)*c+Math.sin(a)*s;switch(l(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":l(o.pan.matrix,o.pan.matrix,p,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=k(B.get(),i,a),c=e.translation[0]*n.pan;switch(0!==c&&(l(o.pan.matrix,o.pan.matrix,-c,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(l(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,m,l){Rt(n.center,x(n.up,n.center),d(n.center),-t.normalize(e(s)),c,o)?Wt(o,r,a,m,l,-t.normalize(e(i))):Bt(o,r,a,m,l)}const Jt=w(),Kt=w(),Lt=w(),Nt=w(),Qt=w(),Xt=w(),Yt=w(),Zt=w(),$t=h(),_t=S(),te=p(),ee=p(),ne=p(),oe=w(),re=w(),ae=w(),ie=new L,se=w(),ce=w(),me={origin:w(),direction:w()},le={origin:w(),direction:w()};export{Y as DISTANCE_CLAMP_VALUES,nt as MIN_HEIGHT_LIMIT,dt as NavigationMode,et as PAN_DISTANCE_MODIFIER,X as PIVOT_DISTANCE_MODIFIER,jt as PreservingHeadingThreshold,ot as ROTATE_PIVOT_DISTANCE_MODIFIER,rt as ROTATE_PIVOT_MIN_DISTANCE_MODIFIER,at as ROTATE_SCREEN_PIXEL_AREA,Z as SCREEN_PIXEL_AREA,Q as SpherePickPointFallback,vt as TiltThresholdPanningSpeed,bt as VerticalPanTresholds,$ as ZOOM_DISTANCE_MODIFIER,tt as ZOOM_MAX_DISTANCE_MODIFIER,_ as ZOOM_MIN_DISTANCE_MODIFIER,Pt as applyPanPlanar,Vt as applyPanSphericalDirectRotation,Tt as applyPanSphericalPreserveHeading,mt as applyRotation,Ft as applyRotationWithTwoAxes,ft as applyZoomOnSphere,pt as applyZoomToPoint,Mt as centroid,it as contentIntersectorOptions,xt as decideNavigationMode,lt as intersectPlaneFromScreenPoint,ut as intersectPlaneFromScreenPointAtEye,Ut as lengthFromPoints,st as normalizeCoordinate,ct as normalizeRotationDelta,gt as offSurfaceTiltToEyeTiltGlobal,yt as onSurfaceTiltToEyeTiltGlobal,Dt as panMotionToRotationMatrix,Ot as panToPosition,zt as pickPointAndInitSphere,Rt as preserveHeadingThreshold,Ct as rotatePointAroundTwoAxes,At as rotationAngleAndAxisDirectRotation,qt as rotationAnglesAndAxesHeadingPreserving,Gt as rotationAnglesHeadingPreserving,kt as sphereOrPlanePointFromScreenPoint};