-
Notifications
You must be signed in to change notification settings - Fork 9
/
orrery.min.js
3 lines (3 loc) · 36.2 KB
/
orrery.min.js
1
2
3
// Copyright 2015-17 Olaf Frohn https://github.com/ofrohn, see LICENSE
!function(){function e(e){var a,n="hr"===e.id||"min"===e.id||"sec"===e.id?1:0;if(e.validity){if(a=e.validity,a.typeMismatch||a.badInput)return t(e,e.title+": check field value"),!1;if(a.rangeOverflow||a.rangeUnderflow)return t(e,e.title+" must be between "+(parseInt(e.min)+n)+" and "+(parseInt(e.max)-n)),!1}else{if(a=e.value,!r(a))return t(e,e.title+": check field value"),!1;if(a=parseFloat(a),a<e.min||a>e.max)return t(e,e.title+" must be between "+(e.min+n)+" and "+(+e.max-n)),!1}return d3.select("#error").style({top:"-9999px",left:"-9999px",opacity:0}),!0}function t(e,t){var a=i(e);d3.select("#error").html(t).style({top:n(a[1]+e.offsetHeight+1),left:n(a[0]),opacity:1}),e.focus()}function a(e){return document.getElementById(e)}function n(e){return e+"px"}function o(e,t){return null!==e&&hasOwnProperty.call(e,t)}function r(e){return!isNaN(parseFloat(e))&&isFinite(e)}function i(e){var t=0,a=0,n=e.offsetWidth,o=e.offsetHeight;if(e.offsetParent)do t+=e.offsetLeft,a+=e.offsetTop;while(null!==(e=e.offsetParent));return{l:t,t:a,w:n,h:o}}function s(e){if(e){var t=e.split(".");if(!(t.length<1)&&(t=t[0].split("-"),t[0]=t[0].replace(/\D/g,""),t[0]))return t[1]=t[1]?t[1].replace(/\D/g,""):"1",t[2]=t[2]?t[2].replace(/\D/g,""):"1",new Date(t[0],t[1]-1,t[2])}}function c(e,t,a){var n,o=e.valueOf();if(!t)return new Date(o);switch(n=a||"d"){case"y":case"yr":o+=31556926080*t;break;case"m":case"mo":o+=26298e5*t;break;case"d":case"dy":o+=864e5*t;break;case"h":case"hr":o+=36e5*t;break;case"n":case"mn":o+=6e4*t;break;case"s":case"sec":o+=1e3*t;break;case"ms":o+=t}return new Date(o)}function l(e,t,a){if(t&&e){var n=t.valueOf()-e.valueOf(),o=a||"d";switch(o){case"y":case"yr":n/=31556926080;break;case"m":case"mo":n/=26298e5;break;case"d":case"dy":n/=864e5;break;case"h":case"hr":n/=36e5;break;case"n":case"mn":n/=6e4;break;case"s":case"sec":n/=1e3;break;case"ms":}return a?Math.floor(n):n}}function u(e,t){for(var a=t>1?e*e:-e*e,n=t*a*e/6,o=(1-t)*e-n,r=4;Math.abs(n)>1e-15;)n*=a/(r*(r+1)),o-=n,r+=2;return o}function d(e){var t,a,n,o,r=e.e,i=e.M,s=1e-8,c=0,l=1.9,d=!1,p=0;if(!i)return 0;if(1>r&&((i<-Math.PI||i>Math.PI)&&(o=T.normalize0(i),c=i-o,i=o),.9>r)){t=Math.atan2(Math.sin(i),Math.cos(i)-r);do a=(t-r*Math.sin(t)-i)/(1-r*Math.cos(t)),t-=a;while(Math.abs(a)>s);return t}if(0>i&&(i=-i,d=!0),t=i,s*=Math.abs(1-r),1e-15>s&&(s=1e-15),(r>.8&&i<Math.PI/3||r>1)&&(n=i/Math.abs(1-r),n*n>6*Math.abs(1-r)&&(n=i<Math.PI?Math.pow(6*i,1/3):T.asinh(i/r)),t=n),r>1&&i>4&&(t=Math.log(i)),1>r)for(;Math.abs(l)>s;)a=p++>8?u(t,r)-i:t-r*Math.sin(t)-i,l=-a/(1-r*Math.cos(t)),t+=l;else for(;Math.abs(l)>s;)a=p++>7?-u(t,r)-i:r*T.sinh(t)-t-i,l=-a/(r*T.cosh(t)-1),t+=l;return d?c-t:c+t}function p(e){var t,a,n,o,r;1===e.e?(r=e.jd0-e.T,o=e.w0*r*.5,a=Math.pow(o+Math.sqrt(o*o+1),1/3),e.v=2*Math.atan(a-1/a)):(e.E=d(e),e.e>1?(t=e.e-T.cosh(e.E),a=T.sinh(e.E)):(t=Math.cos(e.E)-e.e,a=Math.sin(e.E)),a*=Math.sqrt(Math.abs(1-e.e*e.e)),e.v=Math.atan2(a,t)),n=e.q*(1+e.e),e.r=n/(1+e.e*Math.cos(e.v))}function m(e){e.hasOwnProperty("w")||(e.w=e.W-e.N),e.hasOwnProperty("M")||(e.M=e.L-e.W),e.e<1&&(e.M=T.normalize0(e.M)),e.P=Math.pow(Math.abs(e.a),1.5),e.T=e.jd0-e.M/Math.PI/2/e.P,1!==e.e?(e.q=e.a*(1-e.e),e.t0=e.a*Math.sqrt(Math.abs(e.a)/y)):(e.w0=3/Math.sqrt(2)/(e.q*Math.sqrt(e.q/y)),e.a=0,e.t0=0),e.am=Math.sqrt(y*e.q*(1+e.e))}function h(e){var t,a,n,o=e.v+e.w;return t=e.r*(Math.cos(e.N)*Math.cos(o)-Math.sin(e.N)*Math.sin(o)*Math.cos(e.i)),a=e.r*(Math.sin(e.N)*Math.cos(o)+Math.cos(e.N)*Math.sin(o)*Math.cos(e.i)),n=e.r*(Math.sin(o)*Math.sin(e.i)),e.x=t,e.y=a,e.z=n,{x:t,y:a,z:n}}function f(e){var t,a;return t=Math.atan2(e.y,e.x),a=Math.atan2(e.z,Math.sqrt(e.x*e.x+e.y*e.y)),e.l=T.normalize(t),e.b=a,{l:t,b:a}}function E(e){var t=e.getUTCFullYear(),a=e.getUTCMonth()+1,n=e.getUTCDate(),o=(e.getUTCHours()-12+e.getUTCMinutes()/60+e.getUTCSeconds()/3600)/24,r=-4799;if(r>t)return-1;var i=Math.floor((14-a)/12),s=t+4800-i,c=a+12*i-3,l=n+Math.floor((153*c+2)/5)+365*s+Math.floor(s/4)-Math.floor(s/100)+Math.floor(s/400)-32045;return l+o}function g(){requestAnimationFrame(function e(t){requestAnimationFrame(e),B=B||t-1e3/60;var a=Math.min(200,t-B);B=t,Z.forEach(function(e){e(a/1e3,t/1e3)})})}var b=b||{};b.Planets={},b.Planets.baseURL="../images/",b.Planets.scale=1,b.Planets.params={sol:{map:"sunmap.jpg",radius:1.2,tilt:7.25,rot:1.0438,rotation:[286.13,63.87,14.1844],corona:{map:"solarcorona.jpg",radius:5.1}},mer:{map:"mercurymap.jpg",bump:"mercurybump.jpg",radius:.3,tilt:0,rot:58.646,rotation:[318.2274,82.9623,6.1385]},ven:{map:"venusmap.jpg",radius:.4,tilt:177.3,rot:-4.05,rotation:[30.1871,88.761,-1.481]},ter:{map:"earthmap.jpg",bump:"earthbump.jpg",clouds:"earthclouds.png",radius:.4,tilt:23.45,rot:.9973,rotation:[90,66.5607,360.9856]},lun:{map:"moonmap.jpg",bump:"moonbump.jpg",radius:.25,tilt:1.54,rot:27.3217,rotation:[264.6051,89.9784,13.1763]},mar:{map:"marsmap.jpg",bump:"marsbump.jpg",clouds:"marsclouds.png",radius:.35,tilt:25.19,rot:1.026,rotation:[352.9076,63.2821,350.8919]},phob:{map:"phobosmap.jpg",bump:"phobosbump.jpg",radius:.05,tilt:.009,rot:.3189,rotation:[352.9259,63.2928,1128.8445]},deim:{map:"deimosmap.jpg",radius:.04,tilt:.889,rot:1.2624,rotation:[352.801,64.1656,285.1618]},vest:{map:"vestamap.jpg",bump:"vestabump.jpg",radius:.1,tilt:29,rot:.223,rotation:[330.8257,57.7239,1617.3329]},cer:{map:"ceresmap.jpg",radius:.16,tilt:4,rot:.378,rotation:[331.5058,77.8769,952.1532]},jup:{map:"jupitermap.jpg",radius:1.2,tilt:3.12,rot:.414,rotation:[247.8167,87.7835,870.536],ring:{map:"jupiterrings.png",radius:2.7,opacity:.5}},io:{map:"iomap.jpg",radius:.25,tilt:0,rot:1.7691,rotation:[247.7063,87.7869,203.4889]},euro:{map:"europamap.jpg",radius:.25,tilt:.016,rot:3.5512,rotation:[247.93,87.8008,101.3747]},gany:{map:"ganymedemap.jpg",radius:.3,tilt:.068,rot:7.1546,rotation:[248.6707,87.8748,50.3176]},call:{map:"callistomap.jpg",radius:.3,tilt:.356,rot:16.689,rotation:[252.4849,88.191,21.571]},sat:{map:"saturnmap.jpg",radius:1.2,tilt:26.73,rot:.444,rotation:[79.5275,61.9478,810.7939],ring:{map:"saturnrings.png",radius:2.6,opacity:1}},mima:{map:"mimasmap.jpg",radius:.1,tilt:.002,rot:.942,rotation:[79.5174,61.9296,381.9945]},ence:{map:"enceladusmap.jpg",radius:.1,tilt:.002,rot:1.37,rotation:[79.5174,61.9296,262.7318]},teth:{map:"tethysmap.jpg",radius:.15,tilt:.001,rot:1.888,rotation:[79.5174,61.9296,190.6979]},dion:{map:"dionemap.jpg",radius:.15,tilt:.005,rot:2.737,rotation:[79.5174,61.9296,131.5349]},rhea:{map:"rheamap.jpg",radius:.2,tilt:.036,rot:4.518,rotation:[79.507,61.9729,79.69]},tita:{map:"titanclouds.jpg",radius:.35,tilt:.629,rot:15.95,rotation:[79.1738,61.946,22.577]},hype:{map:"hyperionmap.jpg",radius:.08,tilt:.564,rot:21.28,rotation:[79.3687,61.9625,16.917]},iape:{map:"iapetusmap.jpg",radius:.15,tilt:15.21,rot:79.33,rotation:[49.608,72.7238,4.5379]},phoe:{map:"phoebemap.jpg",radius:.08,tilt:26.723,rot:.4,rotation:[60.8478,64.3305,931.639]},ura:{map:"uranusmap.jpg",radius:1,tilt:97.86,rot:.718,rotation:[77.6467,-7.7218,501.1601],ring:{map:"uranusrings.png",radius:2,opacity:.5}},arie:{map:"arielmap.jpg",radius:.15,tilt:0,rot:-2.52,rotation:[77.7555,-7.8066,-142.8357]},umbr:{map:"umbrielmap.jpg",radius:.15,tilt:0,rot:-4.144,rotation:[77.7555,-7.8066,-86.8689]},titan:{map:"titaniamap.jpg",radius:.2,tilt:0,rot:-8.706,rotation:[77.7555,-7.8066,-41.3514]},ober:{map:"oberonmap.jpg",radius:.2,tilt:0,rot:-13.46,rotation:[77.7555,-7.8066,-26.7394]},mira:{map:"mirandamap.jpg",radius:.1,tilt:0,rot:-1.413,rotation:[77.7538,-7.8265,-254.6906]},nep:{map:"neptunemap.jpg",radius:1,tilt:29.56,rot:.671,rotation:[319.2351,61.9736,536.3128],ring:{map:"neptunerings.png",radius:2.5,opacity:.8}},trit:{map:"tritonmap.jpg",radius:.2,tilt:.01,rot:-5.877,rotation:[317.3413,59.8764,-61.2573]},prot:{map:"proteusmap.jpg",radius:.1,tilt:.974,rot:1.122,rotation:[318.631,61.4993,320.7654]},plu:{map:"plutomap.jpg",radius:.2,tilt:122.53,rot:6.387,rotation:[133.6817,-10.9977,56.3625]},cha:{map:"charonmap.jpg",radius:.1,tilt:0,rot:6.387,rotation:[133.6817,-10.9977,56.3625]}};var v={Sun:"sol",Mercury:"mer",Venus:"ven",Earth:"ter",Moon:"lun",Mars:"mar",Phobos:"phob",Deimos:"deim",Vesta:"vest",Ceres:"cer",Jupiter:"jup",Io:"io",Europa:"euro",Ganymede:"gany",Callisto:"call",Saturn:"sat",Mimas:"mima",Enceladus:"ence",Tethys:"teth",Dione:"dion",Rhea:"rhea",Titan:"tita",Iapetus:"iape",Phoebe:"phoe",Uranus:"ura",Ariel:"arie",Umbriel:"umbr",Titania:"titan",Oberon:"ober",Miranda:"mira",Neptune:"nep",Triton:"trit",Pluto:"plu",Charon:"cha"};b.Planets.createSun=function(){return b.Planets.create("sol")},b.Planets.createMercury=function(){return b.Planets.create("mer")},b.Planets.createVenus=function(){return b.Planets.create("ven")},b.Planets.createEarth=function(){return b.Planets.create("ter",!0)},b.Planets.createMoon=function(){return b.Planets.create("lun")},b.Planets.createMars=function(){return b.Planets.create("mar")},b.Planets.createJupiter=function(){return b.Planets.create("jup")},b.Planets.createJupiterRing=function(){return b.Planets.createRing("jup")},b.Planets.createSaturn=function(){return b.Planets.create("sat",!0)},b.Planets.createSaturnRing=function(){return b.Planets.createRing("sat")},b.Planets.createUranus=function(){return b.Planets.create("ura",!0)},b.Planets.createUranusRing=function(){return b.Planets.createRing("ura")},b.Planets.createNeptune=function(){return b.Planets.create("nepe")},b.Planets.createNeptuneRing=function(){return b.Planets.createRing("nep")},b.Planets.createPluto=function(){return b.Planets.create("plu")},b.Planets.createStarfield=function(){var e=new THREE.TextureLoader,t=e.load(b.Planets.baseURL+"tycho-skymap.jpg"),a=new THREE.MeshBasicMaterial({map:t,side:THREE.BackSide}),n=new THREE.SphereGeometry(1e5,32,32),o=new THREE.Mesh(n,a);return o},b.Planets.create=function(e,t){if(!b.Planets.params.hasOwnProperty(e)){if(!v.hasOwnProperty(e))return console.log("Object not found: "+e),null;e=v[e]}var a=b.Planets.params[e],n={},o=new THREE.TextureLoader,r=new THREE.SphereGeometry(a.radius*b.Planets.scale,32,32);if(n.map=o.load(b.Planets.baseURL+a.map),a.hasOwnProperty("bump")&&(n.bumpMap=o.load(b.Planets.baseURL+a.bump),n.bumpScale=.001),a.hasOwnProperty("spec")&&(n.specularMap=o.load(b.Planets.baseURL+a.spec)),"sol"===e)var i=new THREE.MeshBasicMaterial(n);else{var i=new THREE.MeshPhongMaterial(n);n.specular=new THREE.Color(3355443),n.shininess=.1}var s=new THREE.Mesh(r,i);if(!t&&a.hasOwnProperty("ring")){s.receiveShadow=!0,s.castShadow=!0;var c=b.Planets.createRings(e);c.receiveShadow=!0,c.castShadow=!0,s.add(c)}return!t&&a.hasOwnProperty("clouds")&&s.add(b.Planets.createClouds(e)),t||"sol"!==e||s.add(b.Planets.createCorona()),s.rotateY(THREE.Math.degToRad(a.rotation[0]-180)),s.rotateZ(THREE.Math.degToRad(90-a.rotation[1])),s},b.Planets.createRings=function(e){if(!b.Planets.params.hasOwnProperty(e)){if(!v.hasOwnProperty(e))return console.log("Object not found: "+e),null;e=v[e]}if(!b.Planets.params[e].hasOwnProperty("ring"))return console.log("Rings not found: "+e),null;var t=b.Planets.params[e],a=b.Planets.baseURL+t.ring.map,n=new THREE.TextureLoader,o=new b.Planets.RingGeometry(t.radius*b.Planets.scale*1.05,t.ring.radius*b.Planets.scale,64,64),r=new THREE.MeshPhongMaterial({map:n.load(a),side:THREE.DoubleSide,transparent:!0,opacity:t.ring.opacity}),i=new THREE.Mesh(o,r);return i.lookAt(new THREE.Vector3(0,1,0)),i.name=e+"rings",i},b.Planets.createClouds=function(e){if(!b.Planets.params.hasOwnProperty(e)){if(!v.hasOwnProperty(e))return console.log("Object not found: "+e),null;e=v[e]}if(!b.Planets.params[e].hasOwnProperty("clouds"))return console.log("Clouds not found: "+e),null;var t=b.Planets.params[e],a=b.Planets.baseURL+t.clouds,n=new THREE.TextureLoader,o=new THREE.Mesh(new THREE.SphereGeometry(t.radius*b.Planets.scale*1.01,32,32),new THREE.MeshPhongMaterial({map:n.load(a),transparent:!0}));return o.name=e+"clouds",o},b.Planets.createCorona=function(){var e=b.Planets.params.sol,t=b.Planets.baseURL+e.corona.map,a=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(t),color:16777011,transparent:!1,blending:THREE.AdditiveBlending}),n=new THREE.Sprite(a);return n.scale.multiplyScalar(e.corona.radius*b.Planets.scale),n.name="solcorona",n},b.Planets.RingGeometry=function(e,t,a,n,o,r){THREE.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:a,phiSegments:n,thetaStart:o,thetaLength:r},e=e||0,t=t||50,o=void 0!==o?o:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?Math.max(3,a):8,n=void 0!==n?Math.max(1,n):8;var i,s,c=[],l=e,u=(t-e)/n;for(i=0;n+1>i;i++){for(s=0;a+1>s;s++){var d=new THREE.Vector3,p=o+s/a*r;d.x=l*Math.cos(p),d.y=l*Math.sin(p),this.vertices.push(d),c.push(new THREE.Vector2(i/(a-1),s/(n-1)))}l+=u}var m=new THREE.Vector3(0,0,1);for(i=0;n>i;i++){var h=i*(a+1);for(s=0;a>s;s++){var p=s+h,f=p,E=p+a+1,g=p+a+2;this.faces.push(new THREE.Face3(f,E,g,[m.clone(),m.clone(),m.clone()])),this.faceVertexUvs[0].push([c[f].clone(),c[E].clone(),c[g].clone()]),f=p,E=p+a+2,g=p+1,this.faces.push(new THREE.Face3(f,E,g,[m.clone(),m.clone(),m.clone()])),this.faceVertexUvs[0].push([c[f].clone(),c[E].clone(),c[g].clone()])}}this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,l)},b.Planets.RingGeometry.prototype=Object.create(THREE.Geometry.prototype),b.Planets.RingGeometry.prototype.constructor=b.Planets.RingGeometry,THREE.OrbitControls=function(e,t){function a(){return 2*Math.PI/60/60*D.autoRotateSpeed}function n(){return Math.pow(.95,D.zoomSpeed)}function o(e){Z-=e}function r(e){Y-=e}function i(e){D.object instanceof THREE.PerspectiveCamera?q/=e:D.object instanceof THREE.OrthographicCamera?(D.object.zoom=Math.max(D.minZoom,Math.min(D.maxZoom,D.object.zoom*e)),D.object.updateProjectionMatrix(),B=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),D.enableZoom=!1)}function s(e){D.object instanceof THREE.PerspectiveCamera?q*=e:D.object instanceof THREE.OrthographicCamera?(D.object.zoom=Math.max(D.minZoom,Math.min(D.maxZoom,D.object.zoom/e)),D.object.updateProjectionMatrix(),B=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),D.enableZoom=!1)}function c(e){W.set(e.clientX,e.clientY)}function l(e){$.set(e.clientX,e.clientY)}function u(e){K.set(e.clientX,e.clientY)}function d(e){X.set(e.clientX,e.clientY),_.subVectors(X,W);var t=D.domElement===document?D.domElement.body:D.domElement;o(2*Math.PI*_.x/t.clientWidth*D.rotateSpeed),r(2*Math.PI*_.y/t.clientHeight*D.rotateSpeed),W.copy(X),D.update()}function p(e){ee.set(e.clientX,e.clientY),te.subVectors(ee,$),te.y>0?i(n()):te.y<0&&s(n()),$.copy(ee),D.update()}function m(e){J.set(e.clientX,e.clientY),Q.subVectors(J,K),oe(Q.x,Q.y),K.copy(J),D.update()}function h(e){}function f(e){var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?s(n()):0>t&&i(n()),D.update()}function E(e){switch(e.keyCode){case D.keys.UP:oe(0,D.keyPanSpeed),D.update();break;case D.keys.BOTTOM:oe(0,-D.keyPanSpeed),D.update();break;case D.keys.LEFT:oe(D.keyPanSpeed,0),D.update();break;case D.keys.RIGHT:oe(-D.keyPanSpeed,0),D.update()}}function g(e){W.set(e.touches[0].pageX,e.touches[0].pageY)}function b(e){var t=e.touches[0].pageX-e.touches[1].pageX,a=e.touches[0].pageY-e.touches[1].pageY,n=Math.sqrt(t*t+a*a);$.set(0,n)}function v(e){K.set(e.touches[0].pageX,e.touches[0].pageY)}function y(e){X.set(e.touches[0].pageX,e.touches[0].pageY),_.subVectors(X,W);var t=D.domElement===document?D.domElement.body:D.domElement;o(2*Math.PI*_.x/t.clientWidth*D.rotateSpeed),r(2*Math.PI*_.y/t.clientHeight*D.rotateSpeed),W.copy(X),D.update()}function w(e){var t=e.touches[0].pageX-e.touches[1].pageX,a=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+a*a);ee.set(0,o),te.subVectors(ee,$),te.y>0?s(n()):te.y<0&&i(n()),$.copy(ee),D.update()}function M(e){J.set(e.touches[0].pageX,e.touches[0].pageY),Q.subVectors(J,K),oe(Q.x,Q.y),K.copy(J),D.update()}function T(e){}function P(e){if(D.enabled!==!1){if(e.preventDefault(),e.button===D.mouseButtons.ORBIT){if(D.enableRotate===!1)return;c(e),V=U.ROTATE}else if(e.button===D.mouseButtons.ZOOM){if(D.enableZoom===!1)return;l(e),V=U.DOLLY}else if(e.button===D.mouseButtons.PAN){if(D.enablePan===!1)return;u(e),V=U.PAN}V!==U.NONE&&(document.addEventListener("mousemove",R,!1),document.addEventListener("mouseup",H,!1),document.addEventListener("mouseout",H,!1),D.dispatchEvent(I))}}function R(e){if(D.enabled!==!1)if(e.preventDefault(),V===U.ROTATE){if(D.enableRotate===!1)return;d(e)}else if(V===U.DOLLY){if(D.enableZoom===!1)return;p(e)}else if(V===U.PAN){if(D.enablePan===!1)return;m(e)}}function H(e){D.enabled!==!1&&(h(e),document.removeEventListener("mousemove",R,!1),document.removeEventListener("mouseup",H,!1),document.removeEventListener("mouseout",H,!1),D.dispatchEvent(N),V=U.NONE)}function j(e){D.enabled!==!1&&D.enableZoom!==!1&&V===U.NONE&&(e.preventDefault(),e.stopPropagation(),f(e),D.dispatchEvent(I),D.dispatchEvent(N))}function x(e){D.enabled!==!1&&D.enableKeys!==!1&&D.enablePan!==!1&&E(e)}function O(e){if(D.enabled!==!1){switch(e.touches.length){case 1:if(D.enableRotate===!1)return;g(e),V=U.TOUCH_ROTATE;break;case 2:if(D.enableZoom===!1)return;b(e),V=U.TOUCH_DOLLY;break;case 3:if(D.enablePan===!1)return;v(e),V=U.TOUCH_PAN;break;default:V=U.NONE}V!==U.NONE&&D.dispatchEvent(I)}}function C(e){if(D.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(D.enableRotate===!1)return;if(V!==U.TOUCH_ROTATE)return;y(e);break;case 2:if(D.enableZoom===!1)return;if(V!==U.TOUCH_DOLLY)return;w(e);break;case 3:if(D.enablePan===!1)return;if(V!==U.TOUCH_PAN)return;M(e);break;default:V=U.NONE}}function L(e){D.enabled!==!1&&(T(e),D.dispatchEvent(N),V=U.NONE)}function S(e){e.preventDefault()}this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new THREE.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-(1/0),this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:THREE.MOUSE.LEFT,ZOOM:THREE.MOUSE.MIDDLE,PAN:THREE.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return A},this.getAzimuthalAngle=function(){return k},this.reset=function(){D.target.copy(D.target0),D.object.position.copy(D.position0),D.object.zoom=D.zoom0,D.object.updateProjectionMatrix(),D.dispatchEvent(z),D.update(),V=U.NONE},this.update=function(){var t=new THREE.Vector3,n=(new THREE.Quaternion).setFromUnitVectors(e.up,new THREE.Vector3(0,1,0)),r=n.clone().inverse(),i=new THREE.Vector3,s=new THREE.Quaternion;return function(){var e=D.object.position;t.copy(e).sub(D.target),t.applyQuaternion(n),k=Math.atan2(t.x,t.z),A=Math.atan2(Math.sqrt(t.x*t.x+t.z*t.z),t.y),D.autoRotate&&V===U.NONE&&o(a()),k+=Z,A+=Y,k=Math.max(D.minAzimuthAngle,Math.min(D.maxAzimuthAngle,k)),A=Math.max(D.minPolarAngle,Math.min(D.maxPolarAngle,A)),A=Math.max(F,Math.min(Math.PI-F,A));var c=t.length()*q;return c=Math.max(D.minDistance,Math.min(D.maxDistance,c)),D.target.add(G),t.x=c*Math.sin(A)*Math.sin(k),t.y=c*Math.cos(A),t.z=c*Math.sin(A)*Math.cos(k),t.applyQuaternion(r),e.copy(D.target).add(t),D.object.lookAt(D.target),D.enableDamping===!0?(Z*=1-D.dampingFactor,Y*=1-D.dampingFactor):(Z=0,Y=0),q=1,G.set(0,0,0),B||i.distanceToSquared(D.object.position)>F||8*(1-s.dot(D.object.quaternion))>F?(D.dispatchEvent(z),i.copy(D.object.position),s.copy(D.object.quaternion),B=!1,!0):!1}}(),this.dispose=function(){D.domElement.removeEventListener("contextmenu",S,!1),D.domElement.removeEventListener("mousedown",P,!1),D.domElement.removeEventListener("mousewheel",j,!1),D.domElement.removeEventListener("MozMousePixelScroll",j,!1),D.domElement.removeEventListener("touchstart",O,!1),D.domElement.removeEventListener("touchend",L,!1),D.domElement.removeEventListener("touchmove",C,!1),document.removeEventListener("mousemove",R,!1),document.removeEventListener("mouseup",H,!1),document.removeEventListener("mouseout",H,!1),window.removeEventListener("keydown",x,!1)};var k,A,D=this,z={type:"change"},I={type:"start"},N={type:"end"},U={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},V=U.NONE,F=1e-6,Y=0,Z=0,q=1,G=new THREE.Vector3,B=!1,W=new THREE.Vector2,X=new THREE.Vector2,_=new THREE.Vector2,K=new THREE.Vector2,J=new THREE.Vector2,Q=new THREE.Vector2,$=new THREE.Vector2,ee=new THREE.Vector2,te=new THREE.Vector2,ae=function(){var e=new THREE.Vector3;return function(t,a){var n=a.elements;e.set(n[0],n[1],n[2]),e.multiplyScalar(-t),G.add(e)}}(),ne=function(){var e=new THREE.Vector3;return function(t,a){var n=a.elements;e.set(n[4],n[5],n[6]),e.multiplyScalar(t),G.add(e)}}(),oe=function(){var e=new THREE.Vector3;return function(t,a){var n=D.domElement===document?D.domElement.body:D.domElement;if(D.object instanceof THREE.PerspectiveCamera){var o=D.object.position;e.copy(o).sub(D.target);var r=e.length();r*=Math.tan(D.object.fov/2*Math.PI/180),ae(2*t*r/n.clientHeight,D.object.matrix),ne(2*a*r/n.clientHeight,D.object.matrix)}else D.object instanceof THREE.OrthographicCamera?(ae(t*(D.object.right-D.object.left)/n.clientWidth,D.object.matrix),ne(a*(D.object.top-D.object.bottom)/n.clientHeight,D.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),D.enablePan=!1)}}();D.domElement.addEventListener("contextmenu",S,!1),D.domElement.addEventListener("mousedown",P,!1),D.domElement.addEventListener("mousewheel",j,!1),D.domElement.addEventListener("MozMousePixelScroll",j,!1),D.domElement.addEventListener("touchstart",O,!1),D.domElement.addEventListener("touchend",L,!1),D.domElement.addEventListener("touchmove",C,!1),window.addEventListener("keydown",x,!1),this.update()},THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.OrbitControls.prototype.constructor=THREE.OrbitControls,Object.defineProperties(THREE.OrbitControls.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(e){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(e){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=e}}});var y,w=function(t){function a(e){var t=U.node(),a=d3.select(O).node(),o=s(t,a);-9999===t.offsetTop?(T.setTime(e.valueOf()),g(),U.style({top:n(o[1]),left:n(o[0]),opacity:1}),d3.select(a).classed("active",!0)):b()}function s(e,t){var a=i(t),n="left"===N[0]?a.l:a.l+a.w-e.offsetWidth,o="top"===N[1]?a.t-e.offsetHeight-1:a.t+a.h-1;return[n,o]}function c(){var e,t=d3.select("#cal"),a=d3.select("#mon").node().value,n=d3.select("#yr").node().value,o=new Date,i=D;t.node()||(t=U.append("div").attr("id","cal")),n=parseInt(n),a=r(a)?parseInt(a):y(a);var s=new Date(n,a,1);s.setDate(s.getDate()-s.getDay()+i);for(var c=t.node();c.firstChild;)c.removeChild(c.firstChild);if(k===!0)for(e=i;i+7>e;e++){var u=e>6?e-7:e;t.append("div").classed({date:!0,weekday:!0}).html(j[u])}for(e=0;42>e;e++){var d=s.getMonth(),p=s.getDay(),m=w(s);t.append("div").classed({date:!0,grey:d!==a,weekend:d===a&&(0===p||6===p),today:0===l(s,o,"d"),selected:0===l(s,T,"d")}).attr("id",m).on("click",v).html(s.getDate().toString()),s.setDate(s.getDate()+1)}}function u(){var e=T.getFullYear();if(A===!0){var t=U.append("select").attr("title","Year").attr("id","yr").on("change",c).on("keyup",c),a=0;t.selectAll("option").data(x).enter().append("option").text(function(t,n){return t===e&&(a=n),t.toString()}),t.property("selectedIndex",a)}else U.append("input").attr("type","text").attr("title","Year").attr("id","yr").attr("readonly","readonly").attr("value",e)}function d(){var e=T.getMonth();if(A===!0){var t=U.append("select").attr("title","Month").attr("id","mon").on("change",c).on("keyup",c),a=0;t.selectAll("option").data(H).enter().append("option").attr("value",function(t,n){return n===e&&(a=n),n}).text(function(e){return e}),t.property("selectedIndex",a)}else U.append("input").attr("type","text").attr("title","Month").attr("id","mon").attr("readonly","readonly").attr("value",H[e])}function p(e){U.append("div").attr("id",e).on("click",function(){var t=d3.select("#mon").node(),a=d3.select("#yr").node();if("select"===t.tagName.toLowerCase())"left"===e?0===t.selectedIndex?(t.selectedIndex=11,a.selectedIndex--):t.selectedIndex--:11===t.selectedIndex?(t.selectedIndex=0,a.selectedIndex++):t.selectedIndex++;else{var n=y(t.value),o=parseInt(a.value);"left"===e?0===n?(n=11,o--):n--:11===n?(n=0,o++):n++,t.value=H[n],a.value=o}c()})}function m(){L!==!1&&(U.append("input").attr("type","number").attr("id","hr").attr("title","Hours").attr("max","24").attr("min","-1").attr("step","1").attr("value",T.getHours()).on("change",function(){e(this)===!0&&v()}),U.append("input").attr("type","number").attr("id","min").attr("title","Minutes").attr("max","60").attr("min","-1").attr("step","1").attr("value",T.getMinutes()).on("change",function(){e(this)===!0&&v()}),U.append("input").attr("type","number").attr("id","sec").attr("title","Seconds").attr("max","60").attr("min","-1").attr("step","1").attr("value",T.getSeconds()).on("change",function(){e(this)===!0&&v()}),S===!0&&h())}function h(){var e=U.append("select").attr("title","Time zone offset from UTC").attr("id","tz").on("change",v),t=15;P=T.getTimezoneOffset(),e.selectAll("option").data(R).enter().append("option").attr("value",function(e,a){var n=Object.keys(e)[0];return e[n]===P&&(t=a),e[n]}).text(function(e){return Object.keys(e)[0]}),e.property("selectedIndex",t)}function f(e){for(var t=e.getFullYear(),a=[],n=t-10;t+10>=n;n++)a.push(n);return a}function E(e,t){var a=d3.select(e).node();if("select"===a.tagName.toLowerCase()){for(var n=0;n<a.childNodes.length;n++)if(a.childNodes[n].value==t){a.selectedIndex=n;break}}else"mon"===a.id?a.value=H[t]:a.value=t}function g(){E("#yr",T.getFullYear()),E("#mon",T.getMonth()),c(),L&&(d3.select("#hr").node().value=T.getHours(),d3.select("#min").node().value=T.getMinutes(),d3.select("#sec").node().value=T.getSeconds())}function b(){U.style("opacity",0),d3.select("#error").style({top:"-9999px",left:"-9999px",opacity:0}),d3.select(O).classed("active",!1),setTimeout(function(){U.style("top",n(-9999))},600)}function v(){if(this.id&&-1!==this.id.search(/^\d/)&&(T=w.parse(this.id)),L===!0){var e=d3.select("#hr").node().value,t=d3.select("#min").node().value,a=d3.select("#sec").node().value;P=d3.select("#tz").node().value,T.setHours(e,t,a)}g(),I&&I(T,P),z===!0&&b()}function y(e){for(var t=0;t<H.length;t++)if(H[t]===e)return t}var w,M=t||{},T=new Date,P=T.getTimezoneOffset(),R=(d3.time.format("%Z"),[{"−12:00":720},{"−11:00":660},{"−10:00":600},{"−09:30":570},{"−09:00":540},{"−08:00":480},{"−07:00":420},{"−06:00":360},{"−05:00":300},{"−04:30":270},{"−04:00":240},{"−03:30":210},{"−03:00":180},{"−02:00":120},{"−01:00":60},{"±00:00":0},{"+01:00":-60},{"+02:00":-120},{"+03:00":-180},{"+03:30":-210},{"+04:00":-240},{"+04:30":-270},{"+05:00":-300},{"+05:30":-330},{"+05:45":-345},{"+06:00":-360},{"+06:30":-390},{"+07:00":-420},{"+08:00":-480},{"+08:30":-510},{"+08:45":-525},{"+09:00":-540},{"+09:30":-570},{"+10:00":-600},{"+10:30":-630},{"+11:00":-660},{"+12:00":-720},{"+12:45":-765},{"+13:00":-780},{"+14:00":-840}]),H=["January","February","March","April","May","June","July","August","September","October","November","December"],j=["Su","M","Tu","W","Th","F","Sa"],x=f(T),O=M.target||"",C=M.id||"datetimepicker",L=o(M,"time")?M.time:!0,S=o(M,"timezone")?M.timezone:!0,k=o(M,"weekdays")?M.weekdays:!0,A=o(M,"dateselect")?M.dateselect:!0,D=o(M,"startofweek")?M.startofweek:0,z=o(M,"vanishonpick")?M.vanishobpick:!0,I=M.callback||null,N=M.position||["left","top"];w=M.format?d3.time.format(M.format):d3.time.format("%Y-%m-%d");var U=d3.select("body").append("div").attr("id",C);return p("left"),d(),u(),p("right"),c(),m(),this.show=function(e){},this.isVisible=function(){return-9999!==U.node().offsetTop},this.hide=function(){b()},a.target=function(e){return arguments.length?(O=0!==e.indexOf("#")?"#"+e:e,a):O},a.dateFormat=function(e){return arguments.length?(w=d3.time.format(e),a):w},a.callback=function(e){return arguments.length?(I=e,a):I},a.date=function(){return w(T)},a},M=Math.PI/180,T={sinh:function(e){return(Math.pow(Math.E,e)-Math.pow(Math.E,-e))/2},cosh:function(e){return(Math.pow(Math.E,e)+Math.pow(Math.E,-e))/2},tanh:function(e){return 2/(1+Math.exp(-2*e))-1},asinh:function(e){return Math.log(e+Math.sqrt(e*e+1))},acosh:function(e){return Math.log(e+Math.sqrt(e*e-1))},normalize0:function(e){return(e+3*Math.PI)%(2*Math.PI)-Math.PI},normalize:function(e){return(e+2*Math.PI)%(2*Math.PI)},cartesian:function(e){var t=e[0]*M,a=(90-e[1])*M,n=e[2];return[n*Math.sin(a)*Math.cos(t),n*Math.sin(a)*Math.sin(t),n*Math.cos(a)]},spherical:function(e){var t=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z),a=Math.atan(e.y/e.x),n=Math.acos(e.z/t);return[a/M,n/M,t]}},P={sol:.0002959122082855911,mer:0x95955473dbc3,ven:0x89d9374048629,ter:0xa923c08a47948,lun:36599199229256,mar:319711652803400,cer:467549107200,ves:129071530155,jup:0xd2088431b2a1400,sat:0x3ee37dea29c61e0,ura:0x99ad2c257ccb88,nep:0xb54f909dc5b7b8,plu:7327611364884,eri:827117568e4},R=function(e,t,a){var n,r,i,c={},l=["a","e","i","w","M","L","W","N","n"];for(y=a?P[a]:P.sol,t&&(n=t instanceof Date?t:s(t)),n||(n=new Date),c.jd=E(n),n=s(e.ep),c.jd0=E(n),c.d=c.jd-c.jd0,c.cy=c.d/36525,r=0;r<l.length;r++)i=l[r],o(e,"d"+i)?c[i]=e[i]+e["d"+i]*c.cy:o(e,i)&&(c[i]=e[i]),o(c,i)&&(-1===i.search(/a|e/)?c[i]*=Math.PI/180:c[i]*=1);return o(c,"M")&&!o(c,"dM")&&o(c,"n")&&(c.M+=c.n*c.d),m(c),p(c),h(c),f(c),c},H=function(e,t,a){var n=x(e,t.elements);if(!o(t.elements[n],"d")){var r=t.elements[n],i=R(r,e,a),s={name:t.name,pos:[-i.y,i.z,-i.x],elements:t.elements};return t.H&&""!==t.H?s.r=13-t.H:t.r&&""!==t.r?s.r=t.r:s.r=20,t.icon&&""!==t.icon&&(s.icon=t.icon),s}},j=function(e,t){var a=x(e,t.elements);if(!o(t.elements[a],"d")){var n=R(t.elements[a],e);return t.pos=[-n.y,n.z,-n.x],t.pos}},x=function(e,t){var a=0;if(t.length>1)for(var n=0;n<t.length;n++)if(l(new Date(Date.parse(t[n].ep)),e)<=0){a=0===n?0:n-1;break}return a},O=function(e,t){
for(var a,n,o=t.elements[0],r=R(o,e),i=new THREE.Geometry,s=r.P,u=c(e,s,"y"),d=l(e,u)/90,p=new Date(e.valueOf());l(p,u)>0;)n=R(o,p),i.vertices.push(new THREE.Vector3(-n.y,n.z,-n.x)),a=n.z>=0?11184810:6710886,i.colors.push(new THREE.Color(a)),p=c(p,d);return i},C=(new THREE.TextureLoader).load("images/ast.png");C.wrapS=THREE.RepeatWrapping,C.wrapT=THREE.RepeatWrapping;var L,S,k,A,D,z,I,N,U,V=new THREE.ShaderMaterial({uniforms:{color:{value:new THREE.Color(10066329)},texture:{value:C}},vertexShader:["attribute float size;","attribute vec3 ca;","varying vec3 vColor;","void main() {","vColor = ca;","vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","gl_PointSize = size * ( 1.0 / -mvPosition.z );","gl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform vec3 color;","uniform sampler2D texture;","varying vec3 vColor;","void main() {","vec4 color = vec4( color * vColor, 1.0 ) * texture2D( texture, gl_PointCoord );","gl_FragColor = color;","}"].join("\n"),transparent:!0}),F={width:0,height:0,date:!0,dateformat:"%Y-%m-%d",container:"orrery-map",datapath:"data/",imagepath:"images/",planets:{show:!0,image:!0,trajectory:!0,size:null},sbos:{show:!0,image:!1,text:!0,trajectory:!1,size:null},spacecraft:{show:!1,image:!1,text:!0,trajectory:!1,size:null},other:[],set:function(e){var t,a={};if(!e)return this;for(var n in this)if(o(this,n)&&"function"!=typeof this[n])if(o(e,n)&&null!==e[n])if(null===this[n]||this[n].constructor!=Object)a[n]=e[n];else{a[n]={};for(t in this[n])o(e[n],t)?a[n][t]=e[n][t]:a[n][t]=this[n][t]}else a[n]=this[n];return a}},Y={version:"0.5"},Z=[];b.Planets.baseURL="images/maps/",b.Planets.scale=.1;var q=function(e,t){var r=t||new Date,i=null;if(N=F.set(e),S=a(N.container)){i="#"+N.container;var s=window.getComputedStyle(S,null);parseInt(s.width)||N.width||(S.style.width=n(window.innerWidth)),parseInt(s.height)||N.height||(S.style.height=n(window.innerHeight))}else i="body",S=document.body;z=S?S.clientWidth:window.innerWidth,I=S?S.clientHeight:window.innerHeight,L=d3.select(i).append("container"),k=new THREE.WebGLRenderer({antialias:!0}),k.setClearColor("#000"),k.setSize(z,I),k.setPixelRatio(window.devicePixelRatio),k.shadowMap.enabled=!0,k.shadowMap.type=THREE.BasicShadowMap,S.appendChild(k.domElement),A=new THREE.Scene,A.fog=new THREE.FogExp2(0,25e-5),D=new THREE.PerspectiveCamera(45,z/I,.01,1e4),D.position.z=3.5,D.position.y=2;new THREE.OrbitControls(D);A.add(new THREE.AmbientLight(3355443));var c=new THREE.PointLight(16777215,1,0);c.castShadow=!0;var l=b.Planets.create("sol");if(c.add(l),A.add(c),d3.json("data/planets.json",function(e,t){if(e)return console.log(e);var a=[];for(var n in t)if(o(t,n)){var i={id:n},s=H(r,t[n]);if(i.body=s,o(t[n],"trajectory")){var c=O(r,t[n]),l=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.VertexColors,transparent:!0,opacity:.6,fog:!0}),u=new THREE.Line(c,l);A.add(u),i.track=u}var d=b.Planets.create(n);d||(d=new THREE.Mesh(new THREE.SphereGeometry(.02,32,32),new THREE.MeshPhongMaterial({color:"#fff"}))),d.position.fromArray(s.pos),A.add(d),i.mesh=d,a.push(i)}L.selectAll(".planets").data(a).enter().append("path").attr("class","planet").attr("id",function(e){return e.id})}),d3.json("data/sbo.json",function(e,t){if(e)return console.log(e);var a=[],n=Object.keys(t).length,i=new Float32Array(3*n),s=new Float32Array(3*n),c=new Float32Array(n),l=0;for(var u in t)if(o(t,u)){var d={id:u},p=H(r,t[u]);d.body=p;var m=(new THREE.Vector3).fromArray(p.pos);m.toArray(i,3*l);var h=new THREE.Color(15323569);h.toArray(s,3*l),c[l]=p.r,l++,a.push(d)}var f=new THREE.BufferGeometry;f.addAttribute("position",new THREE.BufferAttribute(i,3)),f.addAttribute("size",new THREE.BufferAttribute(c,1)),f.addAttribute("ca",new THREE.BufferAttribute(s,3)),U=new THREE.Points(f,V),A.add(U),L.selectAll(".sbos").data(a).enter().append("path").attr("class","sbo").attr("id",function(e){return e.id})}),Z.push(function(){var e=D.position;A.fog.density=.05/Math.pow(e.x*e.x+e.y*e.y+e.z*e.z,.5),k.render(A,D)}),N.date===!0){var u=w({callback:function(e,t){r.setTime(e.valueOf()),d3.select("#datetime").html(u.date()),Y.update(r)},target:"#datetime",time:!1,dateselect:!1,startofweek:0});d3.select(i).append("div").attr("id","datetime").html(u.date()).on("click",function(){u(r)})}g()},G=function(e){L.selectAll(".planet").each(function(t){var a=j(e,t.body);a&&(t.body.pos=a,t.mesh.position.fromArray(a))});var t=U.geometry.getAttribute("position").array;L.selectAll(".sbo").each(function(a,n){var o=j(e,a.body),r=(new THREE.Vector3).fromArray(o);r.toArray(t,3*n)}),U.geometry.attributes.position.needsUpdate=!0};window.addEventListener("resize",function(){var e=window.getComputedStyle(S,null);z=parseInt(e.width),I=parseInt(e.height),k.setSize(z,I),D.aspect=z/I,D.updateProjectionMatrix()},!1);var B=null;Y.display=q,Y.update=G,Y.animate=function(e){G(e),e.setDate(e.getDate()+1),setTimeout(Y.animate,100,e)},this.Orrery=Y}();