Skip to content

Commit f5061af

Browse files
committed
Final commit
1 parent 2805fa2 commit f5061af

File tree

6 files changed

+77
-29
lines changed

6 files changed

+77
-29
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ <h3>Hardware</h3>
8282
</select>
8383
</div>
8484
<div id="setup-target-overlap-wall" class="popup-target-overlap-select hidden">
85-
<p>Target overlap detection</p>
85+
<p>Target precision</p>
8686
<select title="overlap-wall-popup" name="overlap-wall-popup" id="overlap-wall-selection-popup">
8787
<option value="0.1" selected>Hand tracking</option>
8888
<option value="0.02">Finger tracking</option>
8989
</select>
9090
</div>
9191
<div id="setup-target-overlap-table" class="popup-target-overlap-select hidden">
92-
<p>Target overlap detection</p>
92+
<p>Target precision</p>
9393
<select title="overlap-table-popup" name="overlap-table-popup" id="overlap-table-selection-popup">
9494
<option value="1.2" selected>Hand tracking</option>
9595
</select>

js/UI/Popup.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,24 @@ class Popup{
424424
break;
425425
case 'hand-tracking':
426426
document.getElementById('dimensions-table-height-input').value = Math.floor(sceneElevation * sceneManager.currentUnit.value * 100) / 100;
427+
document.getElementById('dimensions-width-input').value = Math.floor(sceneSize[0] * sceneManager.currentUnit.value * 100) / 100;
428+
document.getElementById('dimensions-length-input').value = Math.floor(sceneSize[1] * sceneManager.currentUnit.value * 100) / 100;
429+
var nodes = JSON.parse(sceneInfos).objects.nodes;
430+
if(nodes.length > 0) {
431+
document.getElementById('dimensions-distance-input').value = Math.floor((nodes[0].zPos) * sceneManager.currentUnit.value * 100) / 100;
432+
} else {
433+
document.getElementById('dimensions-distance-input').value = 2.5;
434+
}
435+
break;
427436
case 'human-tracking':
428437
document.getElementById('dimensions-width-input').value = Math.floor(sceneSize[0] * sceneManager.currentUnit.value * 100) / 100;
429438
document.getElementById('dimensions-length-input').value = Math.floor(sceneSize[1] * sceneManager.currentUnit.value * 100) / 100;
430-
const nodes = JSON.parse(sceneInfos).objects.nodes;
431-
if(nodes.length > 0) document.getElementById('dimensions-distance-input').value = Math.floor((nodes[0].zPos) * sceneManager.currentUnit.value * 100) / 100;
432-
else document.getElementById('dimensions-distance-input').value = '';
439+
var nodes = JSON.parse(sceneInfos).objects.nodes;
440+
if(nodes.length > 0) {
441+
document.getElementById('dimensions-distance-input').value = Math.floor((nodes[0].zPos) * sceneManager.currentUnit.value * 100) / 100;
442+
} else {
443+
document.getElementById('dimensions-distance-input').value = 6;
444+
}
433445
break;
434446
default:
435447
break;

js/UI/Wizard.js

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ function calculateCameraConfig(trackingMode, cameraType, givenWidth, givenLength
634634
// --- STEP 1 : Compute projections' dimensions
635635
let WProj, HProj;
636636
const isHexagonal = cameraType.textId === 'orbbec-femto-mega-narrow';
637-
const isCircular = cameraType.textId === 'orbbec-femto-mega-wide';
637+
const isCircular = (cameraType.textId === 'orbbec-femto-mega-wide') || (cameraType.textId === "ouster-os-dome");
638638

639639
if (isHexagonal) {
640640
const HMaxRect = Math.abs(Math.tan((cameraType.VFov / 2.0) * Math.PI / 180.0)) * effDist * 2;
@@ -731,23 +731,66 @@ function calculateCameraConfig(trackingMode, cameraType, givenWidth, givenLength
731731

732732
function createSceneFromCameraConfig(config, trackingMode, givenWidth, givenLength, camsZPosition, sceneManager)
733733
{
734-
let offsetX = config.w / 2.0;
735-
let offsetY = config.h / 2.0;
736-
if(config.nbW === 1) offsetX -= (config.nbW*config.w - givenWidth)/2.0;
737-
if(config.nbH === 1) offsetY -= (config.nbH*config.h - givenLength)/2.0;
738-
const oX = config.nbW > 1 ? (config.nbW*config.w - givenWidth)/(config.nbW - 1) : 0;
739-
const oY = config.nbH > 1 ? (config.nbH*config.h - givenLength)/(config.nbH - 1) : 0;
734+
// Initialize final spacing variables
735+
let finalSpacingW, finalSpacingH;
740736

737+
// Get the full specs for the camera type
738+
const cameraType = getCamerasTypes().find(c => c.id === config.typeID);
739+
740+
// Check if the camera is circular to apply the correct logic
741+
if (config.isCircular)
742+
{
743+
// --- LOGIC SPECIFIC TO CIRCULAR CAMERAS (AVERAGE COMPROMISE) ---
744+
745+
// Recalculating the projection diameter here as it's not passed in the config object
746+
const heightDetected = (trackingMode === 'human-tracking') ? sceneManager.heightDetected : 0;
747+
const effDist = camsZPosition - heightDetected;
748+
const diameter = Math.abs(Math.tan((cameraType.HFov / 2.0) * Math.PI / 180.0)) * effDist * 2;
749+
750+
// 1. The IDEAL spacing (to guarantee full coverage)
751+
const idealSpacing = config.w;
752+
753+
// 2. The ADJUSTED spacing (to perfectly align with the scene edges)
754+
const adjustedSpacingW = (config.nbW > 1) ? (givenWidth - diameter) / (config.nbW - 1) : idealSpacing;
755+
const adjustedSpacingH = (config.nbH > 1) ? (givenLength - diameter) / (config.nbH - 1) : idealSpacing;
756+
757+
// 3. The FINAL spacing (the average of the two, as a compromise)
758+
finalSpacingW = (idealSpacing + Math.max(0, adjustedSpacingW)) / 2.0;
759+
finalSpacingH = (idealSpacing + Math.max(0, adjustedSpacingH)) / 2.0;
760+
}
761+
else
762+
{
763+
// --- STANDARD LOGIC FOR RECTANGULAR AND OTHER CAMERAS ---
764+
// The spacing is simply the paving tile size, with no compromise
765+
finalSpacingW = config.w;
766+
finalSpacingH = config.h;
767+
}
768+
769+
// --- GEOMETRIC PLACEMENT (COMMON TO ALL TYPES) ---
770+
771+
// Compute the total size of the sensor grid
772+
const totalGridWidth = (config.nbW - 1) * finalSpacingW;
773+
const totalGridHeight = (config.nbH - 1) * finalSpacingH;
774+
775+
// Center it in the scene to find the starting point
776+
const startX = (givenWidth - totalGridWidth) / 2.0;
777+
const startY = (givenLength - totalGridHeight) / 2.0;
778+
779+
// Loop through the grid to place each sensor
741780
for(let i = 0; i < config.nbW; i++)
742781
{
743782
for(let j = 0; j < config.nbH; j++)
744783
{
784+
// Compute the final position of the sensor
785+
const camX = startX + i * finalSpacingW;
786+
const camY = startY + j * finalSpacingH;
787+
788+
// Add the node to the scene, applying a rotation if needed
745789
config.rot
746790
?
747-
sceneManager.objects.addNode(true, trackingMode, config.typeID, offsetX + i*(config.w - oX), offsetY + j*(config.h - oY), camsZPosition, 0, 0, Math.PI/2.0)
791+
sceneManager.objects.addNode(true, trackingMode, config.typeID, camX, camY, camsZPosition, 0, 0, Math.PI/2.0)
748792
:
749-
sceneManager.objects.addNode(true, trackingMode, config.typeID, offsetX + i*(config.w - oX), offsetY + j*(config.h - oY), camsZPosition);
750-
793+
sceneManager.objects.addNode(true, trackingMode, config.typeID, camX, camY, camsZPosition);
751794
}
752795
}
753796
}

js/camera-data

js/scene/SceneManager.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,8 @@ class SceneManager{
468468
{
469469
case 'hand-tracking':
470470
if(this.augmentaSceneLoaded) {
471-
this.sceneWidth = this.checkerboardFloor.width;
472-
this.sceneLength = this.checkerboardFloor.height;
471+
this.sceneWidth = 3;
472+
this.sceneLength = 2;
473473
changeSurface(this.scene, [this.checkerboardWallY], [this.checkerboardFloor], [this.sceneElevation]);
474474
}
475475
this.wallY.position.z = -10; // if you want to get the wall on checkerboard border, change this AND initialization values
@@ -478,8 +478,8 @@ class SceneManager{
478478
this.sceneElevation = 0;
479479

480480
if(this.augmentaSceneLoaded) {
481-
this.sceneWidth = this.checkerboardWallY.width;
482-
this.sceneLength = this.checkerboardWallY.height;
481+
this.sceneWidth = 6;
482+
this.sceneLength = 4;
483483
changeSurface(this.scene, [this.checkerboardFloor], [this.checkerboardWallY], [this.sceneElevation]);}
484484
this.wallY.position.z = 0;
485485
break;
@@ -488,8 +488,8 @@ class SceneManager{
488488
this.sceneElevation = 0;
489489

490490
if(this.augmentaSceneLoaded) {
491-
this.sceneWidth = this.checkerboardFloor.width;
492-
this.sceneLength = this.checkerboardFloor.height;
491+
this.sceneWidth = 11;
492+
this.sceneLength = 6;
493493
changeSurface(this.scene, [this.checkerboardWallY], [this.checkerboardFloor], [this.sceneElevation]);}
494494
this.wallY.position.z = -10;
495495
break;

js/scene/objects/SceneObjects.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ class SceneObjects{
6464
return;
6565
}
6666

67-
//Default case
68-
if(!isBuilder)
69-
{
70-
this.addNode(false, sceneManager.trackingMode, Node.DEFAULT_CAMERA_TYPE_ID, 2.5, 2.5, Node.DEFAULT_NODE_HEIGHT);
71-
}
72-
sceneManager.updateFloorAugmentaSceneBorder(SceneManager.DEFAULT_WIDTH, SceneManager.DEFAULT_LENGTH, SceneManager.TABLE_ELEVATION);
73-
this.populateStorage();
7467
}
7568

7669
/* SCENE SUBJECTS MANAGEMENT */

0 commit comments

Comments
 (0)