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(){
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(){
}
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
*/
......
......@@ -626,6 +626,7 @@ function leaf_events(){
mark.align = {
latitude: mark.latitude,
longitude: mark.longitude,
altitude: 0,
x: 0,
y: 0,
z: 0
......@@ -788,6 +789,8 @@ function leaf_drag_marker(){
function leaf_update_x3dom_marker(p1_ll,p2_ll,index){
var Camera = Map.marker;
var mark = Data.markers[index];
var hecs = Map.marker.getHCState();
......@@ -797,6 +800,7 @@ function leaf_update_x3dom_marker(p1_ll,p2_ll,index){
mark.align.latitude = mark.latitude;
mark.align.longitude = mark.longitude;
mark.align.altitude = Camera._measureMarkers[index]._altitude;
var distance = p1_ll.distanceTo(p2_ll);
......
......@@ -1381,6 +1381,7 @@ X3DOMObject.createNewMarker = function(x,y,z){
mark.align = {
latitude: 0,
longitude: 0,
altitude: 0,
x: mark.x,
y: mark.y,
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