diff --git a/README.md b/README.md new file mode 100644 index 0000000..dec7c86 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +#Whooot +This project follows the principles of Under-engineering as an art form! + +#start the server +navigate to your directory +`python -m "SimpleHTTPServer"` diff --git a/css/compass.css b/css/compass.css new file mode 100644 index 0000000..6f89a27 --- /dev/null +++ b/css/compass.css @@ -0,0 +1,16 @@ +.compass-container { + height: 275px; + width: 300px; +} + +.compass-circle { + position: absolute; + height: 40%; +} + +.compass-needle { + position: relative; + left: 65px; + height: 200px; + top: 35px; +} \ No newline at end of file diff --git a/images/compass-needle.png b/images/compass-needle.png new file mode 100644 index 0000000..44f2c80 Binary files /dev/null and b/images/compass-needle.png differ diff --git a/images/compass-without-needle.png b/images/compass-without-needle.png new file mode 100644 index 0000000..2436b7f Binary files /dev/null and b/images/compass-without-needle.png differ diff --git a/index.html b/index.html index c81c190..ebec697 100644 --- a/index.html +++ b/index.html @@ -21,25 +21,139 @@ –––––––––––––––––––––––––––––––––––––––––––––––––– --> + + + + + + - +
-
-

Basic Page

-

This index.html page is a placeholder with the CSS, font and favicon. It's just waiting for you to add some content! If you need some help hit up the Skeleton documentation.

+
+

Wo ist Martin?

+ + +
+
+
+

Martin is in this direction

+
+ +
+
+ + + + + diff --git a/js/compass.js b/js/compass.js new file mode 100644 index 0000000..c6224d3 --- /dev/null +++ b/js/compass.js @@ -0,0 +1,41 @@ +function woIstMartin(){ + + var officeCoordinates = { + lat: 53.548648, + lng: 9.9861409 + }; + + var martinCoordinates = { + lat: 53.14677033085084, + lng: 27.2021484375 + }; + + // using this formula http://www.igismap.com/formula-to-find-bearing-or-heading-angle-between-two-points-latitude-longitude/ + var locationToDegrees = function(office, martin) { + office.lat = office.lat*Math.PI/180; + office.lng = office.lng*Math.PI/180; + martin.lat = martin.lat*Math.PI/180; + martin.lng = martin.lng*Math.PI/180; + + var deltaLng = martin.lng - office.lng; + var x = Math.cos(martin.lat) * Math.sin(deltaLng); + var y = Math.cos(office.lat) * Math.sin(martin.lat) - Math.sin(office.lat) * Math.cos(martin.lat) * Math.cos(deltaLng); + var inRadian = Math.atan2(x, y); + return ((inRadian * 180/Math.PI) + 360) % 360 + }; + + var getMartinCoordinates = function() { + fetch("martin-url/lat", {method: 'DELETE'}) + .then(function(lat) { + martinCoordinates.lat = lat; + }).then(function(){ + return fetch("martin-url/lng", {method: 'DELETE'}) + }).then(function(lng) { + martinCoordinates.lng = lng; + }); + }; + + getMartinCoordinates(); + var direction = locationToDegrees(officeCoordinates, martinCoordinates); + document.getElementsByClassName("compass-needle")[0].style.transform="rotate(" + direction + "deg)"; +}; diff --git a/js/temp/package.json b/js/temp/package.json new file mode 100644 index 0000000..2f451ce --- /dev/null +++ b/js/temp/package.json @@ -0,0 +1,16 @@ +{ + "name": "temp", + "version": "0.0.0", + "description": "", + "main": "server.js", + "dependencies": { + "express": "^4.13.4" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js" + }, + "author": "", + "license": "ISC" +} diff --git a/js/temp/server.js b/js/temp/server.js new file mode 100644 index 0000000..5beb5ae --- /dev/null +++ b/js/temp/server.js @@ -0,0 +1,17 @@ +var express = require('express'); +var app = express(); + +// respond with "hello world" when a GET request is made to the homepage +app.delete('/martin-url/lat', function(req, res) { + res.send(200, "53.14677033085084"); +}); + +app.delete('/martin-url/lng', function(req, res) { + res.send(200, "27.2021484375"); +}); + +app.use('/', express.static('../../')); + +app.listen(3000, function () { + console.log('Example app listening on port 3000!'); +}); \ No newline at end of file