Commit ee479019 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

fixed back least square fitting

parent 119e77df
...@@ -54,7 +54,8 @@ function hll_f_3d_i(i,v){ ...@@ -54,7 +54,8 @@ function hll_f_3d_i(i,v){
var xyz_real = x3dom_scene_to_real(mark.align.x-base.x,mark.align.y-base.y,mark.align.z-base.z); var xyz_real = x3dom_scene_to_real(mark.align.x-base.x,mark.align.y-base.y,mark.align.z-base.z);
var vec = new x3dom.fields.SFVec3f(xyz_real.x,xyz_real.y,xyz_real.z); //var vec = new x3dom.fields.SFVec3f(xyz_real.x,xyz_real.y,xyz_real.z);
var vec = new x3dom.fields.SFVec3f(mark.align.x-base.x,mark.align.y-base.y,mark.align.z-base.z);
var res = Math.atan2(vec.x,-vec.z)*180/Math.PI + v[2]; var res = Math.atan2(vec.x,-vec.z)*180/Math.PI + v[2];
if (res> 180) res = res - 360; if (res> 180) res = res - 360;
...@@ -181,9 +182,9 @@ function hll_dr_dh_i(i,v){ ...@@ -181,9 +182,9 @@ function hll_dr_dh_i(i,v){
function hll_w_i(i,v){ function hll_w_i(i,v){
var mark = Data.markers[i]; var mark = Data.markers[i];
var xi = mark.align.real.x; var xi = mark.align.x;
var yi = mark.align.real.y; var yi = mark.align.y;
var zi = mark.align.real.z; var zi = mark.align.z;
//var arad = 0.0004404; //var arad = 0.0004404;
var D = 100; var D = 100;
...@@ -204,9 +205,9 @@ function hll_w_i(i,v){ ...@@ -204,9 +205,9 @@ function hll_w_i(i,v){
function art_f_3d_i(i,v){ function art_f_3d_i(i,v){
var mark = Data.markers[i]; var mark = Data.markers[i];
var xi = mark.align.real.x; var xi = mark.align.x;
var yi = mark.align.real.y; var yi = mark.align.y;
var zi = mark.align.real.z; var zi = mark.align.z;
var res = -Math.cos(v[0])*Math.sin(v[1])*xi; var res = -Math.cos(v[0])*Math.sin(v[1])*xi;
res += Math.cos(v[0])*Math.cos(v[1])*yi; res += Math.cos(v[0])*Math.cos(v[1])*yi;
...@@ -236,9 +237,9 @@ function art_r_i(i,v){ ...@@ -236,9 +237,9 @@ function art_r_i(i,v){
function art_dr_dx_i(i,v){ function art_dr_dx_i(i,v){
var mark = Data.markers[i]; var mark = Data.markers[i];
var xi = mark.align.real.x; var xi = mark.align.x;
var yi = mark.align.real.y; var yi = mark.align.y;
var zi = mark.align.real.z; var zi = mark.align.z;
var res = Math.sin(v[0])*Math.sin(v[1])*xi; var res = Math.sin(v[0])*Math.sin(v[1])*xi;
res += -Math.sin(v[0])*Math.cos(v[1])*yi; res += -Math.sin(v[0])*Math.cos(v[1])*yi;
...@@ -251,9 +252,9 @@ function art_dr_dx_i(i,v){ ...@@ -251,9 +252,9 @@ function art_dr_dx_i(i,v){
function art_dr_dy_i(i,v){ function art_dr_dy_i(i,v){
var mark = Data.markers[i]; var mark = Data.markers[i];
var xi = mark.align.real.x; var xi = mark.align.x;
var yi = mark.align.real.y; var yi = mark.align.y;
var zi = mark.align.real.z; var zi = mark.align.z;
var res = -Math.cos(v[0])*Math.cos(v[1])*xi; var res = -Math.cos(v[0])*Math.cos(v[1])*xi;
res += -Math.cos(v[0])*Math.sin(v[1])*yi; res += -Math.cos(v[0])*Math.sin(v[1])*yi;
...@@ -269,9 +270,9 @@ function art_dr_da_i(i,v){ ...@@ -269,9 +270,9 @@ function art_dr_da_i(i,v){
function art_l_i(i){ function art_l_i(i){
var mark = Data.markers[i]; var mark = Data.markers[i];
var xi = mark.align.real.x; var xi = mark.align.x;
var yi = mark.align.real.y; var yi = mark.align.y;
var zi = mark.align.real.z; var zi = mark.align.z;
return Math.sqrt(Math.pow(xi,2)+Math.pow(yi,2)+Math.pow(zi,2)); return Math.sqrt(Math.pow(xi,2)+Math.pow(yi,2)+Math.pow(zi,2));
...@@ -314,9 +315,9 @@ function art2_dr_da_i(i,v){ ...@@ -314,9 +315,9 @@ function art2_dr_da_i(i,v){
function art2_l_i(i){ function art2_l_i(i){
var mark = Data.markers[i]; var mark = Data.markers[i];
var xi = mark.align.real.x; var xi = mark.align.x;
var yi = mark.align.real.y; var yi = mark.align.y;
var zi = mark.align.real.z; var zi = mark.align.z;
return Math.sqrt(Math.pow(xi,2)+Math.pow(yi,2)+Math.pow(zi,2)); return Math.sqrt(Math.pow(xi,2)+Math.pow(yi,2)+Math.pow(zi,2));
......
...@@ -248,7 +248,7 @@ function distance_error(x,y,h){ ...@@ -248,7 +248,7 @@ function distance_error(x,y,h){
//var z_x3d = -Data.markers[i].align.z; //var z_x3d = -Data.markers[i].align.z;
var z_x3d = x3dom_2d_distance(Data.markers[i].real.align.x,Data.markers[i].real.align.z,round); var z_x3d = x3dom_2d_distance(Data.markers[i].align.real.x,Data.markers[i].align.real.z,false);
sum += 1/z_map-1/z_x3d; sum += 1/z_map-1/z_x3d;
console.log("Marker: "+i+", Camera heading: "+angle0+", Point azimuth: "+angle1+" , z_map: "+z_map+", z_x3d: "+z_x3d+", error^-1: "+(1/z_map-1/z_x3d)); console.log("Marker: "+i+", Camera heading: "+angle0+", Point azimuth: "+angle1+" , z_map: "+z_map+", z_x3d: "+z_x3d+", error^-1: "+(1/z_map-1/z_x3d));
......
...@@ -877,6 +877,7 @@ function leaf_drag_marker(){ ...@@ -877,6 +877,7 @@ function leaf_drag_marker(){
var p2_ll = Camera.draggedMarker._latlng; var p2_ll = Camera.draggedMarker._latlng;
leaf_update_x3dom_marker(p1_ll,p2_ll,index); leaf_update_x3dom_marker(p1_ll,p2_ll,index);
X3DOMObject.displayMarkInfo(index); X3DOMObject.displayMarkInfo(index);
} }
...@@ -902,9 +903,13 @@ function leaf_update_x3dom_marker(p1_ll,p2_ll,index){ ...@@ -902,9 +903,13 @@ function leaf_update_x3dom_marker(p1_ll,p2_ll,index){
var dp_w = x3dom_delta_map2scene(p1_ll,p2_ll); var dp_w = x3dom_delta_map2scene(p1_ll,p2_ll);
//update distance only
/*
mark.x = dp_w.x; mark.x = dp_w.x;
mark.y = dp_w.y; mark.y = dp_w.y;
mark.z = dp_w.z; mark.z = dp_w.z;
*/
if(!hecs){ if(!hecs){
mark.d_map = distance; mark.d_map = distance;
......
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