generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from amosproj/sprint-04-release-candidate-
Merge Sprint 04 release candidate to main
- Loading branch information
Showing
10 changed files
with
286 additions
and
141 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ | |
*.code-workspace | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
.history/ | ||
assets/* |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ | |
"i":[ | ||
[ | ||
0, | ||
300 | ||
3 | ||
] | ||
], | ||
"map":{ | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
export const DEFAULT_FOV = 80, MAX_FOV = 100, MIN_FOV = 10; | ||
export const DEFAULT_FOV = 80, MAX_FOV = 100, MIN_FOV = 10; | ||
|
||
export function distanceWGS84TwoPoints(lon1, lat1, lon2, lat2) { | ||
// Distance calculation math roughly taken from here https://www.mkompf.com/gps/distcalc.html | ||
let dx, dy; // distance to origin in kilometers | ||
|
||
const avgLat = (lat1 + lat2) / 2 * 0.01745; | ||
dx = 111.3 * Math.cos(THREE.MathUtils.degToRad(avgLat)) * (lon1 - lon2); | ||
dy = 111.3 * (lat1 - lat2); | ||
|
||
return [dx, dy]; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"use strict"; | ||
|
||
// API provided by the viewer | ||
export class ViewerAPI { | ||
|
||
constructor(viewerImageAPI, viewerPanoAPI) { | ||
this.min = 1; | ||
this.viewerImageAPI = viewerImageAPI; | ||
this.viewerPanoAPI = viewerPanoAPI; | ||
} | ||
|
||
|
||
//Move the view to the given position. | ||
move(lon, lat, z) { | ||
|
||
let temp = [lon, lat, z]; | ||
let resultset = []; | ||
let minval; | ||
let minkey; | ||
|
||
//console.log(viewerImageAPI.viewerImages); | ||
for (let i in this.viewerImageAPI.currentFloor.viewerImages) { | ||
//console.log(viewerImageAPI.viewerImages[i].pos); | ||
//console.log(viewerImageAPI.viewerImages[i].pos[0]); | ||
//console.log(temp[0]); | ||
let result = Math.sqrt( | ||
Math.pow(this.viewerImageAPI.currentFloor.viewerImages[i].pos[0] - temp[0], 2) + | ||
Math.pow(this.viewerImageAPI.currentFloor.viewerImages[i].pos[1] - temp[1], 2) + | ||
Math.pow(this.viewerImageAPI.currentFloor.viewerImages[i].pos[2] - temp[2], 2) ); | ||
//console.log(result); | ||
resultset.push(result); | ||
} | ||
|
||
console.log(resultset); | ||
minkey = 0; | ||
minval = resultset[0]; | ||
for (let i in resultset) { | ||
if (resultset[i] < minval) { | ||
minval = resultset[i]; | ||
minkey = i; | ||
} | ||
} | ||
console.log(minkey); | ||
console.log(minval); | ||
|
||
this.min = minkey; | ||
|
||
// Create a Sphere for the image texture to be displayed on | ||
const sphere = new THREE.SphereGeometry(500, 60, 40); | ||
// invert the geometry on the x-axis so that we look out from the middle of the sphere | ||
sphere.scale( -1, 1, 1); | ||
|
||
// load the 360-panorama image data (one specific hardcoded for now) | ||
const texturePano = new THREE.TextureLoader().load( '../assets/0/'+this.min+'r3.jpg' ); | ||
texturePano.mapping = THREE.EquirectangularReflectionMapping; // not sure if this line matters | ||
|
||
// put the texture on the spehere and add it to the scene | ||
const material = new THREE.MeshBasicMaterial({ map: texturePano }); | ||
const mesh = new THREE.Mesh(sphere, material); | ||
|
||
this.viewerPanoAPI.scene.add(mesh); | ||
|
||
//console.log(minkey); | ||
//console.log(minval); | ||
|
||
} | ||
|
||
|
||
} |
This file contains 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
Oops, something went wrong.