This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <metahttp-equiv="refresh" content="60"/> | |
| <metacharset="utf-8" /> | |
| <script | |
| <script | |
| src="https://threejs.org/build/three.js" | |
| ></script> | |
| <script | |
| src="https://rawgit.com/mrdoob/three.js/master/examples/js/controls/TrackballControls.js" | |
| ></script> | |
| <scriptsrc="https://code.jquery.com/jquery-3.5.1.min.js"></script> | |
| <scriptsrc="geoloc.js"></script> | |
| </head> | |
| <bodyonload="plot()"><divid="view" align="center"> | |
| <h3>latitude:<spanid="lat"></span></h3> | |
| <h3>longitude:<spanid="long"></span></h3></div> | |
| <script>functionplot(){ | |
| $.ajax({ | |
| type: 'GET', | |
| dataType: 'json', | |
| url: 'https://api.wheretheiss.at/v1/satellites/25544', | |
| async: false, | |
| crossDomain: true, | |
| complete: function(data){ | |
| if(data.readyState===4&&data.status===200){ | |
| varlat=data.responseJSON.latitude; | |
| varlong=data.responseJSON.longitude; | |
| document.getElementById("lat").innerHTML=lat; | |
| document.getElementById("long").innerHTML=long; | |
| } | |
| } | |
| }); | |
| } | |
| </script> | |
| <divalign="center"> | |
| <divclass="sketchfab-embed-wrapper"><iframetitle="ISS International Space Station" frameborder="0" allowfullscreenmozallowfullscreen="true" webkitallowfullscreen="true" allow="autoplay; fullscreen; xr-spatial-tracking" src="https://sketchfab.com/models/6887b8f3924e4a348daf2b23fce48d7c/embed"></iframe></p></div> | |
| </div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| window.addEventListener("load",function(){ | |
| "use strict"; | |
| varw=800,h=800; | |
| varrenderer=newTHREE.WebGLRenderer({alpha: true}); | |
| renderer.setSize(w,h); | |
| varview=document.getElementById("view"); | |
| view.appendChild(renderer.domElement); | |
| varcamera=newTHREE.PerspectiveCamera(45,w/h,1,1000); | |
| camera.position.set(0,0,200); | |
| varcontrols=newTHREE.TrackballControls(camera,view); | |
| // The earth object | |
| // curl -Lo mercator.jpg http://goo.gl/xNgf4d | |
| // convert -resize 1024x1024! mercator.jpg earth.jpg | |
| // the side border is laongitude 180deg: -180 -> 0 -> 180 | |
| vartex=newTHREE.TextureLoader().load("earth.jpg.jpg"); | |
| varearth=newTHREE.Mesh( | |
| newTHREE.SphereGeometry(50,32,32), | |
| newTHREE.MeshBasicMaterial({map: tex})); | |
| // note: sphere geometry and tex coords | |
| // (x,z) = (-1, 0) -> (0, 1) -> (1, 0) -> (0, -1) -> (-1, 0) | |
| // mercator maps's long 0deg is on (1, 0) | |
| // marker object | |
| varpointer=newTHREE.Mesh( | |
| newTHREE.SphereGeometry(5,32,32), | |
| newTHREE.MeshBasicMaterial({color: 0xcc9900})); | |
| pointer.position.set(55,0,0);// rotating obj should set (X > 0, 0, 0) | |
| varmarker=newTHREE.Object3D(); | |
| marker.add(pointer); | |
| // setup scene | |
| varobj=newTHREE.Object3D(); | |
| obj.add(marker); | |
| obj.add(earth); | |
| varscene=newTHREE.Scene(); | |
| scene.add(obj); | |
| // [initial position] rotate by lat/long | |
| // For ball is at (X,0,0), the lat rotation should be around Z axis | |
| varrad=Math.PI/180; | |
| varrot=newTHREE.Quaternion().setFromEuler( | |
| newTHREE.Euler(0,135*rad,45*rad,"YZX")); | |
| marker.quaternion.copy(rot); | |
| varloop=functionloop(){ | |
| requestAnimationFrame(loop); | |
| obj.rotation.y+=0.01; | |
| controls.update(); | |
| renderer.clear(); | |
| renderer.render(scene,camera); | |
| }; | |
| loop(); | |
| plot(); | |
| functionplot(){ | |
| $.ajax({ | |
| type: 'GET', | |
| dataType: 'json', | |
| url: 'https://api.wheretheiss.at/v1/satellites/25544', | |
| async: false, | |
| crossDomain: true, | |
| complete: function(data){ | |
| if(data.readyState===4&&data.status===200){ | |
| constlat=data.responseJSON.latitude; | |
| constlong=data.responseJSON.longitude; | |
| varrot=newTHREE.Quaternion().setFromEuler( | |
| newTHREE.Euler(0,lat*rad,long*rad,"YZX")); | |
| marker.quaternion.copy(rot); | |
| } | |
| } | |
| }); | |
| } | |
| },false); |
M
MURALA GANESH BABU 

