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
daf826e7
Commit
daf826e7
authored
Jun 10, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor
parent
30942f4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
22 deletions
+9
-22
x3dom_functions.js
js/x3dom_functions.js
+9
-22
No files found.
js/x3dom_functions.js
View file @
daf826e7
...
...
@@ -213,28 +213,20 @@ function x3dom_setUpRight(){
}
function
x3dom_rotation
(
delta_a
){
/*
* Printing values:
*
* var mat = Scene.element.runtime.viewMatrix().inverse();
* var rotation = new x3dom.fields.Quaternion(0, 0, 1, 0);
* rotation.setValue(mat);
* var translation = mat.e3();
*
*/
/*
* rotation by delta angle around camera's current Up vector
*/
function
x3dom_rotation
(
dangle
){
var
mat
=
Scene
.
element
.
runtime
.
viewMatrix
();
mat
=
mat
.
inverse
();
//console.log(mat.toString());
var
from
=
mat
.
e3
();
var
at
=
from
.
subtract
(
mat
.
e2
());
var
up
=
mat
.
e1
();
var
q0
=
x3dom
.
fields
.
Quaternion
.
axisAngle
(
up
,
-
d
elta_a
);
var
q0
=
x3dom
.
fields
.
Quaternion
.
axisAngle
(
up
,
-
d
angle
);
var
m0
=
q0
.
toMatrix
();
var
m1
=
x3dom
.
fields
.
SFMatrix4f
.
translation
(
from
);
...
...
@@ -250,26 +242,21 @@ function x3dom_rotation(delta_a){
}
// horizontal?
/*
* translate camera in x3dom space
*/
function
x3dom_translation
(
dx
,
dy
,
dz
){
var
delta
=
new
x3dom
.
fields
.
SFVec3f
(
dx
,
dy
,
dz
);
var
mat
=
Scene
.
element
.
runtime
.
viewMatrix
().
inverse
();
var
tr
=
mat
.
e3
();
var
from
=
mat
.
e3
();
var
at
=
from
.
subtract
(
mat
.
e2
());
//console.log(from.toString());
var
up
=
mat
.
e1
();
var
newfrom
=
from
.
add
(
delta
);
//console.log(newfrom.toString());
var
newat
=
newfrom
.
subtract
(
mat
.
e2
());
var
up
=
mat
.
e1
();
var
newmat
=
x3dom
.
fields
.
SFMatrix4f
.
lookAt
(
newfrom
,
newat
,
up
);
...
...
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