Commit 3b04f8d7 authored by Michael Ochmann's avatar Michael Ochmann
Browse files

.

parent 2a2b2872
......@@ -21,7 +21,9 @@
</canvas>
</main>
<footer></footer>
<footer>
<b>Points:</b> <span id=points></span>
</footer>
</body>
</html>
\ No newline at end of file
......@@ -13,12 +13,18 @@ class App {
this.heightmap = new HeightMap();
this.capture();
setInterval(() => {
navigator.geolocation.getCurrentPosition(position => {
this.heightmap.addPoint(new GeoPoint(position.latitude, position.longitude, position.altitude));
});
this.capture();
}, 1000);
}
capture() {
navigator.geolocation.getCurrentPosition(position => {
this.heightmap.addPoint(new GeoPoint(position.latitude, position.longitude, position.altitude));
});
}
}
export default App;
\ No newline at end of file
......@@ -42,9 +42,11 @@ class HeightMap {
addPoint(geoPoint) {
if (geoPoint.constructor.name !== "GeoPoint")
throw new TypeError("an object of type 'GeoPoint' must be passed.");
if (this.points.length > 0 && this.points[0].distance(geoPoint) < 50)
if (this.points.length > 0 && this.points[0].distance(geoPoint) < 5)
return;
$("#points").html(this.points.length);
let min = this.min;
let max = this.max;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment