Loading js/ui_init.js +4 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,7 @@ function x3d_initial_camera_placement(){ // proper Euler rotation var R = Mh.mult(Mt).mult(Mr); //var R = Mr.mult(Mt).mult(Mh); // convert to proper Euler var T = x3dom_toYawPitchRoll(); Loading @@ -459,6 +460,7 @@ function x3d_initial_camera_placement(){ // exclude tilt and roll var RC0_rw = T.inverse().mult(Mh).mult(T); // what's this?! var RC_w = R0.inverse().mult(RC0_rw); // store matrices Data.camera.Matrices = { Loading @@ -468,6 +470,8 @@ function x3d_initial_camera_placement(){ }; x3dom_setViewpoint(RC_w); //x3dom_setViewpoint(RC0_rw); //x3dom_setViewpoint(R0); } Loading js/x3dom_functions.js +47 −4 Original line number Diff line number Diff line Loading @@ -129,12 +129,21 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){ // to get XZ(horizontal) distance - convert to real world coordinates var R0 = Data.camera.Matrices.R0; var p_w = new x3dom.fields.SFVec3f(x-xc,y-yc,z-zc); var p_w = new x3dom.fields.SFVec3f(x,y,z); var p_rw = R0.multMatrixVec(p_w); var c_w = new x3dom.fields.SFVec3f(xc,yc,zc); var c_rw = R0.multMatrixVec(c_w); if (valid_distance){ dist_xz = Math.sqrt(Math.pow(p_rw.x,2)+Math.pow(p_rw.z,2)); dist_xyz = Math.sqrt(Math.pow(p_rw.y,2)+Math.pow(dist_xz,2)); //console.log("D_xz_Local: "+Math.sqrt(Math.pow(p_w.x,2)+Math.pow(p_w.z,2))); //console.log("D_xz_World: "+Math.sqrt(Math.pow(p_rw.x,2)+Math.pow(p_rw.z,2))); dist_xz = Math.sqrt(Math.pow(p_rw.x-c_rw.x,2)+Math.pow(p_rw.z-c_rw.z,2)); dist_xyz = Math.sqrt(Math.pow(p_rw.y-c_rw.y,2)+Math.pow(dist_xz,2)); }else{ dist_xz = null; dist_xyz = null; Loading @@ -146,6 +155,16 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){ el = Math.atan2(p_rw.y,Math.sqrt(p_rw.x*p_rw.x+p_rw.z*p_rw.z))*180/Math.PI; sk = 0; //distance to previous marker if ( (index!=null)&& (index>0)&& (Data.markers[index]!=undefined)&& (Data.markers[index-1]!=undefined) ){ console.log("Getting distance to previous point"); } // fill out the output var result = { x: !round? x : x.toFixed(2), Loading @@ -154,7 +173,13 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){ a: !round? az : az.toFixed(1), e: !round? el : el.toFixed(1), s: !round? sk : sk.toFixed(1) s: !round? sk : sk.toFixed(1), real: { x: !round? p_rw.x:p_rw.x.toFixed(2), y: !round? p_rw.y:p_rw.y.toFixed(2), z: !round? p_rw.z:p_rw.z.toFixed(2) } }; if (dist_xz!=null){ Loading Loading @@ -508,6 +533,7 @@ function x3dom_matrix_test(){ * unrelated: what's x3dom's native getWCtoCCMatrix()? canvas-to-world? */ function x3dom_toYawPitchRoll(){ return new x3dom.fields.SFMatrix4f( 0, 0,-1, 0, Loading Loading @@ -642,6 +668,23 @@ function x3dom_getDistAngle(x,y,z){ } function x3dom_3d_distance(x,y,z,round){ var d = x3dom_2d_distance(x,z,false); var res = Math.sqrt(Math.pow(y,2)+Math.pow(d,2)); res = !round? res:res.toFixed(2); return res; } function x3dom_2d_distance(x,z,round){ var res = Math.sqrt(Math.pow(x,2)+Math.pow(z,2)); res = !round? res:res.toFixed(2); return res; } function x3dom_update_map(){ var Camera = Map.marker; Loading js/x3dom_init.js +50 −36 Original line number Diff line number Diff line Loading @@ -1236,42 +1236,56 @@ X3DOMObject.displayViewInfo = function(e){ //Map.marker.setAltitude(camera.y); //Map.marker.setElevation(camera.e*Math.PI/180); var msg = ` <table> <tr> <td></td> <td colspan='3' align='center'>position, m</td> <td colspan='3' align='center'>orientation, °</td> </tr> <tr> <th></th> <th style='width:60px;'>x</th> <th style='width:60px;'>y</th> <th style='width:60px;'>z</th> <th>azimuth</th> <th>elevation</th> <th>skew</th> </tr> <tr> <td>mouse</td> <td>`+mouse.x+`</td> <td>`+mouse.y+`</td> <td>`+mouse.z+`</td> <td>`+mouse.a+`</td> <td>`+mouse.e+`</td> <td>`+mouse.s+`</td> </tr> <tr> <td>camera</td> <td>`+camera.x+`</td> <td>`+camera.y+`</td> <td>`+camera.z+`</td> <td>`+camera.a+`</td> <td>`+camera.e+`</td> <td>`+camera.s+`</td> </tr> </table> `; var m_dxz = x3dom_2d_distance(mouse.x,mouse.z,true); var m_dxyz = x3dom_3d_distance(mouse.x,mouse.y,mouse.z,true); var m_real_dxz = x3dom_2d_distance(mouse.real.x,mouse.real.z,true); var m_real_dxyz = x3dom_3d_distance(mouse.real.x,mouse.real.y,mouse.real.z,true); var log = [ 'data:', ' scene : x='+mouse.x+' y='+mouse.y+' z='+mouse.z+' d_xz='+m_dxz+' d_xyz='+m_dxyz, ' world : x='+mouse.real.x+' y='+mouse.real.y+' z='+mouse.real.z+' d_xz='+m_real_dxz+' d_xyz='+m_real_dxyz ].join('\n'); console.log(log); var msg = [ '<table>', '<tr>', ' <td></td>', ' <td colspan=\'3\' align=\'center\'>position, m</td>', ' <td colspan=\'3\' align=\'center\'>orientation, °</td>', '</tr>', '<tr>', ' <th></th>', ' <th style=\'width:60px;\'>x</th>', ' <th style=\'width:60px;\'>y</th>', ' <th style=\'width:60px;\'>z</th>', ' <th>azimuth</th>', ' <th>elevation</th>', ' <th>skew</th>', '</tr>', '<tr>', ' <td>mouse</td>', ' <td>'+mouse.real.x+'</td>', ' <td>'+mouse.real.y+'</td>', ' <td>'+mouse.real.z+'</td>', ' <td>'+mouse.a+'</td>', ' <td>'+mouse.e+'</td>', ' <td>'+mouse.s+'</td>', '</tr>', '<tr>', ' <td>camera</td>', ' <td>'+camera.x+'</td>', ' <td>'+camera.y+'</td>', ' <td>'+camera.z+'</td>', ' <td>'+camera.a+'</td>', ' <td>'+camera.e+'</td>', ' <td>'+camera.s+'</td>', '</tr>', '</table>' ].join('\n'); if (SETTINGS.viewinfo){ ui_showMessage("window-viewinfo",msg); Loading Loading
js/ui_init.js +4 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,7 @@ function x3d_initial_camera_placement(){ // proper Euler rotation var R = Mh.mult(Mt).mult(Mr); //var R = Mr.mult(Mt).mult(Mh); // convert to proper Euler var T = x3dom_toYawPitchRoll(); Loading @@ -459,6 +460,7 @@ function x3d_initial_camera_placement(){ // exclude tilt and roll var RC0_rw = T.inverse().mult(Mh).mult(T); // what's this?! var RC_w = R0.inverse().mult(RC0_rw); // store matrices Data.camera.Matrices = { Loading @@ -468,6 +470,8 @@ function x3d_initial_camera_placement(){ }; x3dom_setViewpoint(RC_w); //x3dom_setViewpoint(RC0_rw); //x3dom_setViewpoint(R0); } Loading
js/x3dom_functions.js +47 −4 Original line number Diff line number Diff line Loading @@ -129,12 +129,21 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){ // to get XZ(horizontal) distance - convert to real world coordinates var R0 = Data.camera.Matrices.R0; var p_w = new x3dom.fields.SFVec3f(x-xc,y-yc,z-zc); var p_w = new x3dom.fields.SFVec3f(x,y,z); var p_rw = R0.multMatrixVec(p_w); var c_w = new x3dom.fields.SFVec3f(xc,yc,zc); var c_rw = R0.multMatrixVec(c_w); if (valid_distance){ dist_xz = Math.sqrt(Math.pow(p_rw.x,2)+Math.pow(p_rw.z,2)); dist_xyz = Math.sqrt(Math.pow(p_rw.y,2)+Math.pow(dist_xz,2)); //console.log("D_xz_Local: "+Math.sqrt(Math.pow(p_w.x,2)+Math.pow(p_w.z,2))); //console.log("D_xz_World: "+Math.sqrt(Math.pow(p_rw.x,2)+Math.pow(p_rw.z,2))); dist_xz = Math.sqrt(Math.pow(p_rw.x-c_rw.x,2)+Math.pow(p_rw.z-c_rw.z,2)); dist_xyz = Math.sqrt(Math.pow(p_rw.y-c_rw.y,2)+Math.pow(dist_xz,2)); }else{ dist_xz = null; dist_xyz = null; Loading @@ -146,6 +155,16 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){ el = Math.atan2(p_rw.y,Math.sqrt(p_rw.x*p_rw.x+p_rw.z*p_rw.z))*180/Math.PI; sk = 0; //distance to previous marker if ( (index!=null)&& (index>0)&& (Data.markers[index]!=undefined)&& (Data.markers[index-1]!=undefined) ){ console.log("Getting distance to previous point"); } // fill out the output var result = { x: !round? x : x.toFixed(2), Loading @@ -154,7 +173,13 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){ a: !round? az : az.toFixed(1), e: !round? el : el.toFixed(1), s: !round? sk : sk.toFixed(1) s: !round? sk : sk.toFixed(1), real: { x: !round? p_rw.x:p_rw.x.toFixed(2), y: !round? p_rw.y:p_rw.y.toFixed(2), z: !round? p_rw.z:p_rw.z.toFixed(2) } }; if (dist_xz!=null){ Loading Loading @@ -508,6 +533,7 @@ function x3dom_matrix_test(){ * unrelated: what's x3dom's native getWCtoCCMatrix()? canvas-to-world? */ function x3dom_toYawPitchRoll(){ return new x3dom.fields.SFMatrix4f( 0, 0,-1, 0, Loading Loading @@ -642,6 +668,23 @@ function x3dom_getDistAngle(x,y,z){ } function x3dom_3d_distance(x,y,z,round){ var d = x3dom_2d_distance(x,z,false); var res = Math.sqrt(Math.pow(y,2)+Math.pow(d,2)); res = !round? res:res.toFixed(2); return res; } function x3dom_2d_distance(x,z,round){ var res = Math.sqrt(Math.pow(x,2)+Math.pow(z,2)); res = !round? res:res.toFixed(2); return res; } function x3dom_update_map(){ var Camera = Map.marker; Loading
js/x3dom_init.js +50 −36 Original line number Diff line number Diff line Loading @@ -1236,42 +1236,56 @@ X3DOMObject.displayViewInfo = function(e){ //Map.marker.setAltitude(camera.y); //Map.marker.setElevation(camera.e*Math.PI/180); var msg = ` <table> <tr> <td></td> <td colspan='3' align='center'>position, m</td> <td colspan='3' align='center'>orientation, °</td> </tr> <tr> <th></th> <th style='width:60px;'>x</th> <th style='width:60px;'>y</th> <th style='width:60px;'>z</th> <th>azimuth</th> <th>elevation</th> <th>skew</th> </tr> <tr> <td>mouse</td> <td>`+mouse.x+`</td> <td>`+mouse.y+`</td> <td>`+mouse.z+`</td> <td>`+mouse.a+`</td> <td>`+mouse.e+`</td> <td>`+mouse.s+`</td> </tr> <tr> <td>camera</td> <td>`+camera.x+`</td> <td>`+camera.y+`</td> <td>`+camera.z+`</td> <td>`+camera.a+`</td> <td>`+camera.e+`</td> <td>`+camera.s+`</td> </tr> </table> `; var m_dxz = x3dom_2d_distance(mouse.x,mouse.z,true); var m_dxyz = x3dom_3d_distance(mouse.x,mouse.y,mouse.z,true); var m_real_dxz = x3dom_2d_distance(mouse.real.x,mouse.real.z,true); var m_real_dxyz = x3dom_3d_distance(mouse.real.x,mouse.real.y,mouse.real.z,true); var log = [ 'data:', ' scene : x='+mouse.x+' y='+mouse.y+' z='+mouse.z+' d_xz='+m_dxz+' d_xyz='+m_dxyz, ' world : x='+mouse.real.x+' y='+mouse.real.y+' z='+mouse.real.z+' d_xz='+m_real_dxz+' d_xyz='+m_real_dxyz ].join('\n'); console.log(log); var msg = [ '<table>', '<tr>', ' <td></td>', ' <td colspan=\'3\' align=\'center\'>position, m</td>', ' <td colspan=\'3\' align=\'center\'>orientation, °</td>', '</tr>', '<tr>', ' <th></th>', ' <th style=\'width:60px;\'>x</th>', ' <th style=\'width:60px;\'>y</th>', ' <th style=\'width:60px;\'>z</th>', ' <th>azimuth</th>', ' <th>elevation</th>', ' <th>skew</th>', '</tr>', '<tr>', ' <td>mouse</td>', ' <td>'+mouse.real.x+'</td>', ' <td>'+mouse.real.y+'</td>', ' <td>'+mouse.real.z+'</td>', ' <td>'+mouse.a+'</td>', ' <td>'+mouse.e+'</td>', ' <td>'+mouse.s+'</td>', '</tr>', '<tr>', ' <td>camera</td>', ' <td>'+camera.x+'</td>', ' <td>'+camera.y+'</td>', ' <td>'+camera.z+'</td>', ' <td>'+camera.a+'</td>', ' <td>'+camera.e+'</td>', ' <td>'+camera.s+'</td>', '</tr>', '</table>' ].join('\n'); if (SETTINGS.viewinfo){ ui_showMessage("window-viewinfo",msg); Loading