Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
x3domlet
Commits
ef6a5a1c
Commit
ef6a5a1c
authored
Sep 28, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed saving incorrect tilt
parent
da183e17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
58 deletions
+62
-58
ui_extra_models.js
js/ui_extra_models.js
+62
-58
No files found.
js/ui_extra_models.js
View file @
ef6a5a1c
...
@@ -231,7 +231,7 @@ function parse_load_extra_model(name,version,response){
...
@@ -231,7 +231,7 @@ function parse_load_extra_model(name,version,response){
longitude
:
longitude
,
longitude
:
longitude
,
altitude
:
altitude
,
altitude
:
altitude
,
heading
:
heading
,
heading
:
heading
,
tilt
:
tilt
,
tilt
:
tilt
+
90
,
roll
:
roll
,
roll
:
roll
,
name
:
$
(
response
).
find
(
"name"
).
text
(),
name
:
$
(
response
).
find
(
"name"
).
text
(),
description
:
$
(
response
).
find
(
"Camera"
).
find
(
"description"
).
text
(),
description
:
$
(
response
).
find
(
"Camera"
).
find
(
"description"
).
text
(),
...
@@ -359,7 +359,7 @@ function manualposor_refresh_content(){
...
@@ -359,7 +359,7 @@ function manualposor_refresh_content(){
// B.
// B.
//toMatrix
//toMatrix
console
.
log
(
tra_rot
);
//
console.log(tra_rot);
// tra_tra is local - convert to real world
// tra_tra is local - convert to real world
var
tra_tra
=
$
(
tra
).
attr
(
"translation"
).
split
(
","
);
var
tra_tra
=
$
(
tra
).
attr
(
"translation"
).
split
(
","
);
...
@@ -399,6 +399,12 @@ function manualposor_refresh_content(){
...
@@ -399,6 +399,12 @@ function manualposor_refresh_content(){
//unbind existing
//unbind existing
this
.
removeEventListener
(
"mousewheel"
,
false
);
this
.
removeEventListener
(
"mousewheel"
,
false
);
this
.
removeEventListener
(
"change"
,
false
);
this
.
onchange
=
function
(
event
){
manualposor_update
(
this
);
}
//bind new
//bind new
this
.
onmousewheel
=
function
(
event
){
this
.
onmousewheel
=
function
(
event
){
...
@@ -435,83 +441,81 @@ function manualposor_refresh_content(){
...
@@ -435,83 +441,81 @@ function manualposor_refresh_content(){
newval
=
tmpval
+
(
delta
>
0
?
speed
:
-
speed
);
newval
=
tmpval
+
(
delta
>
0
?
speed
:
-
speed
);
$
(
this
).
val
(
newval
.
toFixed
(
preci
));
$
(
this
).
val
(
newval
.
toFixed
(
preci
));
// move/rotate model
manualposor_update
(
this
);
var
tmp_pp
=
$
(
this
).
parent
().
parent
();
var
tmpname
=
tmp_pp
.
find
(
".mpr_name"
).
html
();
var
tmptransform
=
$
(
"inline[name=x3d_"
+
tmpname
+
"]"
).
parent
();
}
//get new coordinates
}
var
angle
=
0
;
});
var
distance
=
0
;
var
dp_rw
=
{
}
x
:
parseFloat
(
tmp_pp
.
find
(
".mpr_x"
).
val
()),
y
:
parseFloat
(
tmp_pp
.
find
(
".mpr_y"
).
val
()),
z
:
parseFloat
(
tmp_pp
.
find
(
".mpr_z"
).
val
())
};
distance
=
Math
.
sqrt
(
dp_rw
.
x
*
dp_rw
.
x
+
dp_rw
.
z
*
dp_rw
.
z
);
function
manualposor_update
(
elem
){
angle
=
180
/
Math
.
PI
*
Math
.
atan2
(
dp_rw
.
x
,
-
dp_rw
.
z
);
var
tmp_pp
=
$
(
elem
).
parent
().
parent
();
var
tmpname
=
tmp_pp
.
find
(
".mpr_name"
).
html
();
var
tmptransform
=
$
(
"inline[name=x3d_"
+
tmpname
+
"]"
).
parent
();
if
(
dp_rw
.
z
!=
0
){
var
dp_rw
=
{
angle
=
180
/
Math
.
PI
*
Math
.
atan2
(
dp_rw
.
x
,
-
dp_rw
.
z
);
x
:
parseFloat
(
tmp_pp
.
find
(
".mpr_x"
).
val
()),
}
y
:
parseFloat
(
tmp_pp
.
find
(
".mpr_y"
).
val
()),
z
:
parseFloat
(
tmp_pp
.
find
(
".mpr_z"
).
val
())
};
console
.
log
(
"Angle-Distance: "
+
angle
+
" "
+
distance
);
var
distance
=
Math
.
sqrt
(
dp_rw
.
x
*
dp_rw
.
x
+
dp_rw
.
z
*
dp_rw
.
z
);
var
angle
=
180
/
Math
.
PI
*
Math
.
atan2
(
dp_rw
.
x
,
-
dp_rw
.
z
);
var
dp_r
=
x3dom_real_to_scene
(
dp_rw
.
x
,
dp_rw
.
y
,
dp_rw
.
z
);
var
dp_r
=
x3dom_real_to_scene
(
dp_rw
.
x
,
dp_rw
.
y
,
dp_rw
.
z
);
var
new_tra
=
[
dp_r
.
x
,
dp_r
.
y
,
dp_r
.
z
].
join
(
","
);
var
new_tra
=
[
dp_r
.
x
,
dp_r
.
y
,
dp_r
.
z
].
join
(
","
);
var
heading
=
tmp_pp
.
find
(
".mpr_h"
).
val
()
*
Math
.
PI
/
180
;
var
heading
=
tmp_pp
.
find
(
".mpr_h"
).
val
()
*
Math
.
PI
/
180
;
var
tilt
=
tmp_pp
.
find
(
".mpr_t"
).
val
()
*
Math
.
PI
/
180
;
var
tilt
=
tmp_pp
.
find
(
".mpr_t"
).
val
()
*
Math
.
PI
/
180
;
var
roll
=
tmp_pp
.
find
(
".mpr_r"
).
val
()
*
Math
.
PI
/
180
;
var
roll
=
tmp_pp
.
find
(
".mpr_r"
).
val
()
*
Math
.
PI
/
180
;
// update object
var
heading
=
tmp_pp
.
find
(
".mpr_h"
).
val
()
*
Math
.
PI
/
180
;
var
initial_coordinates
=
[
Data
.
camera
.
latitude
,
Data
.
camera
.
longitude
];
var
tilt
=
tmp_pp
.
find
(
".mpr_t"
).
val
()
*
Math
.
PI
/
180
;
var
p0
=
new
L
.
LatLng
(
initial_coordinates
[
0
],
initial_coordinates
[
1
]);
//Camera._latlng;
var
roll
=
tmp_pp
.
find
(
".mpr_r"
).
val
()
*
Math
.
PI
/
180
;
var
p1
=
p0
.
CoordinatesOf
(
angle
,
distance
);
Data
.
extra_models
[
"x3d_"
+
tmpname
].
latitude
=
p1
.
lat
.
toFixed
(
8
);
// update object
Data
.
extra_models
[
"x3d_"
+
tmpname
].
longitude
=
p1
.
lng
.
toFixed
(
8
);
var
initial_coordinates
=
[
Data
.
camera
.
latitude
,
Data
.
camera
.
longitude
];
var
p0
=
new
L
.
LatLng
(
initial_coordinates
[
0
],
initial_coordinates
[
1
]);
//Camera._latlng;
var
p1
=
p0
.
CoordinatesOf
(
angle
,
distance
);
Data
.
extra_models
[
"x3d_"
+
tmpname
].
heading
=
(
parseFloat
(
tmp_pp
.
find
(
".mpr_h"
).
val
())
+
360
)
%
360
;
if
(
tmpname
!=
SETTINGS
.
path
){
Data
.
extra_models
[
"x3d_"
+
tmpname
].
tilt
=
parseFloat
(
tmp_pp
.
find
(
".mpr_t"
).
val
())
+
90
;
Data
.
extra_models
[
"x3d_"
+
tmpname
].
roll
=
tmp_pp
.
find
(
".mpr_r"
).
val
();
// Heading,Tilt,Roll
Data
.
extra_models
[
"x3d_"
+
tmpname
].
latitude
=
p1
.
lat
.
toFixed
(
8
);
var
Mh
=
x3dom
.
fields
.
SFMatrix4f
.
rotationZ
(
heading
);
Data
.
extra_models
[
"x3d_"
+
tmpname
].
longitude
=
p1
.
lng
.
toFixed
(
8
);
var
Mt
=
x3dom
.
fields
.
SFMatrix4f
.
rotationY
(
tilt
);
var
Mr
=
x3dom
.
fields
.
SFMatrix4f
.
rotationX
(
roll
);
// proper Euler rotation
Data
.
extra_models
[
"x3d_"
+
tmpname
].
heading
=
(
parseFloat
(
tmp_pp
.
find
(
".mpr_h"
).
val
())
+
360
)
%
360
;
var
R
=
Mh
.
mult
(
Mt
).
mult
(
Mr
);
Data
.
extra_models
[
"x3d_"
+
tmpname
].
tilt
=
parseFloat
(
tmp_pp
.
find
(
".mpr_t"
).
val
())
+
90
;
//var R = Mr.mult(Mt).mult(Mh);
Data
.
extra_models
[
"x3d_"
+
tmpname
].
roll
=
tmp_pp
.
find
(
".mpr_r"
).
val
();
// convert to proper Euler
var
T
=
x3dom_toYawPitchRoll
();
var
R1
=
T
.
inverse
().
mult
(
R
).
mult
(
T
);
}
var
R0
=
Data
.
camera
.
Matrices
.
R0
;
// Heading,Tilt,Roll
var
Mh
=
x3dom
.
fields
.
SFMatrix4f
.
rotationZ
(
heading
);
var
Mt
=
x3dom
.
fields
.
SFMatrix4f
.
rotationY
(
tilt
);
var
Mr
=
x3dom
.
fields
.
SFMatrix4f
.
rotationX
(
roll
);
var
R_diff
=
R1
.
mult
(
R0
.
inverse
());
// proper Euler rotation
//var R_diff = R1;
var
R
=
Mh
.
mult
(
Mt
).
mult
(
Mr
);
//var R = Mr.mult(Mt).mult(Mh);
// convert to proper Euler
var
T
=
x3dom_toYawPitchRoll
();
var
Q
=
new
x3dom
.
fields
.
Quaternion
(
0
,
0
,
1
,
0
);
var
R1
=
T
.
inverse
().
mult
(
R
).
mult
(
T
);
Q
.
setValue
(
R_diff
);
var
R0
=
Data
.
camera
.
Matrices
.
R0
;
var
AA
=
Q
.
toAxisAngle
();
var
new_rot
=
AA
[
0
].
toString
()
+
" "
+
AA
[
1
];
tmptransform
.
attr
(
"rotation"
,
new_rot
);
var
R_diff
=
R1
.
mult
(
R0
.
inverse
()
);
tmptransform
.
attr
(
"translation"
,
new_tra
)
;
//var R_diff = R1
;
}
var
Q
=
new
x3dom
.
fields
.
Quaternion
(
0
,
0
,
1
,
0
);
Q
.
setValue
(
R_diff
);
var
AA
=
Q
.
toAxisAngle
();
var
new_rot
=
AA
[
0
].
toString
()
+
" "
+
AA
[
1
];
}
tmptransform
.
attr
(
"rotation"
,
new_rot
);
}
);
tmptransform
.
attr
(
"translation"
,
new_tra
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment