Commit 7be238eb authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

tilt and roll adjustment - in development

parent 2c3e9726
...@@ -409,6 +409,11 @@ function x3dom_align_tr(){ ...@@ -409,6 +409,11 @@ function x3dom_align_tr(){
console.log("Tilt: "+tilt+" Roll: "+roll); console.log("Tilt: "+tilt+" Roll: "+roll);
var epsilon = 1e-8;
var result = numbers.calculus.GaussNewton([0,0,0],Data.markers.length,_r_i,[_dr_dx_i,_dr_dy_i,_dr_da_i],epsilon);
console.log(result);
} }
/* /*
...@@ -420,6 +425,80 @@ function align_roll(){ ...@@ -420,6 +425,80 @@ function align_roll(){
} }
function _f1_3d_i(i,v){
var mark = Data.markers[i];
var xi = mark.align.x;
var yi = mark.align.y;
var zi = mark.align.z;
var res = -Math.cos(v[0])*Math.sin(v[1])*xi;
res += Math.cos(v[0])*Math.cos(v[1])*yi;
res += -Math.sin(v[0])*zi;
return res;
}
function _f2_map_i(i,v){
var mark = Data.markers[i];
return (v[2]+mark.align.altitude);
}
function _r_i(i,v){
var f1 = _f1_3d_i(i,v);
var f2 = _f2_map_i(i,v);
//return (f1-f2+360)%360;
return (f1-f2)/_l_i(i);
}
function _dr_dx_i(i,v){
var mark = Data.markers[i];
var xi = mark.align.x;
var yi = mark.align.y;
var zi = mark.align.z;
var res = Math.sin(v[0])*Math.sin(v[1])*xi;
res += -Math.sin(v[0])*Math.cos(v[1])*yi;
res += -Math.cos(v[0])*zi;
return res/_l_i(i);
}
function _dr_dy_i(i,v){
var mark = Data.markers[i];
var xi = mark.align.x;
var yi = mark.align.y;
var zi = mark.align.z;
var res = -Math.cos(v[0])*Math.cos(v[1])*xi;
res += -Math.cos(v[0])*Math.sin(v[1])*yi;
return res/_l_i(i);
}
function _dr_da_i(i,v){
return 1;
}
function _l_i(i){
var mark = Data.markers[i];
var xi = mark.align.x;
var yi = mark.align.y;
var zi = mark.align.z;
return Math.sqrt(xi*xi+yi*yi+zi*zi);
}
/* /*
* not used * not used
*/ */
......
...@@ -626,6 +626,7 @@ function leaf_events(){ ...@@ -626,6 +626,7 @@ function leaf_events(){
mark.align = { mark.align = {
latitude: mark.latitude, latitude: mark.latitude,
longitude: mark.longitude, longitude: mark.longitude,
altitude: 0,
x: 0, x: 0,
y: 0, y: 0,
z: 0 z: 0
...@@ -788,6 +789,8 @@ function leaf_drag_marker(){ ...@@ -788,6 +789,8 @@ function leaf_drag_marker(){
function leaf_update_x3dom_marker(p1_ll,p2_ll,index){ function leaf_update_x3dom_marker(p1_ll,p2_ll,index){
var Camera = Map.marker;
var mark = Data.markers[index]; var mark = Data.markers[index];
var hecs = Map.marker.getHCState(); var hecs = Map.marker.getHCState();
...@@ -797,6 +800,7 @@ function leaf_update_x3dom_marker(p1_ll,p2_ll,index){ ...@@ -797,6 +800,7 @@ function leaf_update_x3dom_marker(p1_ll,p2_ll,index){
mark.align.latitude = mark.latitude; mark.align.latitude = mark.latitude;
mark.align.longitude = mark.longitude; mark.align.longitude = mark.longitude;
mark.align.altitude = Camera._measureMarkers[index]._altitude;
var distance = p1_ll.distanceTo(p2_ll); var distance = p1_ll.distanceTo(p2_ll);
......
...@@ -1381,6 +1381,7 @@ X3DOMObject.createNewMarker = function(x,y,z){ ...@@ -1381,6 +1381,7 @@ X3DOMObject.createNewMarker = function(x,y,z){
mark.align = { mark.align = {
latitude: 0, latitude: 0,
longitude: 0, longitude: 0,
altitude: 0,
x: mark.x, x: mark.x,
y: mark.y, y: mark.y,
z: mark.z z: mark.z
......
Markdown is supported
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