Commit 6796bdda authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

approx tilt and altitude by 2 points

parent f029bffd
...@@ -263,3 +263,48 @@ function art_w_i(i,v){ ...@@ -263,3 +263,48 @@ function art_w_i(i,v){
return 1; return 1;
//return 1/art_l_i(i); //return 1/art_l_i(i);
} }
/**
* Functions for relative altitude, tilt and roll
* art2_...
*/
function art2_f_3d_i(i,v){
return art_f_3d_i(i,[v[0],0,v[1]]);
}
function art2_f_map_i(i,v){
return art_f_map_i(i,[v[0],0,v[1]]);
}
function art2_r_i(i,v){
var f1 = art2_f_3d_i(i,v);
var f2 = art2_f_map_i(i,v);
//return (f1-f2+360)%360;
return (f1-f2);
}
function art2_dr_dx_i(i,v){
return art_dr_dx_i(i,[v[0],0,v[1]]);
}
function art2_dr_da_i(i,v){
return 1;
}
function art2_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(Math.pow(xi,2)+Math.pow(yi,2)+Math.pow(zi,2));
}
function art2_w_i(i,v){
return 1;
//return 1/art_l_i(i);
}
...@@ -263,17 +263,29 @@ function distance_error(x,y,h){ ...@@ -263,17 +263,29 @@ function distance_error(x,y,h){
*/ */
function x3dom_align_art(){ function x3dom_align_art(){
var epsilon = 1e-8;
//test_height_alignment_set1(); //test_height_alignment_set1();
//test_height_alignment_set2(); //test_height_alignment_set2();
//test_height_alignment_set3_2points();
if (Data.markers.length<2){ if (Data.markers.length<2){
console.log("Too few points"); console.log("Too few points");
return; return;
} }
var epsilon = 1e-8; if (Data.markers.length==2){
var result = numbers.calculus.GaussNewton([0,0,0],Data.markers.length,art_r_i,[art_dr_dx_i,art_dr_dy_i,art_dr_da_i],epsilon,art_w_i);
console.log("2 Markers provided: align Height'n'Tilt only (while Roll = 0)");
var result = numbers.calculus.GaussNewton([0,0],Data.markers.length,art2_r_i,[art2_dr_dx_i,art2_dr_da_i],epsilon,art2_w_i);
console.log(result);
return;
}
var result = numbers.calculus.GaussNewton([0,0,0],Data.markers.length,art_r_i,[art_dr_dx_i,art_dr_dy_i,art_dr_da_i],epsilon,art_w_i);
console.log(result); console.log(result);
} }
...@@ -413,7 +425,39 @@ function test_height_alignment_set2(){ ...@@ -413,7 +425,39 @@ function test_height_alignment_set2(){
} }
function test_height_alignment_set3_2points(){
Data.markers = [
// mark 1
{
d_map:59.51564928339807,
d_x3d:58.313592803937226,
align:{
altitude: -10.5,
latitude: 40.723442371919724,
longitude: -111.93217635154726,
x: 23.459612763633526,
y: -16.16174219091789,
z: -53.38653083581816
}
},
// mark 2
{
d_map:190.2700432380853,
d_x3d:182.86147956244875,
align:{
altitude: -10.5,
latitude: 40.72385908620143,
longitude: -111.93070113658906,
x: 37.888760344786206,
y: -21.838175845671834,
z: -178.89315958779198
}
}
];
}
......
...@@ -74,15 +74,23 @@ ...@@ -74,15 +74,23 @@
<div id='help_button'>?</div> <div id='help_button'>?</div>
<div id='download_button' title='Download 3d model (.obj & .x3d formats)'></div> <div id='download_button' title='Download 3d model (.obj & .x3d formats)'></div>
<div id='menu_button'></div> <div id='menu_button'></div>
<div id='align_button' title='Run alignment algorithm for camera heading and location using markers. <div id='align_button' title='Run least squares fit algorithm (Gauss-Newton) for camera heading and location using markers.
Instructions: Instructions:
1. Use approximate location control on the map to change initial approximation for the algorithm. 1. Use approximate location control on the map to change initial approximation for the algorithm.
2. Place at least 3 markers on the 3D model (ctrl+click) - drag to position more precisely. 2. Place at least 3 markers in the 3D scene (ctrl+click) - drag to position more precisely.
3. Move all markers on the map to update their location - drag to position more precisely. 3. Move all markers on the map to update their location - drag to position more precisely.
4. Click this button - the results will appear in a dialog window with "apply"/"cancel" 4. Click this button - the results will appear in a dialog window with "apply"/"cancel"
5. To save the result click upload button (Initial location and heading) in the menu.' class='edit'></div> 5. To save the result click upload button (Initial location and heading) in the menu.' class='edit'></div>
<!--<div id='align_tr_button' title='Align tilt and roll' class='edit'></div>--> <!--<div id='align_tr_button' title='Align tilt and roll' class='edit'></div>-->
<div id='align_tr_button' title='Align tilt and roll' class='experimental'></div> <div id='align_tr_button' title='Run least squares fit algorithm (Gauss-Newton) for camera tilt, roll and altitude (relative).
Instructions:
1. Place markers in the 3D scene (ctrl+click) - drag to position more precisely.
* 2 markers - adjust tilt and altitude, while roll = 0&deg;
* 3+ markers - adjust tilt, roll and altitude
2. Move all markers on the map to update their location - drag to position more precisely.
3. Turn on "Switch and Elevation control mode" for the map, drag markers over map to set approximate altitude relative to the camera.
4. Click this button - the results will appear in the browser console. Look for "v"-vector data.
' class='experimental'></div>
</div> </div>
<div id='info-wrapper'> <div id='info-wrapper'>
......
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