@@ -634,7 +634,7 @@ function calculateCameraConfig(trackingMode, cameraType, givenWidth, givenLength
634
634
// --- STEP 1 : Compute projections' dimensions
635
635
let WProj , HProj ;
636
636
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" ) ;
638
638
639
639
if ( isHexagonal ) {
640
640
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
731
731
732
732
function createSceneFromCameraConfig ( config , trackingMode , givenWidth , givenLength , camsZPosition , sceneManager )
733
733
{
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 ;
740
736
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
741
780
for ( let i = 0 ; i < config . nbW ; i ++ )
742
781
{
743
782
for ( let j = 0 ; j < config . nbH ; j ++ )
744
783
{
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
745
789
config . rot
746
790
?
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 )
748
792
:
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 ) ;
751
794
}
752
795
}
753
796
}
0 commit comments