tricodex
commited on
Commit
•
d0d4987
1
Parent(s):
705eb03
git
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- learning_machines_robobo/.gitignore → .gitignore +188 -188
- README.md +3 -3
- learning_machines_robobo/environment.yml → environment.yml +0 -0
- learning_machines_robobo/.gitattributes +2 -2
- learning_machines_robobo/LICENSE +674 -674
- learning_machines_robobo/README.md +25 -25
- learning_machines_robobo/examples/README.md +61 -61
- learning_machines_robobo/examples/coppelia_sim_tutorial/README.md +139 -139
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/.stylua.toml +10 -10
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/arena/base.lua +24 -24
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/arena/food.lua +121 -121
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/arena/food_random.lua +208 -208
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/back_l.lua +73 -73
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/force_snsort_slicer.lua +8 -8
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/ir_back_c.lua +838 -838
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/left_motor.lua +269 -269
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/phone_holder/pan_motor.lua +70 -70
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/phone_holder/screen.lua +27 -27
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/phone_holder/smartphone.lua +31 -31
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/phone_holder/tilt_motor.lua +72 -72
- learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/right_motor.lua +14 -14
- learning_machines_robobo/examples/coppelia_sim_tutorial/requirements.txt +3 -3
- learning_machines_robobo/examples/coppelia_sim_tutorial/scripts/start_coppelia_sim.ps1 +16 -16
- learning_machines_robobo/examples/coppelia_sim_tutorial/scripts/start_coppelia_sim.sh +9 -9
- learning_machines_robobo/examples/coppelia_sim_tutorial/scripts/start_coppelia_sim.zsh +9 -9
- learning_machines_robobo/examples/docker_tutorial/README.md +284 -284
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/cbor-js/cbor.js +0 -416
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/check-version.py +0 -27
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/coppelia-ws-remote-api/RemoteAPIClient.js +0 -63
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/coppelia-ws-remote-api/WebSocketAsPromised.bundle.js +0 -2515
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/dat-gui/dat.gui.js +0 -2538
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/dat-gui/dat.gui.js.map +0 -0
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/font-awesome/all.min.css +0 -5
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/font-awesome/all.min.js +0 -0
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/jquery/jquery-3.6.0.min.js +0 -2
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/json5/json5.min.js +0 -1
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/reconnecting-websocket/reconnecting-websocket.min.js +0 -1
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/renderjson/renderjson.js +0 -216
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/controls/OrbitControls.js +0 -1079
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/controls/TransformControls.js +0 -1383
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/postprocessing/EffectComposer.js +0 -284
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/postprocessing/OutlinePass.js +0 -596
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/postprocessing/RenderPass.js +0 -74
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/postprocessing/ShaderPass.js +0 -63
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/shaders/CopyShader.js +0 -47
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/three.js +0 -0
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/utils/SceneUtils.js +0 -60
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/OpenMeshCore.dll +0 -0
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/OpenMeshTools.dll +0 -0
- learning_machines_robobo/examples/full_project_setup/CoppeliaSim/Qt53DCore.dll +0 -0
learning_machines_robobo/.gitignore → .gitignore
RENAMED
@@ -1,188 +1,188 @@
|
|
1 |
-
devel/
|
2 |
-
logs/
|
3 |
-
build/
|
4 |
-
bin/
|
5 |
-
lib/
|
6 |
-
msg_gen/
|
7 |
-
srv_gen/
|
8 |
-
msg/*Action.msg
|
9 |
-
msg/*ActionFeedback.msg
|
10 |
-
msg/*ActionGoal.msg
|
11 |
-
msg/*ActionResult.msg
|
12 |
-
msg/*Feedback.msg
|
13 |
-
msg/*Goal.msg
|
14 |
-
msg/*Result.msg
|
15 |
-
msg/_*.py
|
16 |
-
build_isolated/
|
17 |
-
devel_isolated/
|
18 |
-
results/
|
19 |
-
|
20 |
-
# Generated by dynamic reconfigure
|
21 |
-
*.cfgc
|
22 |
-
/cfg/cpp/
|
23 |
-
/cfg/*.py
|
24 |
-
|
25 |
-
# Ignore generated docs
|
26 |
-
*.dox
|
27 |
-
*.wikidoc
|
28 |
-
|
29 |
-
# eclipse stuff
|
30 |
-
.project
|
31 |
-
.cproject
|
32 |
-
|
33 |
-
# qcreator stuff
|
34 |
-
CMakeLists.txt.user
|
35 |
-
|
36 |
-
srv/_*.py
|
37 |
-
*.pcd
|
38 |
-
*.pyc
|
39 |
-
qtcreator-*
|
40 |
-
*.user
|
41 |
-
|
42 |
-
/planning/cfg
|
43 |
-
/planning/docs
|
44 |
-
/planning/src
|
45 |
-
|
46 |
-
*~
|
47 |
-
|
48 |
-
# Emacs
|
49 |
-
.#*
|
50 |
-
|
51 |
-
# Catkin custom files
|
52 |
-
CATKIN_IGNORE
|
53 |
-
|
54 |
-
# Byte-compiled / optimized / DLL files
|
55 |
-
__pycache__/
|
56 |
-
*.py[cod]
|
57 |
-
*$py.class
|
58 |
-
|
59 |
-
# Distribution / packaging
|
60 |
-
.Python
|
61 |
-
build/
|
62 |
-
develop-eggs/
|
63 |
-
dist/
|
64 |
-
downloads/
|
65 |
-
eggs/
|
66 |
-
.eggs/
|
67 |
-
lib/
|
68 |
-
lib64/
|
69 |
-
parts/
|
70 |
-
sdist/
|
71 |
-
var/
|
72 |
-
wheels/
|
73 |
-
pip-wheel-metadata/
|
74 |
-
share/python-wheels/
|
75 |
-
*.egg-info/
|
76 |
-
.installed.cfg
|
77 |
-
*.egg
|
78 |
-
MANIFEST
|
79 |
-
.idea
|
80 |
-
|
81 |
-
# PyInstaller
|
82 |
-
# Usually these files are written by a python script from a template
|
83 |
-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
84 |
-
*.manifest
|
85 |
-
*.spec
|
86 |
-
|
87 |
-
# Installer logs
|
88 |
-
pip-log.txt
|
89 |
-
pip-delete-this-directory.txt
|
90 |
-
|
91 |
-
# Unit test / coverage reports
|
92 |
-
htmlcov/
|
93 |
-
.tox/
|
94 |
-
.nox/
|
95 |
-
.coverage
|
96 |
-
.coverage.*
|
97 |
-
.cache
|
98 |
-
nosetests.xml
|
99 |
-
coverage.xml
|
100 |
-
*.cover
|
101 |
-
*.py,cover
|
102 |
-
.hypothesis/
|
103 |
-
.pytest_cache/
|
104 |
-
|
105 |
-
# Translations
|
106 |
-
*.mo
|
107 |
-
*.pot
|
108 |
-
|
109 |
-
# Django stuff:
|
110 |
-
*.log
|
111 |
-
local_settings.py
|
112 |
-
db.sqlite3
|
113 |
-
db.sqlite3-journal
|
114 |
-
|
115 |
-
# Flask stuff:
|
116 |
-
instance/
|
117 |
-
.webassets-cache
|
118 |
-
|
119 |
-
# Scrapy stuff:
|
120 |
-
.scrapy
|
121 |
-
|
122 |
-
# Sphinx documentation
|
123 |
-
docs/_build/
|
124 |
-
|
125 |
-
# PyBuilder
|
126 |
-
target/
|
127 |
-
|
128 |
-
# Jupyter Notebook
|
129 |
-
.ipynb_checkpoints
|
130 |
-
|
131 |
-
# IPython
|
132 |
-
profile_default/
|
133 |
-
ipython_config.py
|
134 |
-
|
135 |
-
# pyenv
|
136 |
-
.python-version
|
137 |
-
|
138 |
-
# pipenv
|
139 |
-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
140 |
-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
141 |
-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
142 |
-
# install all needed dependencies.
|
143 |
-
#Pipfile.lock
|
144 |
-
|
145 |
-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
146 |
-
__pypackages__/
|
147 |
-
|
148 |
-
# Celery stuff
|
149 |
-
celerybeat-schedule
|
150 |
-
celerybeat.pid
|
151 |
-
|
152 |
-
# SageMath parsed files
|
153 |
-
*.sage.py
|
154 |
-
|
155 |
-
# Environments
|
156 |
-
.env
|
157 |
-
.venv
|
158 |
-
env/
|
159 |
-
venv/
|
160 |
-
ENV/
|
161 |
-
env.bak/
|
162 |
-
venv.bak/
|
163 |
-
|
164 |
-
# Spyder project settings
|
165 |
-
.spyderproject
|
166 |
-
.spyproject
|
167 |
-
|
168 |
-
# Rope project settings
|
169 |
-
.ropeproject
|
170 |
-
|
171 |
-
# mkdocs documentation
|
172 |
-
/site
|
173 |
-
|
174 |
-
# mypy
|
175 |
-
.mypy_cache/
|
176 |
-
.dmypy.json
|
177 |
-
dmypy.json
|
178 |
-
|
179 |
-
# Pyre type checker
|
180 |
-
.pyre/
|
181 |
-
|
182 |
-
# Where we are installing CoppeliaSim
|
183 |
-
CoppeliaSim/
|
184 |
-
coppeliaSim.app/
|
185 |
-
CoppeliaSim.tar.xz
|
186 |
-
|
187 |
-
# macOS stuff
|
188 |
-
.DS_Store
|
|
|
1 |
+
devel/
|
2 |
+
logs/
|
3 |
+
build/
|
4 |
+
bin/
|
5 |
+
lib/
|
6 |
+
msg_gen/
|
7 |
+
srv_gen/
|
8 |
+
msg/*Action.msg
|
9 |
+
msg/*ActionFeedback.msg
|
10 |
+
msg/*ActionGoal.msg
|
11 |
+
msg/*ActionResult.msg
|
12 |
+
msg/*Feedback.msg
|
13 |
+
msg/*Goal.msg
|
14 |
+
msg/*Result.msg
|
15 |
+
msg/_*.py
|
16 |
+
build_isolated/
|
17 |
+
devel_isolated/
|
18 |
+
results/
|
19 |
+
|
20 |
+
# Generated by dynamic reconfigure
|
21 |
+
*.cfgc
|
22 |
+
/cfg/cpp/
|
23 |
+
/cfg/*.py
|
24 |
+
|
25 |
+
# Ignore generated docs
|
26 |
+
*.dox
|
27 |
+
*.wikidoc
|
28 |
+
|
29 |
+
# eclipse stuff
|
30 |
+
.project
|
31 |
+
.cproject
|
32 |
+
|
33 |
+
# qcreator stuff
|
34 |
+
CMakeLists.txt.user
|
35 |
+
|
36 |
+
srv/_*.py
|
37 |
+
*.pcd
|
38 |
+
*.pyc
|
39 |
+
qtcreator-*
|
40 |
+
*.user
|
41 |
+
|
42 |
+
/planning/cfg
|
43 |
+
/planning/docs
|
44 |
+
/planning/src
|
45 |
+
|
46 |
+
*~
|
47 |
+
|
48 |
+
# Emacs
|
49 |
+
.#*
|
50 |
+
|
51 |
+
# Catkin custom files
|
52 |
+
CATKIN_IGNORE
|
53 |
+
|
54 |
+
# Byte-compiled / optimized / DLL files
|
55 |
+
__pycache__/
|
56 |
+
*.py[cod]
|
57 |
+
*$py.class
|
58 |
+
|
59 |
+
# Distribution / packaging
|
60 |
+
.Python
|
61 |
+
build/
|
62 |
+
develop-eggs/
|
63 |
+
dist/
|
64 |
+
downloads/
|
65 |
+
eggs/
|
66 |
+
.eggs/
|
67 |
+
lib/
|
68 |
+
lib64/
|
69 |
+
parts/
|
70 |
+
sdist/
|
71 |
+
var/
|
72 |
+
wheels/
|
73 |
+
pip-wheel-metadata/
|
74 |
+
share/python-wheels/
|
75 |
+
*.egg-info/
|
76 |
+
.installed.cfg
|
77 |
+
*.egg
|
78 |
+
MANIFEST
|
79 |
+
.idea
|
80 |
+
|
81 |
+
# PyInstaller
|
82 |
+
# Usually these files are written by a python script from a template
|
83 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
84 |
+
*.manifest
|
85 |
+
*.spec
|
86 |
+
|
87 |
+
# Installer logs
|
88 |
+
pip-log.txt
|
89 |
+
pip-delete-this-directory.txt
|
90 |
+
|
91 |
+
# Unit test / coverage reports
|
92 |
+
htmlcov/
|
93 |
+
.tox/
|
94 |
+
.nox/
|
95 |
+
.coverage
|
96 |
+
.coverage.*
|
97 |
+
.cache
|
98 |
+
nosetests.xml
|
99 |
+
coverage.xml
|
100 |
+
*.cover
|
101 |
+
*.py,cover
|
102 |
+
.hypothesis/
|
103 |
+
.pytest_cache/
|
104 |
+
|
105 |
+
# Translations
|
106 |
+
*.mo
|
107 |
+
*.pot
|
108 |
+
|
109 |
+
# Django stuff:
|
110 |
+
*.log
|
111 |
+
local_settings.py
|
112 |
+
db.sqlite3
|
113 |
+
db.sqlite3-journal
|
114 |
+
|
115 |
+
# Flask stuff:
|
116 |
+
instance/
|
117 |
+
.webassets-cache
|
118 |
+
|
119 |
+
# Scrapy stuff:
|
120 |
+
.scrapy
|
121 |
+
|
122 |
+
# Sphinx documentation
|
123 |
+
docs/_build/
|
124 |
+
|
125 |
+
# PyBuilder
|
126 |
+
target/
|
127 |
+
|
128 |
+
# Jupyter Notebook
|
129 |
+
.ipynb_checkpoints
|
130 |
+
|
131 |
+
# IPython
|
132 |
+
profile_default/
|
133 |
+
ipython_config.py
|
134 |
+
|
135 |
+
# pyenv
|
136 |
+
.python-version
|
137 |
+
|
138 |
+
# pipenv
|
139 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
140 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
141 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
142 |
+
# install all needed dependencies.
|
143 |
+
#Pipfile.lock
|
144 |
+
|
145 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
146 |
+
__pypackages__/
|
147 |
+
|
148 |
+
# Celery stuff
|
149 |
+
celerybeat-schedule
|
150 |
+
celerybeat.pid
|
151 |
+
|
152 |
+
# SageMath parsed files
|
153 |
+
*.sage.py
|
154 |
+
|
155 |
+
# Environments
|
156 |
+
.env
|
157 |
+
.venv
|
158 |
+
env/
|
159 |
+
venv/
|
160 |
+
ENV/
|
161 |
+
env.bak/
|
162 |
+
venv.bak/
|
163 |
+
|
164 |
+
# Spyder project settings
|
165 |
+
.spyderproject
|
166 |
+
.spyproject
|
167 |
+
|
168 |
+
# Rope project settings
|
169 |
+
.ropeproject
|
170 |
+
|
171 |
+
# mkdocs documentation
|
172 |
+
/site
|
173 |
+
|
174 |
+
# mypy
|
175 |
+
.mypy_cache/
|
176 |
+
.dmypy.json
|
177 |
+
dmypy.json
|
178 |
+
|
179 |
+
# Pyre type checker
|
180 |
+
.pyre/
|
181 |
+
|
182 |
+
# Where we are installing CoppeliaSim
|
183 |
+
CoppeliaSim/
|
184 |
+
coppeliaSim.app/
|
185 |
+
CoppeliaSim.tar.xz
|
186 |
+
|
187 |
+
# macOS stuff
|
188 |
+
.DS_Store
|
README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
---
|
2 |
-
license: gpl-3.0
|
3 |
-
---
|
|
|
1 |
+
---
|
2 |
+
license: gpl-3.0
|
3 |
+
---
|
learning_machines_robobo/environment.yml → environment.yml
RENAMED
File without changes
|
learning_machines_robobo/.gitattributes
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
examples/** linguist-generated
|
2 |
-
**/*.md linguist-documentation
|
|
|
1 |
+
examples/** linguist-generated
|
2 |
+
**/*.md linguist-documentation
|
learning_machines_robobo/LICENSE
CHANGED
@@ -1,674 +1,674 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 3, 29 June 2007
|
3 |
-
|
4 |
-
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
-
Everyone is permitted to copy and distribute verbatim copies
|
6 |
-
of this license document, but changing it is not allowed.
|
7 |
-
|
8 |
-
Preamble
|
9 |
-
|
10 |
-
The GNU General Public License is a free, copyleft license for
|
11 |
-
software and other kinds of works.
|
12 |
-
|
13 |
-
The licenses for most software and other practical works are designed
|
14 |
-
to take away your freedom to share and change the works. By contrast,
|
15 |
-
the GNU General Public License is intended to guarantee your freedom to
|
16 |
-
share and change all versions of a program--to make sure it remains free
|
17 |
-
software for all its users. We, the Free Software Foundation, use the
|
18 |
-
GNU General Public License for most of our software; it applies also to
|
19 |
-
any other work released this way by its authors. You can apply it to
|
20 |
-
your programs, too.
|
21 |
-
|
22 |
-
When we speak of free software, we are referring to freedom, not
|
23 |
-
price. Our General Public Licenses are designed to make sure that you
|
24 |
-
have the freedom to distribute copies of free software (and charge for
|
25 |
-
them if you wish), that you receive source code or can get it if you
|
26 |
-
want it, that you can change the software or use pieces of it in new
|
27 |
-
free programs, and that you know you can do these things.
|
28 |
-
|
29 |
-
To protect your rights, we need to prevent others from denying you
|
30 |
-
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
-
certain responsibilities if you distribute copies of the software, or if
|
32 |
-
you modify it: responsibilities to respect the freedom of others.
|
33 |
-
|
34 |
-
For example, if you distribute copies of such a program, whether
|
35 |
-
gratis or for a fee, you must pass on to the recipients the same
|
36 |
-
freedoms that you received. You must make sure that they, too, receive
|
37 |
-
or can get the source code. And you must show them these terms so they
|
38 |
-
know their rights.
|
39 |
-
|
40 |
-
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
-
(1) assert copyright on the software, and (2) offer you this License
|
42 |
-
giving you legal permission to copy, distribute and/or modify it.
|
43 |
-
|
44 |
-
For the developers' and authors' protection, the GPL clearly explains
|
45 |
-
that there is no warranty for this free software. For both users' and
|
46 |
-
authors' sake, the GPL requires that modified versions be marked as
|
47 |
-
changed, so that their problems will not be attributed erroneously to
|
48 |
-
authors of previous versions.
|
49 |
-
|
50 |
-
Some devices are designed to deny users access to install or run
|
51 |
-
modified versions of the software inside them, although the manufacturer
|
52 |
-
can do so. This is fundamentally incompatible with the aim of
|
53 |
-
protecting users' freedom to change the software. The systematic
|
54 |
-
pattern of such abuse occurs in the area of products for individuals to
|
55 |
-
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
-
have designed this version of the GPL to prohibit the practice for those
|
57 |
-
products. If such problems arise substantially in other domains, we
|
58 |
-
stand ready to extend this provision to those domains in future versions
|
59 |
-
of the GPL, as needed to protect the freedom of users.
|
60 |
-
|
61 |
-
Finally, every program is threatened constantly by software patents.
|
62 |
-
States should not allow patents to restrict development and use of
|
63 |
-
software on general-purpose computers, but in those that do, we wish to
|
64 |
-
avoid the special danger that patents applied to a free program could
|
65 |
-
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
-
patents cannot be used to render the program non-free.
|
67 |
-
|
68 |
-
The precise terms and conditions for copying, distribution and
|
69 |
-
modification follow.
|
70 |
-
|
71 |
-
TERMS AND CONDITIONS
|
72 |
-
|
73 |
-
0. Definitions.
|
74 |
-
|
75 |
-
"This License" refers to version 3 of the GNU General Public License.
|
76 |
-
|
77 |
-
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
-
works, such as semiconductor masks.
|
79 |
-
|
80 |
-
"The Program" refers to any copyrightable work licensed under this
|
81 |
-
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
-
"recipients" may be individuals or organizations.
|
83 |
-
|
84 |
-
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
-
in a fashion requiring copyright permission, other than the making of an
|
86 |
-
exact copy. The resulting work is called a "modified version" of the
|
87 |
-
earlier work or a work "based on" the earlier work.
|
88 |
-
|
89 |
-
A "covered work" means either the unmodified Program or a work based
|
90 |
-
on the Program.
|
91 |
-
|
92 |
-
To "propagate" a work means to do anything with it that, without
|
93 |
-
permission, would make you directly or secondarily liable for
|
94 |
-
infringement under applicable copyright law, except executing it on a
|
95 |
-
computer or modifying a private copy. Propagation includes copying,
|
96 |
-
distribution (with or without modification), making available to the
|
97 |
-
public, and in some countries other activities as well.
|
98 |
-
|
99 |
-
To "convey" a work means any kind of propagation that enables other
|
100 |
-
parties to make or receive copies. Mere interaction with a user through
|
101 |
-
a computer network, with no transfer of a copy, is not conveying.
|
102 |
-
|
103 |
-
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
-
to the extent that it includes a convenient and prominently visible
|
105 |
-
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
-
tells the user that there is no warranty for the work (except to the
|
107 |
-
extent that warranties are provided), that licensees may convey the
|
108 |
-
work under this License, and how to view a copy of this License. If
|
109 |
-
the interface presents a list of user commands or options, such as a
|
110 |
-
menu, a prominent item in the list meets this criterion.
|
111 |
-
|
112 |
-
1. Source Code.
|
113 |
-
|
114 |
-
The "source code" for a work means the preferred form of the work
|
115 |
-
for making modifications to it. "Object code" means any non-source
|
116 |
-
form of a work.
|
117 |
-
|
118 |
-
A "Standard Interface" means an interface that either is an official
|
119 |
-
standard defined by a recognized standards body, or, in the case of
|
120 |
-
interfaces specified for a particular programming language, one that
|
121 |
-
is widely used among developers working in that language.
|
122 |
-
|
123 |
-
The "System Libraries" of an executable work include anything, other
|
124 |
-
than the work as a whole, that (a) is included in the normal form of
|
125 |
-
packaging a Major Component, but which is not part of that Major
|
126 |
-
Component, and (b) serves only to enable use of the work with that
|
127 |
-
Major Component, or to implement a Standard Interface for which an
|
128 |
-
implementation is available to the public in source code form. A
|
129 |
-
"Major Component", in this context, means a major essential component
|
130 |
-
(kernel, window system, and so on) of the specific operating system
|
131 |
-
(if any) on which the executable work runs, or a compiler used to
|
132 |
-
produce the work, or an object code interpreter used to run it.
|
133 |
-
|
134 |
-
The "Corresponding Source" for a work in object code form means all
|
135 |
-
the source code needed to generate, install, and (for an executable
|
136 |
-
work) run the object code and to modify the work, including scripts to
|
137 |
-
control those activities. However, it does not include the work's
|
138 |
-
System Libraries, or general-purpose tools or generally available free
|
139 |
-
programs which are used unmodified in performing those activities but
|
140 |
-
which are not part of the work. For example, Corresponding Source
|
141 |
-
includes interface definition files associated with source files for
|
142 |
-
the work, and the source code for shared libraries and dynamically
|
143 |
-
linked subprograms that the work is specifically designed to require,
|
144 |
-
such as by intimate data communication or control flow between those
|
145 |
-
subprograms and other parts of the work.
|
146 |
-
|
147 |
-
The Corresponding Source need not include anything that users
|
148 |
-
can regenerate automatically from other parts of the Corresponding
|
149 |
-
Source.
|
150 |
-
|
151 |
-
The Corresponding Source for a work in source code form is that
|
152 |
-
same work.
|
153 |
-
|
154 |
-
2. Basic Permissions.
|
155 |
-
|
156 |
-
All rights granted under this License are granted for the term of
|
157 |
-
copyright on the Program, and are irrevocable provided the stated
|
158 |
-
conditions are met. This License explicitly affirms your unlimited
|
159 |
-
permission to run the unmodified Program. The output from running a
|
160 |
-
covered work is covered by this License only if the output, given its
|
161 |
-
content, constitutes a covered work. This License acknowledges your
|
162 |
-
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
-
|
164 |
-
You may make, run and propagate covered works that you do not
|
165 |
-
convey, without conditions so long as your license otherwise remains
|
166 |
-
in force. You may convey covered works to others for the sole purpose
|
167 |
-
of having them make modifications exclusively for you, or provide you
|
168 |
-
with facilities for running those works, provided that you comply with
|
169 |
-
the terms of this License in conveying all material for which you do
|
170 |
-
not control copyright. Those thus making or running the covered works
|
171 |
-
for you must do so exclusively on your behalf, under your direction
|
172 |
-
and control, on terms that prohibit them from making any copies of
|
173 |
-
your copyrighted material outside their relationship with you.
|
174 |
-
|
175 |
-
Conveying under any other circumstances is permitted solely under
|
176 |
-
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
-
makes it unnecessary.
|
178 |
-
|
179 |
-
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
-
|
181 |
-
No covered work shall be deemed part of an effective technological
|
182 |
-
measure under any applicable law fulfilling obligations under article
|
183 |
-
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
-
similar laws prohibiting or restricting circumvention of such
|
185 |
-
measures.
|
186 |
-
|
187 |
-
When you convey a covered work, you waive any legal power to forbid
|
188 |
-
circumvention of technological measures to the extent such circumvention
|
189 |
-
is effected by exercising rights under this License with respect to
|
190 |
-
the covered work, and you disclaim any intention to limit operation or
|
191 |
-
modification of the work as a means of enforcing, against the work's
|
192 |
-
users, your or third parties' legal rights to forbid circumvention of
|
193 |
-
technological measures.
|
194 |
-
|
195 |
-
4. Conveying Verbatim Copies.
|
196 |
-
|
197 |
-
You may convey verbatim copies of the Program's source code as you
|
198 |
-
receive it, in any medium, provided that you conspicuously and
|
199 |
-
appropriately publish on each copy an appropriate copyright notice;
|
200 |
-
keep intact all notices stating that this License and any
|
201 |
-
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
-
keep intact all notices of the absence of any warranty; and give all
|
203 |
-
recipients a copy of this License along with the Program.
|
204 |
-
|
205 |
-
You may charge any price or no price for each copy that you convey,
|
206 |
-
and you may offer support or warranty protection for a fee.
|
207 |
-
|
208 |
-
5. Conveying Modified Source Versions.
|
209 |
-
|
210 |
-
You may convey a work based on the Program, or the modifications to
|
211 |
-
produce it from the Program, in the form of source code under the
|
212 |
-
terms of section 4, provided that you also meet all of these conditions:
|
213 |
-
|
214 |
-
a) The work must carry prominent notices stating that you modified
|
215 |
-
it, and giving a relevant date.
|
216 |
-
|
217 |
-
b) The work must carry prominent notices stating that it is
|
218 |
-
released under this License and any conditions added under section
|
219 |
-
7. This requirement modifies the requirement in section 4 to
|
220 |
-
"keep intact all notices".
|
221 |
-
|
222 |
-
c) You must license the entire work, as a whole, under this
|
223 |
-
License to anyone who comes into possession of a copy. This
|
224 |
-
License will therefore apply, along with any applicable section 7
|
225 |
-
additional terms, to the whole of the work, and all its parts,
|
226 |
-
regardless of how they are packaged. This License gives no
|
227 |
-
permission to license the work in any other way, but it does not
|
228 |
-
invalidate such permission if you have separately received it.
|
229 |
-
|
230 |
-
d) If the work has interactive user interfaces, each must display
|
231 |
-
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
-
interfaces that do not display Appropriate Legal Notices, your
|
233 |
-
work need not make them do so.
|
234 |
-
|
235 |
-
A compilation of a covered work with other separate and independent
|
236 |
-
works, which are not by their nature extensions of the covered work,
|
237 |
-
and which are not combined with it such as to form a larger program,
|
238 |
-
in or on a volume of a storage or distribution medium, is called an
|
239 |
-
"aggregate" if the compilation and its resulting copyright are not
|
240 |
-
used to limit the access or legal rights of the compilation's users
|
241 |
-
beyond what the individual works permit. Inclusion of a covered work
|
242 |
-
in an aggregate does not cause this License to apply to the other
|
243 |
-
parts of the aggregate.
|
244 |
-
|
245 |
-
6. Conveying Non-Source Forms.
|
246 |
-
|
247 |
-
You may convey a covered work in object code form under the terms
|
248 |
-
of sections 4 and 5, provided that you also convey the
|
249 |
-
machine-readable Corresponding Source under the terms of this License,
|
250 |
-
in one of these ways:
|
251 |
-
|
252 |
-
a) Convey the object code in, or embodied in, a physical product
|
253 |
-
(including a physical distribution medium), accompanied by the
|
254 |
-
Corresponding Source fixed on a durable physical medium
|
255 |
-
customarily used for software interchange.
|
256 |
-
|
257 |
-
b) Convey the object code in, or embodied in, a physical product
|
258 |
-
(including a physical distribution medium), accompanied by a
|
259 |
-
written offer, valid for at least three years and valid for as
|
260 |
-
long as you offer spare parts or customer support for that product
|
261 |
-
model, to give anyone who possesses the object code either (1) a
|
262 |
-
copy of the Corresponding Source for all the software in the
|
263 |
-
product that is covered by this License, on a durable physical
|
264 |
-
medium customarily used for software interchange, for a price no
|
265 |
-
more than your reasonable cost of physically performing this
|
266 |
-
conveying of source, or (2) access to copy the
|
267 |
-
Corresponding Source from a network server at no charge.
|
268 |
-
|
269 |
-
c) Convey individual copies of the object code with a copy of the
|
270 |
-
written offer to provide the Corresponding Source. This
|
271 |
-
alternative is allowed only occasionally and noncommercially, and
|
272 |
-
only if you received the object code with such an offer, in accord
|
273 |
-
with subsection 6b.
|
274 |
-
|
275 |
-
d) Convey the object code by offering access from a designated
|
276 |
-
place (gratis or for a charge), and offer equivalent access to the
|
277 |
-
Corresponding Source in the same way through the same place at no
|
278 |
-
further charge. You need not require recipients to copy the
|
279 |
-
Corresponding Source along with the object code. If the place to
|
280 |
-
copy the object code is a network server, the Corresponding Source
|
281 |
-
may be on a different server (operated by you or a third party)
|
282 |
-
that supports equivalent copying facilities, provided you maintain
|
283 |
-
clear directions next to the object code saying where to find the
|
284 |
-
Corresponding Source. Regardless of what server hosts the
|
285 |
-
Corresponding Source, you remain obligated to ensure that it is
|
286 |
-
available for as long as needed to satisfy these requirements.
|
287 |
-
|
288 |
-
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
-
you inform other peers where the object code and Corresponding
|
290 |
-
Source of the work are being offered to the general public at no
|
291 |
-
charge under subsection 6d.
|
292 |
-
|
293 |
-
A separable portion of the object code, whose source code is excluded
|
294 |
-
from the Corresponding Source as a System Library, need not be
|
295 |
-
included in conveying the object code work.
|
296 |
-
|
297 |
-
A "User Product" is either (1) a "consumer product", which means any
|
298 |
-
tangible personal property which is normally used for personal, family,
|
299 |
-
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
-
into a dwelling. In determining whether a product is a consumer product,
|
301 |
-
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
-
product received by a particular user, "normally used" refers to a
|
303 |
-
typical or common use of that class of product, regardless of the status
|
304 |
-
of the particular user or of the way in which the particular user
|
305 |
-
actually uses, or expects or is expected to use, the product. A product
|
306 |
-
is a consumer product regardless of whether the product has substantial
|
307 |
-
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
-
the only significant mode of use of the product.
|
309 |
-
|
310 |
-
"Installation Information" for a User Product means any methods,
|
311 |
-
procedures, authorization keys, or other information required to install
|
312 |
-
and execute modified versions of a covered work in that User Product from
|
313 |
-
a modified version of its Corresponding Source. The information must
|
314 |
-
suffice to ensure that the continued functioning of the modified object
|
315 |
-
code is in no case prevented or interfered with solely because
|
316 |
-
modification has been made.
|
317 |
-
|
318 |
-
If you convey an object code work under this section in, or with, or
|
319 |
-
specifically for use in, a User Product, and the conveying occurs as
|
320 |
-
part of a transaction in which the right of possession and use of the
|
321 |
-
User Product is transferred to the recipient in perpetuity or for a
|
322 |
-
fixed term (regardless of how the transaction is characterized), the
|
323 |
-
Corresponding Source conveyed under this section must be accompanied
|
324 |
-
by the Installation Information. But this requirement does not apply
|
325 |
-
if neither you nor any third party retains the ability to install
|
326 |
-
modified object code on the User Product (for example, the work has
|
327 |
-
been installed in ROM).
|
328 |
-
|
329 |
-
The requirement to provide Installation Information does not include a
|
330 |
-
requirement to continue to provide support service, warranty, or updates
|
331 |
-
for a work that has been modified or installed by the recipient, or for
|
332 |
-
the User Product in which it has been modified or installed. Access to a
|
333 |
-
network may be denied when the modification itself materially and
|
334 |
-
adversely affects the operation of the network or violates the rules and
|
335 |
-
protocols for communication across the network.
|
336 |
-
|
337 |
-
Corresponding Source conveyed, and Installation Information provided,
|
338 |
-
in accord with this section must be in a format that is publicly
|
339 |
-
documented (and with an implementation available to the public in
|
340 |
-
source code form), and must require no special password or key for
|
341 |
-
unpacking, reading or copying.
|
342 |
-
|
343 |
-
7. Additional Terms.
|
344 |
-
|
345 |
-
"Additional permissions" are terms that supplement the terms of this
|
346 |
-
License by making exceptions from one or more of its conditions.
|
347 |
-
Additional permissions that are applicable to the entire Program shall
|
348 |
-
be treated as though they were included in this License, to the extent
|
349 |
-
that they are valid under applicable law. If additional permissions
|
350 |
-
apply only to part of the Program, that part may be used separately
|
351 |
-
under those permissions, but the entire Program remains governed by
|
352 |
-
this License without regard to the additional permissions.
|
353 |
-
|
354 |
-
When you convey a copy of a covered work, you may at your option
|
355 |
-
remove any additional permissions from that copy, or from any part of
|
356 |
-
it. (Additional permissions may be written to require their own
|
357 |
-
removal in certain cases when you modify the work.) You may place
|
358 |
-
additional permissions on material, added by you to a covered work,
|
359 |
-
for which you have or can give appropriate copyright permission.
|
360 |
-
|
361 |
-
Notwithstanding any other provision of this License, for material you
|
362 |
-
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
-
that material) supplement the terms of this License with terms:
|
364 |
-
|
365 |
-
a) Disclaiming warranty or limiting liability differently from the
|
366 |
-
terms of sections 15 and 16 of this License; or
|
367 |
-
|
368 |
-
b) Requiring preservation of specified reasonable legal notices or
|
369 |
-
author attributions in that material or in the Appropriate Legal
|
370 |
-
Notices displayed by works containing it; or
|
371 |
-
|
372 |
-
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
-
requiring that modified versions of such material be marked in
|
374 |
-
reasonable ways as different from the original version; or
|
375 |
-
|
376 |
-
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
-
authors of the material; or
|
378 |
-
|
379 |
-
e) Declining to grant rights under trademark law for use of some
|
380 |
-
trade names, trademarks, or service marks; or
|
381 |
-
|
382 |
-
f) Requiring indemnification of licensors and authors of that
|
383 |
-
material by anyone who conveys the material (or modified versions of
|
384 |
-
it) with contractual assumptions of liability to the recipient, for
|
385 |
-
any liability that these contractual assumptions directly impose on
|
386 |
-
those licensors and authors.
|
387 |
-
|
388 |
-
All other non-permissive additional terms are considered "further
|
389 |
-
restrictions" within the meaning of section 10. If the Program as you
|
390 |
-
received it, or any part of it, contains a notice stating that it is
|
391 |
-
governed by this License along with a term that is a further
|
392 |
-
restriction, you may remove that term. If a license document contains
|
393 |
-
a further restriction but permits relicensing or conveying under this
|
394 |
-
License, you may add to a covered work material governed by the terms
|
395 |
-
of that license document, provided that the further restriction does
|
396 |
-
not survive such relicensing or conveying.
|
397 |
-
|
398 |
-
If you add terms to a covered work in accord with this section, you
|
399 |
-
must place, in the relevant source files, a statement of the
|
400 |
-
additional terms that apply to those files, or a notice indicating
|
401 |
-
where to find the applicable terms.
|
402 |
-
|
403 |
-
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
-
form of a separately written license, or stated as exceptions;
|
405 |
-
the above requirements apply either way.
|
406 |
-
|
407 |
-
8. Termination.
|
408 |
-
|
409 |
-
You may not propagate or modify a covered work except as expressly
|
410 |
-
provided under this License. Any attempt otherwise to propagate or
|
411 |
-
modify it is void, and will automatically terminate your rights under
|
412 |
-
this License (including any patent licenses granted under the third
|
413 |
-
paragraph of section 11).
|
414 |
-
|
415 |
-
However, if you cease all violation of this License, then your
|
416 |
-
license from a particular copyright holder is reinstated (a)
|
417 |
-
provisionally, unless and until the copyright holder explicitly and
|
418 |
-
finally terminates your license, and (b) permanently, if the copyright
|
419 |
-
holder fails to notify you of the violation by some reasonable means
|
420 |
-
prior to 60 days after the cessation.
|
421 |
-
|
422 |
-
Moreover, your license from a particular copyright holder is
|
423 |
-
reinstated permanently if the copyright holder notifies you of the
|
424 |
-
violation by some reasonable means, this is the first time you have
|
425 |
-
received notice of violation of this License (for any work) from that
|
426 |
-
copyright holder, and you cure the violation prior to 30 days after
|
427 |
-
your receipt of the notice.
|
428 |
-
|
429 |
-
Termination of your rights under this section does not terminate the
|
430 |
-
licenses of parties who have received copies or rights from you under
|
431 |
-
this License. If your rights have been terminated and not permanently
|
432 |
-
reinstated, you do not qualify to receive new licenses for the same
|
433 |
-
material under section 10.
|
434 |
-
|
435 |
-
9. Acceptance Not Required for Having Copies.
|
436 |
-
|
437 |
-
You are not required to accept this License in order to receive or
|
438 |
-
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
-
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
-
to receive a copy likewise does not require acceptance. However,
|
441 |
-
nothing other than this License grants you permission to propagate or
|
442 |
-
modify any covered work. These actions infringe copyright if you do
|
443 |
-
not accept this License. Therefore, by modifying or propagating a
|
444 |
-
covered work, you indicate your acceptance of this License to do so.
|
445 |
-
|
446 |
-
10. Automatic Licensing of Downstream Recipients.
|
447 |
-
|
448 |
-
Each time you convey a covered work, the recipient automatically
|
449 |
-
receives a license from the original licensors, to run, modify and
|
450 |
-
propagate that work, subject to this License. You are not responsible
|
451 |
-
for enforcing compliance by third parties with this License.
|
452 |
-
|
453 |
-
An "entity transaction" is a transaction transferring control of an
|
454 |
-
organization, or substantially all assets of one, or subdividing an
|
455 |
-
organization, or merging organizations. If propagation of a covered
|
456 |
-
work results from an entity transaction, each party to that
|
457 |
-
transaction who receives a copy of the work also receives whatever
|
458 |
-
licenses to the work the party's predecessor in interest had or could
|
459 |
-
give under the previous paragraph, plus a right to possession of the
|
460 |
-
Corresponding Source of the work from the predecessor in interest, if
|
461 |
-
the predecessor has it or can get it with reasonable efforts.
|
462 |
-
|
463 |
-
You may not impose any further restrictions on the exercise of the
|
464 |
-
rights granted or affirmed under this License. For example, you may
|
465 |
-
not impose a license fee, royalty, or other charge for exercise of
|
466 |
-
rights granted under this License, and you may not initiate litigation
|
467 |
-
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
-
any patent claim is infringed by making, using, selling, offering for
|
469 |
-
sale, or importing the Program or any portion of it.
|
470 |
-
|
471 |
-
11. Patents.
|
472 |
-
|
473 |
-
A "contributor" is a copyright holder who authorizes use under this
|
474 |
-
License of the Program or a work on which the Program is based. The
|
475 |
-
work thus licensed is called the contributor's "contributor version".
|
476 |
-
|
477 |
-
A contributor's "essential patent claims" are all patent claims
|
478 |
-
owned or controlled by the contributor, whether already acquired or
|
479 |
-
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
-
by this License, of making, using, or selling its contributor version,
|
481 |
-
but do not include claims that would be infringed only as a
|
482 |
-
consequence of further modification of the contributor version. For
|
483 |
-
purposes of this definition, "control" includes the right to grant
|
484 |
-
patent sublicenses in a manner consistent with the requirements of
|
485 |
-
this License.
|
486 |
-
|
487 |
-
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
-
patent license under the contributor's essential patent claims, to
|
489 |
-
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
-
propagate the contents of its contributor version.
|
491 |
-
|
492 |
-
In the following three paragraphs, a "patent license" is any express
|
493 |
-
agreement or commitment, however denominated, not to enforce a patent
|
494 |
-
(such as an express permission to practice a patent or covenant not to
|
495 |
-
sue for patent infringement). To "grant" such a patent license to a
|
496 |
-
party means to make such an agreement or commitment not to enforce a
|
497 |
-
patent against the party.
|
498 |
-
|
499 |
-
If you convey a covered work, knowingly relying on a patent license,
|
500 |
-
and the Corresponding Source of the work is not available for anyone
|
501 |
-
to copy, free of charge and under the terms of this License, through a
|
502 |
-
publicly available network server or other readily accessible means,
|
503 |
-
then you must either (1) cause the Corresponding Source to be so
|
504 |
-
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
-
patent license for this particular work, or (3) arrange, in a manner
|
506 |
-
consistent with the requirements of this License, to extend the patent
|
507 |
-
license to downstream recipients. "Knowingly relying" means you have
|
508 |
-
actual knowledge that, but for the patent license, your conveying the
|
509 |
-
covered work in a country, or your recipient's use of the covered work
|
510 |
-
in a country, would infringe one or more identifiable patents in that
|
511 |
-
country that you have reason to believe are valid.
|
512 |
-
|
513 |
-
If, pursuant to or in connection with a single transaction or
|
514 |
-
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
-
covered work, and grant a patent license to some of the parties
|
516 |
-
receiving the covered work authorizing them to use, propagate, modify
|
517 |
-
or convey a specific copy of the covered work, then the patent license
|
518 |
-
you grant is automatically extended to all recipients of the covered
|
519 |
-
work and works based on it.
|
520 |
-
|
521 |
-
A patent license is "discriminatory" if it does not include within
|
522 |
-
the scope of its coverage, prohibits the exercise of, or is
|
523 |
-
conditioned on the non-exercise of one or more of the rights that are
|
524 |
-
specifically granted under this License. You may not convey a covered
|
525 |
-
work if you are a party to an arrangement with a third party that is
|
526 |
-
in the business of distributing software, under which you make payment
|
527 |
-
to the third party based on the extent of your activity of conveying
|
528 |
-
the work, and under which the third party grants, to any of the
|
529 |
-
parties who would receive the covered work from you, a discriminatory
|
530 |
-
patent license (a) in connection with copies of the covered work
|
531 |
-
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
-
for and in connection with specific products or compilations that
|
533 |
-
contain the covered work, unless you entered into that arrangement,
|
534 |
-
or that patent license was granted, prior to 28 March 2007.
|
535 |
-
|
536 |
-
Nothing in this License shall be construed as excluding or limiting
|
537 |
-
any implied license or other defenses to infringement that may
|
538 |
-
otherwise be available to you under applicable patent law.
|
539 |
-
|
540 |
-
12. No Surrender of Others' Freedom.
|
541 |
-
|
542 |
-
If conditions are imposed on you (whether by court order, agreement or
|
543 |
-
otherwise) that contradict the conditions of this License, they do not
|
544 |
-
excuse you from the conditions of this License. If you cannot convey a
|
545 |
-
covered work so as to satisfy simultaneously your obligations under this
|
546 |
-
License and any other pertinent obligations, then as a consequence you may
|
547 |
-
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
-
to collect a royalty for further conveying from those to whom you convey
|
549 |
-
the Program, the only way you could satisfy both those terms and this
|
550 |
-
License would be to refrain entirely from conveying the Program.
|
551 |
-
|
552 |
-
13. Use with the GNU Affero General Public License.
|
553 |
-
|
554 |
-
Notwithstanding any other provision of this License, you have
|
555 |
-
permission to link or combine any covered work with a work licensed
|
556 |
-
under version 3 of the GNU Affero General Public License into a single
|
557 |
-
combined work, and to convey the resulting work. The terms of this
|
558 |
-
License will continue to apply to the part which is the covered work,
|
559 |
-
but the special requirements of the GNU Affero General Public License,
|
560 |
-
section 13, concerning interaction through a network will apply to the
|
561 |
-
combination as such.
|
562 |
-
|
563 |
-
14. Revised Versions of this License.
|
564 |
-
|
565 |
-
The Free Software Foundation may publish revised and/or new versions of
|
566 |
-
the GNU General Public License from time to time. Such new versions will
|
567 |
-
be similar in spirit to the present version, but may differ in detail to
|
568 |
-
address new problems or concerns.
|
569 |
-
|
570 |
-
Each version is given a distinguishing version number. If the
|
571 |
-
Program specifies that a certain numbered version of the GNU General
|
572 |
-
Public License "or any later version" applies to it, you have the
|
573 |
-
option of following the terms and conditions either of that numbered
|
574 |
-
version or of any later version published by the Free Software
|
575 |
-
Foundation. If the Program does not specify a version number of the
|
576 |
-
GNU General Public License, you may choose any version ever published
|
577 |
-
by the Free Software Foundation.
|
578 |
-
|
579 |
-
If the Program specifies that a proxy can decide which future
|
580 |
-
versions of the GNU General Public License can be used, that proxy's
|
581 |
-
public statement of acceptance of a version permanently authorizes you
|
582 |
-
to choose that version for the Program.
|
583 |
-
|
584 |
-
Later license versions may give you additional or different
|
585 |
-
permissions. However, no additional obligations are imposed on any
|
586 |
-
author or copyright holder as a result of your choosing to follow a
|
587 |
-
later version.
|
588 |
-
|
589 |
-
15. Disclaimer of Warranty.
|
590 |
-
|
591 |
-
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
-
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
-
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
-
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
-
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
-
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
-
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
-
|
600 |
-
16. Limitation of Liability.
|
601 |
-
|
602 |
-
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
-
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
-
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
-
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
-
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
-
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
-
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
-
SUCH DAMAGES.
|
611 |
-
|
612 |
-
17. Interpretation of Sections 15 and 16.
|
613 |
-
|
614 |
-
If the disclaimer of warranty and limitation of liability provided
|
615 |
-
above cannot be given local legal effect according to their terms,
|
616 |
-
reviewing courts shall apply local law that most closely approximates
|
617 |
-
an absolute waiver of all civil liability in connection with the
|
618 |
-
Program, unless a warranty or assumption of liability accompanies a
|
619 |
-
copy of the Program in return for a fee.
|
620 |
-
|
621 |
-
END OF TERMS AND CONDITIONS
|
622 |
-
|
623 |
-
How to Apply These Terms to Your New Programs
|
624 |
-
|
625 |
-
If you develop a new program, and you want it to be of the greatest
|
626 |
-
possible use to the public, the best way to achieve this is to make it
|
627 |
-
free software which everyone can redistribute and change under these terms.
|
628 |
-
|
629 |
-
To do so, attach the following notices to the program. It is safest
|
630 |
-
to attach them to the start of each source file to most effectively
|
631 |
-
state the exclusion of warranty; and each file should have at least
|
632 |
-
the "copyright" line and a pointer to where the full notice is found.
|
633 |
-
|
634 |
-
<one line to give the program's name and a brief idea of what it does.>
|
635 |
-
Copyright (C) <year> <name of author>
|
636 |
-
|
637 |
-
This program is free software: you can redistribute it and/or modify
|
638 |
-
it under the terms of the GNU General Public License as published by
|
639 |
-
the Free Software Foundation, either version 3 of the License, or
|
640 |
-
(at your option) any later version.
|
641 |
-
|
642 |
-
This program is distributed in the hope that it will be useful,
|
643 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
-
GNU General Public License for more details.
|
646 |
-
|
647 |
-
You should have received a copy of the GNU General Public License
|
648 |
-
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649 |
-
|
650 |
-
Also add information on how to contact you by electronic and paper mail.
|
651 |
-
|
652 |
-
If the program does terminal interaction, make it output a short
|
653 |
-
notice like this when it starts in an interactive mode:
|
654 |
-
|
655 |
-
<program> Copyright (C) <year> <name of author>
|
656 |
-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
-
This is free software, and you are welcome to redistribute it
|
658 |
-
under certain conditions; type `show c' for details.
|
659 |
-
|
660 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
-
parts of the General Public License. Of course, your program's commands
|
662 |
-
might be different; for a GUI interface, you would use an "about box".
|
663 |
-
|
664 |
-
You should also get your employer (if you work as a programmer) or school,
|
665 |
-
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
-
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
-
<https://www.gnu.org/licenses/>.
|
668 |
-
|
669 |
-
The GNU General Public License does not permit incorporating your program
|
670 |
-
into proprietary programs. If your program is a subroutine library, you
|
671 |
-
may consider it more useful to permit linking proprietary applications with
|
672 |
-
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
-
Public License instead of this License. But first, please read
|
674 |
-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<https://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
learning_machines_robobo/README.md
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
# Learning Machines Robobo
|
2 |
-
|
3 |
-
This is the GitHub repository for the Learning Machines course.
|
4 |
-
|
5 |
-
If you're a student, everything you need for the course itself is in the [examples](https://github.com/ci-group/learning_machines_robobo/tree/master/examples) directory. It contains all the documentation and code you need. Just clone this repository, cd into examples, and start at that readme, which will guide you through the whole thing.
|
6 |
-
|
7 |
-
### There is an issue/bug with the code.
|
8 |
-
|
9 |
-
If you find a problem with the code, please create an issue [here](https://github.com/ci-group/learning_machines_robobo/issues) on the GitHub repository. For this, please make sure you include these three things:
|
10 |
-
|
11 |
-
- Some example code with instructions on how to run and include it. This should preferably be a minimum failing example, just linking to your entire assignment won't cut it. You might think this is a lot of extra work, but the amount of times I personally found a bug in my own code by trying to construct an example like this is staggering. It's a really good test to make sure that what you think is happening is actually what is happening. Also, it helps whoever wants to fix it understand what is going wrong.
|
12 |
-
- The behaviour you would expect from this minimum failing example. No "it should work," be specific in what output you expect.
|
13 |
-
- The actual behaviour you observed, and that anyone can observe by running the example code you provided. Here, also provide the platform you ran it under, in case it cannot be reproduced.
|
14 |
-
|
15 |
-
## Contributing / maintaining
|
16 |
-
|
17 |
-
If you are working on the project, you should notice that all code you write yourself should be in `maintained/`. All code in the examples is automatically generated (or, well, copied over) from there. This architecture is quite weird, but I couldn't find a better option. Because everything is ROS, it is hard to distribute the individual packages without having to teach students how to install ROS packages, making the code too much of a black box. Alternatively, having only one template (e.g. only `full_project_setup`), which is what was here before, has issues with documentation, as that makes it quite a large project to just dump students into. With the way it currently is, everything is in one place while maintaining, but students can still cd from example to example to explore the codebase.
|
18 |
-
|
19 |
-
To work on the project, first, `cd` into maintained. Here, you can edit the code and test it, (though it might be easier to test it inside the directory of the relevant example.) Once you are confident it is good, you can type `python3 ./build.py`, this will copy all files over to the right examples. If you created new scripts or catkin packages, this build script is also where to make the needed changes to always copy over the files to the appropriate examples. The build script will ask for confirmation for every file it wants to delete. If you're confident everything is backed up, you can pass the `-y` flag to answer yes to all prompts.
|
20 |
-
|
21 |
-
After you have built, it is important to go through the READMEs in the examples, and assert all of them are still correct.
|
22 |
-
|
23 |
-
If you change anything with the docker setup or run scripts it is important to test everything under Linux (X11), Windows, and MacOS before pushing to master, making sure the behaviour is consistent.
|
24 |
-
|
25 |
-
If you changed the Lua scripts, make sure to update all affected models and scenes to match. This is quite tedious, and if you find a way to automate it, please let me know.
|
|
|
1 |
+
# Learning Machines Robobo
|
2 |
+
|
3 |
+
This is the GitHub repository for the Learning Machines course.
|
4 |
+
|
5 |
+
If you're a student, everything you need for the course itself is in the [examples](https://github.com/ci-group/learning_machines_robobo/tree/master/examples) directory. It contains all the documentation and code you need. Just clone this repository, cd into examples, and start at that readme, which will guide you through the whole thing.
|
6 |
+
|
7 |
+
### There is an issue/bug with the code.
|
8 |
+
|
9 |
+
If you find a problem with the code, please create an issue [here](https://github.com/ci-group/learning_machines_robobo/issues) on the GitHub repository. For this, please make sure you include these three things:
|
10 |
+
|
11 |
+
- Some example code with instructions on how to run and include it. This should preferably be a minimum failing example, just linking to your entire assignment won't cut it. You might think this is a lot of extra work, but the amount of times I personally found a bug in my own code by trying to construct an example like this is staggering. It's a really good test to make sure that what you think is happening is actually what is happening. Also, it helps whoever wants to fix it understand what is going wrong.
|
12 |
+
- The behaviour you would expect from this minimum failing example. No "it should work," be specific in what output you expect.
|
13 |
+
- The actual behaviour you observed, and that anyone can observe by running the example code you provided. Here, also provide the platform you ran it under, in case it cannot be reproduced.
|
14 |
+
|
15 |
+
## Contributing / maintaining
|
16 |
+
|
17 |
+
If you are working on the project, you should notice that all code you write yourself should be in `maintained/`. All code in the examples is automatically generated (or, well, copied over) from there. This architecture is quite weird, but I couldn't find a better option. Because everything is ROS, it is hard to distribute the individual packages without having to teach students how to install ROS packages, making the code too much of a black box. Alternatively, having only one template (e.g. only `full_project_setup`), which is what was here before, has issues with documentation, as that makes it quite a large project to just dump students into. With the way it currently is, everything is in one place while maintaining, but students can still cd from example to example to explore the codebase.
|
18 |
+
|
19 |
+
To work on the project, first, `cd` into maintained. Here, you can edit the code and test it, (though it might be easier to test it inside the directory of the relevant example.) Once you are confident it is good, you can type `python3 ./build.py`, this will copy all files over to the right examples. If you created new scripts or catkin packages, this build script is also where to make the needed changes to always copy over the files to the appropriate examples. The build script will ask for confirmation for every file it wants to delete. If you're confident everything is backed up, you can pass the `-y` flag to answer yes to all prompts.
|
20 |
+
|
21 |
+
After you have built, it is important to go through the READMEs in the examples, and assert all of them are still correct.
|
22 |
+
|
23 |
+
If you change anything with the docker setup or run scripts it is important to test everything under Linux (X11), Windows, and MacOS before pushing to master, making sure the behaviour is consistent.
|
24 |
+
|
25 |
+
If you changed the Lua scripts, make sure to update all affected models and scenes to match. This is quite tedious, and if you find a way to automate it, please let me know.
|
learning_machines_robobo/examples/README.md
CHANGED
@@ -1,61 +1,61 @@
|
|
1 |
-
## Intro
|
2 |
-
|
3 |
-
I am going to need to introduce the code for this course a little. You see, this course kind of has a fundamental flaw: It's a robotics course given to AI students, where the robotics is kind of meant to stay in the background. The problem is that robotics is _hard_, and requires a whole new set of tooling you will likely have never touched before.
|
4 |
-
|
5 |
-
If you are the type to first implement/install stuff and understand later, you can follow any of the quick setup files in the full project folder, which you can find for [Windows](https://github.com/ci-group/learning_machines_robobo/blob/master/examples/full_project_setup/quick_setup_windows.md), [MacOS](https://github.com/ci-group/learning_machines_robobo/blob/master/examples/full_project_setup/quick_setup_macos.md), and [Linux](https://github.com/ci-group/learning_machines_robobo/blob/master/examples/full_project_setup/quick_setup_linux.md). These will guide you through the entire installation of the framework you will use throughout the course, but bare in mind you might not have the prerequisites to directly follow it.
|
6 |
-
|
7 |
-
Robotics generally uses something called ROS: Robotics Operating System. There are a few closed-source proprietary alternatives to ROS, but this is the stuff you'd be taught in the first year of a robotics Bachelor. ROS is going to be very different from the software you've touched before. It is a framework for writing C++ robotics packages that run on top of the Linux kernel. There is _some_ second-party support for Python and "experimental" releases for Windows, but you're supposed to develop C++ on Linux. (Yes, ROS2 has support for Windows and MacOS now, but we're stuck on ROS1)
|
8 |
-
|
9 |
-
Most of you, however, are AI students, some might have come here from a Bachelor's that didn't involve any programming and would be completely overwhelmed if I started talking about how variadic templates influence rvalue casts because of return value optimization in the latest version of Clang. So, we're not doing any of that. We're doing no C++ and we have support for Windows, MacOS, and, of course, Linux.
|
10 |
-
|
11 |
-
This doesn't come for free, of course. I haven't taken it upon myself to write ROS1 support for Windows and MacOS, and I didn't manage to update to ROS2 either. No, we're using virtualization. Specifically, we're going to be using Docker. This is going to be making parts of this course a bit inconvenient, as you have to build and start docker containers all the time. But, keep in mind: the alternative is forcing all of you to Linux.
|
12 |
-
|
13 |
-
The second hard thing we're using for this course is CoppelaSim. This is actually pretty alright to use, all things considered. It should run well on all operating systems (though we had issues with macs in previous years), and has native Python bindings (though we're stuck with the Lua bindings for internal scripts). In either case, it _is_ a rather large software package you're likely unfamiliar with, meaning you will need to spend some time to get familiar with it.
|
14 |
-
|
15 |
-
With that out of the way, and you hopefully understanding why parts of this course are a bit inconvenient (I don't want to hear no "but why do we have to use Docker?"), I can start introducing the stuff you need for this course to you. First, there are some small blurps on technologies you might have not touched before but should learn to use for this course. Just a little help if this is the first time having to do this kind of stuff. After that, this README will redirect you to the example projects in this tutorial. These will guide you through setting up and learning everything you need to know to start working on the assignments of this course.
|
16 |
-
|
17 |
-
Before we start some notes:
|
18 |
-
|
19 |
-
- All code in the examples is fine to copy-paste into your assignment project. In fact, you are _encouraged_ to do so. There is a lot of Python code, Dockerfiles, and CMakeLists you're not expected to understand. Copy-paste it in, and don't worry about it.
|
20 |
-
- Setting everything up and going through this thing is going to take you some time. Don't expect to be done in an hour, and don't be afraid to ask questions. Though we tried our best to keep it simple, the nature of robotics software means that setting everything up might be one of the hardest parts of this entire course, especially if you don't have a background in lower-level development.
|
21 |
-
- Don't be afraid of not knowing. One of the most important skills for software development is having a high tolerance for confusion. If you want to, you can spend some extra time to learn everything properly, but a "this seems to be working" is perfectly fine.
|
22 |
-
|
23 |
-
### The command-line
|
24 |
-
|
25 |
-
Wait, seriously? There is a blurp on the command line? Well, yes. Obviously, you have opened a command line before, but, for some of you, this might be the first time using applications that don't have GUI support _at all_. You're going to need to connect to remote (Linux) systems that don't have a screen attached, meaning you're going to need to `cd` and `ls` around the place; use `less` and `cat` to inspect a file; and `nano` (or `vim` if you're as big of a nerd as me) to edit something. This also means that your IDE's debugger and "run" button are not going to work. Use your terminal. If that's not something you're comfortable with, don't worry: it's not hard, and you'll learn as you're doing it. But, I want you to keep in mind that you cannot avoid it, and shouldn't try to. If you're on Windows make sure you're on PowerShell, not CMD. Also, install a nice terminal theme. It's a lot comfier here with pretty colors and a proper font.
|
26 |
-
|
27 |
-
### Python
|
28 |
-
|
29 |
-
We are using Python version 3.8, this is because of the limitations of ROS. Make sure that your everything is tested for Python 3.8, and you're not confusing yourself by using newer versions when looking at documentation or testing small scripts. We're also using Python like an embedded programming language, meaning that stuff like Jupiter notebooks are not going to work and that you're going to have to structure your Python code in modules, as you're not calling the code yourself. The code will be installed, after which another program will call it for you.
|
30 |
-
|
31 |
-
### Docker
|
32 |
-
|
33 |
-
For this course, you are going to use Docker. This is the professional standard for running software. If you've ever come close to professional software development, you will have used it before. But, in short, it is a way to quickly set up and install things that are hard to install and a way to isolate what you are running from the rest of your computer, making it completely reproducible.
|
34 |
-
|
35 |
-
If you've never used it before, it's going to be a similar experience to the first time using git. There are a _ton_ of tutorials online ranging from five minutes to ten hours; there are quite some GUIs available, but, professionally, everyone uses the command line; and it naively runs on Linux, but getting it to work on Windows or Mac is a bit of a hastle and requires jumping trough some hoops.
|
36 |
-
|
37 |
-
Of course, this course won't require you to learn all of docker. We tried our absolute best to make sure you have to touch as little of it as possible, but every time you want to run your code you will do so by typing a docker command in the command-line.
|
38 |
-
|
39 |
-
If you have never used Docker before, or have very little experience with it, you can check out the small tutorial on basic Docker usage that is in this examples directory. [Docker Tutorial](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/docker_tutorial). This will also tell you what you need to have installed, and how to install that.
|
40 |
-
|
41 |
-
### ROS
|
42 |
-
|
43 |
-
For this course, we are using ROS. Again, you don't have to learn anything about it, but you might still find it pleasant to follow a small tutorial on it. There is a basic ROS setup in the examples directory that is meant to get you started. [ROS tutorial help](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/ros_tutorial_help)
|
44 |
-
|
45 |
-
This is especially useful if you're not that good at programming jet, and aren't able to intuit what code does by relying on experience.
|
46 |
-
|
47 |
-
### Using the Robobo
|
48 |
-
|
49 |
-
Getting the hardware running is not as easy as it might seem. There is a quick tutorial in the examples directory to get you started [Getting the hardware running](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/hardware_setup)
|
50 |
-
|
51 |
-
### Using CopellaSim.
|
52 |
-
|
53 |
-
Getting CopellaSim running isn't trivial either. You know the deal, tutorial in examples. [Setting up CopellaSim](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/coppelia_sim_tutorial)
|
54 |
-
|
55 |
-
### Full project example
|
56 |
-
|
57 |
-
Finally, we have reached the point where you can start working on the project. In the examples directory, there is a fully working project that has everything you need. [Full project example](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/full_project_setup), this is the place you'll likely end up copy-pasting the most code from. In fact, I encourage you to copy-paste everything and use it as a template.
|
58 |
-
|
59 |
-
Just running this one will get you a basic project that makes the robot move around a bit, both in the simulation and with the actual hardware.
|
60 |
-
|
61 |
-
You might (are going to) find the code in this example a bit overwhelming. At [ros_basic_setup](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/ros_basic_setup), there is a simpler version that doesn't do anything but does have the minimum required structure to run some code. Take a look through that one every time you are confused about what something in here does, or why it's there, especially when it comes to the shell scripts and other odd files.
|
|
|
1 |
+
## Intro
|
2 |
+
|
3 |
+
I am going to need to introduce the code for this course a little. You see, this course kind of has a fundamental flaw: It's a robotics course given to AI students, where the robotics is kind of meant to stay in the background. The problem is that robotics is _hard_, and requires a whole new set of tooling you will likely have never touched before.
|
4 |
+
|
5 |
+
If you are the type to first implement/install stuff and understand later, you can follow any of the quick setup files in the full project folder, which you can find for [Windows](https://github.com/ci-group/learning_machines_robobo/blob/master/examples/full_project_setup/quick_setup_windows.md), [MacOS](https://github.com/ci-group/learning_machines_robobo/blob/master/examples/full_project_setup/quick_setup_macos.md), and [Linux](https://github.com/ci-group/learning_machines_robobo/blob/master/examples/full_project_setup/quick_setup_linux.md). These will guide you through the entire installation of the framework you will use throughout the course, but bare in mind you might not have the prerequisites to directly follow it.
|
6 |
+
|
7 |
+
Robotics generally uses something called ROS: Robotics Operating System. There are a few closed-source proprietary alternatives to ROS, but this is the stuff you'd be taught in the first year of a robotics Bachelor. ROS is going to be very different from the software you've touched before. It is a framework for writing C++ robotics packages that run on top of the Linux kernel. There is _some_ second-party support for Python and "experimental" releases for Windows, but you're supposed to develop C++ on Linux. (Yes, ROS2 has support for Windows and MacOS now, but we're stuck on ROS1)
|
8 |
+
|
9 |
+
Most of you, however, are AI students, some might have come here from a Bachelor's that didn't involve any programming and would be completely overwhelmed if I started talking about how variadic templates influence rvalue casts because of return value optimization in the latest version of Clang. So, we're not doing any of that. We're doing no C++ and we have support for Windows, MacOS, and, of course, Linux.
|
10 |
+
|
11 |
+
This doesn't come for free, of course. I haven't taken it upon myself to write ROS1 support for Windows and MacOS, and I didn't manage to update to ROS2 either. No, we're using virtualization. Specifically, we're going to be using Docker. This is going to be making parts of this course a bit inconvenient, as you have to build and start docker containers all the time. But, keep in mind: the alternative is forcing all of you to Linux.
|
12 |
+
|
13 |
+
The second hard thing we're using for this course is CoppelaSim. This is actually pretty alright to use, all things considered. It should run well on all operating systems (though we had issues with macs in previous years), and has native Python bindings (though we're stuck with the Lua bindings for internal scripts). In either case, it _is_ a rather large software package you're likely unfamiliar with, meaning you will need to spend some time to get familiar with it.
|
14 |
+
|
15 |
+
With that out of the way, and you hopefully understanding why parts of this course are a bit inconvenient (I don't want to hear no "but why do we have to use Docker?"), I can start introducing the stuff you need for this course to you. First, there are some small blurps on technologies you might have not touched before but should learn to use for this course. Just a little help if this is the first time having to do this kind of stuff. After that, this README will redirect you to the example projects in this tutorial. These will guide you through setting up and learning everything you need to know to start working on the assignments of this course.
|
16 |
+
|
17 |
+
Before we start some notes:
|
18 |
+
|
19 |
+
- All code in the examples is fine to copy-paste into your assignment project. In fact, you are _encouraged_ to do so. There is a lot of Python code, Dockerfiles, and CMakeLists you're not expected to understand. Copy-paste it in, and don't worry about it.
|
20 |
+
- Setting everything up and going through this thing is going to take you some time. Don't expect to be done in an hour, and don't be afraid to ask questions. Though we tried our best to keep it simple, the nature of robotics software means that setting everything up might be one of the hardest parts of this entire course, especially if you don't have a background in lower-level development.
|
21 |
+
- Don't be afraid of not knowing. One of the most important skills for software development is having a high tolerance for confusion. If you want to, you can spend some extra time to learn everything properly, but a "this seems to be working" is perfectly fine.
|
22 |
+
|
23 |
+
### The command-line
|
24 |
+
|
25 |
+
Wait, seriously? There is a blurp on the command line? Well, yes. Obviously, you have opened a command line before, but, for some of you, this might be the first time using applications that don't have GUI support _at all_. You're going to need to connect to remote (Linux) systems that don't have a screen attached, meaning you're going to need to `cd` and `ls` around the place; use `less` and `cat` to inspect a file; and `nano` (or `vim` if you're as big of a nerd as me) to edit something. This also means that your IDE's debugger and "run" button are not going to work. Use your terminal. If that's not something you're comfortable with, don't worry: it's not hard, and you'll learn as you're doing it. But, I want you to keep in mind that you cannot avoid it, and shouldn't try to. If you're on Windows make sure you're on PowerShell, not CMD. Also, install a nice terminal theme. It's a lot comfier here with pretty colors and a proper font.
|
26 |
+
|
27 |
+
### Python
|
28 |
+
|
29 |
+
We are using Python version 3.8, this is because of the limitations of ROS. Make sure that your everything is tested for Python 3.8, and you're not confusing yourself by using newer versions when looking at documentation or testing small scripts. We're also using Python like an embedded programming language, meaning that stuff like Jupiter notebooks are not going to work and that you're going to have to structure your Python code in modules, as you're not calling the code yourself. The code will be installed, after which another program will call it for you.
|
30 |
+
|
31 |
+
### Docker
|
32 |
+
|
33 |
+
For this course, you are going to use Docker. This is the professional standard for running software. If you've ever come close to professional software development, you will have used it before. But, in short, it is a way to quickly set up and install things that are hard to install and a way to isolate what you are running from the rest of your computer, making it completely reproducible.
|
34 |
+
|
35 |
+
If you've never used it before, it's going to be a similar experience to the first time using git. There are a _ton_ of tutorials online ranging from five minutes to ten hours; there are quite some GUIs available, but, professionally, everyone uses the command line; and it naively runs on Linux, but getting it to work on Windows or Mac is a bit of a hastle and requires jumping trough some hoops.
|
36 |
+
|
37 |
+
Of course, this course won't require you to learn all of docker. We tried our absolute best to make sure you have to touch as little of it as possible, but every time you want to run your code you will do so by typing a docker command in the command-line.
|
38 |
+
|
39 |
+
If you have never used Docker before, or have very little experience with it, you can check out the small tutorial on basic Docker usage that is in this examples directory. [Docker Tutorial](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/docker_tutorial). This will also tell you what you need to have installed, and how to install that.
|
40 |
+
|
41 |
+
### ROS
|
42 |
+
|
43 |
+
For this course, we are using ROS. Again, you don't have to learn anything about it, but you might still find it pleasant to follow a small tutorial on it. There is a basic ROS setup in the examples directory that is meant to get you started. [ROS tutorial help](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/ros_tutorial_help)
|
44 |
+
|
45 |
+
This is especially useful if you're not that good at programming jet, and aren't able to intuit what code does by relying on experience.
|
46 |
+
|
47 |
+
### Using the Robobo
|
48 |
+
|
49 |
+
Getting the hardware running is not as easy as it might seem. There is a quick tutorial in the examples directory to get you started [Getting the hardware running](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/hardware_setup)
|
50 |
+
|
51 |
+
### Using CopellaSim.
|
52 |
+
|
53 |
+
Getting CopellaSim running isn't trivial either. You know the deal, tutorial in examples. [Setting up CopellaSim](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/coppelia_sim_tutorial)
|
54 |
+
|
55 |
+
### Full project example
|
56 |
+
|
57 |
+
Finally, we have reached the point where you can start working on the project. In the examples directory, there is a fully working project that has everything you need. [Full project example](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/full_project_setup), this is the place you'll likely end up copy-pasting the most code from. In fact, I encourage you to copy-paste everything and use it as a template.
|
58 |
+
|
59 |
+
Just running this one will get you a basic project that makes the robot move around a bit, both in the simulation and with the actual hardware.
|
60 |
+
|
61 |
+
You might (are going to) find the code in this example a bit overwhelming. At [ros_basic_setup](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/ros_basic_setup), there is a simpler version that doesn't do anything but does have the minimum required structure to run some code. Take a look through that one every time you are confused about what something in here does, or why it's there, especially when it comes to the shell scripts and other odd files.
|
learning_machines_robobo/examples/coppelia_sim_tutorial/README.md
CHANGED
@@ -1,139 +1,139 @@
|
|
1 |
-
# CoppeliaSim tutorial
|
2 |
-
|
3 |
-
For this course, we use CoppeliaSim to simulate the robot. This is not the easiest program to use or install, so this should serve as a short tutorial on how to install and run it.
|
4 |
-
|
5 |
-
First, download the edu version of CoppeliaSim from their [website](https://www.coppeliarobotics.com/downloads). Click "edu" and then select your operating system. On Windows, use the zip package without an installer. On Mac, everything should be fine by default, just select the right version for your hardware. For Linux, it says "Ubuntu," but the package ships with most of its dependencies, so it will run on any distro with some minor troubleshooting. (Tested Debian, Arch and Fedora) On Arch, to get a smooth experience, the only dependency you might want to install is [`icu60`](https://aur.archlinux.org/packages/icu60), on Fedora, you want to install [`libbsd`](https://packages.fedoraproject.org/pkgs/libbsd/libbsd/).
|
6 |
-
|
7 |
-
One thing to note when running on Linux is that there have previously been unexpected issues with the program when running on Wayland. Exactly why this is the case, we don't know. But, on Debian KDE with Wayland, it doesn't start at all, and on Fedora Gnome with Wayland, it randomly crashes every now and then. If you experience weird issues, consider switching to X11.
|
8 |
-
|
9 |
-
#### Windows / Linux post-download
|
10 |
-
|
11 |
-
On Linux and Windows after it is all downloaded, you will find yourself with a zip file. When extracted, this will expose quite a large amount of scripts and executables you might want to run, so we are going to extract it to a location we have access to from the terminal, specifically `./CoppeliaSim` such that you can run the exact same commands as the ones in this README. This exact path is also required because some startup scripts, later on, rely on it being in this location.
|
12 |
-
|
13 |
-
If you're wondering what extracting to `./CoppeliaSim` means here, it is to say that you should extract to a new directory called "CoppeliaSim" that is located in the directory this README is in.
|
14 |
-
|
15 |
-
#### Mac post-download
|
16 |
-
|
17 |
-
On MacOS, after it is downloaded you will have a `coppeliaSim.app` file. Move this file to the directory this README is in, (to `./coppeliaSim.app`) so the commands below work. Note that MacOS might tell you it cannot verify the integrity of the app and refuse to run it. To give it permissions anyway, open finder in the current directory (with `open .`), and control-click the application to show the menu that lets you overwrite these settings.
|
18 |
-
|
19 |
-
### Running CoppeliaSim
|
20 |
-
|
21 |
-
#### The python venv
|
22 |
-
|
23 |
-
The first thing to do when running CoppeliaSim is to create a Python virtual environment and install some requirements on it. Technically speaking, we don't need it just jet, but CoppeliaSim gives you nice red error messages if you don't, and those can be confusing.
|
24 |
-
|
25 |
-
I am going to presume you know what a venv is, but, if you don't, you can just use the [default `venv` module](https://docs.python.org/3.8/library/venv.html), as we don't need any of the fancy features of poetry or anaconda. (In fact, Anaconda specifically is known to cause issues, and I recommend using venv or Virtualenv.) So, just `python3.8 -m venv .venv` and then `source ./venv/bin/activate` or `.\.venv\Scripts\Activate.ps1`. After this, the Python modules you need are already in `requirements.txt`, so you can just run `python -m pip install -r requirements.txt` to install those.
|
26 |
-
|
27 |
-
#### Running the executable
|
28 |
-
|
29 |
-
By default, running CoppeliaSim is as easy as just running the following from a terminal: (You should always run it from the command line, never by clicking an executable in a graphical interface.)
|
30 |
-
|
31 |
-
```sh
|
32 |
-
# On Windows:
|
33 |
-
./CoppeliaSim/coppeliaSim.exe
|
34 |
-
|
35 |
-
# Or, on MacOS:
|
36 |
-
./coppeliaSim.app/Contents/MacOS/coppeliaSim
|
37 |
-
|
38 |
-
# This one should usually work on Linux.
|
39 |
-
./CoppeliaSim/coppeliaSim
|
40 |
-
|
41 |
-
# You might need to instead run the shell script that launches this executable.
|
42 |
-
# This fixes some unexplained issues sometimes:
|
43 |
-
./CoppeliaSim/coppeliaSim.sh
|
44 |
-
```
|
45 |
-
|
46 |
-
If these commands say that the file does not exist, either you're not in the correct working directory with your terminal, or you did not extract CoppeliaSim to the correct location.
|
47 |
-
|
48 |
-
For the full startup options, please refer to the [docs](https://www.coppeliarobotics.com/helpFiles/en/commandLine.htm).
|
49 |
-
|
50 |
-
The executable takes several command line arguments, one of them being the scene to load. So, to load CoppeliaSim with a scene, for example, the `./scenes/Robobo_Scene.ttt`, you can simply run `./CoppeliaSim/coppeliaSim ./scenes/Robobo_Scene.ttt` or similar for your OS.
|
51 |
-
|
52 |
-
If all this worked, you have installed CoppeliaSim correctly. Just copy-paste this `CoppeliaSim` directory (or, on macOS, `coppeliaSim.app` file) around, from this example directory to the `full_project_setup` example to your own project directory to make sure it's available everywhere.
|
53 |
-
|
54 |
-
You can now open it, and click and move around a bit. It's admittedly a rather awkward UI, but you'll need to be somewhat familiar with it.
|
55 |
-
|
56 |
-
One thing you'll notice is little text/script icons next to some nodes in the Scene, mostly on the Robobo. These are Lua scripts that are running on the CoppeliaSim side. Double-click the script symbol to open them.
|
57 |
-
|
58 |
-
### Running with the shell scripts
|
59 |
-
|
60 |
-
To make running CoppeliaSim a bit more ergonomic, we provide some really simple shell scripts to call CoppeliaSim. In some sense, they are nothing more than some documentation on what arguments you might want to pass. You can call these like `bash ./scripts/start_coppelia_sim.sh` on Linux, `zsh ./scripts/start_coppelia_sim.zsh` on MacOS, and `.\start_coppelia_sim.ps1` on Windows. The arguments you can pass are:
|
61 |
-
|
62 |
-
- (required positional first argument) the scene you want to load, which is to say, some `.ttt` file.
|
63 |
-
- (second positional argument) The TCP port to host the ZMQ Remote API on. Which is to say, the port your Python code will use to connect to it. Passing this can be useful for training your controllers, as CoppeliaSim usually uses around 2 cores, so any system with more than that can get an advantage by running multiple in parallel, which means connecting over different ports.
|
64 |
-
- (only flag argument, but needs to be after the positional arguments) -h. If passed, CoppeliaSim will run in headless mode (which is to say, without a graphical interface,) this is also useful when training your controllers, as it makes the sim take fewer resources. CoppeliaSim itself indeed also accepts a `-H` for "true headless" mode, but beware: on some systems, this might cause issues with the camera not giving out any image.
|
65 |
-
|
66 |
-
## Lua
|
67 |
-
|
68 |
-
Wait? We are learning an entirely new programming language? Well, yes. But, don't worry. Lua is a language that is designed specifically to be easy to pick up. You'll come across it more often if you end up doing professional software development. It's a programming language designed to write config files and small add-ons in. I usually call it "sentient json" for that reason. It's famously easy to interface with from C and quite fast. For example, it's the configuration / modding language of choice for games like World of Warcraft, Roblox and Factorio, and development tools ranging from Neovim to Redis to MediaWiki (the backend of Wikipedia and WikiData). Most people who write it are just making config files, and don't really know the language either. Just... bluff your way through this one. Just [read the Wikipedia page](<https://en.wikipedia.org/wiki/Lua_(programming_language)#Features>), and copy that when you need a loop, if-statement of similar. The standard library is effectively nonexistent, and the syntax is extremely minimal, without support for classes or overloading or any other non-essential feature, so everything the language has to offer is in those few examples.
|
69 |
-
|
70 |
-
Technically, CoppeliaSim also supports Python scripts. However, this has only been since recently, and we didn't get that working in time for the course. You can try to play around with that if you want. However, I encourage you to use Lua, as that is what the Robobo itself uses, meaning you can peek at that code whenever you need to see how to get something working.
|
71 |
-
|
72 |
-
### The used Lua scripts
|
73 |
-
|
74 |
-
In this repository, you'll find the Lua scripts used in this course. The Robobo scripts are (for this course modified) versions of what is officially supplied for the Robobo. They have comments and variable names in Portuguese and generally overuse global variables. However, they are the best we have.
|
75 |
-
|
76 |
-
Next to the Robobo scripts, you'll find a `food.lua` script under the arena. This is the script used for food for task 3. You're encouraged to modify this if and when you want to change the behaviour of the food.
|
77 |
-
|
78 |
-
## Talking to CoppeliaSim from Python
|
79 |
-
|
80 |
-
For this course, most of the Python code that talks to CoppeliaSim directly is abstracted away, so you're not really required to understand how to do it. However, it might still be good to get a Hello World of sorts running, just so you know what it is doing, and to make sure that it all works. If you want a more detailed explanation of what is going on, the official source code, documentation, and examples can be found on the [GitHub repo](https://github.com/CoppeliaRobotics/zmqRemoteApi/tree/master/clients/python).
|
81 |
-
|
82 |
-
Let's create a Python file `send_commands.py` like this:
|
83 |
-
|
84 |
-
```python
|
85 |
-
from coppeliasim_zmqremoteapi_client import RemoteAPIClient
|
86 |
-
|
87 |
-
|
88 |
-
client = RemoteAPIClient(
|
89 |
-
host="localhost", # This is just to say, "this same computer"
|
90 |
-
port=23000, # The default port CoppeliaSim launches the ZMQ API at.
|
91 |
-
)
|
92 |
-
# This is Lua nonsense. We are gathering a global Lua object called "sim",
|
93 |
-
# and calling python functions on *that*.
|
94 |
-
# You can ignore it, and pretend we created a "sim" object.
|
95 |
-
sim = client.require("sim")
|
96 |
-
|
97 |
-
# Start the simulation
|
98 |
-
sim.startSimulation()
|
99 |
-
|
100 |
-
# Wait for 5 second
|
101 |
-
sim.wait(5)
|
102 |
-
|
103 |
-
# Stop the simulation
|
104 |
-
sim.stopSimulation()
|
105 |
-
```
|
106 |
-
|
107 |
-
After this, you can run CoppeliaSim (e.g. `./CoppeliaSim/coppeliaSim.sh ./scenes/Robobo_Scene.ttt`) in your venv, and, in a new terminal in the same venv run `python send_commands.py`. You should see the simulation starting (but still nothing moving, as we're not telling any robot to do anything,) and then stopping again. Nothing special.
|
108 |
-
|
109 |
-
## Troubleshooting
|
110 |
-
|
111 |
-
If something isn't working correctly (So, kind of working, but with errors), the first thing to run is its dependency error checker. This will report if all dynamically linked libraries are available (`.dll` on Windows, `.so` on Unix). Its name is `libLoadErrorCheck`, and where it lives depends on your OS and installation method. Just searching for a file of this name in the directory you extracted CoppeliaSim to should let you find it.
|
112 |
-
|
113 |
-
If this script fails on MacOS and Windows, you have found the problem, but all you can do is try to re-download and re-extract everything, and if that doesn't work, your OS is having problems and should be troubleshoot on a case-by-case basis. You should try googling some error messages.
|
114 |
-
|
115 |
-
If you really cannot get it working (and this also applies to Linux,) you can always resort to the [advanced usage](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/coppelia_sim_tutorial#advanced-usage---docker) Docker running method of CoppeliaSim. This is not ideal, as it does not give you the option of seeing the GUI at all, but it at least gives you the option to run the code to make sure it does _something_. This is especially useful if there are some minor details you cannot get running (e.g. The camera won't manage to send you images on your machine, sending only black instead.)
|
116 |
-
|
117 |
-
If the script fails on Linux, you can try to install the `.so` file yourself. It might be that your distribution simply doesn't ship it by default, and it can just be installed through your package manager. If that doesn't work, you can find a working version of the file elsewhere, and put it in `./CoppeliaSim/` (Maybe modifying `$LD_LIBRARY_PATH` to get it recognised). Wrince and repeat with recursive dependencies (Find those with `ldd libSomething.so.0`)
|
118 |
-
|
119 |
-
For example, if you get this common error:
|
120 |
-
|
121 |
-
```
|
122 |
-
[Connectivity >> ZMQ remote API server@addOnScript:error] plugin simZMQ: Cannot load library [PATH]/CoppeliaSim/libsimZMQ.so: (libbsd.so.0: cannot open shared object file: No such file or directory)
|
123 |
-
```
|
124 |
-
|
125 |
-
You should be able to read that `libbsd` does not exist on this system. This error happens on Fedora because it doesn't ship with `libbsd`. Installing it (`sudo dnf install libbsd`) solves the issue.
|
126 |
-
|
127 |
-
This is a recursive dependency, so `libLoadErrorCheck` finds nothing, but `ldd ./CoppeliaSim/libsimZMQ.so` reports the `libbsd.so.0 => not found`
|
128 |
-
|
129 |
-
Note that `ldd ./CoppeliaSim/*.so | grep "not found"` is likely to find missing objects regardless. As long as there are no errors, it's not trying to load or use those missing libraries, so it's not a problem.
|
130 |
-
|
131 |
-
## Advanced usage - Docker
|
132 |
-
|
133 |
-
At some point, you might want to start CoppeliaSim inside a container. This can be because you want to train your simulation on a server somewhere, or because you simply cannot get it running on your system. For this, you can use the [official CoppeliaSim docker image](https://github.com/CoppeliaRobotics/docker-image-coppeliasim) as a guide, or you can use the one provided in this repository, which is effectively identical, but comes with runscripts to help you play around with it, if you had issues with that.
|
134 |
-
|
135 |
-
To get access to these, you have to re-build the examples (as will be the case for all "advanced usage" sections,) This deletes any changed files inside the `examples/` directory, so make sure you don't have any files saved here before running this. To re-build cd into `maintained/` of this project, and run `python3 build.py --advanced_coppelia_sim` from the `maintained/` directory.
|
136 |
-
|
137 |
-
After you have run this, you will find that the runscripts have changed to `_docker` variants, where it should be noted that (like `run.*` from the full project setup,) MacOS users with intel chips should use the `.sh` version of the runscript, the same as Linux, and MacOS users with Apple Sillicon should use the `apple_sillicon.zsh` version.
|
138 |
-
|
139 |
-
Once this example has been rebuilt, you should download the `Ubuntu 22.04` version of CoppeliaSim, and rename it to `./CoppeliaSim.tar.xz`, to make the naming consistent. After this, you should be able to call the runscripts, which will launch a headless instance of CoppeliaSim inside a freshly built container. You can test if this worked by creating and running the `send_commands.py` from earlier again.
|
|
|
1 |
+
# CoppeliaSim tutorial
|
2 |
+
|
3 |
+
For this course, we use CoppeliaSim to simulate the robot. This is not the easiest program to use or install, so this should serve as a short tutorial on how to install and run it.
|
4 |
+
|
5 |
+
First, download the edu version of CoppeliaSim from their [website](https://www.coppeliarobotics.com/downloads). Click "edu" and then select your operating system. On Windows, use the zip package without an installer. On Mac, everything should be fine by default, just select the right version for your hardware. For Linux, it says "Ubuntu," but the package ships with most of its dependencies, so it will run on any distro with some minor troubleshooting. (Tested Debian, Arch and Fedora) On Arch, to get a smooth experience, the only dependency you might want to install is [`icu60`](https://aur.archlinux.org/packages/icu60), on Fedora, you want to install [`libbsd`](https://packages.fedoraproject.org/pkgs/libbsd/libbsd/).
|
6 |
+
|
7 |
+
One thing to note when running on Linux is that there have previously been unexpected issues with the program when running on Wayland. Exactly why this is the case, we don't know. But, on Debian KDE with Wayland, it doesn't start at all, and on Fedora Gnome with Wayland, it randomly crashes every now and then. If you experience weird issues, consider switching to X11.
|
8 |
+
|
9 |
+
#### Windows / Linux post-download
|
10 |
+
|
11 |
+
On Linux and Windows after it is all downloaded, you will find yourself with a zip file. When extracted, this will expose quite a large amount of scripts and executables you might want to run, so we are going to extract it to a location we have access to from the terminal, specifically `./CoppeliaSim` such that you can run the exact same commands as the ones in this README. This exact path is also required because some startup scripts, later on, rely on it being in this location.
|
12 |
+
|
13 |
+
If you're wondering what extracting to `./CoppeliaSim` means here, it is to say that you should extract to a new directory called "CoppeliaSim" that is located in the directory this README is in.
|
14 |
+
|
15 |
+
#### Mac post-download
|
16 |
+
|
17 |
+
On MacOS, after it is downloaded you will have a `coppeliaSim.app` file. Move this file to the directory this README is in, (to `./coppeliaSim.app`) so the commands below work. Note that MacOS might tell you it cannot verify the integrity of the app and refuse to run it. To give it permissions anyway, open finder in the current directory (with `open .`), and control-click the application to show the menu that lets you overwrite these settings.
|
18 |
+
|
19 |
+
### Running CoppeliaSim
|
20 |
+
|
21 |
+
#### The python venv
|
22 |
+
|
23 |
+
The first thing to do when running CoppeliaSim is to create a Python virtual environment and install some requirements on it. Technically speaking, we don't need it just jet, but CoppeliaSim gives you nice red error messages if you don't, and those can be confusing.
|
24 |
+
|
25 |
+
I am going to presume you know what a venv is, but, if you don't, you can just use the [default `venv` module](https://docs.python.org/3.8/library/venv.html), as we don't need any of the fancy features of poetry or anaconda. (In fact, Anaconda specifically is known to cause issues, and I recommend using venv or Virtualenv.) So, just `python3.8 -m venv .venv` and then `source ./venv/bin/activate` or `.\.venv\Scripts\Activate.ps1`. After this, the Python modules you need are already in `requirements.txt`, so you can just run `python -m pip install -r requirements.txt` to install those.
|
26 |
+
|
27 |
+
#### Running the executable
|
28 |
+
|
29 |
+
By default, running CoppeliaSim is as easy as just running the following from a terminal: (You should always run it from the command line, never by clicking an executable in a graphical interface.)
|
30 |
+
|
31 |
+
```sh
|
32 |
+
# On Windows:
|
33 |
+
./CoppeliaSim/coppeliaSim.exe
|
34 |
+
|
35 |
+
# Or, on MacOS:
|
36 |
+
./coppeliaSim.app/Contents/MacOS/coppeliaSim
|
37 |
+
|
38 |
+
# This one should usually work on Linux.
|
39 |
+
./CoppeliaSim/coppeliaSim
|
40 |
+
|
41 |
+
# You might need to instead run the shell script that launches this executable.
|
42 |
+
# This fixes some unexplained issues sometimes:
|
43 |
+
./CoppeliaSim/coppeliaSim.sh
|
44 |
+
```
|
45 |
+
|
46 |
+
If these commands say that the file does not exist, either you're not in the correct working directory with your terminal, or you did not extract CoppeliaSim to the correct location.
|
47 |
+
|
48 |
+
For the full startup options, please refer to the [docs](https://www.coppeliarobotics.com/helpFiles/en/commandLine.htm).
|
49 |
+
|
50 |
+
The executable takes several command line arguments, one of them being the scene to load. So, to load CoppeliaSim with a scene, for example, the `./scenes/Robobo_Scene.ttt`, you can simply run `./CoppeliaSim/coppeliaSim ./scenes/Robobo_Scene.ttt` or similar for your OS.
|
51 |
+
|
52 |
+
If all this worked, you have installed CoppeliaSim correctly. Just copy-paste this `CoppeliaSim` directory (or, on macOS, `coppeliaSim.app` file) around, from this example directory to the `full_project_setup` example to your own project directory to make sure it's available everywhere.
|
53 |
+
|
54 |
+
You can now open it, and click and move around a bit. It's admittedly a rather awkward UI, but you'll need to be somewhat familiar with it.
|
55 |
+
|
56 |
+
One thing you'll notice is little text/script icons next to some nodes in the Scene, mostly on the Robobo. These are Lua scripts that are running on the CoppeliaSim side. Double-click the script symbol to open them.
|
57 |
+
|
58 |
+
### Running with the shell scripts
|
59 |
+
|
60 |
+
To make running CoppeliaSim a bit more ergonomic, we provide some really simple shell scripts to call CoppeliaSim. In some sense, they are nothing more than some documentation on what arguments you might want to pass. You can call these like `bash ./scripts/start_coppelia_sim.sh` on Linux, `zsh ./scripts/start_coppelia_sim.zsh` on MacOS, and `.\start_coppelia_sim.ps1` on Windows. The arguments you can pass are:
|
61 |
+
|
62 |
+
- (required positional first argument) the scene you want to load, which is to say, some `.ttt` file.
|
63 |
+
- (second positional argument) The TCP port to host the ZMQ Remote API on. Which is to say, the port your Python code will use to connect to it. Passing this can be useful for training your controllers, as CoppeliaSim usually uses around 2 cores, so any system with more than that can get an advantage by running multiple in parallel, which means connecting over different ports.
|
64 |
+
- (only flag argument, but needs to be after the positional arguments) -h. If passed, CoppeliaSim will run in headless mode (which is to say, without a graphical interface,) this is also useful when training your controllers, as it makes the sim take fewer resources. CoppeliaSim itself indeed also accepts a `-H` for "true headless" mode, but beware: on some systems, this might cause issues with the camera not giving out any image.
|
65 |
+
|
66 |
+
## Lua
|
67 |
+
|
68 |
+
Wait? We are learning an entirely new programming language? Well, yes. But, don't worry. Lua is a language that is designed specifically to be easy to pick up. You'll come across it more often if you end up doing professional software development. It's a programming language designed to write config files and small add-ons in. I usually call it "sentient json" for that reason. It's famously easy to interface with from C and quite fast. For example, it's the configuration / modding language of choice for games like World of Warcraft, Roblox and Factorio, and development tools ranging from Neovim to Redis to MediaWiki (the backend of Wikipedia and WikiData). Most people who write it are just making config files, and don't really know the language either. Just... bluff your way through this one. Just [read the Wikipedia page](<https://en.wikipedia.org/wiki/Lua_(programming_language)#Features>), and copy that when you need a loop, if-statement of similar. The standard library is effectively nonexistent, and the syntax is extremely minimal, without support for classes or overloading or any other non-essential feature, so everything the language has to offer is in those few examples.
|
69 |
+
|
70 |
+
Technically, CoppeliaSim also supports Python scripts. However, this has only been since recently, and we didn't get that working in time for the course. You can try to play around with that if you want. However, I encourage you to use Lua, as that is what the Robobo itself uses, meaning you can peek at that code whenever you need to see how to get something working.
|
71 |
+
|
72 |
+
### The used Lua scripts
|
73 |
+
|
74 |
+
In this repository, you'll find the Lua scripts used in this course. The Robobo scripts are (for this course modified) versions of what is officially supplied for the Robobo. They have comments and variable names in Portuguese and generally overuse global variables. However, they are the best we have.
|
75 |
+
|
76 |
+
Next to the Robobo scripts, you'll find a `food.lua` script under the arena. This is the script used for food for task 3. You're encouraged to modify this if and when you want to change the behaviour of the food.
|
77 |
+
|
78 |
+
## Talking to CoppeliaSim from Python
|
79 |
+
|
80 |
+
For this course, most of the Python code that talks to CoppeliaSim directly is abstracted away, so you're not really required to understand how to do it. However, it might still be good to get a Hello World of sorts running, just so you know what it is doing, and to make sure that it all works. If you want a more detailed explanation of what is going on, the official source code, documentation, and examples can be found on the [GitHub repo](https://github.com/CoppeliaRobotics/zmqRemoteApi/tree/master/clients/python).
|
81 |
+
|
82 |
+
Let's create a Python file `send_commands.py` like this:
|
83 |
+
|
84 |
+
```python
|
85 |
+
from coppeliasim_zmqremoteapi_client import RemoteAPIClient
|
86 |
+
|
87 |
+
|
88 |
+
client = RemoteAPIClient(
|
89 |
+
host="localhost", # This is just to say, "this same computer"
|
90 |
+
port=23000, # The default port CoppeliaSim launches the ZMQ API at.
|
91 |
+
)
|
92 |
+
# This is Lua nonsense. We are gathering a global Lua object called "sim",
|
93 |
+
# and calling python functions on *that*.
|
94 |
+
# You can ignore it, and pretend we created a "sim" object.
|
95 |
+
sim = client.require("sim")
|
96 |
+
|
97 |
+
# Start the simulation
|
98 |
+
sim.startSimulation()
|
99 |
+
|
100 |
+
# Wait for 5 second
|
101 |
+
sim.wait(5)
|
102 |
+
|
103 |
+
# Stop the simulation
|
104 |
+
sim.stopSimulation()
|
105 |
+
```
|
106 |
+
|
107 |
+
After this, you can run CoppeliaSim (e.g. `./CoppeliaSim/coppeliaSim.sh ./scenes/Robobo_Scene.ttt`) in your venv, and, in a new terminal in the same venv run `python send_commands.py`. You should see the simulation starting (but still nothing moving, as we're not telling any robot to do anything,) and then stopping again. Nothing special.
|
108 |
+
|
109 |
+
## Troubleshooting
|
110 |
+
|
111 |
+
If something isn't working correctly (So, kind of working, but with errors), the first thing to run is its dependency error checker. This will report if all dynamically linked libraries are available (`.dll` on Windows, `.so` on Unix). Its name is `libLoadErrorCheck`, and where it lives depends on your OS and installation method. Just searching for a file of this name in the directory you extracted CoppeliaSim to should let you find it.
|
112 |
+
|
113 |
+
If this script fails on MacOS and Windows, you have found the problem, but all you can do is try to re-download and re-extract everything, and if that doesn't work, your OS is having problems and should be troubleshoot on a case-by-case basis. You should try googling some error messages.
|
114 |
+
|
115 |
+
If you really cannot get it working (and this also applies to Linux,) you can always resort to the [advanced usage](https://github.com/ci-group/learning_machines_robobo/tree/master/examples/coppelia_sim_tutorial#advanced-usage---docker) Docker running method of CoppeliaSim. This is not ideal, as it does not give you the option of seeing the GUI at all, but it at least gives you the option to run the code to make sure it does _something_. This is especially useful if there are some minor details you cannot get running (e.g. The camera won't manage to send you images on your machine, sending only black instead.)
|
116 |
+
|
117 |
+
If the script fails on Linux, you can try to install the `.so` file yourself. It might be that your distribution simply doesn't ship it by default, and it can just be installed through your package manager. If that doesn't work, you can find a working version of the file elsewhere, and put it in `./CoppeliaSim/` (Maybe modifying `$LD_LIBRARY_PATH` to get it recognised). Wrince and repeat with recursive dependencies (Find those with `ldd libSomething.so.0`)
|
118 |
+
|
119 |
+
For example, if you get this common error:
|
120 |
+
|
121 |
+
```
|
122 |
+
[Connectivity >> ZMQ remote API server@addOnScript:error] plugin simZMQ: Cannot load library [PATH]/CoppeliaSim/libsimZMQ.so: (libbsd.so.0: cannot open shared object file: No such file or directory)
|
123 |
+
```
|
124 |
+
|
125 |
+
You should be able to read that `libbsd` does not exist on this system. This error happens on Fedora because it doesn't ship with `libbsd`. Installing it (`sudo dnf install libbsd`) solves the issue.
|
126 |
+
|
127 |
+
This is a recursive dependency, so `libLoadErrorCheck` finds nothing, but `ldd ./CoppeliaSim/libsimZMQ.so` reports the `libbsd.so.0 => not found`
|
128 |
+
|
129 |
+
Note that `ldd ./CoppeliaSim/*.so | grep "not found"` is likely to find missing objects regardless. As long as there are no errors, it's not trying to load or use those missing libraries, so it's not a problem.
|
130 |
+
|
131 |
+
## Advanced usage - Docker
|
132 |
+
|
133 |
+
At some point, you might want to start CoppeliaSim inside a container. This can be because you want to train your simulation on a server somewhere, or because you simply cannot get it running on your system. For this, you can use the [official CoppeliaSim docker image](https://github.com/CoppeliaRobotics/docker-image-coppeliasim) as a guide, or you can use the one provided in this repository, which is effectively identical, but comes with runscripts to help you play around with it, if you had issues with that.
|
134 |
+
|
135 |
+
To get access to these, you have to re-build the examples (as will be the case for all "advanced usage" sections,) This deletes any changed files inside the `examples/` directory, so make sure you don't have any files saved here before running this. To re-build cd into `maintained/` of this project, and run `python3 build.py --advanced_coppelia_sim` from the `maintained/` directory.
|
136 |
+
|
137 |
+
After you have run this, you will find that the runscripts have changed to `_docker` variants, where it should be noted that (like `run.*` from the full project setup,) MacOS users with intel chips should use the `.sh` version of the runscript, the same as Linux, and MacOS users with Apple Sillicon should use the `apple_sillicon.zsh` version.
|
138 |
+
|
139 |
+
Once this example has been rebuilt, you should download the `Ubuntu 22.04` version of CoppeliaSim, and rename it to `./CoppeliaSim.tar.xz`, to make the naming consistent. After this, you should be able to call the runscripts, which will launch a headless instance of CoppeliaSim inside a freshly built container. You can test if this worked by creating and running the `send_commands.py` from earlier again.
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/.stylua.toml
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
column_width = 89
|
2 |
-
line_endings = "Unix"
|
3 |
-
indent_type = "Spaces"
|
4 |
-
indent_width = 4
|
5 |
-
quote_style = "AutoPreferDouble"
|
6 |
-
call_parentheses = "Always"
|
7 |
-
collapse_simple_statement = "Never"
|
8 |
-
|
9 |
-
[sort_requires]
|
10 |
-
enabled = true
|
|
|
1 |
+
column_width = 89
|
2 |
+
line_endings = "Unix"
|
3 |
+
indent_type = "Spaces"
|
4 |
+
indent_width = 4
|
5 |
+
quote_style = "AutoPreferDouble"
|
6 |
+
call_parentheses = "Always"
|
7 |
+
collapse_simple_statement = "Never"
|
8 |
+
|
9 |
+
[sort_requires]
|
10 |
+
enabled = true
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/arena/base.lua
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
sim = require("sim")
|
2 |
-
|
3 |
-
local sensor
|
4 |
-
local food
|
5 |
-
local distance
|
6 |
-
|
7 |
-
function sysCall_init()
|
8 |
-
sensor = sim.getObject("./Base_Proximity_sensor")
|
9 |
-
food = sim.getObject("/Food")
|
10 |
-
distance = -1.0
|
11 |
-
end
|
12 |
-
|
13 |
-
function sysCall_actuation()
|
14 |
-
detected, dist, points, obj, n = sim.checkProximitySensor(sensor, food)
|
15 |
-
if detected then
|
16 |
-
distance = dist
|
17 |
-
else
|
18 |
-
distance = -1.0
|
19 |
-
end
|
20 |
-
end
|
21 |
-
|
22 |
-
getFoodDistance = function(inIntegers, inFloats, inStrings, inBuffer)
|
23 |
-
return {}, { distance }, {}, ""
|
24 |
-
end
|
|
|
1 |
+
sim = require("sim")
|
2 |
+
|
3 |
+
local sensor
|
4 |
+
local food
|
5 |
+
local distance
|
6 |
+
|
7 |
+
function sysCall_init()
|
8 |
+
sensor = sim.getObject("./Base_Proximity_sensor")
|
9 |
+
food = sim.getObject("/Food")
|
10 |
+
distance = -1.0
|
11 |
+
end
|
12 |
+
|
13 |
+
function sysCall_actuation()
|
14 |
+
detected, dist, points, obj, n = sim.checkProximitySensor(sensor, food)
|
15 |
+
if detected then
|
16 |
+
distance = dist
|
17 |
+
else
|
18 |
+
distance = -1.0
|
19 |
+
end
|
20 |
+
end
|
21 |
+
|
22 |
+
getFoodDistance = function(inIntegers, inFloats, inStrings, inBuffer)
|
23 |
+
return {}, { distance }, {}, ""
|
24 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/arena/food.lua
CHANGED
@@ -1,121 +1,121 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
string.startswith = function(self, str)
|
4 |
-
return self:find("^" .. str) ~= nil
|
5 |
-
end
|
6 |
-
|
7 |
-
local food_collected
|
8 |
-
local already_eaten
|
9 |
-
|
10 |
-
function sysCall_init()
|
11 |
-
-- do some initialization here:
|
12 |
-
|
13 |
-
-- Make sure you read the section on "Accessing general-type objects programmatically"
|
14 |
-
-- For instance, if you wish to retrieve the handle of a scene object, use following instruction:
|
15 |
-
-- https://manual.coppeliarobotics.com/en/accessingSceneObjects.htm
|
16 |
-
|
17 |
-
print("Scene initialized")
|
18 |
-
food_collected = 0
|
19 |
-
already_eaten = {}
|
20 |
-
end
|
21 |
-
|
22 |
-
function sysCall_actuation()
|
23 |
-
-- put your actuation code here
|
24 |
-
--
|
25 |
-
-- For example:
|
26 |
-
--
|
27 |
-
-- local position=sim.getObjectPosition(handle,-1)
|
28 |
-
-- position[1]=position[1]+0.001
|
29 |
-
-- sim.setObjectPosition(handle,-1,position)
|
30 |
-
end
|
31 |
-
|
32 |
-
function sysCall_sensing()
|
33 |
-
-- put your sensing code here
|
34 |
-
end
|
35 |
-
|
36 |
-
function sysCall_cleanup()
|
37 |
-
-- do some clean-up here
|
38 |
-
end
|
39 |
-
|
40 |
-
function collect_food(handle)
|
41 |
-
-- This may be called multiple times before the object is actually moved
|
42 |
-
-- up. The bag checks to eat it, if it's not already eaten. It's not a rabbit
|
43 |
-
if not already_eaten[handle] then
|
44 |
-
--print(handle)
|
45 |
-
already_eaten[handle] = true
|
46 |
-
pos = sim.getObjectPosition(handle, -1)
|
47 |
-
pos[3] = pos[3] + 1
|
48 |
-
sim.setObjectPosition(handle, -1, pos)
|
49 |
-
food_collected = food_collected + 1
|
50 |
-
print("Collected food " .. food_collected)
|
51 |
-
end
|
52 |
-
end
|
53 |
-
|
54 |
-
function sysCall_contactCallback(inData)
|
55 |
-
h1 = sim.getObjectName(inData.handle1)
|
56 |
-
--h2 = sim.getObjectName(inData.handle2)
|
57 |
-
if h1:startswith("Food") then
|
58 |
-
--print( h1 .. " -> " .. h2)
|
59 |
-
collect_food(inData.handle1)
|
60 |
-
end
|
61 |
-
--if h2:startswith("Food") then
|
62 |
-
-- print( h1 .. " <- " .. h2)
|
63 |
-
--end
|
64 |
-
return outData
|
65 |
-
end
|
66 |
-
|
67 |
-
function remote_get_collected_food(inInts, inFloats, inStrings, inBuffer)
|
68 |
-
-- inInts, inFloats and inStrings are tables
|
69 |
-
-- inBuffer is a string
|
70 |
-
|
71 |
-
-- Perform any type of operation here.
|
72 |
-
|
73 |
-
-- Always return 3 tables and a string, e.g.:
|
74 |
-
return { food_collected }, {}, {}, ""
|
75 |
-
end
|
76 |
-
|
77 |
-
-- You can define additional system calls here:
|
78 |
-
--[[
|
79 |
-
function sysCall_suspend()
|
80 |
-
end
|
81 |
-
|
82 |
-
function sysCall_resume()
|
83 |
-
end
|
84 |
-
|
85 |
-
function sysCall_dynCallback(inData)
|
86 |
-
end
|
87 |
-
|
88 |
-
function sysCall_jointCallback(inData)
|
89 |
-
return outData
|
90 |
-
end
|
91 |
-
|
92 |
-
function sysCall_contactCallback(inData)
|
93 |
-
return outData
|
94 |
-
end
|
95 |
-
|
96 |
-
function sysCall_beforeCopy(inData)
|
97 |
-
for key,value in pairs(inData.objectHandles) do
|
98 |
-
print("Object with handle "..key.." will be copied")
|
99 |
-
end
|
100 |
-
end
|
101 |
-
|
102 |
-
function sysCall_afterCopy(inData)
|
103 |
-
for key,value in pairs(inData.objectHandles) do
|
104 |
-
print("Object with handle "..key.." was copied")
|
105 |
-
end
|
106 |
-
end
|
107 |
-
|
108 |
-
function sysCall_beforeDelete(inData)
|
109 |
-
for key,value in pairs(inData.objectHandles) do
|
110 |
-
print("Object with handle "..key.." will be deleted")
|
111 |
-
end
|
112 |
-
-- inData.allObjects indicates if all objects in the scene will be deleted
|
113 |
-
end
|
114 |
-
|
115 |
-
function sysCall_afterDelete(inData)
|
116 |
-
for key,value in pairs(inData.objectHandles) do
|
117 |
-
print("Object with handle "..key.." was deleted")
|
118 |
-
end
|
119 |
-
-- inData.allObjects indicates if all objects in the scene were deleted
|
120 |
-
end
|
121 |
-
--]]
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
string.startswith = function(self, str)
|
4 |
+
return self:find("^" .. str) ~= nil
|
5 |
+
end
|
6 |
+
|
7 |
+
local food_collected
|
8 |
+
local already_eaten
|
9 |
+
|
10 |
+
function sysCall_init()
|
11 |
+
-- do some initialization here:
|
12 |
+
|
13 |
+
-- Make sure you read the section on "Accessing general-type objects programmatically"
|
14 |
+
-- For instance, if you wish to retrieve the handle of a scene object, use following instruction:
|
15 |
+
-- https://manual.coppeliarobotics.com/en/accessingSceneObjects.htm
|
16 |
+
|
17 |
+
print("Scene initialized")
|
18 |
+
food_collected = 0
|
19 |
+
already_eaten = {}
|
20 |
+
end
|
21 |
+
|
22 |
+
function sysCall_actuation()
|
23 |
+
-- put your actuation code here
|
24 |
+
--
|
25 |
+
-- For example:
|
26 |
+
--
|
27 |
+
-- local position=sim.getObjectPosition(handle,-1)
|
28 |
+
-- position[1]=position[1]+0.001
|
29 |
+
-- sim.setObjectPosition(handle,-1,position)
|
30 |
+
end
|
31 |
+
|
32 |
+
function sysCall_sensing()
|
33 |
+
-- put your sensing code here
|
34 |
+
end
|
35 |
+
|
36 |
+
function sysCall_cleanup()
|
37 |
+
-- do some clean-up here
|
38 |
+
end
|
39 |
+
|
40 |
+
function collect_food(handle)
|
41 |
+
-- This may be called multiple times before the object is actually moved
|
42 |
+
-- up. The bag checks to eat it, if it's not already eaten. It's not a rabbit
|
43 |
+
if not already_eaten[handle] then
|
44 |
+
--print(handle)
|
45 |
+
already_eaten[handle] = true
|
46 |
+
pos = sim.getObjectPosition(handle, -1)
|
47 |
+
pos[3] = pos[3] + 1
|
48 |
+
sim.setObjectPosition(handle, -1, pos)
|
49 |
+
food_collected = food_collected + 1
|
50 |
+
print("Collected food " .. food_collected)
|
51 |
+
end
|
52 |
+
end
|
53 |
+
|
54 |
+
function sysCall_contactCallback(inData)
|
55 |
+
h1 = sim.getObjectName(inData.handle1)
|
56 |
+
--h2 = sim.getObjectName(inData.handle2)
|
57 |
+
if h1:startswith("Food") then
|
58 |
+
--print( h1 .. " -> " .. h2)
|
59 |
+
collect_food(inData.handle1)
|
60 |
+
end
|
61 |
+
--if h2:startswith("Food") then
|
62 |
+
-- print( h1 .. " <- " .. h2)
|
63 |
+
--end
|
64 |
+
return outData
|
65 |
+
end
|
66 |
+
|
67 |
+
function remote_get_collected_food(inInts, inFloats, inStrings, inBuffer)
|
68 |
+
-- inInts, inFloats and inStrings are tables
|
69 |
+
-- inBuffer is a string
|
70 |
+
|
71 |
+
-- Perform any type of operation here.
|
72 |
+
|
73 |
+
-- Always return 3 tables and a string, e.g.:
|
74 |
+
return { food_collected }, {}, {}, ""
|
75 |
+
end
|
76 |
+
|
77 |
+
-- You can define additional system calls here:
|
78 |
+
--[[
|
79 |
+
function sysCall_suspend()
|
80 |
+
end
|
81 |
+
|
82 |
+
function sysCall_resume()
|
83 |
+
end
|
84 |
+
|
85 |
+
function sysCall_dynCallback(inData)
|
86 |
+
end
|
87 |
+
|
88 |
+
function sysCall_jointCallback(inData)
|
89 |
+
return outData
|
90 |
+
end
|
91 |
+
|
92 |
+
function sysCall_contactCallback(inData)
|
93 |
+
return outData
|
94 |
+
end
|
95 |
+
|
96 |
+
function sysCall_beforeCopy(inData)
|
97 |
+
for key,value in pairs(inData.objectHandles) do
|
98 |
+
print("Object with handle "..key.." will be copied")
|
99 |
+
end
|
100 |
+
end
|
101 |
+
|
102 |
+
function sysCall_afterCopy(inData)
|
103 |
+
for key,value in pairs(inData.objectHandles) do
|
104 |
+
print("Object with handle "..key.." was copied")
|
105 |
+
end
|
106 |
+
end
|
107 |
+
|
108 |
+
function sysCall_beforeDelete(inData)
|
109 |
+
for key,value in pairs(inData.objectHandles) do
|
110 |
+
print("Object with handle "..key.." will be deleted")
|
111 |
+
end
|
112 |
+
-- inData.allObjects indicates if all objects in the scene will be deleted
|
113 |
+
end
|
114 |
+
|
115 |
+
function sysCall_afterDelete(inData)
|
116 |
+
for key,value in pairs(inData.objectHandles) do
|
117 |
+
print("Object with handle "..key.." was deleted")
|
118 |
+
end
|
119 |
+
-- inData.allObjects indicates if all objects in the scene were deleted
|
120 |
+
end
|
121 |
+
--]]
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/arena/food_random.lua
CHANGED
@@ -1,208 +1,208 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
string.startswith = function(self, str)
|
4 |
-
return self:find("^" .. str) ~= nil
|
5 |
-
end
|
6 |
-
|
7 |
-
local food_collected
|
8 |
-
local already_eaten
|
9 |
-
|
10 |
-
function sysCall_init()
|
11 |
-
-- do some initialization here:
|
12 |
-
|
13 |
-
-- Make sure you read the section on "Accessing general-type objects programmatically"
|
14 |
-
-- For instance, if you wish to retrieve the handle of a scene object, use following instruction:
|
15 |
-
-- https://manual.coppeliarobotics.com/en/accessingSceneObjects.htm
|
16 |
-
|
17 |
-
local handle
|
18 |
-
local pos
|
19 |
-
|
20 |
-
handle = sim.getObject("/Food")
|
21 |
-
pos = sim.getObjectPosition(handle, -1)
|
22 |
-
pos[1] = ((math.random() * 2) - 4.1)
|
23 |
-
pos[2] = ((math.random() * 2) - 0.2)
|
24 |
-
if
|
25 |
-
pos[2] > 0.6
|
26 |
-
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
27 |
-
then
|
28 |
-
pos[2] = pos[2] + 0.5
|
29 |
-
end
|
30 |
-
sim.setObjectPosition(handle, -1, pos)
|
31 |
-
|
32 |
-
handle = sim.getObject("/Food0")
|
33 |
-
pos = sim.getObjectPosition(handle, -1)
|
34 |
-
pos[1] = ((math.random() * 2) - 4.1)
|
35 |
-
pos[2] = ((math.random() * 2) - 0.2)
|
36 |
-
if
|
37 |
-
pos[2] > 0.6
|
38 |
-
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
39 |
-
then
|
40 |
-
pos[2] = pos[2] + 0.5
|
41 |
-
end
|
42 |
-
sim.setObjectPosition(handle, -1, pos)
|
43 |
-
|
44 |
-
handle = sim.getObject("/Food1")
|
45 |
-
pos = sim.getObjectPosition(handle, -1)
|
46 |
-
pos[1] = ((math.random() * 2) - 4.1)
|
47 |
-
pos[2] = ((math.random() * 2) - 0.2)
|
48 |
-
if
|
49 |
-
pos[2] > 0.6
|
50 |
-
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
51 |
-
then
|
52 |
-
pos[2] = pos[2] + 0.5
|
53 |
-
end
|
54 |
-
sim.setObjectPosition(handle, -1, pos)
|
55 |
-
|
56 |
-
handle = sim.getObject("/Food2")
|
57 |
-
pos = sim.getObjectPosition(handle, -1)
|
58 |
-
pos[1] = ((math.random() * 2) - 4.1)
|
59 |
-
if
|
60 |
-
pos[2] > 0.6
|
61 |
-
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
62 |
-
then
|
63 |
-
pos[1] = pos[1] + 0.6
|
64 |
-
end
|
65 |
-
pos[2] = ((math.random() * 2) - 0.2)
|
66 |
-
if pos[2] > 0.6 and pos[2] < 1.1 then
|
67 |
-
pos[2] = pos[2] + 0.5
|
68 |
-
end
|
69 |
-
sim.setObjectPosition(handle, -1, pos)
|
70 |
-
|
71 |
-
handle = sim.getObject("/Food3")
|
72 |
-
pos = sim.getObjectPosition(handle, -1)
|
73 |
-
pos[1] = ((math.random() * 2) - 4.1)
|
74 |
-
pos[2] = ((math.random() * 2) - 0.2)
|
75 |
-
if
|
76 |
-
pos[2] > 0.6
|
77 |
-
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
78 |
-
then
|
79 |
-
pos[2] = pos[2] + 0.5
|
80 |
-
end
|
81 |
-
sim.setObjectPosition(handle, -1, pos)
|
82 |
-
|
83 |
-
handle = sim.getObject("/Food4")
|
84 |
-
pos = sim.getObjectPosition(handle, -1)
|
85 |
-
pos[1] = ((math.random() * 2) - 4.1)
|
86 |
-
pos[2] = ((math.random() * 2) - 0.2)
|
87 |
-
if
|
88 |
-
pos[2] > 0.6
|
89 |
-
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
90 |
-
then
|
91 |
-
pos[2] = pos[2] + 0.5
|
92 |
-
end
|
93 |
-
sim.setObjectPosition(handle, -1, pos)
|
94 |
-
|
95 |
-
handle = sim.getObject("/Food5")
|
96 |
-
pos = sim.getObjectPosition(handle, -1)
|
97 |
-
pos[1] = ((math.random() * 2) - 4.1)
|
98 |
-
pos[2] = ((math.random() * 2) - 0.2)
|
99 |
-
if pos[2] > 0.6 and pos[2] < 1.1 then
|
100 |
-
pos[2] = pos[2] + 0.5
|
101 |
-
end
|
102 |
-
sim.setObjectPosition(handle, -1, pos)
|
103 |
-
|
104 |
-
food_collected = 0
|
105 |
-
already_eaten = {}
|
106 |
-
print("Scene initialized")
|
107 |
-
end
|
108 |
-
|
109 |
-
function sysCall_actuation()
|
110 |
-
-- put your actuation code here
|
111 |
-
--
|
112 |
-
-- For example:
|
113 |
-
--
|
114 |
-
-- local position=sim.getObjectPosition(handle,-1)
|
115 |
-
-- position[1]=position[1]+0.001
|
116 |
-
-- sim.setObjectPosition(handle,-1,position)
|
117 |
-
end
|
118 |
-
|
119 |
-
function sysCall_sensing()
|
120 |
-
-- put your sensing code here
|
121 |
-
end
|
122 |
-
|
123 |
-
function sysCall_cleanup()
|
124 |
-
-- do some clean-up here
|
125 |
-
end
|
126 |
-
|
127 |
-
function collect_food(handle)
|
128 |
-
-- This may be called multiple times before the object is actually moved
|
129 |
-
-- up. The bag checks to eat it, if it's not already eaten. It's not a rabbit
|
130 |
-
if not already_eaten[handle] then
|
131 |
-
--print(handle)
|
132 |
-
already_eaten[handle] = true
|
133 |
-
local pos = sim.getObjectPosition(handle, -1)
|
134 |
-
pos[3] = pos[3] + 1
|
135 |
-
sim.setObjectPosition(handle, -1, pos)
|
136 |
-
food_collected = food_collected + 1
|
137 |
-
print("Collected food " .. food_collected)
|
138 |
-
end
|
139 |
-
end
|
140 |
-
|
141 |
-
function sysCall_contactCallback(inData)
|
142 |
-
h1 = sim.getObjectName(inData.handle1)
|
143 |
-
--h2 = sim.getObjectName(inData.handle2)
|
144 |
-
if h1:startswith("Food") then
|
145 |
-
--print( h1 .. " -> " .. h2)
|
146 |
-
collect_food(inData.handle1)
|
147 |
-
end
|
148 |
-
--if h2:startswith("Food") then
|
149 |
-
-- print( h1 .. " <- " .. h2)
|
150 |
-
--end
|
151 |
-
return outData
|
152 |
-
end
|
153 |
-
|
154 |
-
function remote_get_collected_food(inInts, inFloats, inStrings, inBuffer)
|
155 |
-
-- inInts, inFloats and inStrings are tables
|
156 |
-
-- inBuffer is a string
|
157 |
-
|
158 |
-
-- Perform any type of operation here.
|
159 |
-
|
160 |
-
-- Always return 3 tables and a string, e.g.:
|
161 |
-
return { food_collected }, {}, {}, ""
|
162 |
-
end
|
163 |
-
|
164 |
-
-- You can define additional system calls here:
|
165 |
-
--[[
|
166 |
-
function sysCall_suspend()
|
167 |
-
end
|
168 |
-
|
169 |
-
function sysCall_resume()
|
170 |
-
end
|
171 |
-
|
172 |
-
function sysCall_dynCallback(inData)
|
173 |
-
end
|
174 |
-
|
175 |
-
function sysCall_jointCallback(inData)
|
176 |
-
return outData
|
177 |
-
end
|
178 |
-
|
179 |
-
function sysCall_contactCallback(inData)
|
180 |
-
return outData
|
181 |
-
end
|
182 |
-
|
183 |
-
function sysCall_beforeCopy(inData)
|
184 |
-
for key,value in pairs(inData.objectHandles) do
|
185 |
-
print("Object with handle "..key.." will be copied")
|
186 |
-
end
|
187 |
-
end
|
188 |
-
|
189 |
-
function sysCall_afterCopy(inData)
|
190 |
-
for key,value in pairs(inData.objectHandles) do
|
191 |
-
print("Object with handle "..key.." was copied")
|
192 |
-
end
|
193 |
-
end
|
194 |
-
|
195 |
-
function sysCall_beforeDelete(inData)
|
196 |
-
for key,value in pairs(inData.objectHandles) do
|
197 |
-
print("Object with handle "..key.." will be deleted")
|
198 |
-
end
|
199 |
-
-- inData.allObjects indicates if all objects in the scene will be deleted
|
200 |
-
end
|
201 |
-
|
202 |
-
function sysCall_afterDelete(inData)
|
203 |
-
for key,value in pairs(inData.objectHandles) do
|
204 |
-
print("Object with handle "..key.." was deleted")
|
205 |
-
end
|
206 |
-
-- inData.allObjects indicates if all objects in the scene were deleted
|
207 |
-
end
|
208 |
-
--]]
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
string.startswith = function(self, str)
|
4 |
+
return self:find("^" .. str) ~= nil
|
5 |
+
end
|
6 |
+
|
7 |
+
local food_collected
|
8 |
+
local already_eaten
|
9 |
+
|
10 |
+
function sysCall_init()
|
11 |
+
-- do some initialization here:
|
12 |
+
|
13 |
+
-- Make sure you read the section on "Accessing general-type objects programmatically"
|
14 |
+
-- For instance, if you wish to retrieve the handle of a scene object, use following instruction:
|
15 |
+
-- https://manual.coppeliarobotics.com/en/accessingSceneObjects.htm
|
16 |
+
|
17 |
+
local handle
|
18 |
+
local pos
|
19 |
+
|
20 |
+
handle = sim.getObject("/Food")
|
21 |
+
pos = sim.getObjectPosition(handle, -1)
|
22 |
+
pos[1] = ((math.random() * 2) - 4.1)
|
23 |
+
pos[2] = ((math.random() * 2) - 0.2)
|
24 |
+
if
|
25 |
+
pos[2] > 0.6
|
26 |
+
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
27 |
+
then
|
28 |
+
pos[2] = pos[2] + 0.5
|
29 |
+
end
|
30 |
+
sim.setObjectPosition(handle, -1, pos)
|
31 |
+
|
32 |
+
handle = sim.getObject("/Food0")
|
33 |
+
pos = sim.getObjectPosition(handle, -1)
|
34 |
+
pos[1] = ((math.random() * 2) - 4.1)
|
35 |
+
pos[2] = ((math.random() * 2) - 0.2)
|
36 |
+
if
|
37 |
+
pos[2] > 0.6
|
38 |
+
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
39 |
+
then
|
40 |
+
pos[2] = pos[2] + 0.5
|
41 |
+
end
|
42 |
+
sim.setObjectPosition(handle, -1, pos)
|
43 |
+
|
44 |
+
handle = sim.getObject("/Food1")
|
45 |
+
pos = sim.getObjectPosition(handle, -1)
|
46 |
+
pos[1] = ((math.random() * 2) - 4.1)
|
47 |
+
pos[2] = ((math.random() * 2) - 0.2)
|
48 |
+
if
|
49 |
+
pos[2] > 0.6
|
50 |
+
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
51 |
+
then
|
52 |
+
pos[2] = pos[2] + 0.5
|
53 |
+
end
|
54 |
+
sim.setObjectPosition(handle, -1, pos)
|
55 |
+
|
56 |
+
handle = sim.getObject("/Food2")
|
57 |
+
pos = sim.getObjectPosition(handle, -1)
|
58 |
+
pos[1] = ((math.random() * 2) - 4.1)
|
59 |
+
if
|
60 |
+
pos[2] > 0.6
|
61 |
+
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
62 |
+
then
|
63 |
+
pos[1] = pos[1] + 0.6
|
64 |
+
end
|
65 |
+
pos[2] = ((math.random() * 2) - 0.2)
|
66 |
+
if pos[2] > 0.6 and pos[2] < 1.1 then
|
67 |
+
pos[2] = pos[2] + 0.5
|
68 |
+
end
|
69 |
+
sim.setObjectPosition(handle, -1, pos)
|
70 |
+
|
71 |
+
handle = sim.getObject("/Food3")
|
72 |
+
pos = sim.getObjectPosition(handle, -1)
|
73 |
+
pos[1] = ((math.random() * 2) - 4.1)
|
74 |
+
pos[2] = ((math.random() * 2) - 0.2)
|
75 |
+
if
|
76 |
+
pos[2] > 0.6
|
77 |
+
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
78 |
+
then
|
79 |
+
pos[2] = pos[2] + 0.5
|
80 |
+
end
|
81 |
+
sim.setObjectPosition(handle, -1, pos)
|
82 |
+
|
83 |
+
handle = sim.getObject("/Food4")
|
84 |
+
pos = sim.getObjectPosition(handle, -1)
|
85 |
+
pos[1] = ((math.random() * 2) - 4.1)
|
86 |
+
pos[2] = ((math.random() * 2) - 0.2)
|
87 |
+
if
|
88 |
+
pos[2] > 0.6
|
89 |
+
and pos[2] < 1.1 --This checks if the Y-coordinate overlaps with the Robobo Y-coordinate and moves it if it does.
|
90 |
+
then
|
91 |
+
pos[2] = pos[2] + 0.5
|
92 |
+
end
|
93 |
+
sim.setObjectPosition(handle, -1, pos)
|
94 |
+
|
95 |
+
handle = sim.getObject("/Food5")
|
96 |
+
pos = sim.getObjectPosition(handle, -1)
|
97 |
+
pos[1] = ((math.random() * 2) - 4.1)
|
98 |
+
pos[2] = ((math.random() * 2) - 0.2)
|
99 |
+
if pos[2] > 0.6 and pos[2] < 1.1 then
|
100 |
+
pos[2] = pos[2] + 0.5
|
101 |
+
end
|
102 |
+
sim.setObjectPosition(handle, -1, pos)
|
103 |
+
|
104 |
+
food_collected = 0
|
105 |
+
already_eaten = {}
|
106 |
+
print("Scene initialized")
|
107 |
+
end
|
108 |
+
|
109 |
+
function sysCall_actuation()
|
110 |
+
-- put your actuation code here
|
111 |
+
--
|
112 |
+
-- For example:
|
113 |
+
--
|
114 |
+
-- local position=sim.getObjectPosition(handle,-1)
|
115 |
+
-- position[1]=position[1]+0.001
|
116 |
+
-- sim.setObjectPosition(handle,-1,position)
|
117 |
+
end
|
118 |
+
|
119 |
+
function sysCall_sensing()
|
120 |
+
-- put your sensing code here
|
121 |
+
end
|
122 |
+
|
123 |
+
function sysCall_cleanup()
|
124 |
+
-- do some clean-up here
|
125 |
+
end
|
126 |
+
|
127 |
+
function collect_food(handle)
|
128 |
+
-- This may be called multiple times before the object is actually moved
|
129 |
+
-- up. The bag checks to eat it, if it's not already eaten. It's not a rabbit
|
130 |
+
if not already_eaten[handle] then
|
131 |
+
--print(handle)
|
132 |
+
already_eaten[handle] = true
|
133 |
+
local pos = sim.getObjectPosition(handle, -1)
|
134 |
+
pos[3] = pos[3] + 1
|
135 |
+
sim.setObjectPosition(handle, -1, pos)
|
136 |
+
food_collected = food_collected + 1
|
137 |
+
print("Collected food " .. food_collected)
|
138 |
+
end
|
139 |
+
end
|
140 |
+
|
141 |
+
function sysCall_contactCallback(inData)
|
142 |
+
h1 = sim.getObjectName(inData.handle1)
|
143 |
+
--h2 = sim.getObjectName(inData.handle2)
|
144 |
+
if h1:startswith("Food") then
|
145 |
+
--print( h1 .. " -> " .. h2)
|
146 |
+
collect_food(inData.handle1)
|
147 |
+
end
|
148 |
+
--if h2:startswith("Food") then
|
149 |
+
-- print( h1 .. " <- " .. h2)
|
150 |
+
--end
|
151 |
+
return outData
|
152 |
+
end
|
153 |
+
|
154 |
+
function remote_get_collected_food(inInts, inFloats, inStrings, inBuffer)
|
155 |
+
-- inInts, inFloats and inStrings are tables
|
156 |
+
-- inBuffer is a string
|
157 |
+
|
158 |
+
-- Perform any type of operation here.
|
159 |
+
|
160 |
+
-- Always return 3 tables and a string, e.g.:
|
161 |
+
return { food_collected }, {}, {}, ""
|
162 |
+
end
|
163 |
+
|
164 |
+
-- You can define additional system calls here:
|
165 |
+
--[[
|
166 |
+
function sysCall_suspend()
|
167 |
+
end
|
168 |
+
|
169 |
+
function sysCall_resume()
|
170 |
+
end
|
171 |
+
|
172 |
+
function sysCall_dynCallback(inData)
|
173 |
+
end
|
174 |
+
|
175 |
+
function sysCall_jointCallback(inData)
|
176 |
+
return outData
|
177 |
+
end
|
178 |
+
|
179 |
+
function sysCall_contactCallback(inData)
|
180 |
+
return outData
|
181 |
+
end
|
182 |
+
|
183 |
+
function sysCall_beforeCopy(inData)
|
184 |
+
for key,value in pairs(inData.objectHandles) do
|
185 |
+
print("Object with handle "..key.." will be copied")
|
186 |
+
end
|
187 |
+
end
|
188 |
+
|
189 |
+
function sysCall_afterCopy(inData)
|
190 |
+
for key,value in pairs(inData.objectHandles) do
|
191 |
+
print("Object with handle "..key.." was copied")
|
192 |
+
end
|
193 |
+
end
|
194 |
+
|
195 |
+
function sysCall_beforeDelete(inData)
|
196 |
+
for key,value in pairs(inData.objectHandles) do
|
197 |
+
print("Object with handle "..key.." will be deleted")
|
198 |
+
end
|
199 |
+
-- inData.allObjects indicates if all objects in the scene will be deleted
|
200 |
+
end
|
201 |
+
|
202 |
+
function sysCall_afterDelete(inData)
|
203 |
+
for key,value in pairs(inData.objectHandles) do
|
204 |
+
print("Object with handle "..key.." was deleted")
|
205 |
+
end
|
206 |
+
-- inData.allObjects indicates if all objects in the scene were deleted
|
207 |
+
end
|
208 |
+
--]]
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/back_l.lua
CHANGED
@@ -1,73 +1,73 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init()
|
4 |
-
-- do some initialization here
|
5 |
-
Back_L = sim.getObject("../Back_L")
|
6 |
-
Back_R = sim.getObject("../Back_R")
|
7 |
-
Front_C = sim.getObject("../Front_C")
|
8 |
-
Front_L = sim.getObject("../Front_L")
|
9 |
-
Front_LL = sim.getObject("../Front_LL")
|
10 |
-
Front_R = sim.getObject("../Front_R")
|
11 |
-
Front_RR = sim.getObject("../Front_RR")
|
12 |
-
end
|
13 |
-
|
14 |
-
function sysCall_cleanup()
|
15 |
-
-- do some clean-up here
|
16 |
-
sim.setShapeColor(Back_L, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
17 |
-
sim.setShapeColor(Back_R, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
18 |
-
sim.setShapeColor(Front_C, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
19 |
-
sim.setShapeColor(Front_L, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
20 |
-
sim.setShapeColor(Front_LL, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
21 |
-
sim.setShapeColor(Front_R, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
22 |
-
sim.setShapeColor(Front_RR, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
23 |
-
end
|
24 |
-
|
25 |
-
setLEDColor = function(inIntegers, inFloats, parametros, inBuffer) --parametros=[led,color]
|
26 |
-
led = parametros[1]
|
27 |
-
color = parametros[2]
|
28 |
-
--comprobamos el color
|
29 |
-
if color == "off" then
|
30 |
-
rgb = { 1, 1, 1 }
|
31 |
-
elseif color == "white" then
|
32 |
-
rgb = { 1, 1, 1 }
|
33 |
-
elseif color == "red" then
|
34 |
-
rgb = { 1, 0, 0 }
|
35 |
-
elseif color == "blue" then
|
36 |
-
rgb = { 0, 0, 1 }
|
37 |
-
elseif color == "cyan" then
|
38 |
-
rgb = { 0, 1, 1 }
|
39 |
-
elseif color == "magenta" then
|
40 |
-
rgb = { 1, 0, 1 }
|
41 |
-
elseif color == "yellow" then
|
42 |
-
rgb = { 1, 1, 0 }
|
43 |
-
elseif color == "green" then
|
44 |
-
rgb = { 0, 1, 0 }
|
45 |
-
elseif color == "orange" then
|
46 |
-
rgb = { 1, 0.5, 0 }
|
47 |
-
end
|
48 |
-
--encendemos los led correspondientes
|
49 |
-
if led == "Back_L" then
|
50 |
-
sim.setShapeColor(Back_L, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
51 |
-
elseif led == "Back_R" then
|
52 |
-
sim.setShapeColor(Back_R, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
53 |
-
elseif led == "Front_C" then
|
54 |
-
sim.setShapeColor(Front_C, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
55 |
-
elseif led == "Front_L" then
|
56 |
-
sim.setShapeColor(Front_L, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
57 |
-
elseif led == "Front_LL" then
|
58 |
-
sim.setShapeColor(Front_LL, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
59 |
-
elseif led == "Front_R" then
|
60 |
-
sim.setShapeColor(Front_R, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
61 |
-
elseif led == "Front_RR" then
|
62 |
-
sim.setShapeColor(Front_RR, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
63 |
-
elseif led == "all" then
|
64 |
-
sim.setShapeColor(Back_L, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
65 |
-
sim.setShapeColor(Back_R, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
66 |
-
sim.setShapeColor(Front_C, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
67 |
-
sim.setShapeColor(Front_L, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
68 |
-
sim.setShapeColor(Front_LL, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
69 |
-
sim.setShapeColor(Front_R, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
70 |
-
sim.setShapeColor(Front_RR, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
71 |
-
end
|
72 |
-
return {}, {}, {}, ""
|
73 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init()
|
4 |
+
-- do some initialization here
|
5 |
+
Back_L = sim.getObject("../Back_L")
|
6 |
+
Back_R = sim.getObject("../Back_R")
|
7 |
+
Front_C = sim.getObject("../Front_C")
|
8 |
+
Front_L = sim.getObject("../Front_L")
|
9 |
+
Front_LL = sim.getObject("../Front_LL")
|
10 |
+
Front_R = sim.getObject("../Front_R")
|
11 |
+
Front_RR = sim.getObject("../Front_RR")
|
12 |
+
end
|
13 |
+
|
14 |
+
function sysCall_cleanup()
|
15 |
+
-- do some clean-up here
|
16 |
+
sim.setShapeColor(Back_L, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
17 |
+
sim.setShapeColor(Back_R, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
18 |
+
sim.setShapeColor(Front_C, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
19 |
+
sim.setShapeColor(Front_L, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
20 |
+
sim.setShapeColor(Front_LL, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
21 |
+
sim.setShapeColor(Front_R, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
22 |
+
sim.setShapeColor(Front_RR, nil, sim.colorcomponent_ambient_diffuse, { 1, 1, 1 })
|
23 |
+
end
|
24 |
+
|
25 |
+
setLEDColor = function(inIntegers, inFloats, parametros, inBuffer) --parametros=[led,color]
|
26 |
+
led = parametros[1]
|
27 |
+
color = parametros[2]
|
28 |
+
--comprobamos el color
|
29 |
+
if color == "off" then
|
30 |
+
rgb = { 1, 1, 1 }
|
31 |
+
elseif color == "white" then
|
32 |
+
rgb = { 1, 1, 1 }
|
33 |
+
elseif color == "red" then
|
34 |
+
rgb = { 1, 0, 0 }
|
35 |
+
elseif color == "blue" then
|
36 |
+
rgb = { 0, 0, 1 }
|
37 |
+
elseif color == "cyan" then
|
38 |
+
rgb = { 0, 1, 1 }
|
39 |
+
elseif color == "magenta" then
|
40 |
+
rgb = { 1, 0, 1 }
|
41 |
+
elseif color == "yellow" then
|
42 |
+
rgb = { 1, 1, 0 }
|
43 |
+
elseif color == "green" then
|
44 |
+
rgb = { 0, 1, 0 }
|
45 |
+
elseif color == "orange" then
|
46 |
+
rgb = { 1, 0.5, 0 }
|
47 |
+
end
|
48 |
+
--encendemos los led correspondientes
|
49 |
+
if led == "Back_L" then
|
50 |
+
sim.setShapeColor(Back_L, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
51 |
+
elseif led == "Back_R" then
|
52 |
+
sim.setShapeColor(Back_R, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
53 |
+
elseif led == "Front_C" then
|
54 |
+
sim.setShapeColor(Front_C, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
55 |
+
elseif led == "Front_L" then
|
56 |
+
sim.setShapeColor(Front_L, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
57 |
+
elseif led == "Front_LL" then
|
58 |
+
sim.setShapeColor(Front_LL, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
59 |
+
elseif led == "Front_R" then
|
60 |
+
sim.setShapeColor(Front_R, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
61 |
+
elseif led == "Front_RR" then
|
62 |
+
sim.setShapeColor(Front_RR, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
63 |
+
elseif led == "all" then
|
64 |
+
sim.setShapeColor(Back_L, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
65 |
+
sim.setShapeColor(Back_R, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
66 |
+
sim.setShapeColor(Front_C, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
67 |
+
sim.setShapeColor(Front_L, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
68 |
+
sim.setShapeColor(Front_LL, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
69 |
+
sim.setShapeColor(Front_R, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
70 |
+
sim.setShapeColor(Front_RR, nil, sim.colorcomponent_ambient_diffuse, rgb)
|
71 |
+
end
|
72 |
+
return {}, {}, {}, ""
|
73 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/force_snsort_slicer.lua
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init() end
|
4 |
-
|
5 |
-
function sysCall_trigger(inData)
|
6 |
-
-- callback function automatically added for backward compatibility
|
7 |
-
sim.breakForceSensor(inData.handle)
|
8 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init() end
|
4 |
+
|
5 |
+
function sysCall_trigger(inData)
|
6 |
+
-- callback function automatically added for backward compatibility
|
7 |
+
sim.breakForceSensor(inData.handle)
|
8 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/ir_back_c.lua
CHANGED
@@ -1,838 +1,838 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init()
|
4 |
-
IR_Back_L = sim.getObject("../IR_Back_L")
|
5 |
-
IR_Back_L2 = sim.getObject("../IR_Back_L2")
|
6 |
-
IR_Back_L3 = sim.getObject("../IR_Back_L3")
|
7 |
-
IR_Back_L4 = sim.getObject("../IR_Back_L4")
|
8 |
-
IR_Back_L5 = sim.getObject("../IR_Back_L5")
|
9 |
-
IR_Back_L6 = sim.getObject("../IR_Back_L6")
|
10 |
-
IR_Back_L7 = sim.getObject("../IR_Back_L7")
|
11 |
-
IR_Back_L8 = sim.getObject("../IR_Back_L8")
|
12 |
-
IR_Back_L9 = sim.getObject("../IR_Back_L9")
|
13 |
-
IR_Back_L10 = sim.getObject("../IR_Back_L10")
|
14 |
-
IR_Back_L11 = sim.getObject("../IR_Back_L11")
|
15 |
-
IR_Back_L12 = sim.getObject("../IR_Back_L12")
|
16 |
-
IR_Back_L13 = sim.getObject("../IR_Back_L13")
|
17 |
-
IR_Back_L14 = sim.getObject("../IR_Back_L14")
|
18 |
-
IR_Back_L15 = sim.getObject("../IR_Back_L15")
|
19 |
-
IR_Back_L16 = sim.getObject("../IR_Back_L16")
|
20 |
-
IR_Back_R = sim.getObject("../IR_Back_R")
|
21 |
-
IR_Back_R2 = sim.getObject("../IR_Back_R2")
|
22 |
-
IR_Back_R3 = sim.getObject("../IR_Back_R3")
|
23 |
-
IR_Back_R4 = sim.getObject("../IR_Back_R4")
|
24 |
-
IR_Back_R5 = sim.getObject("../IR_Back_R5")
|
25 |
-
IR_Back_R6 = sim.getObject("../IR_Back_R6")
|
26 |
-
IR_Back_R7 = sim.getObject("../IR_Back_R7")
|
27 |
-
IR_Back_R8 = sim.getObject("../IR_Back_R8")
|
28 |
-
IR_Back_R9 = sim.getObject("../IR_Back_R9")
|
29 |
-
IR_Back_R10 = sim.getObject("../IR_Back_R10")
|
30 |
-
IR_Back_R11 = sim.getObject("../IR_Back_R11")
|
31 |
-
IR_Back_R12 = sim.getObject("../IR_Back_R12")
|
32 |
-
IR_Back_R13 = sim.getObject("../IR_Back_R13")
|
33 |
-
IR_Back_R14 = sim.getObject("../IR_Back_R14")
|
34 |
-
IR_Back_R15 = sim.getObject("../IR_Back_R15")
|
35 |
-
IR_Back_R16 = sim.getObject("../IR_Back_R16")
|
36 |
-
IR_Front_L = sim.getObject("../IR_Front_L")
|
37 |
-
IR_Front_L2 = sim.getObject("../IR_Front_L2")
|
38 |
-
IR_Front_L3 = sim.getObject("../IR_Front_L3")
|
39 |
-
IR_Front_L4 = sim.getObject("../IR_Front_L4")
|
40 |
-
IR_Front_L5 = sim.getObject("../IR_Front_L5")
|
41 |
-
IR_Front_L6 = sim.getObject("../IR_Front_L6")
|
42 |
-
IR_Front_L7 = sim.getObject("../IR_Front_L7")
|
43 |
-
IR_Front_L8 = sim.getObject("../IR_Front_L8")
|
44 |
-
IR_Front_L9 = sim.getObject("../IR_Front_L9")
|
45 |
-
IR_Front_L10 = sim.getObject("../IR_Front_L10")
|
46 |
-
IR_Front_L11 = sim.getObject("../IR_Front_L11")
|
47 |
-
IR_Front_L12 = sim.getObject("../IR_Front_L12")
|
48 |
-
IR_Front_L13 = sim.getObject("../IR_Front_L13")
|
49 |
-
IR_Front_L14 = sim.getObject("../IR_Front_L14")
|
50 |
-
IR_Front_L15 = sim.getObject("../IR_Front_L15")
|
51 |
-
IR_Front_L16 = sim.getObject("../IR_Front_L16")
|
52 |
-
IR_Front_R = sim.getObject("../IR_Front_R")
|
53 |
-
IR_Front_R2 = sim.getObject("../IR_Front_R2")
|
54 |
-
IR_Front_R3 = sim.getObject("../IR_Front_R3")
|
55 |
-
IR_Front_R4 = sim.getObject("../IR_Front_R4")
|
56 |
-
IR_Front_R5 = sim.getObject("../IR_Front_R5")
|
57 |
-
IR_Front_R6 = sim.getObject("../IR_Front_R6")
|
58 |
-
IR_Front_R7 = sim.getObject("../IR_Front_R7")
|
59 |
-
IR_Front_R8 = sim.getObject("../IR_Front_R8")
|
60 |
-
IR_Front_R9 = sim.getObject("../IR_Front_R9")
|
61 |
-
IR_Front_R10 = sim.getObject("../IR_Front_R10")
|
62 |
-
IR_Front_R11 = sim.getObject("../IR_Front_R11")
|
63 |
-
IR_Front_R12 = sim.getObject("../IR_Front_R12")
|
64 |
-
IR_Front_R13 = sim.getObject("../IR_Front_R13")
|
65 |
-
IR_Front_R14 = sim.getObject("../IR_Front_R14")
|
66 |
-
IR_Front_R15 = sim.getObject("../IR_Front_R15")
|
67 |
-
IR_Front_R16 = sim.getObject("../IR_Front_R16")
|
68 |
-
IR_Front_C = sim.getObject("../IR_Front_C")
|
69 |
-
IR_Front_C2 = sim.getObject("../IR_Front_C2")
|
70 |
-
IR_Front_C3 = sim.getObject("../IR_Front_C3")
|
71 |
-
IR_Front_C4 = sim.getObject("../IR_Front_C4")
|
72 |
-
IR_Front_C5 = sim.getObject("../IR_Front_C5")
|
73 |
-
IR_Front_C6 = sim.getObject("../IR_Front_C6")
|
74 |
-
IR_Front_C7 = sim.getObject("../IR_Front_C7")
|
75 |
-
IR_Front_C8 = sim.getObject("../IR_Front_C8")
|
76 |
-
IR_Front_C9 = sim.getObject("../IR_Front_C9")
|
77 |
-
IR_Front_C10 = sim.getObject("../IR_Front_C10")
|
78 |
-
IR_Front_C11 = sim.getObject("../IR_Front_C11")
|
79 |
-
IR_Front_C12 = sim.getObject("../IR_Front_C12")
|
80 |
-
IR_Front_C13 = sim.getObject("../IR_Front_C13")
|
81 |
-
IR_Front_C14 = sim.getObject("../IR_Front_C14")
|
82 |
-
IR_Front_C15 = sim.getObject("../IR_Front_C15")
|
83 |
-
IR_Front_C16 = sim.getObject("../IR_Front_C16")
|
84 |
-
IR_Front_RR = sim.getObject("../IR_Front_RR")
|
85 |
-
IR_Front_RR2 = sim.getObject("../IR_Front_RR2")
|
86 |
-
IR_Front_RR3 = sim.getObject("../IR_Front_RR3")
|
87 |
-
IR_Front_RR4 = sim.getObject("../IR_Front_RR4")
|
88 |
-
IR_Front_RR5 = sim.getObject("../IR_Front_RR5")
|
89 |
-
IR_Front_RR6 = sim.getObject("../IR_Front_RR6")
|
90 |
-
IR_Front_RR7 = sim.getObject("../IR_Front_RR7")
|
91 |
-
IR_Front_RR8 = sim.getObject("../IR_Front_RR8")
|
92 |
-
IR_Front_RR9 = sim.getObject("../IR_Front_RR9")
|
93 |
-
IR_Front_RR10 = sim.getObject("../IR_Front_RR10")
|
94 |
-
IR_Front_RR11 = sim.getObject("../IR_Front_RR11")
|
95 |
-
IR_Front_RR12 = sim.getObject("../IR_Front_RR12")
|
96 |
-
IR_Front_RR13 = sim.getObject("../IR_Front_RR13")
|
97 |
-
IR_Front_RR14 = sim.getObject("../IR_Front_RR14")
|
98 |
-
IR_Front_RR15 = sim.getObject("../IR_Front_RR15")
|
99 |
-
IR_Front_RR16 = sim.getObject("../IR_Front_RR16")
|
100 |
-
IR_Back_C = sim.getObject("../IR_Back_C")
|
101 |
-
IR_Back_C2 = sim.getObject("../IR_Back_C2")
|
102 |
-
IR_Back_C3 = sim.getObject("../IR_Back_C3")
|
103 |
-
IR_Back_C4 = sim.getObject("../IR_Back_C4")
|
104 |
-
IR_Back_C5 = sim.getObject("../IR_Back_C5")
|
105 |
-
IR_Back_C6 = sim.getObject("../IR_Back_C6")
|
106 |
-
IR_Back_C7 = sim.getObject("../IR_Back_C7")
|
107 |
-
IR_Back_C8 = sim.getObject("../IR_Back_C8")
|
108 |
-
IR_Back_C9 = sim.getObject("../IR_Back_C9")
|
109 |
-
IR_Back_C10 = sim.getObject("../IR_Back_C10")
|
110 |
-
IR_Back_C11 = sim.getObject("../IR_Back_C11")
|
111 |
-
IR_Back_C12 = sim.getObject("../IR_Back_C12")
|
112 |
-
IR_Back_C13 = sim.getObject("../IR_Back_C13")
|
113 |
-
IR_Back_C14 = sim.getObject("../IR_Back_C14")
|
114 |
-
IR_Back_C15 = sim.getObject("../IR_Back_C15")
|
115 |
-
IR_Back_C16 = sim.getObject("../IR_Back_C16")
|
116 |
-
IR_Front_LL = sim.getObject("../IR_Front_LL")
|
117 |
-
IR_Front_LL2 = sim.getObject("../IR_Front_LL2")
|
118 |
-
IR_Front_LL3 = sim.getObject("../IR_Front_LL3")
|
119 |
-
IR_Front_LL4 = sim.getObject("../IR_Front_LL4")
|
120 |
-
IR_Front_LL5 = sim.getObject("../IR_Front_LL5")
|
121 |
-
IR_Front_LL6 = sim.getObject("../IR_Front_LL6")
|
122 |
-
IR_Front_LL7 = sim.getObject("../IR_Front_LL7")
|
123 |
-
IR_Front_LL8 = sim.getObject("../IR_Front_LL8")
|
124 |
-
IR_Front_LL9 = sim.getObject("../IR_Front_LL9")
|
125 |
-
IR_Front_LL10 = sim.getObject("../IR_Front_LL10")
|
126 |
-
IR_Front_LL11 = sim.getObject("../IR_Front_LL11")
|
127 |
-
IR_Front_LL12 = sim.getObject("../IR_Front_LL12")
|
128 |
-
IR_Front_LL13 = sim.getObject("../IR_Front_LL13")
|
129 |
-
IR_Front_LL14 = sim.getObject("../IR_Front_LL14")
|
130 |
-
IR_Front_LL15 = sim.getObject("../IR_Front_LL15")
|
131 |
-
IR_Front_LL16 = sim.getObject("../IR_Front_LL16")
|
132 |
-
distancia = {} -- Definicion del vector que guardar los valores de las 16 distancias leidas por los 16 sensores de proximidad que forman los sensores infrarrojos implementados
|
133 |
-
IR = {} -- Definicion del vector que guarda los valores de intensidad de los 8 sensores infrarrojos implementados en el modelo
|
134 |
-
-- Definicion de los coeficientes y exponentes optimizados para ajustar el polinomio que calcule la intensidad detectada por el sensor IR a partir de las distancias
|
135 |
-
a = 0.1288
|
136 |
-
b = -1.7887
|
137 |
-
end
|
138 |
-
|
139 |
-
readAllIRSensor = function(inIntegers, inFloats, inStrings, inBuffer)
|
140 |
-
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
141 |
-
local _res
|
142 |
-
if sim.readProximitySensor(IR_Back_L) == 0 then
|
143 |
-
distancia[1] = 1000000
|
144 |
-
else
|
145 |
-
_res, distancia[1] = sim.readProximitySensor(IR_Back_L)
|
146 |
-
end
|
147 |
-
if sim.readProximitySensor(IR_Back_L2) == 0 then
|
148 |
-
distancia[2] = 1000000
|
149 |
-
else
|
150 |
-
_res, distancia[2] = sim.readProximitySensor(IR_Back_L2)
|
151 |
-
end
|
152 |
-
if sim.readProximitySensor(IR_Back_L3) == 0 then
|
153 |
-
distancia[3] = 1000000
|
154 |
-
else
|
155 |
-
_res, distancia[3] = sim.readProximitySensor(IR_Back_L3)
|
156 |
-
end
|
157 |
-
if sim.readProximitySensor(IR_Back_L4) == 0 then
|
158 |
-
distancia[4] = 1000000
|
159 |
-
else
|
160 |
-
_res, distancia[4] = sim.readProximitySensor(IR_Back_L4)
|
161 |
-
end
|
162 |
-
if sim.readProximitySensor(IR_Back_L5) == 0 then
|
163 |
-
distancia[5] = 1000000
|
164 |
-
else
|
165 |
-
_res, distancia[5] = sim.readProximitySensor(IR_Back_L5)
|
166 |
-
end
|
167 |
-
if sim.readProximitySensor(IR_Back_L6) == 0 then
|
168 |
-
distancia[6] = 1000000
|
169 |
-
else
|
170 |
-
_res, distancia[6] = sim.readProximitySensor(IR_Back_L6)
|
171 |
-
end
|
172 |
-
if sim.readProximitySensor(IR_Back_L7) == 0 then
|
173 |
-
distancia[7] = 1000000
|
174 |
-
else
|
175 |
-
_res, distancia[7] = sim.readProximitySensor(IR_Back_L7)
|
176 |
-
end
|
177 |
-
if sim.readProximitySensor(IR_Back_L8) == 0 then
|
178 |
-
distancia[8] = 1000000
|
179 |
-
else
|
180 |
-
_res, distancia[8] = sim.readProximitySensor(IR_Back_L8)
|
181 |
-
end
|
182 |
-
if sim.readProximitySensor(IR_Back_L9) == 0 then
|
183 |
-
distancia[9] = 1000000
|
184 |
-
else
|
185 |
-
_res, distancia[9] = sim.readProximitySensor(IR_Back_L9)
|
186 |
-
end
|
187 |
-
if sim.readProximitySensor(IR_Back_L10) == 0 then
|
188 |
-
distancia[10] = 1000000
|
189 |
-
else
|
190 |
-
_res, distancia[10] = sim.readProximitySensor(IR_Back_L10)
|
191 |
-
end
|
192 |
-
if sim.readProximitySensor(IR_Back_L11) == 0 then
|
193 |
-
distancia[11] = 1000000
|
194 |
-
else
|
195 |
-
_res, distancia[11] = sim.readProximitySensor(IR_Back_L11)
|
196 |
-
end
|
197 |
-
if sim.readProximitySensor(IR_Back_L12) == 0 then
|
198 |
-
distancia[12] = 1000000
|
199 |
-
else
|
200 |
-
_res, distancia[12] = sim.readProximitySensor(IR_Back_L12)
|
201 |
-
end
|
202 |
-
if sim.readProximitySensor(IR_Back_L13) == 0 then
|
203 |
-
distancia[13] = 1000000
|
204 |
-
else
|
205 |
-
_res, distancia[13] = sim.readProximitySensor(IR_Back_L13)
|
206 |
-
end
|
207 |
-
if sim.readProximitySensor(IR_Back_L14) == 0 then
|
208 |
-
distancia[14] = 1000000
|
209 |
-
else
|
210 |
-
_res, distancia[14] = sim.readProximitySensor(IR_Back_L14)
|
211 |
-
end
|
212 |
-
if sim.readProximitySensor(IR_Back_L15) == 0 then
|
213 |
-
distancia[15] = 1000000
|
214 |
-
else
|
215 |
-
_res, distancia[15] = sim.readProximitySensor(IR_Back_L15)
|
216 |
-
end
|
217 |
-
if sim.readProximitySensor(IR_Back_L16) == 0 then
|
218 |
-
distancia[16] = 1000000
|
219 |
-
else
|
220 |
-
_res, distancia[16] = sim.readProximitySensor(IR_Back_L16)
|
221 |
-
end
|
222 |
-
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
223 |
-
valorIR = 0
|
224 |
-
for i = 1, 16, 1 do
|
225 |
-
valorIR = valorIR + a * (distancia[i] ^ b)
|
226 |
-
end
|
227 |
-
IR[1] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
228 |
-
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
229 |
-
if sim.readProximitySensor(IR_Back_R) == 0 then
|
230 |
-
distancia[1] = 1000000
|
231 |
-
else
|
232 |
-
_res, distancia[1] = sim.readProximitySensor(IR_Back_R)
|
233 |
-
end
|
234 |
-
if sim.readProximitySensor(IR_Back_R2) == 0 then
|
235 |
-
distancia[2] = 1000000
|
236 |
-
else
|
237 |
-
_res, distancia[2] = sim.readProximitySensor(IR_Back_R2)
|
238 |
-
end
|
239 |
-
if sim.readProximitySensor(IR_Back_R3) == 0 then
|
240 |
-
distancia[3] = 1000000
|
241 |
-
else
|
242 |
-
_res, distancia[3] = sim.readProximitySensor(IR_Back_R3)
|
243 |
-
end
|
244 |
-
if sim.readProximitySensor(IR_Back_R4) == 0 then
|
245 |
-
distancia[4] = 1000000
|
246 |
-
else
|
247 |
-
_res, distancia[4] = sim.readProximitySensor(IR_Back_R4)
|
248 |
-
end
|
249 |
-
if sim.readProximitySensor(IR_Back_R5) == 0 then
|
250 |
-
distancia[5] = 1000000
|
251 |
-
else
|
252 |
-
_res, distancia[5] = sim.readProximitySensor(IR_Back_R5)
|
253 |
-
end
|
254 |
-
if sim.readProximitySensor(IR_Back_R6) == 0 then
|
255 |
-
distancia[6] = 1000000
|
256 |
-
else
|
257 |
-
_res, distancia[6] = sim.readProximitySensor(IR_Back_R6)
|
258 |
-
end
|
259 |
-
if sim.readProximitySensor(IR_Back_R7) == 0 then
|
260 |
-
distancia[7] = 1000000
|
261 |
-
else
|
262 |
-
_res, distancia[7] = sim.readProximitySensor(IR_Back_R7)
|
263 |
-
end
|
264 |
-
if sim.readProximitySensor(IR_Back_R8) == 0 then
|
265 |
-
distancia[8] = 1000000
|
266 |
-
else
|
267 |
-
_res, distancia[8] = sim.readProximitySensor(IR_Back_R8)
|
268 |
-
end
|
269 |
-
if sim.readProximitySensor(IR_Back_R9) == 0 then
|
270 |
-
distancia[9] = 1000000
|
271 |
-
else
|
272 |
-
_res, distancia[9] = sim.readProximitySensor(IR_Back_R9)
|
273 |
-
end
|
274 |
-
if sim.readProximitySensor(IR_Back_R10) == 0 then
|
275 |
-
distancia[10] = 1000000
|
276 |
-
else
|
277 |
-
_res, distancia[10] = sim.readProximitySensor(IR_Back_R10)
|
278 |
-
end
|
279 |
-
if sim.readProximitySensor(IR_Back_R11) == 0 then
|
280 |
-
distancia[11] = 1000000
|
281 |
-
else
|
282 |
-
_res, distancia[11] = sim.readProximitySensor(IR_Back_R11)
|
283 |
-
end
|
284 |
-
if sim.readProximitySensor(IR_Back_R12) == 0 then
|
285 |
-
distancia[12] = 1000000
|
286 |
-
else
|
287 |
-
_res, distancia[12] = sim.readProximitySensor(IR_Back_R12)
|
288 |
-
end
|
289 |
-
if sim.readProximitySensor(IR_Back_R13) == 0 then
|
290 |
-
distancia[13] = 1000000
|
291 |
-
else
|
292 |
-
_res, distancia[13] = sim.readProximitySensor(IR_Back_R13)
|
293 |
-
end
|
294 |
-
if sim.readProximitySensor(IR_Back_R14) == 0 then
|
295 |
-
distancia[14] = 1000000
|
296 |
-
else
|
297 |
-
_res, distancia[14] = sim.readProximitySensor(IR_Back_R14)
|
298 |
-
end
|
299 |
-
if sim.readProximitySensor(IR_Back_R15) == 0 then
|
300 |
-
distancia[15] = 1000000
|
301 |
-
else
|
302 |
-
_res, distancia[15] = sim.readProximitySensor(IR_Back_R15)
|
303 |
-
end
|
304 |
-
if sim.readProximitySensor(IR_Back_R16) == 0 then
|
305 |
-
distancia[16] = 1000000
|
306 |
-
else
|
307 |
-
_res, distancia[16] = sim.readProximitySensor(IR_Back_R16)
|
308 |
-
end
|
309 |
-
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
310 |
-
valorIR = 0
|
311 |
-
for i = 1, 16, 1 do
|
312 |
-
valorIR = valorIR + a * (distancia[i] ^ b)
|
313 |
-
end
|
314 |
-
IR[2] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
315 |
-
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
316 |
-
if sim.readProximitySensor(IR_Front_L) == 0 then
|
317 |
-
distancia[1] = 1000000
|
318 |
-
else
|
319 |
-
_res, distancia[1] = sim.readProximitySensor(IR_Front_L)
|
320 |
-
end
|
321 |
-
if sim.readProximitySensor(IR_Front_L2) == 0 then
|
322 |
-
distancia[2] = 1000000
|
323 |
-
else
|
324 |
-
_res, distancia[2] = sim.readProximitySensor(IR_Front_L2)
|
325 |
-
end
|
326 |
-
if sim.readProximitySensor(IR_Front_L3) == 0 then
|
327 |
-
distancia[3] = 1000000
|
328 |
-
else
|
329 |
-
_res, distancia[3] = sim.readProximitySensor(IR_Front_L3)
|
330 |
-
end
|
331 |
-
if sim.readProximitySensor(IR_Front_L4) == 0 then
|
332 |
-
distancia[4] = 1000000
|
333 |
-
else
|
334 |
-
_res, distancia[4] = sim.readProximitySensor(IR_Front_L4)
|
335 |
-
end
|
336 |
-
if sim.readProximitySensor(IR_Front_L5) == 0 then
|
337 |
-
distancia[5] = 1000000
|
338 |
-
else
|
339 |
-
_res, distancia[5] = sim.readProximitySensor(IR_Front_L5)
|
340 |
-
end
|
341 |
-
if sim.readProximitySensor(IR_Front_L6) == 0 then
|
342 |
-
distancia[6] = 1000000
|
343 |
-
else
|
344 |
-
_res, distancia[6] = sim.readProximitySensor(IR_Front_L6)
|
345 |
-
end
|
346 |
-
if sim.readProximitySensor(IR_Front_L7) == 0 then
|
347 |
-
distancia[7] = 1000000
|
348 |
-
else
|
349 |
-
_res, distancia[7] = sim.readProximitySensor(IR_Front_L7)
|
350 |
-
end
|
351 |
-
if sim.readProximitySensor(IR_Front_L8) == 0 then
|
352 |
-
distancia[8] = 1000000
|
353 |
-
else
|
354 |
-
_res, distancia[8] = sim.readProximitySensor(IR_Front_L8)
|
355 |
-
end
|
356 |
-
if sim.readProximitySensor(IR_Front_L9) == 0 then
|
357 |
-
distancia[9] = 1000000
|
358 |
-
else
|
359 |
-
_res, distancia[9] = sim.readProximitySensor(IR_Front_L9)
|
360 |
-
end
|
361 |
-
if sim.readProximitySensor(IR_Front_L10) == 0 then
|
362 |
-
distancia[10] = 1000000
|
363 |
-
else
|
364 |
-
_res, distancia[10] = sim.readProximitySensor(IR_Front_L10)
|
365 |
-
end
|
366 |
-
if sim.readProximitySensor(IR_Front_L11) == 0 then
|
367 |
-
distancia[11] = 1000000
|
368 |
-
else
|
369 |
-
_res, distancia[11] = sim.readProximitySensor(IR_Front_L11)
|
370 |
-
end
|
371 |
-
if sim.readProximitySensor(IR_Front_L12) == 0 then
|
372 |
-
distancia[12] = 1000000
|
373 |
-
else
|
374 |
-
_res, distancia[12] = sim.readProximitySensor(IR_Front_L12)
|
375 |
-
end
|
376 |
-
if sim.readProximitySensor(IR_Front_L13) == 0 then
|
377 |
-
distancia[13] = 1000000
|
378 |
-
else
|
379 |
-
_res, distancia[13] = sim.readProximitySensor(IR_Front_L13)
|
380 |
-
end
|
381 |
-
if sim.readProximitySensor(IR_Front_L14) == 0 then
|
382 |
-
distancia[14] = 1000000
|
383 |
-
else
|
384 |
-
_res, distancia[14] = sim.readProximitySensor(IR_Front_L14)
|
385 |
-
end
|
386 |
-
if sim.readProximitySensor(IR_Front_L15) == 0 then
|
387 |
-
distancia[15] = 1000000
|
388 |
-
else
|
389 |
-
_res, distancia[15] = sim.readProximitySensor(IR_Front_L15)
|
390 |
-
end
|
391 |
-
if sim.readProximitySensor(IR_Front_L16) == 0 then
|
392 |
-
distancia[16] = 1000000
|
393 |
-
else
|
394 |
-
_res, distancia[16] = sim.readProximitySensor(IR_Front_L16)
|
395 |
-
end
|
396 |
-
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
397 |
-
valorIR = 0
|
398 |
-
for i = 1, 16, 1 do
|
399 |
-
valorIR = valorIR + a * (distancia[i] ^ b)
|
400 |
-
end
|
401 |
-
IR[3] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
402 |
-
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
403 |
-
if sim.readProximitySensor(IR_Front_R) == 0 then
|
404 |
-
distancia[1] = 1000000
|
405 |
-
else
|
406 |
-
_res, distancia[1] = sim.readProximitySensor(IR_Front_R)
|
407 |
-
end
|
408 |
-
if sim.readProximitySensor(IR_Front_R2) == 0 then
|
409 |
-
distancia[2] = 1000000
|
410 |
-
else
|
411 |
-
_res, distancia[2] = sim.readProximitySensor(IR_Front_R2)
|
412 |
-
end
|
413 |
-
if sim.readProximitySensor(IR_Front_R3) == 0 then
|
414 |
-
distancia[3] = 1000000
|
415 |
-
else
|
416 |
-
_res, distancia[3] = sim.readProximitySensor(IR_Front_R3)
|
417 |
-
end
|
418 |
-
if sim.readProximitySensor(IR_Front_R4) == 0 then
|
419 |
-
distancia[4] = 1000000
|
420 |
-
else
|
421 |
-
_res, distancia[4] = sim.readProximitySensor(IR_Front_R4)
|
422 |
-
end
|
423 |
-
if sim.readProximitySensor(IR_Front_R5) == 0 then
|
424 |
-
distancia[5] = 1000000
|
425 |
-
else
|
426 |
-
_res, distancia[5] = sim.readProximitySensor(IR_Front_R5)
|
427 |
-
end
|
428 |
-
if sim.readProximitySensor(IR_Front_R6) == 0 then
|
429 |
-
distancia[6] = 1000000
|
430 |
-
else
|
431 |
-
_res, distancia[6] = sim.readProximitySensor(IR_Front_R6)
|
432 |
-
end
|
433 |
-
if sim.readProximitySensor(IR_Front_R7) == 0 then
|
434 |
-
distancia[7] = 1000000
|
435 |
-
else
|
436 |
-
_res, distancia[7] = sim.readProximitySensor(IR_Front_R7)
|
437 |
-
end
|
438 |
-
if sim.readProximitySensor(IR_Front_R8) == 0 then
|
439 |
-
distancia[8] = 1000000
|
440 |
-
else
|
441 |
-
_res, distancia[8] = sim.readProximitySensor(IR_Front_R8)
|
442 |
-
end
|
443 |
-
if sim.readProximitySensor(IR_Front_R9) == 0 then
|
444 |
-
distancia[9] = 1000000
|
445 |
-
else
|
446 |
-
_res, distancia[9] = sim.readProximitySensor(IR_Front_R9)
|
447 |
-
end
|
448 |
-
if sim.readProximitySensor(IR_Front_R10) == 0 then
|
449 |
-
distancia[10] = 1000000
|
450 |
-
else
|
451 |
-
_res, distancia[10] = sim.readProximitySensor(IR_Front_R10)
|
452 |
-
end
|
453 |
-
if sim.readProximitySensor(IR_Front_R11) == 0 then
|
454 |
-
distancia[11] = 1000000
|
455 |
-
else
|
456 |
-
_res, distancia[11] = sim.readProximitySensor(IR_Front_R11)
|
457 |
-
end
|
458 |
-
if sim.readProximitySensor(IR_Front_R12) == 0 then
|
459 |
-
distancia[12] = 1000000
|
460 |
-
else
|
461 |
-
_res, distancia[12] = sim.readProximitySensor(IR_Front_R12)
|
462 |
-
end
|
463 |
-
if sim.readProximitySensor(IR_Front_R13) == 0 then
|
464 |
-
distancia[13] = 1000000
|
465 |
-
else
|
466 |
-
_res, distancia[13] = sim.readProximitySensor(IR_Front_R13)
|
467 |
-
end
|
468 |
-
if sim.readProximitySensor(IR_Front_R14) == 0 then
|
469 |
-
distancia[14] = 1000000
|
470 |
-
else
|
471 |
-
_res, distancia[14] = sim.readProximitySensor(IR_Front_R14)
|
472 |
-
end
|
473 |
-
if sim.readProximitySensor(IR_Front_R15) == 0 then
|
474 |
-
distancia[15] = 1000000
|
475 |
-
else
|
476 |
-
_res, distancia[15] = sim.readProximitySensor(IR_Front_R15)
|
477 |
-
end
|
478 |
-
if sim.readProximitySensor(IR_Front_R16) == 0 then
|
479 |
-
distancia[16] = 1000000
|
480 |
-
else
|
481 |
-
_res, distancia[16] = sim.readProximitySensor(IR_Front_R16)
|
482 |
-
end
|
483 |
-
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
484 |
-
valorIR = 0
|
485 |
-
for i = 1, 16, 1 do
|
486 |
-
valorIR = valorIR + a * (distancia[i] ^ b)
|
487 |
-
end
|
488 |
-
IR[4] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
489 |
-
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
490 |
-
if sim.readProximitySensor(IR_Front_C) == 0 then
|
491 |
-
distancia[1] = 1000000
|
492 |
-
else
|
493 |
-
_res, distancia[1] = sim.readProximitySensor(IR_Front_C)
|
494 |
-
end
|
495 |
-
if sim.readProximitySensor(IR_Front_C2) == 0 then
|
496 |
-
distancia[2] = 1000000
|
497 |
-
else
|
498 |
-
_res, distancia[2] = sim.readProximitySensor(IR_Front_C2)
|
499 |
-
end
|
500 |
-
if sim.readProximitySensor(IR_Front_C3) == 0 then
|
501 |
-
distancia[3] = 1000000
|
502 |
-
else
|
503 |
-
_res, distancia[3] = sim.readProximitySensor(IR_Front_C3)
|
504 |
-
end
|
505 |
-
if sim.readProximitySensor(IR_Front_C4) == 0 then
|
506 |
-
distancia[4] = 1000000
|
507 |
-
else
|
508 |
-
_res, distancia[4] = sim.readProximitySensor(IR_Front_C4)
|
509 |
-
end
|
510 |
-
if sim.readProximitySensor(IR_Front_C5) == 0 then
|
511 |
-
distancia[5] = 1000000
|
512 |
-
else
|
513 |
-
_res, distancia[5] = sim.readProximitySensor(IR_Front_C5)
|
514 |
-
end
|
515 |
-
if sim.readProximitySensor(IR_Front_C6) == 0 then
|
516 |
-
distancia[6] = 1000000
|
517 |
-
else
|
518 |
-
_res, distancia[6] = sim.readProximitySensor(IR_Front_C6)
|
519 |
-
end
|
520 |
-
if sim.readProximitySensor(IR_Front_C7) == 0 then
|
521 |
-
distancia[7] = 1000000
|
522 |
-
else
|
523 |
-
_res, distancia[7] = sim.readProximitySensor(IR_Front_C7)
|
524 |
-
end
|
525 |
-
if sim.readProximitySensor(IR_Front_C8) == 0 then
|
526 |
-
distancia[8] = 1000000
|
527 |
-
else
|
528 |
-
_res, distancia[8] = sim.readProximitySensor(IR_Front_C8)
|
529 |
-
end
|
530 |
-
if sim.readProximitySensor(IR_Front_C9) == 0 then
|
531 |
-
distancia[9] = 1000000
|
532 |
-
else
|
533 |
-
_res, distancia[9] = sim.readProximitySensor(IR_Front_C9)
|
534 |
-
end
|
535 |
-
if sim.readProximitySensor(IR_Front_C10) == 0 then
|
536 |
-
distancia[10] = 1000000
|
537 |
-
else
|
538 |
-
_res, distancia[10] = sim.readProximitySensor(IR_Front_C10)
|
539 |
-
end
|
540 |
-
if sim.readProximitySensor(IR_Front_C11) == 0 then
|
541 |
-
distancia[11] = 1000000
|
542 |
-
else
|
543 |
-
_res, distancia[11] = sim.readProximitySensor(IR_Front_C11)
|
544 |
-
end
|
545 |
-
if sim.readProximitySensor(IR_Front_C12) == 0 then
|
546 |
-
distancia[12] = 1000000
|
547 |
-
else
|
548 |
-
_res, distancia[12] = sim.readProximitySensor(IR_Front_C12)
|
549 |
-
end
|
550 |
-
if sim.readProximitySensor(IR_Front_C13) == 0 then
|
551 |
-
distancia[13] = 1000000
|
552 |
-
else
|
553 |
-
_res, distancia[13] = sim.readProximitySensor(IR_Front_C13)
|
554 |
-
end
|
555 |
-
if sim.readProximitySensor(IR_Front_C14) == 0 then
|
556 |
-
distancia[14] = 1000000
|
557 |
-
else
|
558 |
-
_res, distancia[14] = sim.readProximitySensor(IR_Front_C14)
|
559 |
-
end
|
560 |
-
if sim.readProximitySensor(IR_Front_C15) == 0 then
|
561 |
-
distancia[15] = 1000000
|
562 |
-
else
|
563 |
-
_res, distancia[15] = sim.readProximitySensor(IR_Front_C15)
|
564 |
-
end
|
565 |
-
if sim.readProximitySensor(IR_Front_C16) == 0 then
|
566 |
-
distancia[16] = 1000000
|
567 |
-
else
|
568 |
-
_res, distancia[16] = sim.readProximitySensor(IR_Front_C16)
|
569 |
-
end
|
570 |
-
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
571 |
-
valorIR = 0
|
572 |
-
for i = 1, 16, 1 do
|
573 |
-
valorIR = valorIR + a * (distancia[i] ^ b)
|
574 |
-
end
|
575 |
-
IR[5] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
576 |
-
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
577 |
-
if sim.readProximitySensor(IR_Front_RR) == 0 then
|
578 |
-
distancia[1] = 1000000
|
579 |
-
else
|
580 |
-
_res, distancia[1] = sim.readProximitySensor(IR_Front_RR)
|
581 |
-
end
|
582 |
-
if sim.readProximitySensor(IR_Front_RR2) == 0 then
|
583 |
-
distancia[2] = 1000000
|
584 |
-
else
|
585 |
-
_res, distancia[2] = sim.readProximitySensor(IR_Front_RR2)
|
586 |
-
end
|
587 |
-
if sim.readProximitySensor(IR_Front_RR3) == 0 then
|
588 |
-
distancia[3] = 1000000
|
589 |
-
else
|
590 |
-
_res, distancia[3] = sim.readProximitySensor(IR_Front_RR3)
|
591 |
-
end
|
592 |
-
if sim.readProximitySensor(IR_Front_RR4) == 0 then
|
593 |
-
distancia[4] = 1000000
|
594 |
-
else
|
595 |
-
_res, distancia[4] = sim.readProximitySensor(IR_Front_RR4)
|
596 |
-
end
|
597 |
-
if sim.readProximitySensor(IR_Front_RR5) == 0 then
|
598 |
-
distancia[5] = 1000000
|
599 |
-
else
|
600 |
-
_res, distancia[5] = sim.readProximitySensor(IR_Front_RR5)
|
601 |
-
end
|
602 |
-
if sim.readProximitySensor(IR_Front_RR6) == 0 then
|
603 |
-
distancia[6] = 1000000
|
604 |
-
else
|
605 |
-
_res, distancia[6] = sim.readProximitySensor(IR_Front_RR6)
|
606 |
-
end
|
607 |
-
if sim.readProximitySensor(IR_Front_RR7) == 0 then
|
608 |
-
distancia[7] = 1000000
|
609 |
-
else
|
610 |
-
_res, distancia[7] = sim.readProximitySensor(IR_Front_RR7)
|
611 |
-
end
|
612 |
-
if sim.readProximitySensor(IR_Front_RR8) == 0 then
|
613 |
-
distancia[8] = 1000000
|
614 |
-
else
|
615 |
-
_res, distancia[8] = sim.readProximitySensor(IR_Front_RR8)
|
616 |
-
end
|
617 |
-
if sim.readProximitySensor(IR_Front_RR9) == 0 then
|
618 |
-
distancia[9] = 1000000
|
619 |
-
else
|
620 |
-
_res, distancia[9] = sim.readProximitySensor(IR_Front_RR9)
|
621 |
-
end
|
622 |
-
if sim.readProximitySensor(IR_Front_RR10) == 0 then
|
623 |
-
distancia[10] = 1000000
|
624 |
-
else
|
625 |
-
_res, distancia[10] = sim.readProximitySensor(IR_Front_RR10)
|
626 |
-
end
|
627 |
-
if sim.readProximitySensor(IR_Front_RR11) == 0 then
|
628 |
-
distancia[11] = 1000000
|
629 |
-
else
|
630 |
-
_res, distancia[11] = sim.readProximitySensor(IR_Front_RR11)
|
631 |
-
end
|
632 |
-
if sim.readProximitySensor(IR_Front_RR12) == 0 then
|
633 |
-
distancia[12] = 1000000
|
634 |
-
else
|
635 |
-
_res, distancia[12] = sim.readProximitySensor(IR_Front_RR12)
|
636 |
-
end
|
637 |
-
if sim.readProximitySensor(IR_Front_RR13) == 0 then
|
638 |
-
distancia[13] = 1000000
|
639 |
-
else
|
640 |
-
_res, distancia[13] = sim.readProximitySensor(IR_Front_RR13)
|
641 |
-
end
|
642 |
-
if sim.readProximitySensor(IR_Front_RR14) == 0 then
|
643 |
-
distancia[14] = 1000000
|
644 |
-
else
|
645 |
-
_res, distancia[14] = sim.readProximitySensor(IR_Front_RR14)
|
646 |
-
end
|
647 |
-
if sim.readProximitySensor(IR_Front_RR15) == 0 then
|
648 |
-
distancia[15] = 1000000
|
649 |
-
else
|
650 |
-
_res, distancia[15] = sim.readProximitySensor(IR_Front_RR15)
|
651 |
-
end
|
652 |
-
if sim.readProximitySensor(IR_Front_RR16) == 0 then
|
653 |
-
distancia[16] = 1000000
|
654 |
-
else
|
655 |
-
_res, distancia[16] = sim.readProximitySensor(IR_Front_RR16)
|
656 |
-
end
|
657 |
-
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
658 |
-
valorIR = 0
|
659 |
-
for i = 1, 16, 1 do
|
660 |
-
valorIR = valorIR + a * (distancia[i] ^ b)
|
661 |
-
end
|
662 |
-
IR[6] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
663 |
-
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
664 |
-
if sim.readProximitySensor(IR_Back_C) == 0 then
|
665 |
-
distancia[1] = 1000000
|
666 |
-
else
|
667 |
-
_res, distancia[1] = sim.readProximitySensor(IR_Back_C)
|
668 |
-
end
|
669 |
-
if sim.readProximitySensor(IR_Back_C2) == 0 then
|
670 |
-
distancia[2] = 1000000
|
671 |
-
else
|
672 |
-
_res, distancia[2] = sim.readProximitySensor(IR_Back_C2)
|
673 |
-
end
|
674 |
-
if sim.readProximitySensor(IR_Back_C3) == 0 then
|
675 |
-
distancia[3] = 1000000
|
676 |
-
else
|
677 |
-
_res, distancia[3] = sim.readProximitySensor(IR_Back_C3)
|
678 |
-
end
|
679 |
-
if sim.readProximitySensor(IR_Back_C4) == 0 then
|
680 |
-
distancia[4] = 1000000
|
681 |
-
else
|
682 |
-
_res, distancia[4] = sim.readProximitySensor(IR_Back_C4)
|
683 |
-
end
|
684 |
-
if sim.readProximitySensor(IR_Back_C5) == 0 then
|
685 |
-
distancia[5] = 1000000
|
686 |
-
else
|
687 |
-
_res, distancia[5] = sim.readProximitySensor(IR_Back_C5)
|
688 |
-
end
|
689 |
-
if sim.readProximitySensor(IR_Back_C6) == 0 then
|
690 |
-
distancia[6] = 1000000
|
691 |
-
else
|
692 |
-
_res, distancia[6] = sim.readProximitySensor(IR_Back_C6)
|
693 |
-
end
|
694 |
-
if sim.readProximitySensor(IR_Back_C7) == 0 then
|
695 |
-
distancia[7] = 1000000
|
696 |
-
else
|
697 |
-
_res, distancia[7] = sim.readProximitySensor(IR_Back_C7)
|
698 |
-
end
|
699 |
-
if sim.readProximitySensor(IR_Back_C8) == 0 then
|
700 |
-
distancia[8] = 1000000
|
701 |
-
else
|
702 |
-
_res, distancia[8] = sim.readProximitySensor(IR_Back_C8)
|
703 |
-
end
|
704 |
-
if sim.readProximitySensor(IR_Back_C9) == 0 then
|
705 |
-
distancia[9] = 1000000
|
706 |
-
else
|
707 |
-
_res, distancia[9] = sim.readProximitySensor(IR_Back_C9)
|
708 |
-
end
|
709 |
-
if sim.readProximitySensor(IR_Back_C10) == 0 then
|
710 |
-
distancia[10] = 1000000
|
711 |
-
else
|
712 |
-
_res, distancia[10] = sim.readProximitySensor(IR_Back_C10)
|
713 |
-
end
|
714 |
-
if sim.readProximitySensor(IR_Back_C11) == 0 then
|
715 |
-
distancia[11] = 1000000
|
716 |
-
else
|
717 |
-
_res, distancia[11] = sim.readProximitySensor(IR_Back_C11)
|
718 |
-
end
|
719 |
-
if sim.readProximitySensor(IR_Back_C12) == 0 then
|
720 |
-
distancia[12] = 1000000
|
721 |
-
else
|
722 |
-
_res, distancia[12] = sim.readProximitySensor(IR_Back_C12)
|
723 |
-
end
|
724 |
-
if sim.readProximitySensor(IR_Back_C13) == 0 then
|
725 |
-
distancia[13] = 1000000
|
726 |
-
else
|
727 |
-
_res, distancia[13] = sim.readProximitySensor(IR_Back_C13)
|
728 |
-
end
|
729 |
-
if sim.readProximitySensor(IR_Back_C14) == 0 then
|
730 |
-
distancia[14] = 1000000
|
731 |
-
else
|
732 |
-
_res, distancia[14] = sim.readProximitySensor(IR_Back_C14)
|
733 |
-
end
|
734 |
-
if sim.readProximitySensor(IR_Back_C15) == 0 then
|
735 |
-
distancia[15] = 1000000
|
736 |
-
else
|
737 |
-
_res, distancia[15] = sim.readProximitySensor(IR_Back_C15)
|
738 |
-
end
|
739 |
-
if sim.readProximitySensor(IR_Back_C16) == 0 then
|
740 |
-
distancia[16] = 1000000
|
741 |
-
else
|
742 |
-
_res, distancia[16] = sim.readProximitySensor(IR_Back_C16)
|
743 |
-
end
|
744 |
-
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
745 |
-
valorIR = 0
|
746 |
-
for i = 1, 16, 1 do
|
747 |
-
valorIR = valorIR + a * (distancia[i] ^ b)
|
748 |
-
end
|
749 |
-
IR[7] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
750 |
-
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
751 |
-
if sim.readProximitySensor(IR_Front_LL) == 0 then
|
752 |
-
distancia[1] = 1000000
|
753 |
-
else
|
754 |
-
_res, distancia[1] = sim.readProximitySensor(IR_Front_LL)
|
755 |
-
end
|
756 |
-
if sim.readProximitySensor(IR_Front_LL2) == 0 then
|
757 |
-
distancia[2] = 1000000
|
758 |
-
else
|
759 |
-
_res, distancia[2] = sim.readProximitySensor(IR_Front_LL2)
|
760 |
-
end
|
761 |
-
if sim.readProximitySensor(IR_Front_LL3) == 0 then
|
762 |
-
distancia[3] = 1000000
|
763 |
-
else
|
764 |
-
_res, distancia[3] = sim.readProximitySensor(IR_Front_LL3)
|
765 |
-
end
|
766 |
-
if sim.readProximitySensor(IR_Front_LL4) == 0 then
|
767 |
-
distancia[4] = 1000000
|
768 |
-
else
|
769 |
-
_res, distancia[4] = sim.readProximitySensor(IR_Front_LL4)
|
770 |
-
end
|
771 |
-
if sim.readProximitySensor(IR_Front_LL5) == 0 then
|
772 |
-
distancia[5] = 1000000
|
773 |
-
else
|
774 |
-
_res, distancia[5] = sim.readProximitySensor(IR_Front_LL5)
|
775 |
-
end
|
776 |
-
if sim.readProximitySensor(IR_Front_LL6) == 0 then
|
777 |
-
distancia[6] = 1000000
|
778 |
-
else
|
779 |
-
_res, distancia[6] = sim.readProximitySensor(IR_Front_LL6)
|
780 |
-
end
|
781 |
-
if sim.readProximitySensor(IR_Front_LL7) == 0 then
|
782 |
-
distancia[7] = 1000000
|
783 |
-
else
|
784 |
-
_res, distancia[7] = sim.readProximitySensor(IR_Front_LL7)
|
785 |
-
end
|
786 |
-
if sim.readProximitySensor(IR_Front_LL8) == 0 then
|
787 |
-
distancia[8] = 1000000
|
788 |
-
else
|
789 |
-
_res, distancia[8] = sim.readProximitySensor(IR_Front_LL8)
|
790 |
-
end
|
791 |
-
if sim.readProximitySensor(IR_Front_LL9) == 0 then
|
792 |
-
distancia[9] = 1000000
|
793 |
-
else
|
794 |
-
_res, distancia[9] = sim.readProximitySensor(IR_Front_LL9)
|
795 |
-
end
|
796 |
-
if sim.readProximitySensor(IR_Front_LL10) == 0 then
|
797 |
-
distancia[10] = 1000000
|
798 |
-
else
|
799 |
-
_res, distancia[10] = sim.readProximitySensor(IR_Front_LL10)
|
800 |
-
end
|
801 |
-
if sim.readProximitySensor(IR_Front_LL11) == 0 then
|
802 |
-
distancia[11] = 1000000
|
803 |
-
else
|
804 |
-
_res, distancia[11] = sim.readProximitySensor(IR_Front_LL11)
|
805 |
-
end
|
806 |
-
if sim.readProximitySensor(IR_Front_LL12) == 0 then
|
807 |
-
distancia[12] = 1000000
|
808 |
-
else
|
809 |
-
_res, distancia[12] = sim.readProximitySensor(IR_Front_LL12)
|
810 |
-
end
|
811 |
-
if sim.readProximitySensor(IR_Front_LL13) == 0 then
|
812 |
-
distancia[13] = 1000000
|
813 |
-
else
|
814 |
-
_res, distancia[13] = sim.readProximitySensor(IR_Front_LL13)
|
815 |
-
end
|
816 |
-
if sim.readProximitySensor(IR_Front_LL14) == 0 then
|
817 |
-
distancia[14] = 1000000
|
818 |
-
else
|
819 |
-
_res, distancia[14] = sim.readProximitySensor(IR_Front_LL14)
|
820 |
-
end
|
821 |
-
if sim.readProximitySensor(IR_Front_LL15) == 0 then
|
822 |
-
distancia[15] = 1000000
|
823 |
-
else
|
824 |
-
_res, distancia[15] = sim.readProximitySensor(IR_Front_LL15)
|
825 |
-
end
|
826 |
-
if sim.readProximitySensor(IR_Front_LL16) == 0 then
|
827 |
-
distancia[16] = 1000000
|
828 |
-
else
|
829 |
-
_res, distancia[16] = sim.readProximitySensor(IR_Front_LL16)
|
830 |
-
end
|
831 |
-
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
832 |
-
valorIR = 0
|
833 |
-
for i = 1, 16, 1 do
|
834 |
-
valorIR = valorIR + a * (distancia[i] ^ b)
|
835 |
-
end
|
836 |
-
IR[8] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
837 |
-
return IR, {}, {}, ""
|
838 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init()
|
4 |
+
IR_Back_L = sim.getObject("../IR_Back_L")
|
5 |
+
IR_Back_L2 = sim.getObject("../IR_Back_L2")
|
6 |
+
IR_Back_L3 = sim.getObject("../IR_Back_L3")
|
7 |
+
IR_Back_L4 = sim.getObject("../IR_Back_L4")
|
8 |
+
IR_Back_L5 = sim.getObject("../IR_Back_L5")
|
9 |
+
IR_Back_L6 = sim.getObject("../IR_Back_L6")
|
10 |
+
IR_Back_L7 = sim.getObject("../IR_Back_L7")
|
11 |
+
IR_Back_L8 = sim.getObject("../IR_Back_L8")
|
12 |
+
IR_Back_L9 = sim.getObject("../IR_Back_L9")
|
13 |
+
IR_Back_L10 = sim.getObject("../IR_Back_L10")
|
14 |
+
IR_Back_L11 = sim.getObject("../IR_Back_L11")
|
15 |
+
IR_Back_L12 = sim.getObject("../IR_Back_L12")
|
16 |
+
IR_Back_L13 = sim.getObject("../IR_Back_L13")
|
17 |
+
IR_Back_L14 = sim.getObject("../IR_Back_L14")
|
18 |
+
IR_Back_L15 = sim.getObject("../IR_Back_L15")
|
19 |
+
IR_Back_L16 = sim.getObject("../IR_Back_L16")
|
20 |
+
IR_Back_R = sim.getObject("../IR_Back_R")
|
21 |
+
IR_Back_R2 = sim.getObject("../IR_Back_R2")
|
22 |
+
IR_Back_R3 = sim.getObject("../IR_Back_R3")
|
23 |
+
IR_Back_R4 = sim.getObject("../IR_Back_R4")
|
24 |
+
IR_Back_R5 = sim.getObject("../IR_Back_R5")
|
25 |
+
IR_Back_R6 = sim.getObject("../IR_Back_R6")
|
26 |
+
IR_Back_R7 = sim.getObject("../IR_Back_R7")
|
27 |
+
IR_Back_R8 = sim.getObject("../IR_Back_R8")
|
28 |
+
IR_Back_R9 = sim.getObject("../IR_Back_R9")
|
29 |
+
IR_Back_R10 = sim.getObject("../IR_Back_R10")
|
30 |
+
IR_Back_R11 = sim.getObject("../IR_Back_R11")
|
31 |
+
IR_Back_R12 = sim.getObject("../IR_Back_R12")
|
32 |
+
IR_Back_R13 = sim.getObject("../IR_Back_R13")
|
33 |
+
IR_Back_R14 = sim.getObject("../IR_Back_R14")
|
34 |
+
IR_Back_R15 = sim.getObject("../IR_Back_R15")
|
35 |
+
IR_Back_R16 = sim.getObject("../IR_Back_R16")
|
36 |
+
IR_Front_L = sim.getObject("../IR_Front_L")
|
37 |
+
IR_Front_L2 = sim.getObject("../IR_Front_L2")
|
38 |
+
IR_Front_L3 = sim.getObject("../IR_Front_L3")
|
39 |
+
IR_Front_L4 = sim.getObject("../IR_Front_L4")
|
40 |
+
IR_Front_L5 = sim.getObject("../IR_Front_L5")
|
41 |
+
IR_Front_L6 = sim.getObject("../IR_Front_L6")
|
42 |
+
IR_Front_L7 = sim.getObject("../IR_Front_L7")
|
43 |
+
IR_Front_L8 = sim.getObject("../IR_Front_L8")
|
44 |
+
IR_Front_L9 = sim.getObject("../IR_Front_L9")
|
45 |
+
IR_Front_L10 = sim.getObject("../IR_Front_L10")
|
46 |
+
IR_Front_L11 = sim.getObject("../IR_Front_L11")
|
47 |
+
IR_Front_L12 = sim.getObject("../IR_Front_L12")
|
48 |
+
IR_Front_L13 = sim.getObject("../IR_Front_L13")
|
49 |
+
IR_Front_L14 = sim.getObject("../IR_Front_L14")
|
50 |
+
IR_Front_L15 = sim.getObject("../IR_Front_L15")
|
51 |
+
IR_Front_L16 = sim.getObject("../IR_Front_L16")
|
52 |
+
IR_Front_R = sim.getObject("../IR_Front_R")
|
53 |
+
IR_Front_R2 = sim.getObject("../IR_Front_R2")
|
54 |
+
IR_Front_R3 = sim.getObject("../IR_Front_R3")
|
55 |
+
IR_Front_R4 = sim.getObject("../IR_Front_R4")
|
56 |
+
IR_Front_R5 = sim.getObject("../IR_Front_R5")
|
57 |
+
IR_Front_R6 = sim.getObject("../IR_Front_R6")
|
58 |
+
IR_Front_R7 = sim.getObject("../IR_Front_R7")
|
59 |
+
IR_Front_R8 = sim.getObject("../IR_Front_R8")
|
60 |
+
IR_Front_R9 = sim.getObject("../IR_Front_R9")
|
61 |
+
IR_Front_R10 = sim.getObject("../IR_Front_R10")
|
62 |
+
IR_Front_R11 = sim.getObject("../IR_Front_R11")
|
63 |
+
IR_Front_R12 = sim.getObject("../IR_Front_R12")
|
64 |
+
IR_Front_R13 = sim.getObject("../IR_Front_R13")
|
65 |
+
IR_Front_R14 = sim.getObject("../IR_Front_R14")
|
66 |
+
IR_Front_R15 = sim.getObject("../IR_Front_R15")
|
67 |
+
IR_Front_R16 = sim.getObject("../IR_Front_R16")
|
68 |
+
IR_Front_C = sim.getObject("../IR_Front_C")
|
69 |
+
IR_Front_C2 = sim.getObject("../IR_Front_C2")
|
70 |
+
IR_Front_C3 = sim.getObject("../IR_Front_C3")
|
71 |
+
IR_Front_C4 = sim.getObject("../IR_Front_C4")
|
72 |
+
IR_Front_C5 = sim.getObject("../IR_Front_C5")
|
73 |
+
IR_Front_C6 = sim.getObject("../IR_Front_C6")
|
74 |
+
IR_Front_C7 = sim.getObject("../IR_Front_C7")
|
75 |
+
IR_Front_C8 = sim.getObject("../IR_Front_C8")
|
76 |
+
IR_Front_C9 = sim.getObject("../IR_Front_C9")
|
77 |
+
IR_Front_C10 = sim.getObject("../IR_Front_C10")
|
78 |
+
IR_Front_C11 = sim.getObject("../IR_Front_C11")
|
79 |
+
IR_Front_C12 = sim.getObject("../IR_Front_C12")
|
80 |
+
IR_Front_C13 = sim.getObject("../IR_Front_C13")
|
81 |
+
IR_Front_C14 = sim.getObject("../IR_Front_C14")
|
82 |
+
IR_Front_C15 = sim.getObject("../IR_Front_C15")
|
83 |
+
IR_Front_C16 = sim.getObject("../IR_Front_C16")
|
84 |
+
IR_Front_RR = sim.getObject("../IR_Front_RR")
|
85 |
+
IR_Front_RR2 = sim.getObject("../IR_Front_RR2")
|
86 |
+
IR_Front_RR3 = sim.getObject("../IR_Front_RR3")
|
87 |
+
IR_Front_RR4 = sim.getObject("../IR_Front_RR4")
|
88 |
+
IR_Front_RR5 = sim.getObject("../IR_Front_RR5")
|
89 |
+
IR_Front_RR6 = sim.getObject("../IR_Front_RR6")
|
90 |
+
IR_Front_RR7 = sim.getObject("../IR_Front_RR7")
|
91 |
+
IR_Front_RR8 = sim.getObject("../IR_Front_RR8")
|
92 |
+
IR_Front_RR9 = sim.getObject("../IR_Front_RR9")
|
93 |
+
IR_Front_RR10 = sim.getObject("../IR_Front_RR10")
|
94 |
+
IR_Front_RR11 = sim.getObject("../IR_Front_RR11")
|
95 |
+
IR_Front_RR12 = sim.getObject("../IR_Front_RR12")
|
96 |
+
IR_Front_RR13 = sim.getObject("../IR_Front_RR13")
|
97 |
+
IR_Front_RR14 = sim.getObject("../IR_Front_RR14")
|
98 |
+
IR_Front_RR15 = sim.getObject("../IR_Front_RR15")
|
99 |
+
IR_Front_RR16 = sim.getObject("../IR_Front_RR16")
|
100 |
+
IR_Back_C = sim.getObject("../IR_Back_C")
|
101 |
+
IR_Back_C2 = sim.getObject("../IR_Back_C2")
|
102 |
+
IR_Back_C3 = sim.getObject("../IR_Back_C3")
|
103 |
+
IR_Back_C4 = sim.getObject("../IR_Back_C4")
|
104 |
+
IR_Back_C5 = sim.getObject("../IR_Back_C5")
|
105 |
+
IR_Back_C6 = sim.getObject("../IR_Back_C6")
|
106 |
+
IR_Back_C7 = sim.getObject("../IR_Back_C7")
|
107 |
+
IR_Back_C8 = sim.getObject("../IR_Back_C8")
|
108 |
+
IR_Back_C9 = sim.getObject("../IR_Back_C9")
|
109 |
+
IR_Back_C10 = sim.getObject("../IR_Back_C10")
|
110 |
+
IR_Back_C11 = sim.getObject("../IR_Back_C11")
|
111 |
+
IR_Back_C12 = sim.getObject("../IR_Back_C12")
|
112 |
+
IR_Back_C13 = sim.getObject("../IR_Back_C13")
|
113 |
+
IR_Back_C14 = sim.getObject("../IR_Back_C14")
|
114 |
+
IR_Back_C15 = sim.getObject("../IR_Back_C15")
|
115 |
+
IR_Back_C16 = sim.getObject("../IR_Back_C16")
|
116 |
+
IR_Front_LL = sim.getObject("../IR_Front_LL")
|
117 |
+
IR_Front_LL2 = sim.getObject("../IR_Front_LL2")
|
118 |
+
IR_Front_LL3 = sim.getObject("../IR_Front_LL3")
|
119 |
+
IR_Front_LL4 = sim.getObject("../IR_Front_LL4")
|
120 |
+
IR_Front_LL5 = sim.getObject("../IR_Front_LL5")
|
121 |
+
IR_Front_LL6 = sim.getObject("../IR_Front_LL6")
|
122 |
+
IR_Front_LL7 = sim.getObject("../IR_Front_LL7")
|
123 |
+
IR_Front_LL8 = sim.getObject("../IR_Front_LL8")
|
124 |
+
IR_Front_LL9 = sim.getObject("../IR_Front_LL9")
|
125 |
+
IR_Front_LL10 = sim.getObject("../IR_Front_LL10")
|
126 |
+
IR_Front_LL11 = sim.getObject("../IR_Front_LL11")
|
127 |
+
IR_Front_LL12 = sim.getObject("../IR_Front_LL12")
|
128 |
+
IR_Front_LL13 = sim.getObject("../IR_Front_LL13")
|
129 |
+
IR_Front_LL14 = sim.getObject("../IR_Front_LL14")
|
130 |
+
IR_Front_LL15 = sim.getObject("../IR_Front_LL15")
|
131 |
+
IR_Front_LL16 = sim.getObject("../IR_Front_LL16")
|
132 |
+
distancia = {} -- Definicion del vector que guardar los valores de las 16 distancias leidas por los 16 sensores de proximidad que forman los sensores infrarrojos implementados
|
133 |
+
IR = {} -- Definicion del vector que guarda los valores de intensidad de los 8 sensores infrarrojos implementados en el modelo
|
134 |
+
-- Definicion de los coeficientes y exponentes optimizados para ajustar el polinomio que calcule la intensidad detectada por el sensor IR a partir de las distancias
|
135 |
+
a = 0.1288
|
136 |
+
b = -1.7887
|
137 |
+
end
|
138 |
+
|
139 |
+
readAllIRSensor = function(inIntegers, inFloats, inStrings, inBuffer)
|
140 |
+
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
141 |
+
local _res
|
142 |
+
if sim.readProximitySensor(IR_Back_L) == 0 then
|
143 |
+
distancia[1] = 1000000
|
144 |
+
else
|
145 |
+
_res, distancia[1] = sim.readProximitySensor(IR_Back_L)
|
146 |
+
end
|
147 |
+
if sim.readProximitySensor(IR_Back_L2) == 0 then
|
148 |
+
distancia[2] = 1000000
|
149 |
+
else
|
150 |
+
_res, distancia[2] = sim.readProximitySensor(IR_Back_L2)
|
151 |
+
end
|
152 |
+
if sim.readProximitySensor(IR_Back_L3) == 0 then
|
153 |
+
distancia[3] = 1000000
|
154 |
+
else
|
155 |
+
_res, distancia[3] = sim.readProximitySensor(IR_Back_L3)
|
156 |
+
end
|
157 |
+
if sim.readProximitySensor(IR_Back_L4) == 0 then
|
158 |
+
distancia[4] = 1000000
|
159 |
+
else
|
160 |
+
_res, distancia[4] = sim.readProximitySensor(IR_Back_L4)
|
161 |
+
end
|
162 |
+
if sim.readProximitySensor(IR_Back_L5) == 0 then
|
163 |
+
distancia[5] = 1000000
|
164 |
+
else
|
165 |
+
_res, distancia[5] = sim.readProximitySensor(IR_Back_L5)
|
166 |
+
end
|
167 |
+
if sim.readProximitySensor(IR_Back_L6) == 0 then
|
168 |
+
distancia[6] = 1000000
|
169 |
+
else
|
170 |
+
_res, distancia[6] = sim.readProximitySensor(IR_Back_L6)
|
171 |
+
end
|
172 |
+
if sim.readProximitySensor(IR_Back_L7) == 0 then
|
173 |
+
distancia[7] = 1000000
|
174 |
+
else
|
175 |
+
_res, distancia[7] = sim.readProximitySensor(IR_Back_L7)
|
176 |
+
end
|
177 |
+
if sim.readProximitySensor(IR_Back_L8) == 0 then
|
178 |
+
distancia[8] = 1000000
|
179 |
+
else
|
180 |
+
_res, distancia[8] = sim.readProximitySensor(IR_Back_L8)
|
181 |
+
end
|
182 |
+
if sim.readProximitySensor(IR_Back_L9) == 0 then
|
183 |
+
distancia[9] = 1000000
|
184 |
+
else
|
185 |
+
_res, distancia[9] = sim.readProximitySensor(IR_Back_L9)
|
186 |
+
end
|
187 |
+
if sim.readProximitySensor(IR_Back_L10) == 0 then
|
188 |
+
distancia[10] = 1000000
|
189 |
+
else
|
190 |
+
_res, distancia[10] = sim.readProximitySensor(IR_Back_L10)
|
191 |
+
end
|
192 |
+
if sim.readProximitySensor(IR_Back_L11) == 0 then
|
193 |
+
distancia[11] = 1000000
|
194 |
+
else
|
195 |
+
_res, distancia[11] = sim.readProximitySensor(IR_Back_L11)
|
196 |
+
end
|
197 |
+
if sim.readProximitySensor(IR_Back_L12) == 0 then
|
198 |
+
distancia[12] = 1000000
|
199 |
+
else
|
200 |
+
_res, distancia[12] = sim.readProximitySensor(IR_Back_L12)
|
201 |
+
end
|
202 |
+
if sim.readProximitySensor(IR_Back_L13) == 0 then
|
203 |
+
distancia[13] = 1000000
|
204 |
+
else
|
205 |
+
_res, distancia[13] = sim.readProximitySensor(IR_Back_L13)
|
206 |
+
end
|
207 |
+
if sim.readProximitySensor(IR_Back_L14) == 0 then
|
208 |
+
distancia[14] = 1000000
|
209 |
+
else
|
210 |
+
_res, distancia[14] = sim.readProximitySensor(IR_Back_L14)
|
211 |
+
end
|
212 |
+
if sim.readProximitySensor(IR_Back_L15) == 0 then
|
213 |
+
distancia[15] = 1000000
|
214 |
+
else
|
215 |
+
_res, distancia[15] = sim.readProximitySensor(IR_Back_L15)
|
216 |
+
end
|
217 |
+
if sim.readProximitySensor(IR_Back_L16) == 0 then
|
218 |
+
distancia[16] = 1000000
|
219 |
+
else
|
220 |
+
_res, distancia[16] = sim.readProximitySensor(IR_Back_L16)
|
221 |
+
end
|
222 |
+
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
223 |
+
valorIR = 0
|
224 |
+
for i = 1, 16, 1 do
|
225 |
+
valorIR = valorIR + a * (distancia[i] ^ b)
|
226 |
+
end
|
227 |
+
IR[1] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
228 |
+
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
229 |
+
if sim.readProximitySensor(IR_Back_R) == 0 then
|
230 |
+
distancia[1] = 1000000
|
231 |
+
else
|
232 |
+
_res, distancia[1] = sim.readProximitySensor(IR_Back_R)
|
233 |
+
end
|
234 |
+
if sim.readProximitySensor(IR_Back_R2) == 0 then
|
235 |
+
distancia[2] = 1000000
|
236 |
+
else
|
237 |
+
_res, distancia[2] = sim.readProximitySensor(IR_Back_R2)
|
238 |
+
end
|
239 |
+
if sim.readProximitySensor(IR_Back_R3) == 0 then
|
240 |
+
distancia[3] = 1000000
|
241 |
+
else
|
242 |
+
_res, distancia[3] = sim.readProximitySensor(IR_Back_R3)
|
243 |
+
end
|
244 |
+
if sim.readProximitySensor(IR_Back_R4) == 0 then
|
245 |
+
distancia[4] = 1000000
|
246 |
+
else
|
247 |
+
_res, distancia[4] = sim.readProximitySensor(IR_Back_R4)
|
248 |
+
end
|
249 |
+
if sim.readProximitySensor(IR_Back_R5) == 0 then
|
250 |
+
distancia[5] = 1000000
|
251 |
+
else
|
252 |
+
_res, distancia[5] = sim.readProximitySensor(IR_Back_R5)
|
253 |
+
end
|
254 |
+
if sim.readProximitySensor(IR_Back_R6) == 0 then
|
255 |
+
distancia[6] = 1000000
|
256 |
+
else
|
257 |
+
_res, distancia[6] = sim.readProximitySensor(IR_Back_R6)
|
258 |
+
end
|
259 |
+
if sim.readProximitySensor(IR_Back_R7) == 0 then
|
260 |
+
distancia[7] = 1000000
|
261 |
+
else
|
262 |
+
_res, distancia[7] = sim.readProximitySensor(IR_Back_R7)
|
263 |
+
end
|
264 |
+
if sim.readProximitySensor(IR_Back_R8) == 0 then
|
265 |
+
distancia[8] = 1000000
|
266 |
+
else
|
267 |
+
_res, distancia[8] = sim.readProximitySensor(IR_Back_R8)
|
268 |
+
end
|
269 |
+
if sim.readProximitySensor(IR_Back_R9) == 0 then
|
270 |
+
distancia[9] = 1000000
|
271 |
+
else
|
272 |
+
_res, distancia[9] = sim.readProximitySensor(IR_Back_R9)
|
273 |
+
end
|
274 |
+
if sim.readProximitySensor(IR_Back_R10) == 0 then
|
275 |
+
distancia[10] = 1000000
|
276 |
+
else
|
277 |
+
_res, distancia[10] = sim.readProximitySensor(IR_Back_R10)
|
278 |
+
end
|
279 |
+
if sim.readProximitySensor(IR_Back_R11) == 0 then
|
280 |
+
distancia[11] = 1000000
|
281 |
+
else
|
282 |
+
_res, distancia[11] = sim.readProximitySensor(IR_Back_R11)
|
283 |
+
end
|
284 |
+
if sim.readProximitySensor(IR_Back_R12) == 0 then
|
285 |
+
distancia[12] = 1000000
|
286 |
+
else
|
287 |
+
_res, distancia[12] = sim.readProximitySensor(IR_Back_R12)
|
288 |
+
end
|
289 |
+
if sim.readProximitySensor(IR_Back_R13) == 0 then
|
290 |
+
distancia[13] = 1000000
|
291 |
+
else
|
292 |
+
_res, distancia[13] = sim.readProximitySensor(IR_Back_R13)
|
293 |
+
end
|
294 |
+
if sim.readProximitySensor(IR_Back_R14) == 0 then
|
295 |
+
distancia[14] = 1000000
|
296 |
+
else
|
297 |
+
_res, distancia[14] = sim.readProximitySensor(IR_Back_R14)
|
298 |
+
end
|
299 |
+
if sim.readProximitySensor(IR_Back_R15) == 0 then
|
300 |
+
distancia[15] = 1000000
|
301 |
+
else
|
302 |
+
_res, distancia[15] = sim.readProximitySensor(IR_Back_R15)
|
303 |
+
end
|
304 |
+
if sim.readProximitySensor(IR_Back_R16) == 0 then
|
305 |
+
distancia[16] = 1000000
|
306 |
+
else
|
307 |
+
_res, distancia[16] = sim.readProximitySensor(IR_Back_R16)
|
308 |
+
end
|
309 |
+
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
310 |
+
valorIR = 0
|
311 |
+
for i = 1, 16, 1 do
|
312 |
+
valorIR = valorIR + a * (distancia[i] ^ b)
|
313 |
+
end
|
314 |
+
IR[2] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
315 |
+
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
316 |
+
if sim.readProximitySensor(IR_Front_L) == 0 then
|
317 |
+
distancia[1] = 1000000
|
318 |
+
else
|
319 |
+
_res, distancia[1] = sim.readProximitySensor(IR_Front_L)
|
320 |
+
end
|
321 |
+
if sim.readProximitySensor(IR_Front_L2) == 0 then
|
322 |
+
distancia[2] = 1000000
|
323 |
+
else
|
324 |
+
_res, distancia[2] = sim.readProximitySensor(IR_Front_L2)
|
325 |
+
end
|
326 |
+
if sim.readProximitySensor(IR_Front_L3) == 0 then
|
327 |
+
distancia[3] = 1000000
|
328 |
+
else
|
329 |
+
_res, distancia[3] = sim.readProximitySensor(IR_Front_L3)
|
330 |
+
end
|
331 |
+
if sim.readProximitySensor(IR_Front_L4) == 0 then
|
332 |
+
distancia[4] = 1000000
|
333 |
+
else
|
334 |
+
_res, distancia[4] = sim.readProximitySensor(IR_Front_L4)
|
335 |
+
end
|
336 |
+
if sim.readProximitySensor(IR_Front_L5) == 0 then
|
337 |
+
distancia[5] = 1000000
|
338 |
+
else
|
339 |
+
_res, distancia[5] = sim.readProximitySensor(IR_Front_L5)
|
340 |
+
end
|
341 |
+
if sim.readProximitySensor(IR_Front_L6) == 0 then
|
342 |
+
distancia[6] = 1000000
|
343 |
+
else
|
344 |
+
_res, distancia[6] = sim.readProximitySensor(IR_Front_L6)
|
345 |
+
end
|
346 |
+
if sim.readProximitySensor(IR_Front_L7) == 0 then
|
347 |
+
distancia[7] = 1000000
|
348 |
+
else
|
349 |
+
_res, distancia[7] = sim.readProximitySensor(IR_Front_L7)
|
350 |
+
end
|
351 |
+
if sim.readProximitySensor(IR_Front_L8) == 0 then
|
352 |
+
distancia[8] = 1000000
|
353 |
+
else
|
354 |
+
_res, distancia[8] = sim.readProximitySensor(IR_Front_L8)
|
355 |
+
end
|
356 |
+
if sim.readProximitySensor(IR_Front_L9) == 0 then
|
357 |
+
distancia[9] = 1000000
|
358 |
+
else
|
359 |
+
_res, distancia[9] = sim.readProximitySensor(IR_Front_L9)
|
360 |
+
end
|
361 |
+
if sim.readProximitySensor(IR_Front_L10) == 0 then
|
362 |
+
distancia[10] = 1000000
|
363 |
+
else
|
364 |
+
_res, distancia[10] = sim.readProximitySensor(IR_Front_L10)
|
365 |
+
end
|
366 |
+
if sim.readProximitySensor(IR_Front_L11) == 0 then
|
367 |
+
distancia[11] = 1000000
|
368 |
+
else
|
369 |
+
_res, distancia[11] = sim.readProximitySensor(IR_Front_L11)
|
370 |
+
end
|
371 |
+
if sim.readProximitySensor(IR_Front_L12) == 0 then
|
372 |
+
distancia[12] = 1000000
|
373 |
+
else
|
374 |
+
_res, distancia[12] = sim.readProximitySensor(IR_Front_L12)
|
375 |
+
end
|
376 |
+
if sim.readProximitySensor(IR_Front_L13) == 0 then
|
377 |
+
distancia[13] = 1000000
|
378 |
+
else
|
379 |
+
_res, distancia[13] = sim.readProximitySensor(IR_Front_L13)
|
380 |
+
end
|
381 |
+
if sim.readProximitySensor(IR_Front_L14) == 0 then
|
382 |
+
distancia[14] = 1000000
|
383 |
+
else
|
384 |
+
_res, distancia[14] = sim.readProximitySensor(IR_Front_L14)
|
385 |
+
end
|
386 |
+
if sim.readProximitySensor(IR_Front_L15) == 0 then
|
387 |
+
distancia[15] = 1000000
|
388 |
+
else
|
389 |
+
_res, distancia[15] = sim.readProximitySensor(IR_Front_L15)
|
390 |
+
end
|
391 |
+
if sim.readProximitySensor(IR_Front_L16) == 0 then
|
392 |
+
distancia[16] = 1000000
|
393 |
+
else
|
394 |
+
_res, distancia[16] = sim.readProximitySensor(IR_Front_L16)
|
395 |
+
end
|
396 |
+
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
397 |
+
valorIR = 0
|
398 |
+
for i = 1, 16, 1 do
|
399 |
+
valorIR = valorIR + a * (distancia[i] ^ b)
|
400 |
+
end
|
401 |
+
IR[3] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
402 |
+
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
403 |
+
if sim.readProximitySensor(IR_Front_R) == 0 then
|
404 |
+
distancia[1] = 1000000
|
405 |
+
else
|
406 |
+
_res, distancia[1] = sim.readProximitySensor(IR_Front_R)
|
407 |
+
end
|
408 |
+
if sim.readProximitySensor(IR_Front_R2) == 0 then
|
409 |
+
distancia[2] = 1000000
|
410 |
+
else
|
411 |
+
_res, distancia[2] = sim.readProximitySensor(IR_Front_R2)
|
412 |
+
end
|
413 |
+
if sim.readProximitySensor(IR_Front_R3) == 0 then
|
414 |
+
distancia[3] = 1000000
|
415 |
+
else
|
416 |
+
_res, distancia[3] = sim.readProximitySensor(IR_Front_R3)
|
417 |
+
end
|
418 |
+
if sim.readProximitySensor(IR_Front_R4) == 0 then
|
419 |
+
distancia[4] = 1000000
|
420 |
+
else
|
421 |
+
_res, distancia[4] = sim.readProximitySensor(IR_Front_R4)
|
422 |
+
end
|
423 |
+
if sim.readProximitySensor(IR_Front_R5) == 0 then
|
424 |
+
distancia[5] = 1000000
|
425 |
+
else
|
426 |
+
_res, distancia[5] = sim.readProximitySensor(IR_Front_R5)
|
427 |
+
end
|
428 |
+
if sim.readProximitySensor(IR_Front_R6) == 0 then
|
429 |
+
distancia[6] = 1000000
|
430 |
+
else
|
431 |
+
_res, distancia[6] = sim.readProximitySensor(IR_Front_R6)
|
432 |
+
end
|
433 |
+
if sim.readProximitySensor(IR_Front_R7) == 0 then
|
434 |
+
distancia[7] = 1000000
|
435 |
+
else
|
436 |
+
_res, distancia[7] = sim.readProximitySensor(IR_Front_R7)
|
437 |
+
end
|
438 |
+
if sim.readProximitySensor(IR_Front_R8) == 0 then
|
439 |
+
distancia[8] = 1000000
|
440 |
+
else
|
441 |
+
_res, distancia[8] = sim.readProximitySensor(IR_Front_R8)
|
442 |
+
end
|
443 |
+
if sim.readProximitySensor(IR_Front_R9) == 0 then
|
444 |
+
distancia[9] = 1000000
|
445 |
+
else
|
446 |
+
_res, distancia[9] = sim.readProximitySensor(IR_Front_R9)
|
447 |
+
end
|
448 |
+
if sim.readProximitySensor(IR_Front_R10) == 0 then
|
449 |
+
distancia[10] = 1000000
|
450 |
+
else
|
451 |
+
_res, distancia[10] = sim.readProximitySensor(IR_Front_R10)
|
452 |
+
end
|
453 |
+
if sim.readProximitySensor(IR_Front_R11) == 0 then
|
454 |
+
distancia[11] = 1000000
|
455 |
+
else
|
456 |
+
_res, distancia[11] = sim.readProximitySensor(IR_Front_R11)
|
457 |
+
end
|
458 |
+
if sim.readProximitySensor(IR_Front_R12) == 0 then
|
459 |
+
distancia[12] = 1000000
|
460 |
+
else
|
461 |
+
_res, distancia[12] = sim.readProximitySensor(IR_Front_R12)
|
462 |
+
end
|
463 |
+
if sim.readProximitySensor(IR_Front_R13) == 0 then
|
464 |
+
distancia[13] = 1000000
|
465 |
+
else
|
466 |
+
_res, distancia[13] = sim.readProximitySensor(IR_Front_R13)
|
467 |
+
end
|
468 |
+
if sim.readProximitySensor(IR_Front_R14) == 0 then
|
469 |
+
distancia[14] = 1000000
|
470 |
+
else
|
471 |
+
_res, distancia[14] = sim.readProximitySensor(IR_Front_R14)
|
472 |
+
end
|
473 |
+
if sim.readProximitySensor(IR_Front_R15) == 0 then
|
474 |
+
distancia[15] = 1000000
|
475 |
+
else
|
476 |
+
_res, distancia[15] = sim.readProximitySensor(IR_Front_R15)
|
477 |
+
end
|
478 |
+
if sim.readProximitySensor(IR_Front_R16) == 0 then
|
479 |
+
distancia[16] = 1000000
|
480 |
+
else
|
481 |
+
_res, distancia[16] = sim.readProximitySensor(IR_Front_R16)
|
482 |
+
end
|
483 |
+
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
484 |
+
valorIR = 0
|
485 |
+
for i = 1, 16, 1 do
|
486 |
+
valorIR = valorIR + a * (distancia[i] ^ b)
|
487 |
+
end
|
488 |
+
IR[4] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
489 |
+
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
490 |
+
if sim.readProximitySensor(IR_Front_C) == 0 then
|
491 |
+
distancia[1] = 1000000
|
492 |
+
else
|
493 |
+
_res, distancia[1] = sim.readProximitySensor(IR_Front_C)
|
494 |
+
end
|
495 |
+
if sim.readProximitySensor(IR_Front_C2) == 0 then
|
496 |
+
distancia[2] = 1000000
|
497 |
+
else
|
498 |
+
_res, distancia[2] = sim.readProximitySensor(IR_Front_C2)
|
499 |
+
end
|
500 |
+
if sim.readProximitySensor(IR_Front_C3) == 0 then
|
501 |
+
distancia[3] = 1000000
|
502 |
+
else
|
503 |
+
_res, distancia[3] = sim.readProximitySensor(IR_Front_C3)
|
504 |
+
end
|
505 |
+
if sim.readProximitySensor(IR_Front_C4) == 0 then
|
506 |
+
distancia[4] = 1000000
|
507 |
+
else
|
508 |
+
_res, distancia[4] = sim.readProximitySensor(IR_Front_C4)
|
509 |
+
end
|
510 |
+
if sim.readProximitySensor(IR_Front_C5) == 0 then
|
511 |
+
distancia[5] = 1000000
|
512 |
+
else
|
513 |
+
_res, distancia[5] = sim.readProximitySensor(IR_Front_C5)
|
514 |
+
end
|
515 |
+
if sim.readProximitySensor(IR_Front_C6) == 0 then
|
516 |
+
distancia[6] = 1000000
|
517 |
+
else
|
518 |
+
_res, distancia[6] = sim.readProximitySensor(IR_Front_C6)
|
519 |
+
end
|
520 |
+
if sim.readProximitySensor(IR_Front_C7) == 0 then
|
521 |
+
distancia[7] = 1000000
|
522 |
+
else
|
523 |
+
_res, distancia[7] = sim.readProximitySensor(IR_Front_C7)
|
524 |
+
end
|
525 |
+
if sim.readProximitySensor(IR_Front_C8) == 0 then
|
526 |
+
distancia[8] = 1000000
|
527 |
+
else
|
528 |
+
_res, distancia[8] = sim.readProximitySensor(IR_Front_C8)
|
529 |
+
end
|
530 |
+
if sim.readProximitySensor(IR_Front_C9) == 0 then
|
531 |
+
distancia[9] = 1000000
|
532 |
+
else
|
533 |
+
_res, distancia[9] = sim.readProximitySensor(IR_Front_C9)
|
534 |
+
end
|
535 |
+
if sim.readProximitySensor(IR_Front_C10) == 0 then
|
536 |
+
distancia[10] = 1000000
|
537 |
+
else
|
538 |
+
_res, distancia[10] = sim.readProximitySensor(IR_Front_C10)
|
539 |
+
end
|
540 |
+
if sim.readProximitySensor(IR_Front_C11) == 0 then
|
541 |
+
distancia[11] = 1000000
|
542 |
+
else
|
543 |
+
_res, distancia[11] = sim.readProximitySensor(IR_Front_C11)
|
544 |
+
end
|
545 |
+
if sim.readProximitySensor(IR_Front_C12) == 0 then
|
546 |
+
distancia[12] = 1000000
|
547 |
+
else
|
548 |
+
_res, distancia[12] = sim.readProximitySensor(IR_Front_C12)
|
549 |
+
end
|
550 |
+
if sim.readProximitySensor(IR_Front_C13) == 0 then
|
551 |
+
distancia[13] = 1000000
|
552 |
+
else
|
553 |
+
_res, distancia[13] = sim.readProximitySensor(IR_Front_C13)
|
554 |
+
end
|
555 |
+
if sim.readProximitySensor(IR_Front_C14) == 0 then
|
556 |
+
distancia[14] = 1000000
|
557 |
+
else
|
558 |
+
_res, distancia[14] = sim.readProximitySensor(IR_Front_C14)
|
559 |
+
end
|
560 |
+
if sim.readProximitySensor(IR_Front_C15) == 0 then
|
561 |
+
distancia[15] = 1000000
|
562 |
+
else
|
563 |
+
_res, distancia[15] = sim.readProximitySensor(IR_Front_C15)
|
564 |
+
end
|
565 |
+
if sim.readProximitySensor(IR_Front_C16) == 0 then
|
566 |
+
distancia[16] = 1000000
|
567 |
+
else
|
568 |
+
_res, distancia[16] = sim.readProximitySensor(IR_Front_C16)
|
569 |
+
end
|
570 |
+
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
571 |
+
valorIR = 0
|
572 |
+
for i = 1, 16, 1 do
|
573 |
+
valorIR = valorIR + a * (distancia[i] ^ b)
|
574 |
+
end
|
575 |
+
IR[5] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
576 |
+
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
577 |
+
if sim.readProximitySensor(IR_Front_RR) == 0 then
|
578 |
+
distancia[1] = 1000000
|
579 |
+
else
|
580 |
+
_res, distancia[1] = sim.readProximitySensor(IR_Front_RR)
|
581 |
+
end
|
582 |
+
if sim.readProximitySensor(IR_Front_RR2) == 0 then
|
583 |
+
distancia[2] = 1000000
|
584 |
+
else
|
585 |
+
_res, distancia[2] = sim.readProximitySensor(IR_Front_RR2)
|
586 |
+
end
|
587 |
+
if sim.readProximitySensor(IR_Front_RR3) == 0 then
|
588 |
+
distancia[3] = 1000000
|
589 |
+
else
|
590 |
+
_res, distancia[3] = sim.readProximitySensor(IR_Front_RR3)
|
591 |
+
end
|
592 |
+
if sim.readProximitySensor(IR_Front_RR4) == 0 then
|
593 |
+
distancia[4] = 1000000
|
594 |
+
else
|
595 |
+
_res, distancia[4] = sim.readProximitySensor(IR_Front_RR4)
|
596 |
+
end
|
597 |
+
if sim.readProximitySensor(IR_Front_RR5) == 0 then
|
598 |
+
distancia[5] = 1000000
|
599 |
+
else
|
600 |
+
_res, distancia[5] = sim.readProximitySensor(IR_Front_RR5)
|
601 |
+
end
|
602 |
+
if sim.readProximitySensor(IR_Front_RR6) == 0 then
|
603 |
+
distancia[6] = 1000000
|
604 |
+
else
|
605 |
+
_res, distancia[6] = sim.readProximitySensor(IR_Front_RR6)
|
606 |
+
end
|
607 |
+
if sim.readProximitySensor(IR_Front_RR7) == 0 then
|
608 |
+
distancia[7] = 1000000
|
609 |
+
else
|
610 |
+
_res, distancia[7] = sim.readProximitySensor(IR_Front_RR7)
|
611 |
+
end
|
612 |
+
if sim.readProximitySensor(IR_Front_RR8) == 0 then
|
613 |
+
distancia[8] = 1000000
|
614 |
+
else
|
615 |
+
_res, distancia[8] = sim.readProximitySensor(IR_Front_RR8)
|
616 |
+
end
|
617 |
+
if sim.readProximitySensor(IR_Front_RR9) == 0 then
|
618 |
+
distancia[9] = 1000000
|
619 |
+
else
|
620 |
+
_res, distancia[9] = sim.readProximitySensor(IR_Front_RR9)
|
621 |
+
end
|
622 |
+
if sim.readProximitySensor(IR_Front_RR10) == 0 then
|
623 |
+
distancia[10] = 1000000
|
624 |
+
else
|
625 |
+
_res, distancia[10] = sim.readProximitySensor(IR_Front_RR10)
|
626 |
+
end
|
627 |
+
if sim.readProximitySensor(IR_Front_RR11) == 0 then
|
628 |
+
distancia[11] = 1000000
|
629 |
+
else
|
630 |
+
_res, distancia[11] = sim.readProximitySensor(IR_Front_RR11)
|
631 |
+
end
|
632 |
+
if sim.readProximitySensor(IR_Front_RR12) == 0 then
|
633 |
+
distancia[12] = 1000000
|
634 |
+
else
|
635 |
+
_res, distancia[12] = sim.readProximitySensor(IR_Front_RR12)
|
636 |
+
end
|
637 |
+
if sim.readProximitySensor(IR_Front_RR13) == 0 then
|
638 |
+
distancia[13] = 1000000
|
639 |
+
else
|
640 |
+
_res, distancia[13] = sim.readProximitySensor(IR_Front_RR13)
|
641 |
+
end
|
642 |
+
if sim.readProximitySensor(IR_Front_RR14) == 0 then
|
643 |
+
distancia[14] = 1000000
|
644 |
+
else
|
645 |
+
_res, distancia[14] = sim.readProximitySensor(IR_Front_RR14)
|
646 |
+
end
|
647 |
+
if sim.readProximitySensor(IR_Front_RR15) == 0 then
|
648 |
+
distancia[15] = 1000000
|
649 |
+
else
|
650 |
+
_res, distancia[15] = sim.readProximitySensor(IR_Front_RR15)
|
651 |
+
end
|
652 |
+
if sim.readProximitySensor(IR_Front_RR16) == 0 then
|
653 |
+
distancia[16] = 1000000
|
654 |
+
else
|
655 |
+
_res, distancia[16] = sim.readProximitySensor(IR_Front_RR16)
|
656 |
+
end
|
657 |
+
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
658 |
+
valorIR = 0
|
659 |
+
for i = 1, 16, 1 do
|
660 |
+
valorIR = valorIR + a * (distancia[i] ^ b)
|
661 |
+
end
|
662 |
+
IR[6] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
663 |
+
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
664 |
+
if sim.readProximitySensor(IR_Back_C) == 0 then
|
665 |
+
distancia[1] = 1000000
|
666 |
+
else
|
667 |
+
_res, distancia[1] = sim.readProximitySensor(IR_Back_C)
|
668 |
+
end
|
669 |
+
if sim.readProximitySensor(IR_Back_C2) == 0 then
|
670 |
+
distancia[2] = 1000000
|
671 |
+
else
|
672 |
+
_res, distancia[2] = sim.readProximitySensor(IR_Back_C2)
|
673 |
+
end
|
674 |
+
if sim.readProximitySensor(IR_Back_C3) == 0 then
|
675 |
+
distancia[3] = 1000000
|
676 |
+
else
|
677 |
+
_res, distancia[3] = sim.readProximitySensor(IR_Back_C3)
|
678 |
+
end
|
679 |
+
if sim.readProximitySensor(IR_Back_C4) == 0 then
|
680 |
+
distancia[4] = 1000000
|
681 |
+
else
|
682 |
+
_res, distancia[4] = sim.readProximitySensor(IR_Back_C4)
|
683 |
+
end
|
684 |
+
if sim.readProximitySensor(IR_Back_C5) == 0 then
|
685 |
+
distancia[5] = 1000000
|
686 |
+
else
|
687 |
+
_res, distancia[5] = sim.readProximitySensor(IR_Back_C5)
|
688 |
+
end
|
689 |
+
if sim.readProximitySensor(IR_Back_C6) == 0 then
|
690 |
+
distancia[6] = 1000000
|
691 |
+
else
|
692 |
+
_res, distancia[6] = sim.readProximitySensor(IR_Back_C6)
|
693 |
+
end
|
694 |
+
if sim.readProximitySensor(IR_Back_C7) == 0 then
|
695 |
+
distancia[7] = 1000000
|
696 |
+
else
|
697 |
+
_res, distancia[7] = sim.readProximitySensor(IR_Back_C7)
|
698 |
+
end
|
699 |
+
if sim.readProximitySensor(IR_Back_C8) == 0 then
|
700 |
+
distancia[8] = 1000000
|
701 |
+
else
|
702 |
+
_res, distancia[8] = sim.readProximitySensor(IR_Back_C8)
|
703 |
+
end
|
704 |
+
if sim.readProximitySensor(IR_Back_C9) == 0 then
|
705 |
+
distancia[9] = 1000000
|
706 |
+
else
|
707 |
+
_res, distancia[9] = sim.readProximitySensor(IR_Back_C9)
|
708 |
+
end
|
709 |
+
if sim.readProximitySensor(IR_Back_C10) == 0 then
|
710 |
+
distancia[10] = 1000000
|
711 |
+
else
|
712 |
+
_res, distancia[10] = sim.readProximitySensor(IR_Back_C10)
|
713 |
+
end
|
714 |
+
if sim.readProximitySensor(IR_Back_C11) == 0 then
|
715 |
+
distancia[11] = 1000000
|
716 |
+
else
|
717 |
+
_res, distancia[11] = sim.readProximitySensor(IR_Back_C11)
|
718 |
+
end
|
719 |
+
if sim.readProximitySensor(IR_Back_C12) == 0 then
|
720 |
+
distancia[12] = 1000000
|
721 |
+
else
|
722 |
+
_res, distancia[12] = sim.readProximitySensor(IR_Back_C12)
|
723 |
+
end
|
724 |
+
if sim.readProximitySensor(IR_Back_C13) == 0 then
|
725 |
+
distancia[13] = 1000000
|
726 |
+
else
|
727 |
+
_res, distancia[13] = sim.readProximitySensor(IR_Back_C13)
|
728 |
+
end
|
729 |
+
if sim.readProximitySensor(IR_Back_C14) == 0 then
|
730 |
+
distancia[14] = 1000000
|
731 |
+
else
|
732 |
+
_res, distancia[14] = sim.readProximitySensor(IR_Back_C14)
|
733 |
+
end
|
734 |
+
if sim.readProximitySensor(IR_Back_C15) == 0 then
|
735 |
+
distancia[15] = 1000000
|
736 |
+
else
|
737 |
+
_res, distancia[15] = sim.readProximitySensor(IR_Back_C15)
|
738 |
+
end
|
739 |
+
if sim.readProximitySensor(IR_Back_C16) == 0 then
|
740 |
+
distancia[16] = 1000000
|
741 |
+
else
|
742 |
+
_res, distancia[16] = sim.readProximitySensor(IR_Back_C16)
|
743 |
+
end
|
744 |
+
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
745 |
+
valorIR = 0
|
746 |
+
for i = 1, 16, 1 do
|
747 |
+
valorIR = valorIR + a * (distancia[i] ^ b)
|
748 |
+
end
|
749 |
+
IR[7] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
750 |
+
-- Lectura de distancias de cada sensor de proximidad y guardado en el vector "distancia"
|
751 |
+
if sim.readProximitySensor(IR_Front_LL) == 0 then
|
752 |
+
distancia[1] = 1000000
|
753 |
+
else
|
754 |
+
_res, distancia[1] = sim.readProximitySensor(IR_Front_LL)
|
755 |
+
end
|
756 |
+
if sim.readProximitySensor(IR_Front_LL2) == 0 then
|
757 |
+
distancia[2] = 1000000
|
758 |
+
else
|
759 |
+
_res, distancia[2] = sim.readProximitySensor(IR_Front_LL2)
|
760 |
+
end
|
761 |
+
if sim.readProximitySensor(IR_Front_LL3) == 0 then
|
762 |
+
distancia[3] = 1000000
|
763 |
+
else
|
764 |
+
_res, distancia[3] = sim.readProximitySensor(IR_Front_LL3)
|
765 |
+
end
|
766 |
+
if sim.readProximitySensor(IR_Front_LL4) == 0 then
|
767 |
+
distancia[4] = 1000000
|
768 |
+
else
|
769 |
+
_res, distancia[4] = sim.readProximitySensor(IR_Front_LL4)
|
770 |
+
end
|
771 |
+
if sim.readProximitySensor(IR_Front_LL5) == 0 then
|
772 |
+
distancia[5] = 1000000
|
773 |
+
else
|
774 |
+
_res, distancia[5] = sim.readProximitySensor(IR_Front_LL5)
|
775 |
+
end
|
776 |
+
if sim.readProximitySensor(IR_Front_LL6) == 0 then
|
777 |
+
distancia[6] = 1000000
|
778 |
+
else
|
779 |
+
_res, distancia[6] = sim.readProximitySensor(IR_Front_LL6)
|
780 |
+
end
|
781 |
+
if sim.readProximitySensor(IR_Front_LL7) == 0 then
|
782 |
+
distancia[7] = 1000000
|
783 |
+
else
|
784 |
+
_res, distancia[7] = sim.readProximitySensor(IR_Front_LL7)
|
785 |
+
end
|
786 |
+
if sim.readProximitySensor(IR_Front_LL8) == 0 then
|
787 |
+
distancia[8] = 1000000
|
788 |
+
else
|
789 |
+
_res, distancia[8] = sim.readProximitySensor(IR_Front_LL8)
|
790 |
+
end
|
791 |
+
if sim.readProximitySensor(IR_Front_LL9) == 0 then
|
792 |
+
distancia[9] = 1000000
|
793 |
+
else
|
794 |
+
_res, distancia[9] = sim.readProximitySensor(IR_Front_LL9)
|
795 |
+
end
|
796 |
+
if sim.readProximitySensor(IR_Front_LL10) == 0 then
|
797 |
+
distancia[10] = 1000000
|
798 |
+
else
|
799 |
+
_res, distancia[10] = sim.readProximitySensor(IR_Front_LL10)
|
800 |
+
end
|
801 |
+
if sim.readProximitySensor(IR_Front_LL11) == 0 then
|
802 |
+
distancia[11] = 1000000
|
803 |
+
else
|
804 |
+
_res, distancia[11] = sim.readProximitySensor(IR_Front_LL11)
|
805 |
+
end
|
806 |
+
if sim.readProximitySensor(IR_Front_LL12) == 0 then
|
807 |
+
distancia[12] = 1000000
|
808 |
+
else
|
809 |
+
_res, distancia[12] = sim.readProximitySensor(IR_Front_LL12)
|
810 |
+
end
|
811 |
+
if sim.readProximitySensor(IR_Front_LL13) == 0 then
|
812 |
+
distancia[13] = 1000000
|
813 |
+
else
|
814 |
+
_res, distancia[13] = sim.readProximitySensor(IR_Front_LL13)
|
815 |
+
end
|
816 |
+
if sim.readProximitySensor(IR_Front_LL14) == 0 then
|
817 |
+
distancia[14] = 1000000
|
818 |
+
else
|
819 |
+
_res, distancia[14] = sim.readProximitySensor(IR_Front_LL14)
|
820 |
+
end
|
821 |
+
if sim.readProximitySensor(IR_Front_LL15) == 0 then
|
822 |
+
distancia[15] = 1000000
|
823 |
+
else
|
824 |
+
_res, distancia[15] = sim.readProximitySensor(IR_Front_LL15)
|
825 |
+
end
|
826 |
+
if sim.readProximitySensor(IR_Front_LL16) == 0 then
|
827 |
+
distancia[16] = 1000000
|
828 |
+
else
|
829 |
+
_res, distancia[16] = sim.readProximitySensor(IR_Front_LL16)
|
830 |
+
end
|
831 |
+
-- Calculo de la intensidad detectada por el sensor IR a partir de las distancias obtenidas de cada sensor de proximidad
|
832 |
+
valorIR = 0
|
833 |
+
for i = 1, 16, 1 do
|
834 |
+
valorIR = valorIR + a * (distancia[i] ^ b)
|
835 |
+
end
|
836 |
+
IR[8] = valorIR --+math.random(-5,5)/100*valorIR-- Guardado del valor de la intensidad en el vector "IR" y simulacion de ruido en el sensor
|
837 |
+
return IR, {}, {}, ""
|
838 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/left_motor.lua
CHANGED
@@ -1,269 +1,269 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init()
|
4 |
-
-- do some initialization here
|
5 |
-
motorI = sim.getObject("../Left_Motor")
|
6 |
-
motorD = sim.getObject("../Right_Motor")
|
7 |
-
d = 0
|
8 |
-
pos_inicial_I = 0
|
9 |
-
pos_inicial_D = 0
|
10 |
-
end
|
11 |
-
|
12 |
-
function sysCall_actuation()
|
13 |
-
-- put your actuation code here
|
14 |
-
if d > 0 then
|
15 |
-
-- Cuando se supere el tiempo de duracion del movimiento de las ruedas, se paran los joints y se resetean las variables globales
|
16 |
-
if (sim.getSimulationTime() - t_inicial) >= d then
|
17 |
-
sim.setJointTargetVelocity(motorI, 0)
|
18 |
-
sim.setJointTargetVelocity(motorD, 0)
|
19 |
-
sim.setInt32Signal(signal, 0)
|
20 |
-
d = 0
|
21 |
-
vI = 0
|
22 |
-
vD = 0
|
23 |
-
end
|
24 |
-
end
|
25 |
-
end
|
26 |
-
|
27 |
-
moveWheelsByTime = function(velocidad, tiempo, inString, inBuffer) -- "velocidad" es un vector de dos elementos: velocidades de la rueda derecha e izquierda
|
28 |
-
d = tiempo[1] -- Definicion de una variable que guarda el tiempo que se moveran las ruedas
|
29 |
-
t_inicial = sim.getSimulationTime() -- Definicion de una variable que guarda el instante en el que se llama a la funcion
|
30 |
-
signal = inString[1]
|
31 |
-
sim.setInt32Signal(signal, 1) -- Definicion de una variable global que bloquea la funcion (1) o la desbloquea (0)
|
32 |
-
-- Se asegura que los argumentos de velocidad recibidos tienen un valor entre -100 y 100
|
33 |
-
if velocidad[2] > 100 then
|
34 |
-
vI = 100
|
35 |
-
elseif velocidad[2] < -100 then
|
36 |
-
vI = -100
|
37 |
-
else
|
38 |
-
vI = velocidad[2]
|
39 |
-
end
|
40 |
-
if velocidad[1] > 100 then
|
41 |
-
vD = 100
|
42 |
-
elseif velocidad[1] < -100 then
|
43 |
-
vD = -100
|
44 |
-
else
|
45 |
-
vD = velocidad[1]
|
46 |
-
end
|
47 |
-
--Calculo de la velocidad de la rueda izquierda dividiendo los grados calculados con el polinomio entre el tiempo asignado
|
48 |
-
if vI > 0 then
|
49 |
-
sim.setJointTargetVelocity(
|
50 |
-
motorI,
|
51 |
-
(
|
52 |
-
(0.000001646 * (vI ^ 3) - 0.00285 * (vI ^ 2) + 6.649 * vI + 51.14)
|
53 |
-
+ (-0.0002912 * (vI ^ 3) + 0.04647 * (vI ^ 2) - 1.339 * vI - 12.25)
|
54 |
-
/ d
|
55 |
-
)
|
56 |
-
* math.pi
|
57 |
-
/ 180
|
58 |
-
)
|
59 |
-
elseif vI < 0 then
|
60 |
-
sim.setJointTargetVelocity(
|
61 |
-
motorI,
|
62 |
-
-(
|
63 |
-
(
|
64 |
-
0.000001646 * math.abs(vI ^ 3)
|
65 |
-
- 0.00285 * (vI ^ 2)
|
66 |
-
+ 6.649 * math.abs(vI)
|
67 |
-
+ 51.14
|
68 |
-
)
|
69 |
-
+ (
|
70 |
-
-0.0002912 * math.abs(vI ^ 3)
|
71 |
-
+ 0.04647 * (vI ^ 2)
|
72 |
-
- 1.339 * math.abs(vI)
|
73 |
-
- 12.25
|
74 |
-
)
|
75 |
-
/ d
|
76 |
-
)
|
77 |
-
* math.pi
|
78 |
-
/ 180
|
79 |
-
)
|
80 |
-
else
|
81 |
-
sim.setJointTargetVelocity(motorI, 0)
|
82 |
-
end
|
83 |
-
--Calculo de la velocidad de la rueda izquierda dividiendo los grados calculados con el polinomio entre el tiempo asignado
|
84 |
-
if vD > 0 then
|
85 |
-
sim.setJointTargetVelocity(
|
86 |
-
motorD,
|
87 |
-
(
|
88 |
-
(0.000001646 * (vD ^ 3) - 0.00285 * (vD ^ 2) + 6.649 * vD + 51.14)
|
89 |
-
+ (-0.0002912 * (vD ^ 3) + 0.04647 * (vD ^ 2) - 1.339 * vD - 12.25)
|
90 |
-
/ d
|
91 |
-
)
|
92 |
-
* math.pi
|
93 |
-
/ 180
|
94 |
-
)
|
95 |
-
elseif vD < 0 then
|
96 |
-
sim.setJointTargetVelocity(
|
97 |
-
motorD,
|
98 |
-
-(
|
99 |
-
(
|
100 |
-
0.000001646 * math.abs(vD ^ 3)
|
101 |
-
- 0.00285 * (vD ^ 2)
|
102 |
-
+ 6.649 * math.abs(vD)
|
103 |
-
+ 51.14
|
104 |
-
)
|
105 |
-
+ (
|
106 |
-
-0.0002912 * math.abs(vD ^ 3)
|
107 |
-
+ 0.04647 * (vD ^ 2)
|
108 |
-
- 1.339 * math.abs(vD)
|
109 |
-
- 12.25
|
110 |
-
)
|
111 |
-
/ d
|
112 |
-
)
|
113 |
-
* math.pi
|
114 |
-
/ 180
|
115 |
-
)
|
116 |
-
else
|
117 |
-
sim.setJointTargetVelocity(motorD, 0)
|
118 |
-
end
|
119 |
-
return {}, {}, {}, ""
|
120 |
-
end
|
121 |
-
|
122 |
-
moveWheelsByDegrees = function(parametros, inFloats, rueda, inBuffer) -- "parametros" es un vector de dos elementos:
|
123 |
-
--velocidad de la/s rueda/s y los grados a recorrer por la/s misma/s
|
124 |
-
--"rueda" es un string que indica la/s rueda/s que se quiere/n mover
|
125 |
-
t_inicial = sim.getSimulationTime()
|
126 |
-
sim.setInt32Signal("Bloqueado", 1)
|
127 |
-
--El tiempo se obtiene despejando la variable t del polinomio desarrollado en el apartado 7.2.2 de la memoria
|
128 |
-
d = math.max(
|
129 |
-
(
|
130 |
-
parametros[1]
|
131 |
-
- (
|
132 |
-
-0.000325 * (math.abs(parametros[2]) ^ 3)
|
133 |
-
+ 0.042847 * (math.abs(parametros[2]) ^ 2)
|
134 |
-
- 2.064049 * (math.abs(parametros[2]))
|
135 |
-
- 17.697271
|
136 |
-
)
|
137 |
-
)
|
138 |
-
/ (
|
139 |
-
-0.000046 * (math.abs(parametros[2]) ^ 3)
|
140 |
-
+ 0.005219 * (math.abs(parametros[2]) ^ 2)
|
141 |
-
+ 6.357077 * (math.abs(parametros[2]))
|
142 |
-
+ 51.366765
|
143 |
-
),
|
144 |
-
0
|
145 |
-
)
|
146 |
-
|
147 |
-
--Se asegura que los argumentos de velocidad recibidos tienen un valor entre -100 y 100 y asigna para cada rueda
|
148 |
-
if parametros[2] > 100 then
|
149 |
-
if rueda[1] == "left" then
|
150 |
-
vI = 100
|
151 |
-
elseif rueda[1] == "right" then
|
152 |
-
vD = 100
|
153 |
-
else
|
154 |
-
vI = 100
|
155 |
-
vD = 100
|
156 |
-
end
|
157 |
-
elseif parametros[2] < -100 then
|
158 |
-
if rueda[1] == "left" then
|
159 |
-
vI = -100
|
160 |
-
elseif rueda[1] == "right" then
|
161 |
-
vD = -100
|
162 |
-
else
|
163 |
-
vI = -100
|
164 |
-
vD = -100
|
165 |
-
end
|
166 |
-
else
|
167 |
-
if rueda[1] == "left" then
|
168 |
-
vI = parametros[2]
|
169 |
-
elseif rueda[1] == "right" then
|
170 |
-
vD = parametros[2]
|
171 |
-
else
|
172 |
-
vI = parametros[2]
|
173 |
-
vD = parametros[2]
|
174 |
-
end
|
175 |
-
end
|
176 |
-
--Calculo de la velocidad de la rueda izquierda dividiendo los grados calculados con el polinomio entre el tiempo asignado
|
177 |
-
if vI > 0 then
|
178 |
-
sim.setJointTargetVelocity(
|
179 |
-
motorI,
|
180 |
-
(
|
181 |
-
(0.000001646 * (vI ^ 3) - 0.00285 * (vI ^ 2) + 6.649 * vI + 51.14)
|
182 |
-
+ (-0.0002912 * (vI ^ 3) + 0.04647 * (vI ^ 2) - 1.339 * vI - 12.25)
|
183 |
-
/ d
|
184 |
-
)
|
185 |
-
* math.pi
|
186 |
-
/ 180
|
187 |
-
)
|
188 |
-
elseif vI < 0 then
|
189 |
-
sim.setJointTargetVelocity(
|
190 |
-
motorI,
|
191 |
-
-(
|
192 |
-
(
|
193 |
-
0.000001646 * math.abs(vI ^ 3)
|
194 |
-
- 0.00285 * (vI ^ 2)
|
195 |
-
+ 6.649 * math.abs(vI)
|
196 |
-
+ 51.14
|
197 |
-
)
|
198 |
-
+ (
|
199 |
-
-0.0002912 * math.abs(vI ^ 3)
|
200 |
-
+ 0.04647 * (vI ^ 2)
|
201 |
-
- 1.339 * math.abs(vI)
|
202 |
-
- 12.25
|
203 |
-
)
|
204 |
-
/ d
|
205 |
-
)
|
206 |
-
* math.pi
|
207 |
-
/ 180
|
208 |
-
)
|
209 |
-
else
|
210 |
-
sim.setJointTargetVelocity(motorI, 0)
|
211 |
-
end
|
212 |
-
--Calculo de la velocidad de la rueda izquierda dividiendo los grados calculados con el polinomio entre el tiempo asignado
|
213 |
-
if vD > 0 then
|
214 |
-
sim.setJointTargetVelocity(
|
215 |
-
motorD,
|
216 |
-
(
|
217 |
-
(0.000001646 * (vD ^ 3) - 0.00285 * (vD ^ 2) + 6.649 * vD + 51.14)
|
218 |
-
+ (-0.0002912 * (vD ^ 3) + 0.04647 * (vD ^ 2) - 1.339 * vD - 12.25)
|
219 |
-
/ d
|
220 |
-
)
|
221 |
-
* math.pi
|
222 |
-
/ 180
|
223 |
-
)
|
224 |
-
elseif vD < 0 then
|
225 |
-
sim.setJointTargetVelocity(
|
226 |
-
motorD,
|
227 |
-
-(
|
228 |
-
(
|
229 |
-
0.000001646 * math.abs(vD ^ 3)
|
230 |
-
- 0.00285 * (vD ^ 2)
|
231 |
-
+ 6.649 * math.abs(vD)
|
232 |
-
+ 51.14
|
233 |
-
)
|
234 |
-
+ (
|
235 |
-
-0.0002912 * math.abs(vD ^ 3)
|
236 |
-
+ 0.04647 * (vD ^ 2)
|
237 |
-
- 1.339 * math.abs(vD)
|
238 |
-
- 12.25
|
239 |
-
)
|
240 |
-
/ d
|
241 |
-
)
|
242 |
-
* math.pi
|
243 |
-
/ 180
|
244 |
-
)
|
245 |
-
else
|
246 |
-
sim.setJointTargetVelocity(motorD, 0)
|
247 |
-
end
|
248 |
-
return {}, {}, {}, ""
|
249 |
-
end
|
250 |
-
|
251 |
-
readWheels = function(inIntegers, inFloats, rueda, inBuffer)
|
252 |
-
medidasRuedas = {} -- Definicion del vector donde se guarda la posicion y velocidad de las ruedas en el momento de llamar a la funcion
|
253 |
-
-- {posicionRuedaI,posicionRuedaD,velocidadRuedaI,velocidadRuedaD}
|
254 |
-
-- Para leer los encoders de las ruedas se calcula la diferencia entre la posicion actual y la posicion referencia
|
255 |
-
medidasRuedas[1] =
|
256 |
-
math.floor(sim.getJointPosition(motorD) * 180 / math.pi - pos_inicial_D)
|
257 |
-
medidasRuedas[2] =
|
258 |
-
math.floor(sim.getJointPosition(motorI) * 180 / math.pi - pos_inicial_I)
|
259 |
-
medidasRuedas[3] = vI
|
260 |
-
medidasRuedas[4] = vD
|
261 |
-
return medidasRuedas, {}, {}, ""
|
262 |
-
end
|
263 |
-
|
264 |
-
resetWheelEncoders = function(inIntegers, inFloats, inStrings, inBuffer)
|
265 |
-
-- Al resetear los encoders se hace que la posicion de referencia sea la posicion actual de la rueda
|
266 |
-
pos_inicial_I = math.floor(sim.getJointPosition(motorI) * 180 / math.pi)
|
267 |
-
pos_inicial_D = math.floor(sim.getJointPosition(motorD) * 180 / math.pi)
|
268 |
-
return {}, {}, {}, ""
|
269 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init()
|
4 |
+
-- do some initialization here
|
5 |
+
motorI = sim.getObject("../Left_Motor")
|
6 |
+
motorD = sim.getObject("../Right_Motor")
|
7 |
+
d = 0
|
8 |
+
pos_inicial_I = 0
|
9 |
+
pos_inicial_D = 0
|
10 |
+
end
|
11 |
+
|
12 |
+
function sysCall_actuation()
|
13 |
+
-- put your actuation code here
|
14 |
+
if d > 0 then
|
15 |
+
-- Cuando se supere el tiempo de duracion del movimiento de las ruedas, se paran los joints y se resetean las variables globales
|
16 |
+
if (sim.getSimulationTime() - t_inicial) >= d then
|
17 |
+
sim.setJointTargetVelocity(motorI, 0)
|
18 |
+
sim.setJointTargetVelocity(motorD, 0)
|
19 |
+
sim.setInt32Signal(signal, 0)
|
20 |
+
d = 0
|
21 |
+
vI = 0
|
22 |
+
vD = 0
|
23 |
+
end
|
24 |
+
end
|
25 |
+
end
|
26 |
+
|
27 |
+
moveWheelsByTime = function(velocidad, tiempo, inString, inBuffer) -- "velocidad" es un vector de dos elementos: velocidades de la rueda derecha e izquierda
|
28 |
+
d = tiempo[1] -- Definicion de una variable que guarda el tiempo que se moveran las ruedas
|
29 |
+
t_inicial = sim.getSimulationTime() -- Definicion de una variable que guarda el instante en el que se llama a la funcion
|
30 |
+
signal = inString[1]
|
31 |
+
sim.setInt32Signal(signal, 1) -- Definicion de una variable global que bloquea la funcion (1) o la desbloquea (0)
|
32 |
+
-- Se asegura que los argumentos de velocidad recibidos tienen un valor entre -100 y 100
|
33 |
+
if velocidad[2] > 100 then
|
34 |
+
vI = 100
|
35 |
+
elseif velocidad[2] < -100 then
|
36 |
+
vI = -100
|
37 |
+
else
|
38 |
+
vI = velocidad[2]
|
39 |
+
end
|
40 |
+
if velocidad[1] > 100 then
|
41 |
+
vD = 100
|
42 |
+
elseif velocidad[1] < -100 then
|
43 |
+
vD = -100
|
44 |
+
else
|
45 |
+
vD = velocidad[1]
|
46 |
+
end
|
47 |
+
--Calculo de la velocidad de la rueda izquierda dividiendo los grados calculados con el polinomio entre el tiempo asignado
|
48 |
+
if vI > 0 then
|
49 |
+
sim.setJointTargetVelocity(
|
50 |
+
motorI,
|
51 |
+
(
|
52 |
+
(0.000001646 * (vI ^ 3) - 0.00285 * (vI ^ 2) + 6.649 * vI + 51.14)
|
53 |
+
+ (-0.0002912 * (vI ^ 3) + 0.04647 * (vI ^ 2) - 1.339 * vI - 12.25)
|
54 |
+
/ d
|
55 |
+
)
|
56 |
+
* math.pi
|
57 |
+
/ 180
|
58 |
+
)
|
59 |
+
elseif vI < 0 then
|
60 |
+
sim.setJointTargetVelocity(
|
61 |
+
motorI,
|
62 |
+
-(
|
63 |
+
(
|
64 |
+
0.000001646 * math.abs(vI ^ 3)
|
65 |
+
- 0.00285 * (vI ^ 2)
|
66 |
+
+ 6.649 * math.abs(vI)
|
67 |
+
+ 51.14
|
68 |
+
)
|
69 |
+
+ (
|
70 |
+
-0.0002912 * math.abs(vI ^ 3)
|
71 |
+
+ 0.04647 * (vI ^ 2)
|
72 |
+
- 1.339 * math.abs(vI)
|
73 |
+
- 12.25
|
74 |
+
)
|
75 |
+
/ d
|
76 |
+
)
|
77 |
+
* math.pi
|
78 |
+
/ 180
|
79 |
+
)
|
80 |
+
else
|
81 |
+
sim.setJointTargetVelocity(motorI, 0)
|
82 |
+
end
|
83 |
+
--Calculo de la velocidad de la rueda izquierda dividiendo los grados calculados con el polinomio entre el tiempo asignado
|
84 |
+
if vD > 0 then
|
85 |
+
sim.setJointTargetVelocity(
|
86 |
+
motorD,
|
87 |
+
(
|
88 |
+
(0.000001646 * (vD ^ 3) - 0.00285 * (vD ^ 2) + 6.649 * vD + 51.14)
|
89 |
+
+ (-0.0002912 * (vD ^ 3) + 0.04647 * (vD ^ 2) - 1.339 * vD - 12.25)
|
90 |
+
/ d
|
91 |
+
)
|
92 |
+
* math.pi
|
93 |
+
/ 180
|
94 |
+
)
|
95 |
+
elseif vD < 0 then
|
96 |
+
sim.setJointTargetVelocity(
|
97 |
+
motorD,
|
98 |
+
-(
|
99 |
+
(
|
100 |
+
0.000001646 * math.abs(vD ^ 3)
|
101 |
+
- 0.00285 * (vD ^ 2)
|
102 |
+
+ 6.649 * math.abs(vD)
|
103 |
+
+ 51.14
|
104 |
+
)
|
105 |
+
+ (
|
106 |
+
-0.0002912 * math.abs(vD ^ 3)
|
107 |
+
+ 0.04647 * (vD ^ 2)
|
108 |
+
- 1.339 * math.abs(vD)
|
109 |
+
- 12.25
|
110 |
+
)
|
111 |
+
/ d
|
112 |
+
)
|
113 |
+
* math.pi
|
114 |
+
/ 180
|
115 |
+
)
|
116 |
+
else
|
117 |
+
sim.setJointTargetVelocity(motorD, 0)
|
118 |
+
end
|
119 |
+
return {}, {}, {}, ""
|
120 |
+
end
|
121 |
+
|
122 |
+
moveWheelsByDegrees = function(parametros, inFloats, rueda, inBuffer) -- "parametros" es un vector de dos elementos:
|
123 |
+
--velocidad de la/s rueda/s y los grados a recorrer por la/s misma/s
|
124 |
+
--"rueda" es un string que indica la/s rueda/s que se quiere/n mover
|
125 |
+
t_inicial = sim.getSimulationTime()
|
126 |
+
sim.setInt32Signal("Bloqueado", 1)
|
127 |
+
--El tiempo se obtiene despejando la variable t del polinomio desarrollado en el apartado 7.2.2 de la memoria
|
128 |
+
d = math.max(
|
129 |
+
(
|
130 |
+
parametros[1]
|
131 |
+
- (
|
132 |
+
-0.000325 * (math.abs(parametros[2]) ^ 3)
|
133 |
+
+ 0.042847 * (math.abs(parametros[2]) ^ 2)
|
134 |
+
- 2.064049 * (math.abs(parametros[2]))
|
135 |
+
- 17.697271
|
136 |
+
)
|
137 |
+
)
|
138 |
+
/ (
|
139 |
+
-0.000046 * (math.abs(parametros[2]) ^ 3)
|
140 |
+
+ 0.005219 * (math.abs(parametros[2]) ^ 2)
|
141 |
+
+ 6.357077 * (math.abs(parametros[2]))
|
142 |
+
+ 51.366765
|
143 |
+
),
|
144 |
+
0
|
145 |
+
)
|
146 |
+
|
147 |
+
--Se asegura que los argumentos de velocidad recibidos tienen un valor entre -100 y 100 y asigna para cada rueda
|
148 |
+
if parametros[2] > 100 then
|
149 |
+
if rueda[1] == "left" then
|
150 |
+
vI = 100
|
151 |
+
elseif rueda[1] == "right" then
|
152 |
+
vD = 100
|
153 |
+
else
|
154 |
+
vI = 100
|
155 |
+
vD = 100
|
156 |
+
end
|
157 |
+
elseif parametros[2] < -100 then
|
158 |
+
if rueda[1] == "left" then
|
159 |
+
vI = -100
|
160 |
+
elseif rueda[1] == "right" then
|
161 |
+
vD = -100
|
162 |
+
else
|
163 |
+
vI = -100
|
164 |
+
vD = -100
|
165 |
+
end
|
166 |
+
else
|
167 |
+
if rueda[1] == "left" then
|
168 |
+
vI = parametros[2]
|
169 |
+
elseif rueda[1] == "right" then
|
170 |
+
vD = parametros[2]
|
171 |
+
else
|
172 |
+
vI = parametros[2]
|
173 |
+
vD = parametros[2]
|
174 |
+
end
|
175 |
+
end
|
176 |
+
--Calculo de la velocidad de la rueda izquierda dividiendo los grados calculados con el polinomio entre el tiempo asignado
|
177 |
+
if vI > 0 then
|
178 |
+
sim.setJointTargetVelocity(
|
179 |
+
motorI,
|
180 |
+
(
|
181 |
+
(0.000001646 * (vI ^ 3) - 0.00285 * (vI ^ 2) + 6.649 * vI + 51.14)
|
182 |
+
+ (-0.0002912 * (vI ^ 3) + 0.04647 * (vI ^ 2) - 1.339 * vI - 12.25)
|
183 |
+
/ d
|
184 |
+
)
|
185 |
+
* math.pi
|
186 |
+
/ 180
|
187 |
+
)
|
188 |
+
elseif vI < 0 then
|
189 |
+
sim.setJointTargetVelocity(
|
190 |
+
motorI,
|
191 |
+
-(
|
192 |
+
(
|
193 |
+
0.000001646 * math.abs(vI ^ 3)
|
194 |
+
- 0.00285 * (vI ^ 2)
|
195 |
+
+ 6.649 * math.abs(vI)
|
196 |
+
+ 51.14
|
197 |
+
)
|
198 |
+
+ (
|
199 |
+
-0.0002912 * math.abs(vI ^ 3)
|
200 |
+
+ 0.04647 * (vI ^ 2)
|
201 |
+
- 1.339 * math.abs(vI)
|
202 |
+
- 12.25
|
203 |
+
)
|
204 |
+
/ d
|
205 |
+
)
|
206 |
+
* math.pi
|
207 |
+
/ 180
|
208 |
+
)
|
209 |
+
else
|
210 |
+
sim.setJointTargetVelocity(motorI, 0)
|
211 |
+
end
|
212 |
+
--Calculo de la velocidad de la rueda izquierda dividiendo los grados calculados con el polinomio entre el tiempo asignado
|
213 |
+
if vD > 0 then
|
214 |
+
sim.setJointTargetVelocity(
|
215 |
+
motorD,
|
216 |
+
(
|
217 |
+
(0.000001646 * (vD ^ 3) - 0.00285 * (vD ^ 2) + 6.649 * vD + 51.14)
|
218 |
+
+ (-0.0002912 * (vD ^ 3) + 0.04647 * (vD ^ 2) - 1.339 * vD - 12.25)
|
219 |
+
/ d
|
220 |
+
)
|
221 |
+
* math.pi
|
222 |
+
/ 180
|
223 |
+
)
|
224 |
+
elseif vD < 0 then
|
225 |
+
sim.setJointTargetVelocity(
|
226 |
+
motorD,
|
227 |
+
-(
|
228 |
+
(
|
229 |
+
0.000001646 * math.abs(vD ^ 3)
|
230 |
+
- 0.00285 * (vD ^ 2)
|
231 |
+
+ 6.649 * math.abs(vD)
|
232 |
+
+ 51.14
|
233 |
+
)
|
234 |
+
+ (
|
235 |
+
-0.0002912 * math.abs(vD ^ 3)
|
236 |
+
+ 0.04647 * (vD ^ 2)
|
237 |
+
- 1.339 * math.abs(vD)
|
238 |
+
- 12.25
|
239 |
+
)
|
240 |
+
/ d
|
241 |
+
)
|
242 |
+
* math.pi
|
243 |
+
/ 180
|
244 |
+
)
|
245 |
+
else
|
246 |
+
sim.setJointTargetVelocity(motorD, 0)
|
247 |
+
end
|
248 |
+
return {}, {}, {}, ""
|
249 |
+
end
|
250 |
+
|
251 |
+
readWheels = function(inIntegers, inFloats, rueda, inBuffer)
|
252 |
+
medidasRuedas = {} -- Definicion del vector donde se guarda la posicion y velocidad de las ruedas en el momento de llamar a la funcion
|
253 |
+
-- {posicionRuedaI,posicionRuedaD,velocidadRuedaI,velocidadRuedaD}
|
254 |
+
-- Para leer los encoders de las ruedas se calcula la diferencia entre la posicion actual y la posicion referencia
|
255 |
+
medidasRuedas[1] =
|
256 |
+
math.floor(sim.getJointPosition(motorD) * 180 / math.pi - pos_inicial_D)
|
257 |
+
medidasRuedas[2] =
|
258 |
+
math.floor(sim.getJointPosition(motorI) * 180 / math.pi - pos_inicial_I)
|
259 |
+
medidasRuedas[3] = vI
|
260 |
+
medidasRuedas[4] = vD
|
261 |
+
return medidasRuedas, {}, {}, ""
|
262 |
+
end
|
263 |
+
|
264 |
+
resetWheelEncoders = function(inIntegers, inFloats, inStrings, inBuffer)
|
265 |
+
-- Al resetear los encoders se hace que la posicion de referencia sea la posicion actual de la rueda
|
266 |
+
pos_inicial_I = math.floor(sim.getJointPosition(motorI) * 180 / math.pi)
|
267 |
+
pos_inicial_D = math.floor(sim.getJointPosition(motorD) * 180 / math.pi)
|
268 |
+
return {}, {}, {}, ""
|
269 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/phone_holder/pan_motor.lua
CHANGED
@@ -1,70 +1,70 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init()
|
4 |
-
-- se ejecuta una vez al inicio de la simulacion
|
5 |
-
motor = sim.getObject(".")
|
6 |
-
v = 0
|
7 |
-
end
|
8 |
-
|
9 |
-
function sysCall_actuation()
|
10 |
-
-- se ejecuta en cada paso de simulacion
|
11 |
-
if v > 0 then
|
12 |
-
posicion_actual = sim.getJointPosition(motor) * 180 / math.pi
|
13 |
-
-- Cuando la diferencia entre la posicion objetivo y la actual sea menor a 2 se detiene la articulacion y se resetean las variables globales
|
14 |
-
if (posicion_objetivo - posicion_actual) * parametro < 1 then
|
15 |
-
sim.setJointTargetVelocity(motor, 0)
|
16 |
-
sim.setInt32Signal(signal, 0)
|
17 |
-
v = 0
|
18 |
-
end
|
19 |
-
end
|
20 |
-
end
|
21 |
-
|
22 |
-
movePanTo = function(parametros, inFloat, inString, inBuffer) -- "s" es un vector de dos elementos: posicion objetivo (en grados) del pan y su velocidad
|
23 |
-
parametros[1] = -1 * (parametros[1] - 180)
|
24 |
-
-- Se asegura que la posicion objetivo del pan este comprendida entre -160 y 160, y su velocidad entre 0 y 100
|
25 |
-
if parametros[1] > 160 then
|
26 |
-
posicion_objetivo = 160
|
27 |
-
elseif parametros[1] < -160 then
|
28 |
-
posicion_objetivo = -160
|
29 |
-
else
|
30 |
-
posicion_objetivo = parametros[1]
|
31 |
-
end
|
32 |
-
if parametros[2] > 100 then
|
33 |
-
v = 100
|
34 |
-
elseif parametros[2] < 0 then
|
35 |
-
v = 0
|
36 |
-
else
|
37 |
-
v = parametros[2]
|
38 |
-
end
|
39 |
-
if v > 0 then
|
40 |
-
signal = inString[1]
|
41 |
-
sim.setInt32Signal(signal, 1) -- Definicion de una variable global que bloquea la funcion (1) o la desbloquea (0)
|
42 |
-
posicion_inicial = math.floor(sim.getJointPosition(motor) * 180 / math.pi) -- Posicion del pan en el momento de la llamada a la funcion
|
43 |
-
-- Comparacion de la posicion objetivo del pan con la posicion actual y asignacion del sentido de giro de la articulacion
|
44 |
-
if posicion_objetivo > posicion_inicial then
|
45 |
-
parametro = 1
|
46 |
-
elseif posicion_objetivo < posicion_inicial then
|
47 |
-
parametro = -1
|
48 |
-
else
|
49 |
-
parametro = 0
|
50 |
-
end
|
51 |
-
-- Calculo de la velocidad de la articulacion dividiendo el angulo entre el tiempo despejado del polinomio desarrollado en la teoria
|
52 |
-
angulo = math.abs(posicion_objetivo - posicion_inicial)
|
53 |
-
sim.setJointTargetVelocity(
|
54 |
-
motor,
|
55 |
-
parametro
|
56 |
-
* angulo
|
57 |
-
/ ((angulo - (-0.000020 * (v ^ 3) + 0.001064 * (v ^ 2) - 0.330338 * v - 0.890735)) / (-0.000031 * (v ^ 3) + 0.003877 * (v ^ 2) + 0.847465 * v + 8.054684))
|
58 |
-
* math.pi
|
59 |
-
/ 180
|
60 |
-
)
|
61 |
-
end
|
62 |
-
return {}, {}, {}, ""
|
63 |
-
end
|
64 |
-
|
65 |
-
readPanPosition = function(inIntegers, inFloats, inStrings, inBuffer)
|
66 |
-
posicionPanInt = {} -- Definicion del vector donde se guarda la posicion (en grados) del pan en el momento de llamar a la funcion
|
67 |
-
posicionPanFloat = -sim.getJointPosition(motor) * 180 / math.pi
|
68 |
-
posicionPanInt[1] = math.floor(posicionPanFloat) + 180
|
69 |
-
return posicionPanInt, {}, {}, ""
|
70 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init()
|
4 |
+
-- se ejecuta una vez al inicio de la simulacion
|
5 |
+
motor = sim.getObject(".")
|
6 |
+
v = 0
|
7 |
+
end
|
8 |
+
|
9 |
+
function sysCall_actuation()
|
10 |
+
-- se ejecuta en cada paso de simulacion
|
11 |
+
if v > 0 then
|
12 |
+
posicion_actual = sim.getJointPosition(motor) * 180 / math.pi
|
13 |
+
-- Cuando la diferencia entre la posicion objetivo y la actual sea menor a 2 se detiene la articulacion y se resetean las variables globales
|
14 |
+
if (posicion_objetivo - posicion_actual) * parametro < 1 then
|
15 |
+
sim.setJointTargetVelocity(motor, 0)
|
16 |
+
sim.setInt32Signal(signal, 0)
|
17 |
+
v = 0
|
18 |
+
end
|
19 |
+
end
|
20 |
+
end
|
21 |
+
|
22 |
+
movePanTo = function(parametros, inFloat, inString, inBuffer) -- "s" es un vector de dos elementos: posicion objetivo (en grados) del pan y su velocidad
|
23 |
+
parametros[1] = -1 * (parametros[1] - 180)
|
24 |
+
-- Se asegura que la posicion objetivo del pan este comprendida entre -160 y 160, y su velocidad entre 0 y 100
|
25 |
+
if parametros[1] > 160 then
|
26 |
+
posicion_objetivo = 160
|
27 |
+
elseif parametros[1] < -160 then
|
28 |
+
posicion_objetivo = -160
|
29 |
+
else
|
30 |
+
posicion_objetivo = parametros[1]
|
31 |
+
end
|
32 |
+
if parametros[2] > 100 then
|
33 |
+
v = 100
|
34 |
+
elseif parametros[2] < 0 then
|
35 |
+
v = 0
|
36 |
+
else
|
37 |
+
v = parametros[2]
|
38 |
+
end
|
39 |
+
if v > 0 then
|
40 |
+
signal = inString[1]
|
41 |
+
sim.setInt32Signal(signal, 1) -- Definicion de una variable global que bloquea la funcion (1) o la desbloquea (0)
|
42 |
+
posicion_inicial = math.floor(sim.getJointPosition(motor) * 180 / math.pi) -- Posicion del pan en el momento de la llamada a la funcion
|
43 |
+
-- Comparacion de la posicion objetivo del pan con la posicion actual y asignacion del sentido de giro de la articulacion
|
44 |
+
if posicion_objetivo > posicion_inicial then
|
45 |
+
parametro = 1
|
46 |
+
elseif posicion_objetivo < posicion_inicial then
|
47 |
+
parametro = -1
|
48 |
+
else
|
49 |
+
parametro = 0
|
50 |
+
end
|
51 |
+
-- Calculo de la velocidad de la articulacion dividiendo el angulo entre el tiempo despejado del polinomio desarrollado en la teoria
|
52 |
+
angulo = math.abs(posicion_objetivo - posicion_inicial)
|
53 |
+
sim.setJointTargetVelocity(
|
54 |
+
motor,
|
55 |
+
parametro
|
56 |
+
* angulo
|
57 |
+
/ ((angulo - (-0.000020 * (v ^ 3) + 0.001064 * (v ^ 2) - 0.330338 * v - 0.890735)) / (-0.000031 * (v ^ 3) + 0.003877 * (v ^ 2) + 0.847465 * v + 8.054684))
|
58 |
+
* math.pi
|
59 |
+
/ 180
|
60 |
+
)
|
61 |
+
end
|
62 |
+
return {}, {}, {}, ""
|
63 |
+
end
|
64 |
+
|
65 |
+
readPanPosition = function(inIntegers, inFloats, inStrings, inBuffer)
|
66 |
+
posicionPanInt = {} -- Definicion del vector donde se guarda la posicion (en grados) del pan en el momento de llamar a la funcion
|
67 |
+
posicionPanFloat = -sim.getJointPosition(motor) * 180 / math.pi
|
68 |
+
posicionPanInt[1] = math.floor(posicionPanFloat) + 180
|
69 |
+
return posicionPanInt, {}, {}, ""
|
70 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/phone_holder/screen.lua
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init()
|
4 |
-
-- do some initialization here
|
5 |
-
print("test")
|
6 |
-
screen = sim.getObject(".")
|
7 |
-
defaultEmotion = ""
|
8 |
-
end
|
9 |
-
|
10 |
-
function sysCall_cleanup()
|
11 |
-
-- do some clean-up here
|
12 |
-
local _face, img, _resolution =
|
13 |
-
sim.createTexture(defaultEmotion, 0, nil, nil, nil, 0, nil)
|
14 |
-
sim.setShapeTexture(screen, img, sim.texturemap_cube, 1100, { 0.13, 0.13 }, nil, nil)
|
15 |
-
end
|
16 |
-
|
17 |
-
setDefaultEmotion = function(inIntegers, inFloats, inStrings, inBuffer)
|
18 |
-
defaultEmotion = inStrings[1]
|
19 |
-
return {}, {}, {}, ""
|
20 |
-
end
|
21 |
-
|
22 |
-
setEmotionTo = function(inIntegers, inFloats, inStrings, inBuffer)
|
23 |
-
local _face, img, _resolution =
|
24 |
-
sim.createTexture(inStrings[1], 0, nil, nil, nil, 0, nil)
|
25 |
-
sim.setShapeTexture(screen, img, sim.texturemap_cube, 1100, { 0.13, 0.13 }, nil, nil)
|
26 |
-
return {}, {}, {}, ""
|
27 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init()
|
4 |
+
-- do some initialization here
|
5 |
+
print("test")
|
6 |
+
screen = sim.getObject(".")
|
7 |
+
defaultEmotion = ""
|
8 |
+
end
|
9 |
+
|
10 |
+
function sysCall_cleanup()
|
11 |
+
-- do some clean-up here
|
12 |
+
local _face, img, _resolution =
|
13 |
+
sim.createTexture(defaultEmotion, 0, nil, nil, nil, 0, nil)
|
14 |
+
sim.setShapeTexture(screen, img, sim.texturemap_cube, 1100, { 0.13, 0.13 }, nil, nil)
|
15 |
+
end
|
16 |
+
|
17 |
+
setDefaultEmotion = function(inIntegers, inFloats, inStrings, inBuffer)
|
18 |
+
defaultEmotion = inStrings[1]
|
19 |
+
return {}, {}, {}, ""
|
20 |
+
end
|
21 |
+
|
22 |
+
setEmotionTo = function(inIntegers, inFloats, inStrings, inBuffer)
|
23 |
+
local _face, img, _resolution =
|
24 |
+
sim.createTexture(inStrings[1], 0, nil, nil, nil, 0, nil)
|
25 |
+
sim.setShapeTexture(screen, img, sim.texturemap_cube, 1100, { 0.13, 0.13 }, nil, nil)
|
26 |
+
return {}, {}, {}, ""
|
27 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/phone_holder/smartphone.lua
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init()
|
4 |
-
-- do some initialization here
|
5 |
-
aceleracion = {} -- Definicion del vector donde se guarda la orientacion del smartphone
|
6 |
-
orientacion = {} -- Definicion del vector donde se guarda la orientacion del smartphone
|
7 |
-
smartphone = sim.getObject(".")
|
8 |
-
smartphone_camera = sim.getObject("./Smartphone_camera")
|
9 |
-
pos_anterior = sim.getObjectPosition(smartphone, -1)
|
10 |
-
pos_antant = sim.getObjectPosition(smartphone, -1)
|
11 |
-
end
|
12 |
-
|
13 |
-
readOrientationSensor = function(inIntegers, inFloats, inStrings, inBuffer)
|
14 |
-
orientacion = sim.getObjectOrientation(smartphone, -1)
|
15 |
-
orientacion[1], orientacion[2], orientacion[3] =
|
16 |
-
sim.alphaBetaGammaToYawPitchRoll(orientacion[1], orientacion[2], orientacion[3])
|
17 |
-
orientacion[1] = orientacion[1] * 180 / math.pi
|
18 |
-
orientacion[2] = orientacion[2] * 180 / math.pi
|
19 |
-
orientacion[3] = orientacion[3] * 180 / math.pi
|
20 |
-
return {}, orientacion, {}, ""
|
21 |
-
end
|
22 |
-
|
23 |
-
readAccelerationSensor = function(inIntegers, inFloats, inStrings, inBuffer)
|
24 |
-
pos = sim.getObjectPosition(smartphone, -1)
|
25 |
-
aceleracion[1] = pos[1] - 2 * pos_anterior[1] + pos_antant[1]
|
26 |
-
aceleracion[2] = pos[2] - 2 * pos_anterior[2] + pos_antant[2]
|
27 |
-
aceleracion[3] = pos[3] - 2 * pos_anterior[3] + pos_antant[3]
|
28 |
-
pos_antant = pos_anterior
|
29 |
-
pos_anterior = pos
|
30 |
-
return {}, aceleracion, {}, ""
|
31 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init()
|
4 |
+
-- do some initialization here
|
5 |
+
aceleracion = {} -- Definicion del vector donde se guarda la orientacion del smartphone
|
6 |
+
orientacion = {} -- Definicion del vector donde se guarda la orientacion del smartphone
|
7 |
+
smartphone = sim.getObject(".")
|
8 |
+
smartphone_camera = sim.getObject("./Smartphone_camera")
|
9 |
+
pos_anterior = sim.getObjectPosition(smartphone, -1)
|
10 |
+
pos_antant = sim.getObjectPosition(smartphone, -1)
|
11 |
+
end
|
12 |
+
|
13 |
+
readOrientationSensor = function(inIntegers, inFloats, inStrings, inBuffer)
|
14 |
+
orientacion = sim.getObjectOrientation(smartphone, -1)
|
15 |
+
orientacion[1], orientacion[2], orientacion[3] =
|
16 |
+
sim.alphaBetaGammaToYawPitchRoll(orientacion[1], orientacion[2], orientacion[3])
|
17 |
+
orientacion[1] = orientacion[1] * 180 / math.pi
|
18 |
+
orientacion[2] = orientacion[2] * 180 / math.pi
|
19 |
+
orientacion[3] = orientacion[3] * 180 / math.pi
|
20 |
+
return {}, orientacion, {}, ""
|
21 |
+
end
|
22 |
+
|
23 |
+
readAccelerationSensor = function(inIntegers, inFloats, inStrings, inBuffer)
|
24 |
+
pos = sim.getObjectPosition(smartphone, -1)
|
25 |
+
aceleracion[1] = pos[1] - 2 * pos_anterior[1] + pos_antant[1]
|
26 |
+
aceleracion[2] = pos[2] - 2 * pos_anterior[2] + pos_antant[2]
|
27 |
+
aceleracion[3] = pos[3] - 2 * pos_anterior[3] + pos_antant[3]
|
28 |
+
pos_antant = pos_anterior
|
29 |
+
pos_anterior = pos
|
30 |
+
return {}, aceleracion, {}, ""
|
31 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/phone_holder/tilt_motor.lua
CHANGED
@@ -1,72 +1,72 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init()
|
4 |
-
-- se ejecuta una vez al inicio de la simulacion
|
5 |
-
motor = sim.getObject(".")
|
6 |
-
v = 0
|
7 |
-
end
|
8 |
-
|
9 |
-
function sysCall_actuation()
|
10 |
-
-- se ejecuta en cada paso de simulacion
|
11 |
-
if v > 0 then
|
12 |
-
posicion_actual = sim.getJointPosition(motor) * 180 / math.pi + 70
|
13 |
-
-- Cuando la diferencia entre la posicion objetivo y la actual sea menor a 2 se detiene la articulacion y se resetean las variables globales
|
14 |
-
if (posicion_objetivo - posicion_actual) * parametro < 1 then
|
15 |
-
sim.setJointTargetVelocity(motor, 0)
|
16 |
-
sim.setInt32Signal(signal, 0)
|
17 |
-
sim.setObjectInt32Param(motor, sim.jointintparam_ctrl_enabled, 1)
|
18 |
-
sim.setJointTargetPosition(motor, (posicion_actual - 70) * math.pi / 180)
|
19 |
-
v = 0
|
20 |
-
end
|
21 |
-
end
|
22 |
-
end
|
23 |
-
|
24 |
-
moveTiltTo = function(parametros, inFloat, inString, inBuffer) -- "parametros" es un vector de dos elementos: posicion objetivo (en grados) del tilt y su velocidad
|
25 |
-
-- Se asegura que la posicion objetivo del tilt este comprendida entre 0 y 105, y su velocidad entre 0 y 100
|
26 |
-
if parametros[1] > 105 then
|
27 |
-
posicion_objetivo = 105
|
28 |
-
elseif parametros[1] < 5 then
|
29 |
-
posicion_objetivo = 5
|
30 |
-
else
|
31 |
-
posicion_objetivo = parametros[1]
|
32 |
-
end
|
33 |
-
if parametros[2] > 100 then
|
34 |
-
v = 100
|
35 |
-
elseif parametros[2] < 0 then
|
36 |
-
v = 0
|
37 |
-
else
|
38 |
-
v = parametros[2]
|
39 |
-
end
|
40 |
-
if v > 0 then
|
41 |
-
signal = inString[1]
|
42 |
-
sim.setInt32Signal(signal, 1) -- Definicion de una variable global que bloquea la funcion (1) o la desbloquea (0)
|
43 |
-
posicion_inicial = math.floor(sim.getJointPosition(motor) * 180 / math.pi + 70) -- Posicion del tilt en el momento de la llamada a la funcion
|
44 |
-
-- Comparacion de la posicion objetivo del tilt con la posicion inicial y asignacion del sentido de giro de la articulacion
|
45 |
-
if posicion_objetivo > posicion_inicial then
|
46 |
-
parametro = 1
|
47 |
-
elseif posicion_objetivo < posicion_inicial then
|
48 |
-
parametro = -1
|
49 |
-
else
|
50 |
-
parametro = 0
|
51 |
-
end
|
52 |
-
-- Calculo de la velocidad de la articulacion dividiendo el angulo entre el tiempo despejado del polinomio desarrollado en la teoria
|
53 |
-
angulo = math.abs(posicion_objetivo - posicion_inicial)
|
54 |
-
sim.setObjectInt32Param(motor, sim.jointintparam_ctrl_enabled, 0)
|
55 |
-
sim.setJointTargetVelocity(
|
56 |
-
motor,
|
57 |
-
parametro
|
58 |
-
* angulo
|
59 |
-
/ ((angulo - (-0.000088 * (v ^ 3) + 0.012325 * (v ^ 2) - 0.549530 * v + 4.737946)) / (0.000014 * (v ^ 3) - 0.002598 * (v ^ 2) + 0.480940 * v + 3.181534))
|
60 |
-
* math.pi
|
61 |
-
/ 180
|
62 |
-
)
|
63 |
-
end
|
64 |
-
return {}, {}, {}, ""
|
65 |
-
end
|
66 |
-
|
67 |
-
readTiltPosition = function(inIntegers, inFloats, inStrings, inBuffer)
|
68 |
-
posicionTiltInt = {} -- Definicion del vector donde se guarda la posicion (en grados) del tilt en el momento de llamar a la funcion
|
69 |
-
posicionTiltFloat = sim.getJointPosition(motor) * 180 / math.pi + 70
|
70 |
-
posicionTiltInt[1] = math.floor(posicionTiltFloat)
|
71 |
-
return posicionTiltInt, {}, {}, ""
|
72 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init()
|
4 |
+
-- se ejecuta una vez al inicio de la simulacion
|
5 |
+
motor = sim.getObject(".")
|
6 |
+
v = 0
|
7 |
+
end
|
8 |
+
|
9 |
+
function sysCall_actuation()
|
10 |
+
-- se ejecuta en cada paso de simulacion
|
11 |
+
if v > 0 then
|
12 |
+
posicion_actual = sim.getJointPosition(motor) * 180 / math.pi + 70
|
13 |
+
-- Cuando la diferencia entre la posicion objetivo y la actual sea menor a 2 se detiene la articulacion y se resetean las variables globales
|
14 |
+
if (posicion_objetivo - posicion_actual) * parametro < 1 then
|
15 |
+
sim.setJointTargetVelocity(motor, 0)
|
16 |
+
sim.setInt32Signal(signal, 0)
|
17 |
+
sim.setObjectInt32Param(motor, sim.jointintparam_ctrl_enabled, 1)
|
18 |
+
sim.setJointTargetPosition(motor, (posicion_actual - 70) * math.pi / 180)
|
19 |
+
v = 0
|
20 |
+
end
|
21 |
+
end
|
22 |
+
end
|
23 |
+
|
24 |
+
moveTiltTo = function(parametros, inFloat, inString, inBuffer) -- "parametros" es un vector de dos elementos: posicion objetivo (en grados) del tilt y su velocidad
|
25 |
+
-- Se asegura que la posicion objetivo del tilt este comprendida entre 0 y 105, y su velocidad entre 0 y 100
|
26 |
+
if parametros[1] > 105 then
|
27 |
+
posicion_objetivo = 105
|
28 |
+
elseif parametros[1] < 5 then
|
29 |
+
posicion_objetivo = 5
|
30 |
+
else
|
31 |
+
posicion_objetivo = parametros[1]
|
32 |
+
end
|
33 |
+
if parametros[2] > 100 then
|
34 |
+
v = 100
|
35 |
+
elseif parametros[2] < 0 then
|
36 |
+
v = 0
|
37 |
+
else
|
38 |
+
v = parametros[2]
|
39 |
+
end
|
40 |
+
if v > 0 then
|
41 |
+
signal = inString[1]
|
42 |
+
sim.setInt32Signal(signal, 1) -- Definicion de una variable global que bloquea la funcion (1) o la desbloquea (0)
|
43 |
+
posicion_inicial = math.floor(sim.getJointPosition(motor) * 180 / math.pi + 70) -- Posicion del tilt en el momento de la llamada a la funcion
|
44 |
+
-- Comparacion de la posicion objetivo del tilt con la posicion inicial y asignacion del sentido de giro de la articulacion
|
45 |
+
if posicion_objetivo > posicion_inicial then
|
46 |
+
parametro = 1
|
47 |
+
elseif posicion_objetivo < posicion_inicial then
|
48 |
+
parametro = -1
|
49 |
+
else
|
50 |
+
parametro = 0
|
51 |
+
end
|
52 |
+
-- Calculo de la velocidad de la articulacion dividiendo el angulo entre el tiempo despejado del polinomio desarrollado en la teoria
|
53 |
+
angulo = math.abs(posicion_objetivo - posicion_inicial)
|
54 |
+
sim.setObjectInt32Param(motor, sim.jointintparam_ctrl_enabled, 0)
|
55 |
+
sim.setJointTargetVelocity(
|
56 |
+
motor,
|
57 |
+
parametro
|
58 |
+
* angulo
|
59 |
+
/ ((angulo - (-0.000088 * (v ^ 3) + 0.012325 * (v ^ 2) - 0.549530 * v + 4.737946)) / (0.000014 * (v ^ 3) - 0.002598 * (v ^ 2) + 0.480940 * v + 3.181534))
|
60 |
+
* math.pi
|
61 |
+
/ 180
|
62 |
+
)
|
63 |
+
end
|
64 |
+
return {}, {}, {}, ""
|
65 |
+
end
|
66 |
+
|
67 |
+
readTiltPosition = function(inIntegers, inFloats, inStrings, inBuffer)
|
68 |
+
posicionTiltInt = {} -- Definicion del vector donde se guarda la posicion (en grados) del tilt en el momento de llamar a la funcion
|
69 |
+
posicionTiltFloat = sim.getJointPosition(motor) * 180 / math.pi + 70
|
70 |
+
posicionTiltInt[1] = math.floor(posicionTiltFloat)
|
71 |
+
return posicionTiltInt, {}, {}, ""
|
72 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/lua_scripts/robobo/right_motor.lua
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
local sim = require("sim")
|
2 |
-
|
3 |
-
function sysCall_init()
|
4 |
-
-- do some initialization here
|
5 |
-
motor = sim.sim.getObject("../Left_Motor")
|
6 |
-
pos_anterior = sim.getJointPosition(motor)
|
7 |
-
end
|
8 |
-
|
9 |
-
function sysCall_actuation()
|
10 |
-
-- put your actuation code here
|
11 |
-
pos = sim.getJointPosition(motor)
|
12 |
-
velocidad = math.floor((pos - pos_anterior) / 0.05 * 180 / math.pi)
|
13 |
-
pos_anterior = pos
|
14 |
-
end
|
|
|
1 |
+
local sim = require("sim")
|
2 |
+
|
3 |
+
function sysCall_init()
|
4 |
+
-- do some initialization here
|
5 |
+
motor = sim.sim.getObject("../Left_Motor")
|
6 |
+
pos_anterior = sim.getJointPosition(motor)
|
7 |
+
end
|
8 |
+
|
9 |
+
function sysCall_actuation()
|
10 |
+
-- put your actuation code here
|
11 |
+
pos = sim.getJointPosition(motor)
|
12 |
+
velocidad = math.floor((pos - pos_anterior) / 0.05 * 180 / math.pi)
|
13 |
+
pos_anterior = pos
|
14 |
+
end
|
learning_machines_robobo/examples/coppelia_sim_tutorial/requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
pyzmq
|
2 |
-
cbor2
|
3 |
-
coppeliasim-zmqremoteapi-client
|
|
|
1 |
+
pyzmq
|
2 |
+
cbor2
|
3 |
+
coppeliasim-zmqremoteapi-client
|
learning_machines_robobo/examples/coppelia_sim_tutorial/scripts/start_coppelia_sim.ps1
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
# if PowerShell scripts don't work, make sure to:
|
2 |
-
# `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned`
|
3 |
-
# in a powershell running in administrator mode.
|
4 |
-
param(
|
5 |
-
[Parameter(Mandatory=$true, Position=0, HelpMessage="Path to the .ttt scene to load in CoppeliaSim")]
|
6 |
-
[string] $scenePath,
|
7 |
-
[Parameter(Mandatory=$false, Position=1, HelpMessage="The TCP port to start the CoppeliaSim API at")]
|
8 |
-
[int] $apiPort = 23000,
|
9 |
-
[Parameter(Mandatory=$false, Position=2, HelpMessage="Wether to run in headless (GUI-less) mode")]
|
10 |
-
[switch] $headless
|
11 |
-
)
|
12 |
-
|
13 |
-
$h = if ($headless.IsPresent) {"-h"} else {""}
|
14 |
-
|
15 |
-
# Presumes you have CoppeliaSim extracted to ./CoppeliaSim
|
16 |
-
.\CoppeliaSim\coppeliaSim.exe "$scenePath" $h "-GzmqRemoteApi.rpcPort=$($apiPort)"
|
|
|
1 |
+
# if PowerShell scripts don't work, make sure to:
|
2 |
+
# `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned`
|
3 |
+
# in a powershell running in administrator mode.
|
4 |
+
param(
|
5 |
+
[Parameter(Mandatory=$true, Position=0, HelpMessage="Path to the .ttt scene to load in CoppeliaSim")]
|
6 |
+
[string] $scenePath,
|
7 |
+
[Parameter(Mandatory=$false, Position=1, HelpMessage="The TCP port to start the CoppeliaSim API at")]
|
8 |
+
[int] $apiPort = 23000,
|
9 |
+
[Parameter(Mandatory=$false, Position=2, HelpMessage="Wether to run in headless (GUI-less) mode")]
|
10 |
+
[switch] $headless
|
11 |
+
)
|
12 |
+
|
13 |
+
$h = if ($headless.IsPresent) {"-h"} else {""}
|
14 |
+
|
15 |
+
# Presumes you have CoppeliaSim extracted to ./CoppeliaSim
|
16 |
+
.\CoppeliaSim\coppeliaSim.exe "$scenePath" $h "-GzmqRemoteApi.rpcPort=$($apiPort)"
|
learning_machines_robobo/examples/coppelia_sim_tutorial/scripts/start_coppelia_sim.sh
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
#!/usr/bin/env bash
|
2 |
-
|
3 |
-
# Pass the scene you want to load as first argument
|
4 |
-
# Specify the port you want as second argument. Defaults to 23000 (same as default for SimulationRobobo and CoppeliaSim as a whole)
|
5 |
-
# If you want to run in headless mode, specify `-h` as a third argument
|
6 |
-
${1:?"Specify the scene you want to load as a first argument"}
|
7 |
-
|
8 |
-
# Presumes you have CoppeliaSim extracted to ./CoppeliaSim
|
9 |
-
./CoppeliaSim/coppeliaSim.sh "$1" $3 "-GzmqRemoteApi.rpcPort=${2:-23000}"
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
|
3 |
+
# Pass the scene you want to load as first argument
|
4 |
+
# Specify the port you want as second argument. Defaults to 23000 (same as default for SimulationRobobo and CoppeliaSim as a whole)
|
5 |
+
# If you want to run in headless mode, specify `-h` as a third argument
|
6 |
+
${1:?"Specify the scene you want to load as a first argument"}
|
7 |
+
|
8 |
+
# Presumes you have CoppeliaSim extracted to ./CoppeliaSim
|
9 |
+
./CoppeliaSim/coppeliaSim.sh "$1" $3 "-GzmqRemoteApi.rpcPort=${2:-23000}"
|
learning_machines_robobo/examples/coppelia_sim_tutorial/scripts/start_coppelia_sim.zsh
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
#!/usr/bin/env zsh
|
2 |
-
|
3 |
-
# Pass the scene you want to load as first argument
|
4 |
-
# Specify the port you want as second argument. Defaults to 23000 (same as default for SimulationRobobo, and CoppeliaSim as a whole)
|
5 |
-
# If you want to run in headless mode, specify `-h` as a third argument
|
6 |
-
${1:?"Specify the scene you want to load as a first argument"}
|
7 |
-
|
8 |
-
# Presumes you have CoppeliaSim extracted to ./coppeliaSim.app
|
9 |
-
./coppeliaSim.app/Contents/MacOS/coppeliaSim "$1" $3 "-GzmqRemoteApi.rpcPort=${2:-23000}"
|
|
|
1 |
+
#!/usr/bin/env zsh
|
2 |
+
|
3 |
+
# Pass the scene you want to load as first argument
|
4 |
+
# Specify the port you want as second argument. Defaults to 23000 (same as default for SimulationRobobo, and CoppeliaSim as a whole)
|
5 |
+
# If you want to run in headless mode, specify `-h` as a third argument
|
6 |
+
${1:?"Specify the scene you want to load as a first argument"}
|
7 |
+
|
8 |
+
# Presumes you have CoppeliaSim extracted to ./coppeliaSim.app
|
9 |
+
./coppeliaSim.app/Contents/MacOS/coppeliaSim "$1" $3 "-GzmqRemoteApi.rpcPort=${2:-23000}"
|
learning_machines_robobo/examples/docker_tutorial/README.md
CHANGED
@@ -1,284 +1,284 @@
|
|
1 |
-
## An Intro to Docker
|
2 |
-
|
3 |
-
If you have never touched it before, Docker is going to be a bit overwhelming to use, especially if you're on Windows and never touched a Unix shell before. But, don't worry, though there is a lot to learn about docker, you're not going to need a lot of it.
|
4 |
-
|
5 |
-
## What is Docker, and why do we use it?
|
6 |
-
|
7 |
-
Docker is the professional standard for running code. It creates an isolated environment that allows you to have reproducible systems to run in.
|
8 |
-
|
9 |
-
In short, it is a system to create small mini-computers on your computer. You can think of it as setting up a small computer, with an operating system and some installed software, on top of your current computer and operating system. Every docker container is a small mini-computer that behaves like it's a separate machine running on separate hardware.
|
10 |
-
|
11 |
-
If you've used virtual machines before, it's a bit like that. The difference between Docker and a VM is that a VM virtualizes the _Hardware_, whereas Docker virtualizes the _Kernel_, this allows Docker to be way faster and more lightweight than running a VM.
|
12 |
-
|
13 |
-
To run code in a container, then, is effectively to start up a separate computer, and run your code in there. This is how you should think of it. First you `docker build`, which is to say you create this small computer, and then you `docker run`, which is to say you run the computer.
|
14 |
-
|
15 |
-
The reason this is useful is because of docker images. This is what you create when you `docker build`. They are, effectively, small mini-computers, that are completely set up and configured. you can create a file, called a `Dockerfile`, that specifies exactly how this system should be set up. It installs any needed software, applies all needed configurations, sets all environment variables, etc. Without docker, we'd have stuff like "Oh, this code works on my machine, but not on your machine, because I have ROS installed differently than you" or "I have this setting applied whereas you don't" or a myriad of other things. This way, the configuration of the operating system under which the code is run is completely reproducible. If the code runs in the container, it runs everywhere.
|
16 |
-
|
17 |
-
The main reason we use it is ROS noetic, which is a mess to install, and works barely on Windows and not at all on MacOS. Instead of that, we just use the `ros:noetic` docker base image, which will have everything installed properly.
|
18 |
-
|
19 |
-
## Installing Docker
|
20 |
-
|
21 |
-
The first thing that's important is installing it. What we are going to need is the [Docker engine](https://docs.docker.com/engine/install/), which can only be directly installed on Linux. This is not an accident, Docker is Linux-based and depends on it. Luckily enough, there exists the [Docker Desktop](https://docs.docker.com/desktop/), which is a software suite that will install the Docker engine for you on any operating system (by installing a Linux VM or WSL and running docker in that). It also comes with a ton more stuff, like a GUI and Docker-compose, but we won't touch those here. We only care about the engine and the CLI.
|
22 |
-
|
23 |
-
During the installation process, you can use all default settings, and you can click "continue without logging in," as you don't need an account, either.
|
24 |
-
|
25 |
-
#### Installing Docker Desktop on Windows.
|
26 |
-
|
27 |
-
To install Docker Desktop on Windows, first things first, you're going to need to install [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install) (Windows Subsystem for Linux), for which you need to [enable hardware virtualization](https://docs.docker.com/desktop/troubleshoot/topics/#virtualization) in your BIOS and Windows Control Panel. The supported versions are Windows 10 Home and Pro (22H2 or higher) and Windows 11 Home and Pro (21H2 or higher) If WSL is not installed, docker will install, but it won't work. We're not explicitly _using_ WSL, and you never have to open a WSL terminal. It's just that Docker needs it.
|
28 |
-
|
29 |
-
The full official installation guide can be found [at the Docker docs](https://docs.docker.com/desktop/install/windows-install/).
|
30 |
-
|
31 |
-
There is also this thing called a "Hyper-V backend" with Windows containers. We don't want that: we want the WSL2 backend, as we're running Linux containers.
|
32 |
-
|
33 |
-
#### Installing Docker Desktop on macOS
|
34 |
-
|
35 |
-
To install Docker Desktop on MacOS, you need to have MacOS 12 (Monterkey) or higher (that is, Ventura or Sonoma). If you do, you can just follow the installation instructions on [the Docker docs](https://docs.docker.com/desktop/install/mac-install/).
|
36 |
-
|
37 |
-
#### Installing Docker on Linux.
|
38 |
-
|
39 |
-
If you want to have an identical experience to the plebs using MacOS or Windows and are on Fedora, Debian, or Ubuntu, you can install Docker Desktop as per the [Docker docs](https://docs.docker.com/desktop/install/linux-install/).
|
40 |
-
|
41 |
-
However, on Linux, on any distribution, you can also install the Docker Engine directly with the instructions [here](https://docs.docker.com/engine/install/). This won't install any graphical interface, but will also remove a layer of virtualization, allowing you more control and insight over the docker images than when using Docker Desktop, meaning you can play with visual pass-trough and other things like that.
|
42 |
-
|
43 |
-
#### My OS is not supported?
|
44 |
-
|
45 |
-
If you are on an OS that is too old, or too niche, you have to install something that is supported. You can run a VM or dual-boot. Probably the easiest thing to quickly set up that is also easy to use for this course is to dual-boot [LMDE](https://www.linuxmint.com/download_lmde.php). This is based on Debian Linux, so you can google "How to X on Debian" and follow any command-line results to the letter, but also comes with a nice installer that's easy to set up for a dual-boot.
|
46 |
-
|
47 |
-
## Using Docker
|
48 |
-
|
49 |
-
To use docker, type the command `docker` in the command line. This is the only command we will use for this course. This should display a bunch of command line options. If it doesn't, go back the the installation instructions.
|
50 |
-
|
51 |
-
From this entire docker desktop thing you installed, you don't need any of its GUI elements. We only care about the command line executables.
|
52 |
-
|
53 |
-
If that command works, we need to make sure that the Docker Deamon is running before we can do anything else. This is something you need to do whenever you want to run any docker command.
|
54 |
-
|
55 |
-
If you installed Docker Desktop, you should just open the GUI of Docker Desktop. We are not _using_ this gui, but opening it (and then closing it,) makes sure it is running.
|
56 |
-
|
57 |
-
On linux, if you did not install the Docker Desktop, you can start the docker daemon by running:
|
58 |
-
|
59 |
-
```sh
|
60 |
-
systemctl start docker
|
61 |
-
```
|
62 |
-
|
63 |
-
If you want to, you can, at this point, go through the [Getting Started Guide](https://docs.docker.com/get-started/). You don't have to, but this is the easiest place to go through if you, at any point, feel like you're stuck on Docker and want to learn how it works.
|
64 |
-
|
65 |
-
### Basic docker commands: run and build
|
66 |
-
|
67 |
-
There are three things you need to know `docker build`, `Dockerfile`, and `docker run`.
|
68 |
-
|
69 |
-
The Dockerfile is the thing that specifies what's inside the little computer. It specifies what to install, what configuration to set up, and all that.
|
70 |
-
|
71 |
-
The first thing we need to say about this is that Docker does not like Windows `\r\n` (CRLF) line endings, and wants files to have `\n` (LF) line endings instead. This shouldn't be something you have to worry about, as files are converted (using a tool called `dos2unix` and a powershell command) for you in all scripts, but if anything inexplicable doesn't work and you are on Windows, checking the line endings (including those of your Dockerfile) is one of the first things you should try.
|
72 |
-
|
73 |
-
Here is a small example, that installs Ubuntu as a base, and then installs git on ubuntu:
|
74 |
-
|
75 |
-
```Dockerfile
|
76 |
-
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
77 |
-
FROM ubuntu:20.04
|
78 |
-
|
79 |
-
# Run apt-get to install git
|
80 |
-
# This has three stages:
|
81 |
-
# * First, we update apt, to make sure we are installing the latest version of everything
|
82 |
-
# * Second, we are installing git
|
83 |
-
# * Third, we are removing some junk files that were created in the process.
|
84 |
-
# (You don't have to bother about this third step)
|
85 |
-
RUN apt-get -y update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
86 |
-
```
|
87 |
-
|
88 |
-
Notice how we don't need to specify `sudo`, we're in a separate computer that is being run specifically for this task: we can run everything as root.
|
89 |
-
|
90 |
-
Create a file called `Dockerfile` (no extension), and paste this code in. Then, run on your own OS's terminal:
|
91 |
-
|
92 |
-
```sh
|
93 |
-
docker build --tag my_first_container .
|
94 |
-
```
|
95 |
-
|
96 |
-
This will create this small computer under the name (tag) `my_first_container`, from the current directory, which is what the period stands for.
|
97 |
-
|
98 |
-
If you installed Docker Desktop, it will once again ask you to log in after building a container. Again, you can ignore this.
|
99 |
-
|
100 |
-
We can then run the container with (again on your main terminal):
|
101 |
-
|
102 |
-
```sh
|
103 |
-
docker run my_first_container
|
104 |
-
```
|
105 |
-
|
106 |
-
This won't do anything. That makes sense, it'll just start up and, since we didn't specify it to do anything, shut down immediately after.
|
107 |
-
|
108 |
-
Let's instead tell it to echo hello world as an entrypoint, which is to say, we tell it that is the command it should run when started up.
|
109 |
-
|
110 |
-
```Dockerfile
|
111 |
-
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
112 |
-
FROM ubuntu:20.04
|
113 |
-
|
114 |
-
# Run apt-get to install git
|
115 |
-
RUN apt-get -y update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
116 |
-
|
117 |
-
# Specify what to run, in this case, the `echo` command with as argument `Hello world`
|
118 |
-
CMD ["echo", "Hello World"]
|
119 |
-
```
|
120 |
-
|
121 |
-
When we now build this new container with `docker build --tag my_first_container .` and then run with `docker run my_first_container`, we'll see it print "Hello World"
|
122 |
-
|
123 |
-
---
|
124 |
-
|
125 |
-
Let's now say we want to view (`head`) this README in there instead of installing git and printing Hello World. let's do:
|
126 |
-
|
127 |
-
```Dockerfile
|
128 |
-
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
129 |
-
FROM ubuntu:20.04
|
130 |
-
|
131 |
-
# Specify what to run, in this case, the `head` command (print the first few lines of a file to the terminal) with as argument `./README.md`
|
132 |
-
CMD ["head", "./REAMDE.md"]
|
133 |
-
```
|
134 |
-
|
135 |
-
Again, build with `docker build --tag my_first_container .` and then run with `docker run my_first_container`.
|
136 |
-
|
137 |
-
This won't work. REAME.md might exist on your computer, but it doesn't exist on the container. We have to copy that file in from your computer to the container, and then view it:
|
138 |
-
|
139 |
-
```Dockerfile
|
140 |
-
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
141 |
-
FROM ubuntu:20.04
|
142 |
-
|
143 |
-
# Let's CD to a more sensible working directory
|
144 |
-
WORKDIR /root/workdir
|
145 |
-
|
146 |
-
# Copy the file from your own machine to the container
|
147 |
-
COPY ./README.md ./README.md
|
148 |
-
|
149 |
-
# Specify what to run, in this case, the `head` command (print the first few lines of a file to the terminal) with as argument `./README.md`
|
150 |
-
CMD ["head", "./README.md"]
|
151 |
-
```
|
152 |
-
|
153 |
-
Again, you build this new container with with `docker build --tag my_first_container .` and then run with `docker run my_first_container`.
|
154 |
-
|
155 |
-
You now know almost everything you need to know. There are two more things that might end up fooling you. The first: debugging.
|
156 |
-
|
157 |
-
### Debugging code inside containers
|
158 |
-
|
159 |
-
Let's say you made a typo in the Dockerfile, and wrote `COPY ./README.md ./REAMDE.md` instead, and let's say you don't spot this. How do you debug this?
|
160 |
-
|
161 |
-
First, let's remove the entrypoint from the docker container:
|
162 |
-
|
163 |
-
```Dockerfile
|
164 |
-
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
165 |
-
FROM ubuntu:20.04
|
166 |
-
|
167 |
-
# Let's CD to a more sensible working directory
|
168 |
-
WORKDIR /root/workdir
|
169 |
-
|
170 |
-
# Copy over the file from your own machine to the container, misspelled
|
171 |
-
COPY ./README.md ./REAMDE.md
|
172 |
-
```
|
173 |
-
|
174 |
-
Now, you can again `docker build --tag my_first_container .`, but we'll run it with:
|
175 |
-
|
176 |
-
```sh
|
177 |
-
docker run -it my_first_container bash
|
178 |
-
```
|
179 |
-
|
180 |
-
This will run the container in interactive mode with `-it` (Technically, it stands for something else, but don't bother about that), and it will launch a single command on startup: `bash`.
|
181 |
-
|
182 |
-
Now, you are spawned inside a bash shell in your container. You can `apt-get install`, you can `cat`, `ls`, and `cd` around the place, and do anything else you might want to do for troubleshooting. This is the previously mentioned point where being good at a Linux command line really pays off. The more debugging you can do while in here, the less cumbersome working with containers is. To exit a container you started like this and return to the terminal of your own OS, type `exit` and hit enter.
|
183 |
-
|
184 |
-
This is a general pattern for debugging docker containers. You remove everything that breaks, you build and then run in interactive mode to troubleshoot what is going on.
|
185 |
-
|
186 |
-
### Managing running containers
|
187 |
-
|
188 |
-
Similarly, for debugging, you might find yourself in a situation where the requested ports are already occupied. This means that the container is already running.
|
189 |
-
|
190 |
-
To see all running docker containers type on the terminal of your own OS:
|
191 |
-
|
192 |
-
```sh
|
193 |
-
docker ps
|
194 |
-
```
|
195 |
-
|
196 |
-
After that, you can shut down a container by typing:
|
197 |
-
|
198 |
-
```sh
|
199 |
-
docker container stop "container id"
|
200 |
-
```
|
201 |
-
|
202 |
-
Or, if you want to just kill all containers on Unix:
|
203 |
-
|
204 |
-
```sh
|
205 |
-
docker ps -q | xargs docker container stop
|
206 |
-
```
|
207 |
-
|
208 |
-
### Passing commandline arguments to the command we run inside the container
|
209 |
-
|
210 |
-
The last thing that still needs to be explained is how to pass command line arguments from your shell to the docker container. This is quite complicated, but, luckily enough, you only need to understand the oversimplified version: instead of `CMD`, we are going to be using `ENTRYPOINT`.
|
211 |
-
|
212 |
-
```Dockerfile
|
213 |
-
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
214 |
-
FROM ubuntu:20.04
|
215 |
-
|
216 |
-
# Specify what to run, in this case, the `echo` command. What we are echoing is going to depend on what we pass through the command line.
|
217 |
-
ENTRYPOINT ["echo"]
|
218 |
-
```
|
219 |
-
|
220 |
-
You can build this again as usual with `docker build --tag my_first_container .` After that, you can run it with:
|
221 |
-
|
222 |
-
```sh
|
223 |
-
docker run my_first_container "Hello World"
|
224 |
-
```
|
225 |
-
|
226 |
-
As you can see, all arguments after the container name are passed to the entrypoint before running.
|
227 |
-
|
228 |
-
### Deleting built images
|
229 |
-
|
230 |
-
Every now and then, you might want to delete all the images you have build in the past. They don't take up a lof of space, and you will usually overwrite them anyway, but it's good to clean stuff up every now and then.
|
231 |
-
|
232 |
-
To do this, run:
|
233 |
-
|
234 |
-
```sh
|
235 |
-
docker container prune
|
236 |
-
```
|
237 |
-
|
238 |
-
### Docker permission issues.
|
239 |
-
|
240 |
-
If you're on macOS or Linux, you might find yourself with docker permission issues. Errors like: `ERROR: failed to solve: ros:noetic: error getting credentials - err: exit status 1, out: `, or having to always call docker with `sudo`. There are several things you might need to do to fix this. The first command you should try running on your terminal is:
|
241 |
-
|
242 |
-
```sh
|
243 |
-
ls -la $HOME | grep .docker
|
244 |
-
```
|
245 |
-
|
246 |
-
If that says the file is not owned by your user (e.g. you don't see something resembling your username in the output), you might be able to fix your issues by running:
|
247 |
-
|
248 |
-
```sh
|
249 |
-
sudo chown -R $(id -u):$(id -g) $HOME/.docker
|
250 |
-
```
|
251 |
-
|
252 |
-
If that doesn't work. You should really just google and, if you cannot find anything, ask. Docker can be hard to install, and this not working might happen depending on how you specifically set up your own computer.
|
253 |
-
|
254 |
-
### Running with Apple Silicon
|
255 |
-
|
256 |
-
Running docker with a machine on Apple silicon, so far, has just worked. But, later on in the course, it won't. Because of that, in `full_project_setup`, we provide you with another script: `run_apple_sillicon.zsh`, in which we add one flag: `--platform linux/amd64`, which specifies to `buildx` to run or build the container under the `x86` (amd64) CPU architecture (and virtualise that when needed).
|
257 |
-
|
258 |
-
To get all this running, first of all, enable experimental features in docker desktop. It's in the settings somewhere, but they move it around so much it's hard to tell you exactly where to look.
|
259 |
-
|
260 |
-
After you have enabled experimental features (and maybe restart your machine after that,) you can run in your terminal:
|
261 |
-
|
262 |
-
```zsh
|
263 |
-
docker buildx create --use
|
264 |
-
```
|
265 |
-
|
266 |
-
Another issue you might run into with docker on Apple Scillicon is:
|
267 |
-
|
268 |
-
```
|
269 |
-
Operation not permitted (src/thread.cpp:281)
|
270 |
-
qemu: uncaught target signal 6 (Aborted) - core dumped
|
271 |
-
```
|
272 |
-
|
273 |
-
This is usually caused by Docker desktop trying to run your code multi-threaded somehow, but the Docker virtualisation layer not allowing for this. For this, go into the docker desktop settings, Resources, and then make sure the amount of CPUs Docker Desktop is allowed to use is set to 1.
|
274 |
-
|
275 |
-
After that, the `--platform linux/amd64` flag is going to work on your system, and you can use the `run_apple_sillicon.zsh` script to run instead of the `run.sh` script. Macs with intel processors are not affected by this.
|
276 |
-
|
277 |
-
### Looking ahead
|
278 |
-
|
279 |
-
In `run.sh` / `run.ps1`, which are the scripts you'll use to start docker for the full project setup, we use a bunch more flags and things. These, you don't have to worry about. However, here is a quick summary of what they are, and how we use them:
|
280 |
-
|
281 |
-
- `-v [host_path]:[container_path]` mount a volume. Basically, this allows you to have some directory on your own system to which the container can read and write. This is used such that you can save your results on your own system but should be used with care, as having two operating systems mount the same file system can cause unexpected issues, especially on Windows.
|
282 |
-
- `-p [host_port]:[container_port]` Expose or link a TCP port from the container to your host. Used for talking with the robot.
|
283 |
-
- `--rm` Remove any container of the same name that is already running.
|
284 |
-
- `-t` Allocate a pseudo-TTY. Without it, some print functions from the container wouldn't show up on your own terminal when running.
|
|
|
1 |
+
## An Intro to Docker
|
2 |
+
|
3 |
+
If you have never touched it before, Docker is going to be a bit overwhelming to use, especially if you're on Windows and never touched a Unix shell before. But, don't worry, though there is a lot to learn about docker, you're not going to need a lot of it.
|
4 |
+
|
5 |
+
## What is Docker, and why do we use it?
|
6 |
+
|
7 |
+
Docker is the professional standard for running code. It creates an isolated environment that allows you to have reproducible systems to run in.
|
8 |
+
|
9 |
+
In short, it is a system to create small mini-computers on your computer. You can think of it as setting up a small computer, with an operating system and some installed software, on top of your current computer and operating system. Every docker container is a small mini-computer that behaves like it's a separate machine running on separate hardware.
|
10 |
+
|
11 |
+
If you've used virtual machines before, it's a bit like that. The difference between Docker and a VM is that a VM virtualizes the _Hardware_, whereas Docker virtualizes the _Kernel_, this allows Docker to be way faster and more lightweight than running a VM.
|
12 |
+
|
13 |
+
To run code in a container, then, is effectively to start up a separate computer, and run your code in there. This is how you should think of it. First you `docker build`, which is to say you create this small computer, and then you `docker run`, which is to say you run the computer.
|
14 |
+
|
15 |
+
The reason this is useful is because of docker images. This is what you create when you `docker build`. They are, effectively, small mini-computers, that are completely set up and configured. you can create a file, called a `Dockerfile`, that specifies exactly how this system should be set up. It installs any needed software, applies all needed configurations, sets all environment variables, etc. Without docker, we'd have stuff like "Oh, this code works on my machine, but not on your machine, because I have ROS installed differently than you" or "I have this setting applied whereas you don't" or a myriad of other things. This way, the configuration of the operating system under which the code is run is completely reproducible. If the code runs in the container, it runs everywhere.
|
16 |
+
|
17 |
+
The main reason we use it is ROS noetic, which is a mess to install, and works barely on Windows and not at all on MacOS. Instead of that, we just use the `ros:noetic` docker base image, which will have everything installed properly.
|
18 |
+
|
19 |
+
## Installing Docker
|
20 |
+
|
21 |
+
The first thing that's important is installing it. What we are going to need is the [Docker engine](https://docs.docker.com/engine/install/), which can only be directly installed on Linux. This is not an accident, Docker is Linux-based and depends on it. Luckily enough, there exists the [Docker Desktop](https://docs.docker.com/desktop/), which is a software suite that will install the Docker engine for you on any operating system (by installing a Linux VM or WSL and running docker in that). It also comes with a ton more stuff, like a GUI and Docker-compose, but we won't touch those here. We only care about the engine and the CLI.
|
22 |
+
|
23 |
+
During the installation process, you can use all default settings, and you can click "continue without logging in," as you don't need an account, either.
|
24 |
+
|
25 |
+
#### Installing Docker Desktop on Windows.
|
26 |
+
|
27 |
+
To install Docker Desktop on Windows, first things first, you're going to need to install [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install) (Windows Subsystem for Linux), for which you need to [enable hardware virtualization](https://docs.docker.com/desktop/troubleshoot/topics/#virtualization) in your BIOS and Windows Control Panel. The supported versions are Windows 10 Home and Pro (22H2 or higher) and Windows 11 Home and Pro (21H2 or higher) If WSL is not installed, docker will install, but it won't work. We're not explicitly _using_ WSL, and you never have to open a WSL terminal. It's just that Docker needs it.
|
28 |
+
|
29 |
+
The full official installation guide can be found [at the Docker docs](https://docs.docker.com/desktop/install/windows-install/).
|
30 |
+
|
31 |
+
There is also this thing called a "Hyper-V backend" with Windows containers. We don't want that: we want the WSL2 backend, as we're running Linux containers.
|
32 |
+
|
33 |
+
#### Installing Docker Desktop on macOS
|
34 |
+
|
35 |
+
To install Docker Desktop on MacOS, you need to have MacOS 12 (Monterkey) or higher (that is, Ventura or Sonoma). If you do, you can just follow the installation instructions on [the Docker docs](https://docs.docker.com/desktop/install/mac-install/).
|
36 |
+
|
37 |
+
#### Installing Docker on Linux.
|
38 |
+
|
39 |
+
If you want to have an identical experience to the plebs using MacOS or Windows and are on Fedora, Debian, or Ubuntu, you can install Docker Desktop as per the [Docker docs](https://docs.docker.com/desktop/install/linux-install/).
|
40 |
+
|
41 |
+
However, on Linux, on any distribution, you can also install the Docker Engine directly with the instructions [here](https://docs.docker.com/engine/install/). This won't install any graphical interface, but will also remove a layer of virtualization, allowing you more control and insight over the docker images than when using Docker Desktop, meaning you can play with visual pass-trough and other things like that.
|
42 |
+
|
43 |
+
#### My OS is not supported?
|
44 |
+
|
45 |
+
If you are on an OS that is too old, or too niche, you have to install something that is supported. You can run a VM or dual-boot. Probably the easiest thing to quickly set up that is also easy to use for this course is to dual-boot [LMDE](https://www.linuxmint.com/download_lmde.php). This is based on Debian Linux, so you can google "How to X on Debian" and follow any command-line results to the letter, but also comes with a nice installer that's easy to set up for a dual-boot.
|
46 |
+
|
47 |
+
## Using Docker
|
48 |
+
|
49 |
+
To use docker, type the command `docker` in the command line. This is the only command we will use for this course. This should display a bunch of command line options. If it doesn't, go back the the installation instructions.
|
50 |
+
|
51 |
+
From this entire docker desktop thing you installed, you don't need any of its GUI elements. We only care about the command line executables.
|
52 |
+
|
53 |
+
If that command works, we need to make sure that the Docker Deamon is running before we can do anything else. This is something you need to do whenever you want to run any docker command.
|
54 |
+
|
55 |
+
If you installed Docker Desktop, you should just open the GUI of Docker Desktop. We are not _using_ this gui, but opening it (and then closing it,) makes sure it is running.
|
56 |
+
|
57 |
+
On linux, if you did not install the Docker Desktop, you can start the docker daemon by running:
|
58 |
+
|
59 |
+
```sh
|
60 |
+
systemctl start docker
|
61 |
+
```
|
62 |
+
|
63 |
+
If you want to, you can, at this point, go through the [Getting Started Guide](https://docs.docker.com/get-started/). You don't have to, but this is the easiest place to go through if you, at any point, feel like you're stuck on Docker and want to learn how it works.
|
64 |
+
|
65 |
+
### Basic docker commands: run and build
|
66 |
+
|
67 |
+
There are three things you need to know `docker build`, `Dockerfile`, and `docker run`.
|
68 |
+
|
69 |
+
The Dockerfile is the thing that specifies what's inside the little computer. It specifies what to install, what configuration to set up, and all that.
|
70 |
+
|
71 |
+
The first thing we need to say about this is that Docker does not like Windows `\r\n` (CRLF) line endings, and wants files to have `\n` (LF) line endings instead. This shouldn't be something you have to worry about, as files are converted (using a tool called `dos2unix` and a powershell command) for you in all scripts, but if anything inexplicable doesn't work and you are on Windows, checking the line endings (including those of your Dockerfile) is one of the first things you should try.
|
72 |
+
|
73 |
+
Here is a small example, that installs Ubuntu as a base, and then installs git on ubuntu:
|
74 |
+
|
75 |
+
```Dockerfile
|
76 |
+
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
77 |
+
FROM ubuntu:20.04
|
78 |
+
|
79 |
+
# Run apt-get to install git
|
80 |
+
# This has three stages:
|
81 |
+
# * First, we update apt, to make sure we are installing the latest version of everything
|
82 |
+
# * Second, we are installing git
|
83 |
+
# * Third, we are removing some junk files that were created in the process.
|
84 |
+
# (You don't have to bother about this third step)
|
85 |
+
RUN apt-get -y update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
86 |
+
```
|
87 |
+
|
88 |
+
Notice how we don't need to specify `sudo`, we're in a separate computer that is being run specifically for this task: we can run everything as root.
|
89 |
+
|
90 |
+
Create a file called `Dockerfile` (no extension), and paste this code in. Then, run on your own OS's terminal:
|
91 |
+
|
92 |
+
```sh
|
93 |
+
docker build --tag my_first_container .
|
94 |
+
```
|
95 |
+
|
96 |
+
This will create this small computer under the name (tag) `my_first_container`, from the current directory, which is what the period stands for.
|
97 |
+
|
98 |
+
If you installed Docker Desktop, it will once again ask you to log in after building a container. Again, you can ignore this.
|
99 |
+
|
100 |
+
We can then run the container with (again on your main terminal):
|
101 |
+
|
102 |
+
```sh
|
103 |
+
docker run my_first_container
|
104 |
+
```
|
105 |
+
|
106 |
+
This won't do anything. That makes sense, it'll just start up and, since we didn't specify it to do anything, shut down immediately after.
|
107 |
+
|
108 |
+
Let's instead tell it to echo hello world as an entrypoint, which is to say, we tell it that is the command it should run when started up.
|
109 |
+
|
110 |
+
```Dockerfile
|
111 |
+
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
112 |
+
FROM ubuntu:20.04
|
113 |
+
|
114 |
+
# Run apt-get to install git
|
115 |
+
RUN apt-get -y update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
116 |
+
|
117 |
+
# Specify what to run, in this case, the `echo` command with as argument `Hello world`
|
118 |
+
CMD ["echo", "Hello World"]
|
119 |
+
```
|
120 |
+
|
121 |
+
When we now build this new container with `docker build --tag my_first_container .` and then run with `docker run my_first_container`, we'll see it print "Hello World"
|
122 |
+
|
123 |
+
---
|
124 |
+
|
125 |
+
Let's now say we want to view (`head`) this README in there instead of installing git and printing Hello World. let's do:
|
126 |
+
|
127 |
+
```Dockerfile
|
128 |
+
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
129 |
+
FROM ubuntu:20.04
|
130 |
+
|
131 |
+
# Specify what to run, in this case, the `head` command (print the first few lines of a file to the terminal) with as argument `./README.md`
|
132 |
+
CMD ["head", "./REAMDE.md"]
|
133 |
+
```
|
134 |
+
|
135 |
+
Again, build with `docker build --tag my_first_container .` and then run with `docker run my_first_container`.
|
136 |
+
|
137 |
+
This won't work. REAME.md might exist on your computer, but it doesn't exist on the container. We have to copy that file in from your computer to the container, and then view it:
|
138 |
+
|
139 |
+
```Dockerfile
|
140 |
+
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
141 |
+
FROM ubuntu:20.04
|
142 |
+
|
143 |
+
# Let's CD to a more sensible working directory
|
144 |
+
WORKDIR /root/workdir
|
145 |
+
|
146 |
+
# Copy the file from your own machine to the container
|
147 |
+
COPY ./README.md ./README.md
|
148 |
+
|
149 |
+
# Specify what to run, in this case, the `head` command (print the first few lines of a file to the terminal) with as argument `./README.md`
|
150 |
+
CMD ["head", "./README.md"]
|
151 |
+
```
|
152 |
+
|
153 |
+
Again, you build this new container with with `docker build --tag my_first_container .` and then run with `docker run my_first_container`.
|
154 |
+
|
155 |
+
You now know almost everything you need to know. There are two more things that might end up fooling you. The first: debugging.
|
156 |
+
|
157 |
+
### Debugging code inside containers
|
158 |
+
|
159 |
+
Let's say you made a typo in the Dockerfile, and wrote `COPY ./README.md ./REAMDE.md` instead, and let's say you don't spot this. How do you debug this?
|
160 |
+
|
161 |
+
First, let's remove the entrypoint from the docker container:
|
162 |
+
|
163 |
+
```Dockerfile
|
164 |
+
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
165 |
+
FROM ubuntu:20.04
|
166 |
+
|
167 |
+
# Let's CD to a more sensible working directory
|
168 |
+
WORKDIR /root/workdir
|
169 |
+
|
170 |
+
# Copy over the file from your own machine to the container, misspelled
|
171 |
+
COPY ./README.md ./REAMDE.md
|
172 |
+
```
|
173 |
+
|
174 |
+
Now, you can again `docker build --tag my_first_container .`, but we'll run it with:
|
175 |
+
|
176 |
+
```sh
|
177 |
+
docker run -it my_first_container bash
|
178 |
+
```
|
179 |
+
|
180 |
+
This will run the container in interactive mode with `-it` (Technically, it stands for something else, but don't bother about that), and it will launch a single command on startup: `bash`.
|
181 |
+
|
182 |
+
Now, you are spawned inside a bash shell in your container. You can `apt-get install`, you can `cat`, `ls`, and `cd` around the place, and do anything else you might want to do for troubleshooting. This is the previously mentioned point where being good at a Linux command line really pays off. The more debugging you can do while in here, the less cumbersome working with containers is. To exit a container you started like this and return to the terminal of your own OS, type `exit` and hit enter.
|
183 |
+
|
184 |
+
This is a general pattern for debugging docker containers. You remove everything that breaks, you build and then run in interactive mode to troubleshoot what is going on.
|
185 |
+
|
186 |
+
### Managing running containers
|
187 |
+
|
188 |
+
Similarly, for debugging, you might find yourself in a situation where the requested ports are already occupied. This means that the container is already running.
|
189 |
+
|
190 |
+
To see all running docker containers type on the terminal of your own OS:
|
191 |
+
|
192 |
+
```sh
|
193 |
+
docker ps
|
194 |
+
```
|
195 |
+
|
196 |
+
After that, you can shut down a container by typing:
|
197 |
+
|
198 |
+
```sh
|
199 |
+
docker container stop "container id"
|
200 |
+
```
|
201 |
+
|
202 |
+
Or, if you want to just kill all containers on Unix:
|
203 |
+
|
204 |
+
```sh
|
205 |
+
docker ps -q | xargs docker container stop
|
206 |
+
```
|
207 |
+
|
208 |
+
### Passing commandline arguments to the command we run inside the container
|
209 |
+
|
210 |
+
The last thing that still needs to be explained is how to pass command line arguments from your shell to the docker container. This is quite complicated, but, luckily enough, you only need to understand the oversimplified version: instead of `CMD`, we are going to be using `ENTRYPOINT`.
|
211 |
+
|
212 |
+
```Dockerfile
|
213 |
+
# We base ourselves on Unbuntu. This is the base OS we are installing.
|
214 |
+
FROM ubuntu:20.04
|
215 |
+
|
216 |
+
# Specify what to run, in this case, the `echo` command. What we are echoing is going to depend on what we pass through the command line.
|
217 |
+
ENTRYPOINT ["echo"]
|
218 |
+
```
|
219 |
+
|
220 |
+
You can build this again as usual with `docker build --tag my_first_container .` After that, you can run it with:
|
221 |
+
|
222 |
+
```sh
|
223 |
+
docker run my_first_container "Hello World"
|
224 |
+
```
|
225 |
+
|
226 |
+
As you can see, all arguments after the container name are passed to the entrypoint before running.
|
227 |
+
|
228 |
+
### Deleting built images
|
229 |
+
|
230 |
+
Every now and then, you might want to delete all the images you have build in the past. They don't take up a lof of space, and you will usually overwrite them anyway, but it's good to clean stuff up every now and then.
|
231 |
+
|
232 |
+
To do this, run:
|
233 |
+
|
234 |
+
```sh
|
235 |
+
docker container prune
|
236 |
+
```
|
237 |
+
|
238 |
+
### Docker permission issues.
|
239 |
+
|
240 |
+
If you're on macOS or Linux, you might find yourself with docker permission issues. Errors like: `ERROR: failed to solve: ros:noetic: error getting credentials - err: exit status 1, out: `, or having to always call docker with `sudo`. There are several things you might need to do to fix this. The first command you should try running on your terminal is:
|
241 |
+
|
242 |
+
```sh
|
243 |
+
ls -la $HOME | grep .docker
|
244 |
+
```
|
245 |
+
|
246 |
+
If that says the file is not owned by your user (e.g. you don't see something resembling your username in the output), you might be able to fix your issues by running:
|
247 |
+
|
248 |
+
```sh
|
249 |
+
sudo chown -R $(id -u):$(id -g) $HOME/.docker
|
250 |
+
```
|
251 |
+
|
252 |
+
If that doesn't work. You should really just google and, if you cannot find anything, ask. Docker can be hard to install, and this not working might happen depending on how you specifically set up your own computer.
|
253 |
+
|
254 |
+
### Running with Apple Silicon
|
255 |
+
|
256 |
+
Running docker with a machine on Apple silicon, so far, has just worked. But, later on in the course, it won't. Because of that, in `full_project_setup`, we provide you with another script: `run_apple_sillicon.zsh`, in which we add one flag: `--platform linux/amd64`, which specifies to `buildx` to run or build the container under the `x86` (amd64) CPU architecture (and virtualise that when needed).
|
257 |
+
|
258 |
+
To get all this running, first of all, enable experimental features in docker desktop. It's in the settings somewhere, but they move it around so much it's hard to tell you exactly where to look.
|
259 |
+
|
260 |
+
After you have enabled experimental features (and maybe restart your machine after that,) you can run in your terminal:
|
261 |
+
|
262 |
+
```zsh
|
263 |
+
docker buildx create --use
|
264 |
+
```
|
265 |
+
|
266 |
+
Another issue you might run into with docker on Apple Scillicon is:
|
267 |
+
|
268 |
+
```
|
269 |
+
Operation not permitted (src/thread.cpp:281)
|
270 |
+
qemu: uncaught target signal 6 (Aborted) - core dumped
|
271 |
+
```
|
272 |
+
|
273 |
+
This is usually caused by Docker desktop trying to run your code multi-threaded somehow, but the Docker virtualisation layer not allowing for this. For this, go into the docker desktop settings, Resources, and then make sure the amount of CPUs Docker Desktop is allowed to use is set to 1.
|
274 |
+
|
275 |
+
After that, the `--platform linux/amd64` flag is going to work on your system, and you can use the `run_apple_sillicon.zsh` script to run instead of the `run.sh` script. Macs with intel processors are not affected by this.
|
276 |
+
|
277 |
+
### Looking ahead
|
278 |
+
|
279 |
+
In `run.sh` / `run.ps1`, which are the scripts you'll use to start docker for the full project setup, we use a bunch more flags and things. These, you don't have to worry about. However, here is a quick summary of what they are, and how we use them:
|
280 |
+
|
281 |
+
- `-v [host_path]:[container_path]` mount a volume. Basically, this allows you to have some directory on your own system to which the container can read and write. This is used such that you can save your results on your own system but should be used with care, as having two operating systems mount the same file system can cause unexpected issues, especially on Windows.
|
282 |
+
- `-p [host_port]:[container_port]` Expose or link a TCP port from the container to your host. Used for talking with the robot.
|
283 |
+
- `--rm` Remove any container of the same name that is already running.
|
284 |
+
- `-t` Allocate a pseudo-TTY. Without it, some print functions from the container wouldn't show up on your own terminal when running.
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/cbor-js/cbor.js
DELETED
@@ -1,416 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* The MIT License (MIT)
|
3 |
-
*
|
4 |
-
* Copyright (c) 2014-2016 Patrick Gansterer <paroga@paroga.com>
|
5 |
-
*
|
6 |
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
-
* of this software and associated documentation files (the "Software"), to deal
|
8 |
-
* in the Software without restriction, including without limitation the rights
|
9 |
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
-
* copies of the Software, and to permit persons to whom the Software is
|
11 |
-
* furnished to do so, subject to the following conditions:
|
12 |
-
*
|
13 |
-
* The above copyright notice and this permission notice shall be included in all
|
14 |
-
* copies or substantial portions of the Software.
|
15 |
-
*
|
16 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22 |
-
* SOFTWARE.
|
23 |
-
*/
|
24 |
-
|
25 |
-
(function(global, undefined) { "use strict";
|
26 |
-
var POW_2_24 = 5.960464477539063e-8,
|
27 |
-
POW_2_32 = 4294967296,
|
28 |
-
POW_2_53 = 9007199254740992,
|
29 |
-
DECODE_CHUNK_SIZE = 8192;
|
30 |
-
|
31 |
-
function encode(value) {
|
32 |
-
var data = new ArrayBuffer(256);
|
33 |
-
var dataView = new DataView(data);
|
34 |
-
var byteView = new Uint8Array(data);
|
35 |
-
var lastLength;
|
36 |
-
var offset = 0;
|
37 |
-
|
38 |
-
function prepareWrite(length) {
|
39 |
-
var newByteLength = data.byteLength;
|
40 |
-
var requiredLength = offset + length;
|
41 |
-
while (newByteLength < requiredLength)
|
42 |
-
newByteLength <<= 1;
|
43 |
-
if (newByteLength !== data.byteLength) {
|
44 |
-
var oldDataView = dataView;
|
45 |
-
data = new ArrayBuffer(newByteLength);
|
46 |
-
dataView = new DataView(data);
|
47 |
-
byteView = new Uint8Array(data);
|
48 |
-
var uint32count = (offset + 3) >> 2;
|
49 |
-
for (var i = 0; i < uint32count; ++i)
|
50 |
-
dataView.setUint32(i << 2, oldDataView.getUint32(i << 2));
|
51 |
-
}
|
52 |
-
|
53 |
-
lastLength = length;
|
54 |
-
return dataView;
|
55 |
-
}
|
56 |
-
function commitWrite() {
|
57 |
-
offset += lastLength;
|
58 |
-
}
|
59 |
-
function writeFloat64(value) {
|
60 |
-
commitWrite(prepareWrite(8).setFloat64(offset, value));
|
61 |
-
}
|
62 |
-
function writeUint8(value) {
|
63 |
-
commitWrite(prepareWrite(1).setUint8(offset, value));
|
64 |
-
}
|
65 |
-
function writeUint8Array(value) {
|
66 |
-
prepareWrite(value.length);
|
67 |
-
byteView.set(value, offset);
|
68 |
-
commitWrite();
|
69 |
-
}
|
70 |
-
function writeUint16(value) {
|
71 |
-
commitWrite(prepareWrite(2).setUint16(offset, value));
|
72 |
-
}
|
73 |
-
function writeUint32(value) {
|
74 |
-
commitWrite(prepareWrite(4).setUint32(offset, value));
|
75 |
-
}
|
76 |
-
function writeUint64(value) {
|
77 |
-
var low = value % POW_2_32;
|
78 |
-
var high = (value - low) / POW_2_32;
|
79 |
-
var dataView = prepareWrite(8);
|
80 |
-
dataView.setUint32(offset, high);
|
81 |
-
dataView.setUint32(offset + 4, low);
|
82 |
-
commitWrite();
|
83 |
-
}
|
84 |
-
function writeTypeAndLength(type, length) {
|
85 |
-
if (length < 24) {
|
86 |
-
writeUint8(type << 5 | length);
|
87 |
-
} else if (length < 0x100) {
|
88 |
-
writeUint8(type << 5 | 24);
|
89 |
-
writeUint8(length);
|
90 |
-
} else if (length < 0x10000) {
|
91 |
-
writeUint8(type << 5 | 25);
|
92 |
-
writeUint16(length);
|
93 |
-
} else if (length < 0x100000000) {
|
94 |
-
writeUint8(type << 5 | 26);
|
95 |
-
writeUint32(length);
|
96 |
-
} else {
|
97 |
-
writeUint8(type << 5 | 27);
|
98 |
-
writeUint64(length);
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
function encodeItem(value) {
|
103 |
-
var i;
|
104 |
-
|
105 |
-
if (value === false)
|
106 |
-
return writeUint8(0xf4);
|
107 |
-
if (value === true)
|
108 |
-
return writeUint8(0xf5);
|
109 |
-
if (value === null)
|
110 |
-
return writeUint8(0xf6);
|
111 |
-
if (value === undefined)
|
112 |
-
return writeUint8(0xf7);
|
113 |
-
|
114 |
-
switch (typeof value) {
|
115 |
-
case "number":
|
116 |
-
if (Math.floor(value) === value) {
|
117 |
-
if (0 <= value && value <= POW_2_53)
|
118 |
-
return writeTypeAndLength(0, value);
|
119 |
-
if (-POW_2_53 <= value && value < 0)
|
120 |
-
return writeTypeAndLength(1, -(value + 1));
|
121 |
-
}
|
122 |
-
writeUint8(0xfb);
|
123 |
-
return writeFloat64(value);
|
124 |
-
|
125 |
-
case "string":
|
126 |
-
var utf8data = [];
|
127 |
-
for (i = 0; i < value.length; ++i) {
|
128 |
-
var charCode = value.charCodeAt(i);
|
129 |
-
if (charCode < 0x80) {
|
130 |
-
utf8data.push(charCode);
|
131 |
-
} else if (charCode < 0x800) {
|
132 |
-
utf8data.push(0xc0 | charCode >> 6);
|
133 |
-
utf8data.push(0x80 | charCode & 0x3f);
|
134 |
-
} else if (charCode < 0xd800 || charCode >= 0xe000) {
|
135 |
-
utf8data.push(0xe0 | charCode >> 12);
|
136 |
-
utf8data.push(0x80 | (charCode >> 6) & 0x3f);
|
137 |
-
utf8data.push(0x80 | charCode & 0x3f);
|
138 |
-
} else {
|
139 |
-
charCode = (charCode & 0x3ff) << 10;
|
140 |
-
charCode |= value.charCodeAt(++i) & 0x3ff;
|
141 |
-
charCode += 0x10000;
|
142 |
-
|
143 |
-
utf8data.push(0xf0 | charCode >> 18);
|
144 |
-
utf8data.push(0x80 | (charCode >> 12) & 0x3f);
|
145 |
-
utf8data.push(0x80 | (charCode >> 6) & 0x3f);
|
146 |
-
utf8data.push(0x80 | charCode & 0x3f);
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
writeTypeAndLength(3, utf8data.length);
|
151 |
-
return writeUint8Array(utf8data);
|
152 |
-
|
153 |
-
default:
|
154 |
-
var length;
|
155 |
-
if (Array.isArray(value)) {
|
156 |
-
length = value.length;
|
157 |
-
writeTypeAndLength(4, length);
|
158 |
-
for (i = 0; i < length; ++i)
|
159 |
-
encodeItem(value[i]);
|
160 |
-
} else if (value instanceof Uint8Array) {
|
161 |
-
writeTypeAndLength(2, value.length);
|
162 |
-
writeUint8Array(value);
|
163 |
-
} else {
|
164 |
-
var keys = Object.keys(value);
|
165 |
-
length = keys.length;
|
166 |
-
writeTypeAndLength(5, length);
|
167 |
-
for (i = 0; i < length; ++i) {
|
168 |
-
var key = keys[i];
|
169 |
-
encodeItem(key);
|
170 |
-
encodeItem(value[key]);
|
171 |
-
}
|
172 |
-
}
|
173 |
-
}
|
174 |
-
}
|
175 |
-
|
176 |
-
encodeItem(value);
|
177 |
-
|
178 |
-
if ("slice" in data)
|
179 |
-
return data.slice(0, offset);
|
180 |
-
|
181 |
-
var ret = new ArrayBuffer(offset);
|
182 |
-
var retView = new DataView(ret);
|
183 |
-
for (var i = 0; i < offset; ++i)
|
184 |
-
retView.setUint8(i, dataView.getUint8(i));
|
185 |
-
return ret;
|
186 |
-
}
|
187 |
-
|
188 |
-
function decode(data, tagger, simpleValue) {
|
189 |
-
var dataView = new DataView(data);
|
190 |
-
var ta = new Uint8Array(data);
|
191 |
-
var offset = 0;
|
192 |
-
|
193 |
-
if (typeof tagger !== "function")
|
194 |
-
tagger = function(value) { return value; };
|
195 |
-
if (typeof simpleValue !== "function")
|
196 |
-
simpleValue = function() { return undefined; };
|
197 |
-
|
198 |
-
function commitRead(length, value) {
|
199 |
-
offset += length;
|
200 |
-
return value;
|
201 |
-
}
|
202 |
-
function readArrayBuffer(length) {
|
203 |
-
return commitRead(length, new Uint8Array(data, offset, length));
|
204 |
-
}
|
205 |
-
function readFloat16() {
|
206 |
-
var tempArrayBuffer = new ArrayBuffer(4);
|
207 |
-
var tempDataView = new DataView(tempArrayBuffer);
|
208 |
-
var value = readUint16();
|
209 |
-
|
210 |
-
var sign = value & 0x8000;
|
211 |
-
var exponent = value & 0x7c00;
|
212 |
-
var fraction = value & 0x03ff;
|
213 |
-
|
214 |
-
if (exponent === 0x7c00)
|
215 |
-
exponent = 0xff << 10;
|
216 |
-
else if (exponent !== 0)
|
217 |
-
exponent += (127 - 15) << 10;
|
218 |
-
else if (fraction !== 0)
|
219 |
-
return (sign ? -1 : 1) * fraction * POW_2_24;
|
220 |
-
|
221 |
-
tempDataView.setUint32(0, sign << 16 | exponent << 13 | fraction << 13);
|
222 |
-
return tempDataView.getFloat32(0);
|
223 |
-
}
|
224 |
-
function readFloat32() {
|
225 |
-
return commitRead(4, dataView.getFloat32(offset));
|
226 |
-
}
|
227 |
-
function readFloat64() {
|
228 |
-
return commitRead(8, dataView.getFloat64(offset));
|
229 |
-
}
|
230 |
-
function readUint8() {
|
231 |
-
return commitRead(1, ta[offset]);
|
232 |
-
}
|
233 |
-
function readUint16() {
|
234 |
-
return commitRead(2, dataView.getUint16(offset));
|
235 |
-
}
|
236 |
-
function readUint32() {
|
237 |
-
return commitRead(4, dataView.getUint32(offset));
|
238 |
-
}
|
239 |
-
function readUint64() {
|
240 |
-
return readUint32() * POW_2_32 + readUint32();
|
241 |
-
}
|
242 |
-
function readBreak() {
|
243 |
-
if (ta[offset] !== 0xff)
|
244 |
-
return false;
|
245 |
-
offset += 1;
|
246 |
-
return true;
|
247 |
-
}
|
248 |
-
function readLength(additionalInformation) {
|
249 |
-
if (additionalInformation < 24)
|
250 |
-
return additionalInformation;
|
251 |
-
if (additionalInformation === 24)
|
252 |
-
return readUint8();
|
253 |
-
if (additionalInformation === 25)
|
254 |
-
return readUint16();
|
255 |
-
if (additionalInformation === 26)
|
256 |
-
return readUint32();
|
257 |
-
if (additionalInformation === 27)
|
258 |
-
return readUint64();
|
259 |
-
if (additionalInformation === 31)
|
260 |
-
return -1;
|
261 |
-
throw "Invalid length encoding";
|
262 |
-
}
|
263 |
-
function readIndefiniteStringLength(majorType) {
|
264 |
-
var initialByte = readUint8();
|
265 |
-
if (initialByte === 0xff)
|
266 |
-
return -1;
|
267 |
-
var length = readLength(initialByte & 0x1f);
|
268 |
-
if (length < 0 || (initialByte >> 5) !== majorType)
|
269 |
-
throw "Invalid indefinite length element";
|
270 |
-
return length;
|
271 |
-
}
|
272 |
-
|
273 |
-
function appendUtf16Data(utf16data, length) {
|
274 |
-
for (var i = 0; i < length; ++i) {
|
275 |
-
var value = readUint8();
|
276 |
-
if (value & 0x80) {
|
277 |
-
if (value < 0xe0) {
|
278 |
-
value = (value & 0x1f) << 6
|
279 |
-
| (readUint8() & 0x3f);
|
280 |
-
length -= 1;
|
281 |
-
} else if (value < 0xf0) {
|
282 |
-
value = (value & 0x0f) << 12
|
283 |
-
| (readUint8() & 0x3f) << 6
|
284 |
-
| (readUint8() & 0x3f);
|
285 |
-
length -= 2;
|
286 |
-
} else {
|
287 |
-
value = (value & 0x0f) << 18
|
288 |
-
| (readUint8() & 0x3f) << 12
|
289 |
-
| (readUint8() & 0x3f) << 6
|
290 |
-
| (readUint8() & 0x3f);
|
291 |
-
length -= 3;
|
292 |
-
}
|
293 |
-
}
|
294 |
-
|
295 |
-
if (value < 0x10000) {
|
296 |
-
utf16data.push(value);
|
297 |
-
} else {
|
298 |
-
value -= 0x10000;
|
299 |
-
utf16data.push(0xd800 | (value >> 10));
|
300 |
-
utf16data.push(0xdc00 | (value & 0x3ff));
|
301 |
-
}
|
302 |
-
}
|
303 |
-
}
|
304 |
-
|
305 |
-
function decodeItem() {
|
306 |
-
var initialByte = readUint8();
|
307 |
-
var majorType = initialByte >> 5;
|
308 |
-
var additionalInformation = initialByte & 0x1f;
|
309 |
-
var i;
|
310 |
-
var length;
|
311 |
-
|
312 |
-
if (majorType === 7) {
|
313 |
-
switch (additionalInformation) {
|
314 |
-
case 25:
|
315 |
-
return readFloat16();
|
316 |
-
case 26:
|
317 |
-
return readFloat32();
|
318 |
-
case 27:
|
319 |
-
return readFloat64();
|
320 |
-
}
|
321 |
-
}
|
322 |
-
|
323 |
-
length = readLength(additionalInformation);
|
324 |
-
if (length < 0 && (majorType < 2 || 6 < majorType))
|
325 |
-
throw "Invalid length";
|
326 |
-
|
327 |
-
switch (majorType) {
|
328 |
-
case 0:
|
329 |
-
return length;
|
330 |
-
case 1:
|
331 |
-
return -1 - length;
|
332 |
-
case 2:
|
333 |
-
if (length < 0) {
|
334 |
-
var elements = [];
|
335 |
-
var fullArrayLength = 0;
|
336 |
-
while ((length = readIndefiniteStringLength(majorType)) >= 0) {
|
337 |
-
fullArrayLength += length;
|
338 |
-
elements.push(readArrayBuffer(length));
|
339 |
-
}
|
340 |
-
var fullArray = new Uint8Array(fullArrayLength);
|
341 |
-
var fullArrayOffset = 0;
|
342 |
-
for (i = 0; i < elements.length; ++i) {
|
343 |
-
fullArray.set(elements[i], fullArrayOffset);
|
344 |
-
fullArrayOffset += elements[i].length;
|
345 |
-
}
|
346 |
-
return fullArray;
|
347 |
-
}
|
348 |
-
return readArrayBuffer(length);
|
349 |
-
case 3:
|
350 |
-
var utf16data = [];
|
351 |
-
if (length < 0) {
|
352 |
-
while ((length = readIndefiniteStringLength(majorType)) >= 0)
|
353 |
-
appendUtf16Data(utf16data, length);
|
354 |
-
} else
|
355 |
-
appendUtf16Data(utf16data, length);
|
356 |
-
var string = "";
|
357 |
-
for (i = 0; i < utf16data.length; i += DECODE_CHUNK_SIZE) {
|
358 |
-
string += String.fromCharCode.apply(
|
359 |
-
null,
|
360 |
-
utf16data.slice(i, i + DECODE_CHUNK_SIZE)
|
361 |
-
);
|
362 |
-
}
|
363 |
-
return string;
|
364 |
-
case 4:
|
365 |
-
var retArray;
|
366 |
-
if (length < 0) {
|
367 |
-
retArray = [];
|
368 |
-
while (!readBreak())
|
369 |
-
retArray.push(decodeItem());
|
370 |
-
} else {
|
371 |
-
retArray = new Array(length);
|
372 |
-
for (i = 0; i < length; ++i)
|
373 |
-
retArray[i] = decodeItem();
|
374 |
-
}
|
375 |
-
return retArray;
|
376 |
-
case 5:
|
377 |
-
var retObject = {};
|
378 |
-
for (i = 0; i < length || length < 0 && !readBreak(); ++i) {
|
379 |
-
var key = decodeItem();
|
380 |
-
retObject[key] = decodeItem();
|
381 |
-
}
|
382 |
-
return retObject;
|
383 |
-
case 6:
|
384 |
-
return tagger(decodeItem(), length);
|
385 |
-
case 7:
|
386 |
-
switch (length) {
|
387 |
-
case 20:
|
388 |
-
return false;
|
389 |
-
case 21:
|
390 |
-
return true;
|
391 |
-
case 22:
|
392 |
-
return null;
|
393 |
-
case 23:
|
394 |
-
return undefined;
|
395 |
-
default:
|
396 |
-
return simpleValue(length);
|
397 |
-
}
|
398 |
-
}
|
399 |
-
}
|
400 |
-
|
401 |
-
var ret = decodeItem();
|
402 |
-
if (offset !== data.byteLength)
|
403 |
-
throw "Remaining bytes";
|
404 |
-
return ret;
|
405 |
-
}
|
406 |
-
|
407 |
-
var obj = { encode: encode, decode: decode };
|
408 |
-
|
409 |
-
if (typeof define === "function" && define.amd)
|
410 |
-
define("cbor/cbor", obj);
|
411 |
-
else if (typeof module !== "undefined" && module.exports)
|
412 |
-
module.exports = obj;
|
413 |
-
else if (!global.CBOR)
|
414 |
-
global.CBOR = obj;
|
415 |
-
|
416 |
-
})(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/check-version.py
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
#!/usr/bin/env python3
|
2 |
-
from bs4 import BeautifulSoup
|
3 |
-
import requests
|
4 |
-
|
5 |
-
def get(url):
|
6 |
-
r = requests.get(url)
|
7 |
-
assert(r.status_code == 200)
|
8 |
-
return BeautifulSoup(r.content, features='lxml')
|
9 |
-
|
10 |
-
def get_github_latest_tag(user_repo):
|
11 |
-
s = get(f'https://github.com/{user_repo}/tags')
|
12 |
-
return s.select('div.repository-content div.Box-row')[0].select('h4.commit-title a')[0].text.strip()
|
13 |
-
|
14 |
-
s = get('https://fontawesome.com/v6.0/docs/changelog/')
|
15 |
-
print('font-awesome:', s.select('main article header')[0].select('code')[0].text.strip())
|
16 |
-
|
17 |
-
print('renderjson:', get_github_latest_tag('caldwell/renderjson'))
|
18 |
-
|
19 |
-
print('three-js:', get_github_latest_tag('mrdoob/three.js'))
|
20 |
-
|
21 |
-
print('jquery:', get_github_latest_tag('jquery/jquery'))
|
22 |
-
|
23 |
-
print('reconnecting-websocket:', get_github_latest_tag('joewalnes/reconnecting-websocket'))
|
24 |
-
|
25 |
-
print('dat-gui:', get_github_latest_tag('dataarts/dat.gui'))
|
26 |
-
|
27 |
-
print('cbor-js:', get_github_latest_tag('paroga/cbor-js'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/coppelia-ws-remote-api/RemoteAPIClient.js
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
"use strict";
|
2 |
-
|
3 |
-
const WebSocketAsPromised = require('websocket-as-promised');
|
4 |
-
|
5 |
-
class RemoteAPIClient {
|
6 |
-
constructor(host = 'localhost', port = 23050, codec = "cbor", opts = {}) {
|
7 |
-
this.host = host;
|
8 |
-
this.port = port;
|
9 |
-
this.codec = codec;
|
10 |
-
var packMessage;
|
11 |
-
var unpackMessage;
|
12 |
-
if(this.codec == 'cbor') {
|
13 |
-
//this.websocket.binaryType = "arraybuffer";
|
14 |
-
packMessage = data => CBOR.encode(data);
|
15 |
-
unpackMessage = async data => CBOR.decode(await data.arrayBuffer());
|
16 |
-
} else if(this.codec == "json") {
|
17 |
-
packMessage = data => JSON.stringify(data);
|
18 |
-
unpackMessage = data => JSON.parse(data);
|
19 |
-
}
|
20 |
-
var wsOpts = {
|
21 |
-
packMessage,
|
22 |
-
unpackMessage,
|
23 |
-
// attach requestId to message as `id` field
|
24 |
-
attachRequestId: (data, requestId) => Object.assign({id: requestId}, data),
|
25 |
-
// read requestId from message `id` field
|
26 |
-
extractRequestId: data => data && data.id,
|
27 |
-
};
|
28 |
-
for(var k in opts)
|
29 |
-
wsOpts[k] = opts[k];
|
30 |
-
this.websocket = new WebSocketAsPromised(`ws://${this.host}:${this.port}`, wsOpts);
|
31 |
-
}
|
32 |
-
|
33 |
-
async call(func, args) {
|
34 |
-
var reply = await this.websocket.sendRequest({func, args});
|
35 |
-
if(reply.success) {
|
36 |
-
return reply.ret;
|
37 |
-
} else {
|
38 |
-
throw reply.error;
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
async getObject(name) {
|
43 |
-
var r = await this.call('wsRemoteApi.info', [name]);
|
44 |
-
return this.getObject_(name, r[0]);
|
45 |
-
}
|
46 |
-
|
47 |
-
getObject_(name, _info) {
|
48 |
-
const client = this;
|
49 |
-
var ret = {}
|
50 |
-
for(let k in _info) {
|
51 |
-
var v = _info[k];
|
52 |
-
if(Object.keys(v).length == 1 && v['func'] !== undefined)
|
53 |
-
ret[k] = async function(...args) {
|
54 |
-
return await client.call(name + "." + k, args);
|
55 |
-
};
|
56 |
-
else if(Object.keys(v).length == 1 && v['const'] !== undefined)
|
57 |
-
ret[k] = v['const'];
|
58 |
-
else
|
59 |
-
ret[k] = this.getObject(name + "." + k, null, null, v);
|
60 |
-
}
|
61 |
-
return ret
|
62 |
-
}
|
63 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/coppelia-ws-remote-api/WebSocketAsPromised.bundle.js
DELETED
@@ -1,2515 +0,0 @@
|
|
1 |
-
require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2 |
-
'use strict';
|
3 |
-
|
4 |
-
var GetIntrinsic = require('get-intrinsic');
|
5 |
-
|
6 |
-
var callBind = require('./');
|
7 |
-
|
8 |
-
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
9 |
-
|
10 |
-
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
11 |
-
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
12 |
-
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
13 |
-
return callBind(intrinsic);
|
14 |
-
}
|
15 |
-
return intrinsic;
|
16 |
-
};
|
17 |
-
|
18 |
-
},{"./":2,"get-intrinsic":26}],2:[function(require,module,exports){
|
19 |
-
'use strict';
|
20 |
-
|
21 |
-
var bind = require('function-bind');
|
22 |
-
var GetIntrinsic = require('get-intrinsic');
|
23 |
-
|
24 |
-
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
25 |
-
var $call = GetIntrinsic('%Function.prototype.call%');
|
26 |
-
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
27 |
-
|
28 |
-
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
29 |
-
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
30 |
-
var $max = GetIntrinsic('%Math.max%');
|
31 |
-
|
32 |
-
if ($defineProperty) {
|
33 |
-
try {
|
34 |
-
$defineProperty({}, 'a', { value: 1 });
|
35 |
-
} catch (e) {
|
36 |
-
// IE 8 has a broken defineProperty
|
37 |
-
$defineProperty = null;
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
module.exports = function callBind(originalFunction) {
|
42 |
-
var func = $reflectApply(bind, $call, arguments);
|
43 |
-
if ($gOPD && $defineProperty) {
|
44 |
-
var desc = $gOPD(func, 'length');
|
45 |
-
if (desc.configurable) {
|
46 |
-
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
47 |
-
$defineProperty(
|
48 |
-
func,
|
49 |
-
'length',
|
50 |
-
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
51 |
-
);
|
52 |
-
}
|
53 |
-
}
|
54 |
-
return func;
|
55 |
-
};
|
56 |
-
|
57 |
-
var applyBind = function applyBind() {
|
58 |
-
return $reflectApply(bind, $apply, arguments);
|
59 |
-
};
|
60 |
-
|
61 |
-
if ($defineProperty) {
|
62 |
-
$defineProperty(module.exports, 'apply', { value: applyBind });
|
63 |
-
} else {
|
64 |
-
module.exports.apply = applyBind;
|
65 |
-
}
|
66 |
-
|
67 |
-
},{"function-bind":25,"get-intrinsic":26}],3:[function(require,module,exports){
|
68 |
-
/* chnl v1.2.0 by Vitaliy Potapov @preserve */
|
69 |
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}function _createSuper(r){var i=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);if(i){var n=_getPrototypeOf(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return _possibleConstructorReturn(this,e)}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Channel=function(){function c(e){_classCallCheck(this,c),this._listeners=[],this._mute=!1,this._accumulate=!1,this._accumulatedEvents=[],this._name=e||"",this._onListenerAdded=null,this._onFirstListenerAdded=null,this._onListenerRemoved=null,this._onLastListenerRemoved=null}return _createClass(c,[{key:"addListener",value:function(e,t){this._pushListener(e,t,!1)}},{key:"addOnceListener",value:function(e,t){this._pushListener(e,t,!0)}},{key:"removeListener",value:function(e,t){this._ensureListener(e);var n=this._indexOfListener(e,t);0<=n&&this._spliceListener(n)}},{key:"removeAllListeners",value:function(){for(;this.hasListeners();)this._spliceListener(0)}},{key:"hasListener",value:function(e,t){return this._ensureListener(e),0<=this._indexOfListener(e,t)}},{key:"hasListeners",value:function(){return 0<this._listeners.length}},{key:"dispatch",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._invokeListeners({args:t,async:!1})}},{key:"dispatchAsync",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._invokeListeners({args:t,async:!0})}},{key:"mute",value:function(e){var t=0<arguments.length&&void 0!==e?e:{};this._mute=!0,t.accumulate?this._accumulate=!0:(this._accumulate=!1,this._accumulatedEvents=[])}},{key:"unmute",value:function(){this._mute=!1,this._accumulate&&(this._dispatchAccumulated(),this._accumulate=!1)}},{key:"_invokeListeners",value:function(e){var t=this,n=0<arguments.length&&void 0!==e?e:{args:[],async:!1};this._mute?this._accumulate&&this._accumulatedEvents.push(n):this._listeners.slice().forEach(function(e){t._invokeListener(e,n),e.once&&t.removeListener(e.callback,e.context)})}},{key:"_invokeListener",value:function(e,t){var n,r,i=e.callback instanceof c;t.async?i?(n=e.callback).dispatchAsync.apply(n,_toConsumableArray(t.args)):setTimeout(function(){return e.callback.apply(e.context,t.args)},0):i?(r=e.callback).dispatch.apply(r,_toConsumableArray(t.args)):e.callback.apply(e.context,t.args)}},{key:"_ensureListener",value:function(e){if(!c.isValidListener(e))throw new Error("Channel "+this._name+": listener is not a function and not a Channel")}},{key:"_dispatchInnerAddEvents",value:function(){var e,t;this._onListenerAdded&&(e=this._onListenerAdded).dispatch.apply(e,arguments);this._onFirstListenerAdded&&1===this._listeners.length&&(t=this._onFirstListenerAdded).dispatch.apply(t,arguments)}},{key:"_dispatchInnerRemoveEvents",value:function(){var e,t;this._onListenerRemoved&&(e=this._onListenerRemoved).dispatch.apply(e,arguments);this._onLastListenerRemoved&&0===this._listeners.length&&(t=this._onLastListenerRemoved).dispatch.apply(t,arguments)}},{key:"_indexOfListener",value:function(e,t){for(var n=0;n<this._listeners.length;n++){var r=this._listeners[n],i=r.callback===e,s=e instanceof c,o=void 0===t&&void 0===r.context,a=t===r.context;if(i&&(s||o||a))return n}}},{key:"_dispatchAccumulated",value:function(){var t=this;this._accumulatedEvents.forEach(function(e){return t._invokeListeners(e)}),this._accumulatedEvents=[]}},{key:"_pushListener",value:function(e,t,n){this._ensureListener(e),this._checkForDuplicates(e,t),this._listeners.push({callback:e,context:t,once:n}),this._dispatchInnerAddEvents(e,t,n)}},{key:"_checkForDuplicates",value:function(e,t){if(this.hasListener(e,t))throw new Error("Channel "+this._name+": duplicating listeners")}},{key:"_spliceListener",value:function(e){var t=this._listeners[e],n=t.callback,r=t.context,i=t.once;this._listeners.splice(e,1),this._dispatchInnerRemoveEvents(n,r,i)}},{key:"onListenerAdded",get:function(){return this._onListenerAdded||(this._onListenerAdded=new c("".concat(this._name,":onListenerAdded"))),this._onListenerAdded}},{key:"onFirstListenerAdded",get:function(){return this._onFirstListenerAdded||(this._onFirstListenerAdded=new c("".concat(this._name,":onFirstListenerAdded"))),this._onFirstListenerAdded}},{key:"onListenerRemoved",get:function(){return this._onListenerRemoved||(this._onListenerRemoved=new c("".concat(this._name,":onListenerRemoved"))),this._onListenerRemoved}},{key:"onLastListenerRemoved",get:function(){return this._onLastListenerRemoved||(this._onLastListenerRemoved=new c("".concat(this._name,":onLastListenerRemoved"))),this._onLastListenerRemoved}}],[{key:"isValidListener",value:function(e){return"function"==typeof e||e instanceof c}}]),c}(),EventEmitter=function(){function e(){_classCallCheck(this,e),this._channels=new Map}return _createClass(e,[{key:"addListener",value:function(e,t,n){this._getChannel(e).addListener(t,n)}},{key:"on",value:function(e,t,n){this.addListener(e,t,n)}},{key:"addOnceListener",value:function(e,t,n){this._getChannel(e).addOnceListener(t,n)}},{key:"once",value:function(e,t,n){this.addOnceListener(e,t,n)}},{key:"removeListener",value:function(e,t,n){this._getChannel(e).removeListener(t,n)}},{key:"off",value:function(e,t,n){this.removeListener(e,t,n)}},{key:"hasListener",value:function(e,t,n){return this._getChannel(e).hasListener(t,n)}},{key:"has",value:function(e,t,n){return this.hasListener(e,t,n)}},{key:"hasListeners",value:function(e){return this._getChannel(e).hasListeners()}},{key:"dispatch",value:function(e){for(var t,n=arguments.length,r=new Array(1<n?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];(t=this._getChannel(e)).dispatch.apply(t,r)}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.dispatch.apply(this,[e].concat(n))}},{key:"_getChannel",value:function(e){return this._channels.has(e)||this._channels.set(e,new Channel(e)),this._channels.get(e)}}]),e}(),SubscriptionItem=function(){function t(e){_classCallCheck(this,t),this._params=e,this._isOn=!1,this._assertParams()}return _createClass(t,[{key:"on",value:function(){if(!this._isOn){var e=this._params.channel,t=e.addListener||e.addEventListener||e.on;this._applyMethod(t),this._isOn=!0}}},{key:"off",value:function(){if(this._isOn){var e=this._params.channel,t=e.removeListener||e.removeEventListener||e.off;this._applyMethod(t),this._isOn=!1}}},{key:"_applyMethod",value:function(e){var t=this._params,n=t.channel,r=t.event,i=t.listener,s=r?[r,i]:[i];e.apply(n,s)}},{key:"_assertParams",value:function(){var e=this._params,t=e.channel,n=e.event,r=e.listener;if(!t||"object"!==_typeof(t))throw new Error("Channel should be object");if(n&&"string"!=typeof n)throw new Error("Event should be string");if(!r||!Channel.isValidListener(r))throw new Error("Listener should be function or Channel")}}]),t}(),Subscription=function(){function t(e){_classCallCheck(this,t),this._items=e.map(function(e){return new SubscriptionItem(e)})}return _createClass(t,[{key:"on",value:function(){return this._items.forEach(function(e){return e.on()}),this}},{key:"off",value:function(){return this._items.forEach(function(e){return e.off()}),this}}]),t}(),ReactSubscription=function(){_inherits(i,Subscription);var r=_createSuper(i);function i(e,t){var n;return _classCallCheck(this,i),(n=r.call(this,t))._overrideComponentCallback(e,"componentDidMount","on"),n._overrideComponentCallback(e,"componentWillUnmount","off"),n}return _createClass(i,[{key:"_overrideComponentCallback",value:function(r,e,i){var s=this,o=r[e];r[e]=function(){if(s[i](),"function"==typeof o){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.apply(r,t)}}}}]),i}(),chnl=Channel;chnl.EventEmitter=EventEmitter,chnl.Subscription=Subscription,chnl.ReactSubscription=ReactSubscription,module.exports=chnl;
|
70 |
-
|
71 |
-
},{}],4:[function(require,module,exports){
|
72 |
-
'use strict';
|
73 |
-
|
74 |
-
var keys = require('object-keys');
|
75 |
-
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
|
76 |
-
|
77 |
-
var toStr = Object.prototype.toString;
|
78 |
-
var concat = Array.prototype.concat;
|
79 |
-
var origDefineProperty = Object.defineProperty;
|
80 |
-
|
81 |
-
var isFunction = function (fn) {
|
82 |
-
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
|
83 |
-
};
|
84 |
-
|
85 |
-
var arePropertyDescriptorsSupported = function () {
|
86 |
-
var obj = {};
|
87 |
-
try {
|
88 |
-
origDefineProperty(obj, 'x', { enumerable: false, value: obj });
|
89 |
-
// eslint-disable-next-line no-unused-vars, no-restricted-syntax
|
90 |
-
for (var _ in obj) { // jscs:ignore disallowUnusedVariables
|
91 |
-
return false;
|
92 |
-
}
|
93 |
-
return obj.x === obj;
|
94 |
-
} catch (e) { /* this is IE 8. */
|
95 |
-
return false;
|
96 |
-
}
|
97 |
-
};
|
98 |
-
var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
|
99 |
-
|
100 |
-
var defineProperty = function (object, name, value, predicate) {
|
101 |
-
if (name in object && (!isFunction(predicate) || !predicate())) {
|
102 |
-
return;
|
103 |
-
}
|
104 |
-
if (supportsDescriptors) {
|
105 |
-
origDefineProperty(object, name, {
|
106 |
-
configurable: true,
|
107 |
-
enumerable: false,
|
108 |
-
value: value,
|
109 |
-
writable: true
|
110 |
-
});
|
111 |
-
} else {
|
112 |
-
object[name] = value;
|
113 |
-
}
|
114 |
-
};
|
115 |
-
|
116 |
-
var defineProperties = function (object, map) {
|
117 |
-
var predicates = arguments.length > 2 ? arguments[2] : {};
|
118 |
-
var props = keys(map);
|
119 |
-
if (hasSymbols) {
|
120 |
-
props = concat.call(props, Object.getOwnPropertySymbols(map));
|
121 |
-
}
|
122 |
-
for (var i = 0; i < props.length; i += 1) {
|
123 |
-
defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
|
124 |
-
}
|
125 |
-
};
|
126 |
-
|
127 |
-
defineProperties.supportsDescriptors = !!supportsDescriptors;
|
128 |
-
|
129 |
-
module.exports = defineProperties;
|
130 |
-
|
131 |
-
},{"object-keys":32}],5:[function(require,module,exports){
|
132 |
-
'use strict';
|
133 |
-
|
134 |
-
var GetIntrinsic = require('get-intrinsic');
|
135 |
-
|
136 |
-
var $Array = GetIntrinsic('%Array%');
|
137 |
-
|
138 |
-
// eslint-disable-next-line global-require
|
139 |
-
var toStr = !$Array.isArray && require('call-bind/callBound')('Object.prototype.toString');
|
140 |
-
|
141 |
-
// https://ecma-international.org/ecma-262/6.0/#sec-isarray
|
142 |
-
|
143 |
-
module.exports = $Array.isArray || function IsArray(argument) {
|
144 |
-
return toStr(argument) === '[object Array]';
|
145 |
-
};
|
146 |
-
|
147 |
-
},{"call-bind/callBound":1,"get-intrinsic":26}],6:[function(require,module,exports){
|
148 |
-
'use strict';
|
149 |
-
|
150 |
-
var GetIntrinsic = require('get-intrinsic');
|
151 |
-
|
152 |
-
var $TypeError = GetIntrinsic('%TypeError%');
|
153 |
-
|
154 |
-
var isPropertyDescriptor = require('../helpers/isPropertyDescriptor');
|
155 |
-
var DefineOwnProperty = require('../helpers/DefineOwnProperty');
|
156 |
-
|
157 |
-
var FromPropertyDescriptor = require('./FromPropertyDescriptor');
|
158 |
-
var IsAccessorDescriptor = require('./IsAccessorDescriptor');
|
159 |
-
var IsDataDescriptor = require('./IsDataDescriptor');
|
160 |
-
var IsPropertyKey = require('./IsPropertyKey');
|
161 |
-
var SameValue = require('./SameValue');
|
162 |
-
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
|
163 |
-
var Type = require('./Type');
|
164 |
-
|
165 |
-
// https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow
|
166 |
-
|
167 |
-
module.exports = function DefinePropertyOrThrow(O, P, desc) {
|
168 |
-
if (Type(O) !== 'Object') {
|
169 |
-
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
170 |
-
}
|
171 |
-
|
172 |
-
if (!IsPropertyKey(P)) {
|
173 |
-
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
174 |
-
}
|
175 |
-
|
176 |
-
var Desc = isPropertyDescriptor({
|
177 |
-
Type: Type,
|
178 |
-
IsDataDescriptor: IsDataDescriptor,
|
179 |
-
IsAccessorDescriptor: IsAccessorDescriptor
|
180 |
-
}, desc) ? desc : ToPropertyDescriptor(desc);
|
181 |
-
if (!isPropertyDescriptor({
|
182 |
-
Type: Type,
|
183 |
-
IsDataDescriptor: IsDataDescriptor,
|
184 |
-
IsAccessorDescriptor: IsAccessorDescriptor
|
185 |
-
}, Desc)) {
|
186 |
-
throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor');
|
187 |
-
}
|
188 |
-
|
189 |
-
return DefineOwnProperty(
|
190 |
-
IsDataDescriptor,
|
191 |
-
SameValue,
|
192 |
-
FromPropertyDescriptor,
|
193 |
-
O,
|
194 |
-
P,
|
195 |
-
Desc
|
196 |
-
);
|
197 |
-
};
|
198 |
-
|
199 |
-
},{"../helpers/DefineOwnProperty":20,"../helpers/isPropertyDescriptor":23,"./FromPropertyDescriptor":7,"./IsAccessorDescriptor":8,"./IsDataDescriptor":11,"./IsPropertyKey":12,"./SameValue":13,"./ToPropertyDescriptor":16,"./Type":17,"get-intrinsic":26}],7:[function(require,module,exports){
|
200 |
-
'use strict';
|
201 |
-
|
202 |
-
var assertRecord = require('../helpers/assertRecord');
|
203 |
-
|
204 |
-
var Type = require('./Type');
|
205 |
-
|
206 |
-
// https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
|
207 |
-
|
208 |
-
module.exports = function FromPropertyDescriptor(Desc) {
|
209 |
-
if (typeof Desc === 'undefined') {
|
210 |
-
return Desc;
|
211 |
-
}
|
212 |
-
|
213 |
-
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
|
214 |
-
|
215 |
-
var obj = {};
|
216 |
-
if ('[[Value]]' in Desc) {
|
217 |
-
obj.value = Desc['[[Value]]'];
|
218 |
-
}
|
219 |
-
if ('[[Writable]]' in Desc) {
|
220 |
-
obj.writable = Desc['[[Writable]]'];
|
221 |
-
}
|
222 |
-
if ('[[Get]]' in Desc) {
|
223 |
-
obj.get = Desc['[[Get]]'];
|
224 |
-
}
|
225 |
-
if ('[[Set]]' in Desc) {
|
226 |
-
obj.set = Desc['[[Set]]'];
|
227 |
-
}
|
228 |
-
if ('[[Enumerable]]' in Desc) {
|
229 |
-
obj.enumerable = Desc['[[Enumerable]]'];
|
230 |
-
}
|
231 |
-
if ('[[Configurable]]' in Desc) {
|
232 |
-
obj.configurable = Desc['[[Configurable]]'];
|
233 |
-
}
|
234 |
-
return obj;
|
235 |
-
};
|
236 |
-
|
237 |
-
},{"../helpers/assertRecord":21,"./Type":17}],8:[function(require,module,exports){
|
238 |
-
'use strict';
|
239 |
-
|
240 |
-
var has = require('has');
|
241 |
-
|
242 |
-
var assertRecord = require('../helpers/assertRecord');
|
243 |
-
|
244 |
-
var Type = require('./Type');
|
245 |
-
|
246 |
-
// https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor
|
247 |
-
|
248 |
-
module.exports = function IsAccessorDescriptor(Desc) {
|
249 |
-
if (typeof Desc === 'undefined') {
|
250 |
-
return false;
|
251 |
-
}
|
252 |
-
|
253 |
-
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
|
254 |
-
|
255 |
-
if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
|
256 |
-
return false;
|
257 |
-
}
|
258 |
-
|
259 |
-
return true;
|
260 |
-
};
|
261 |
-
|
262 |
-
},{"../helpers/assertRecord":21,"./Type":17,"has":29}],9:[function(require,module,exports){
|
263 |
-
'use strict';
|
264 |
-
|
265 |
-
// http://262.ecma-international.org/5.1/#sec-9.11
|
266 |
-
|
267 |
-
module.exports = require('is-callable');
|
268 |
-
|
269 |
-
},{"is-callable":30}],10:[function(require,module,exports){
|
270 |
-
'use strict';
|
271 |
-
|
272 |
-
var GetIntrinsic = require('../GetIntrinsic.js');
|
273 |
-
|
274 |
-
var $construct = GetIntrinsic('%Reflect.construct%', true);
|
275 |
-
|
276 |
-
var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
|
277 |
-
try {
|
278 |
-
DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} });
|
279 |
-
} catch (e) {
|
280 |
-
// Accessor properties aren't supported
|
281 |
-
DefinePropertyOrThrow = null;
|
282 |
-
}
|
283 |
-
|
284 |
-
// https://ecma-international.org/ecma-262/6.0/#sec-isconstructor
|
285 |
-
|
286 |
-
if (DefinePropertyOrThrow && $construct) {
|
287 |
-
var isConstructorMarker = {};
|
288 |
-
var badArrayLike = {};
|
289 |
-
DefinePropertyOrThrow(badArrayLike, 'length', {
|
290 |
-
'[[Get]]': function () {
|
291 |
-
throw isConstructorMarker;
|
292 |
-
},
|
293 |
-
'[[Enumerable]]': true
|
294 |
-
});
|
295 |
-
|
296 |
-
module.exports = function IsConstructor(argument) {
|
297 |
-
try {
|
298 |
-
// `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`:
|
299 |
-
$construct(argument, badArrayLike);
|
300 |
-
} catch (err) {
|
301 |
-
return err === isConstructorMarker;
|
302 |
-
}
|
303 |
-
};
|
304 |
-
} else {
|
305 |
-
module.exports = function IsConstructor(argument) {
|
306 |
-
// unfortunately there's no way to truly check this without try/catch `new argument` in old environments
|
307 |
-
return typeof argument === 'function' && !!argument.prototype;
|
308 |
-
};
|
309 |
-
}
|
310 |
-
|
311 |
-
},{"../GetIntrinsic.js":19,"./DefinePropertyOrThrow":6}],11:[function(require,module,exports){
|
312 |
-
'use strict';
|
313 |
-
|
314 |
-
var has = require('has');
|
315 |
-
|
316 |
-
var assertRecord = require('../helpers/assertRecord');
|
317 |
-
|
318 |
-
var Type = require('./Type');
|
319 |
-
|
320 |
-
// https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
|
321 |
-
|
322 |
-
module.exports = function IsDataDescriptor(Desc) {
|
323 |
-
if (typeof Desc === 'undefined') {
|
324 |
-
return false;
|
325 |
-
}
|
326 |
-
|
327 |
-
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
|
328 |
-
|
329 |
-
if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
|
330 |
-
return false;
|
331 |
-
}
|
332 |
-
|
333 |
-
return true;
|
334 |
-
};
|
335 |
-
|
336 |
-
},{"../helpers/assertRecord":21,"./Type":17,"has":29}],12:[function(require,module,exports){
|
337 |
-
'use strict';
|
338 |
-
|
339 |
-
// https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey
|
340 |
-
|
341 |
-
module.exports = function IsPropertyKey(argument) {
|
342 |
-
return typeof argument === 'string' || typeof argument === 'symbol';
|
343 |
-
};
|
344 |
-
|
345 |
-
},{}],13:[function(require,module,exports){
|
346 |
-
'use strict';
|
347 |
-
|
348 |
-
var $isNaN = require('../helpers/isNaN');
|
349 |
-
|
350 |
-
// http://262.ecma-international.org/5.1/#sec-9.12
|
351 |
-
|
352 |
-
module.exports = function SameValue(x, y) {
|
353 |
-
if (x === y) { // 0 === -0, but they are not identical.
|
354 |
-
if (x === 0) { return 1 / x === 1 / y; }
|
355 |
-
return true;
|
356 |
-
}
|
357 |
-
return $isNaN(x) && $isNaN(y);
|
358 |
-
};
|
359 |
-
|
360 |
-
},{"../helpers/isNaN":22}],14:[function(require,module,exports){
|
361 |
-
'use strict';
|
362 |
-
|
363 |
-
var GetIntrinsic = require('get-intrinsic');
|
364 |
-
|
365 |
-
var $species = GetIntrinsic('%Symbol.species%', true);
|
366 |
-
var $TypeError = GetIntrinsic('%TypeError%');
|
367 |
-
|
368 |
-
var IsConstructor = require('./IsConstructor');
|
369 |
-
var Type = require('./Type');
|
370 |
-
|
371 |
-
// https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor
|
372 |
-
|
373 |
-
module.exports = function SpeciesConstructor(O, defaultConstructor) {
|
374 |
-
if (Type(O) !== 'Object') {
|
375 |
-
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
376 |
-
}
|
377 |
-
var C = O.constructor;
|
378 |
-
if (typeof C === 'undefined') {
|
379 |
-
return defaultConstructor;
|
380 |
-
}
|
381 |
-
if (Type(C) !== 'Object') {
|
382 |
-
throw new $TypeError('O.constructor is not an Object');
|
383 |
-
}
|
384 |
-
var S = $species ? C[$species] : void 0;
|
385 |
-
if (S == null) {
|
386 |
-
return defaultConstructor;
|
387 |
-
}
|
388 |
-
if (IsConstructor(S)) {
|
389 |
-
return S;
|
390 |
-
}
|
391 |
-
throw new $TypeError('no constructor found');
|
392 |
-
};
|
393 |
-
|
394 |
-
},{"./IsConstructor":10,"./Type":17,"get-intrinsic":26}],15:[function(require,module,exports){
|
395 |
-
'use strict';
|
396 |
-
|
397 |
-
// http://262.ecma-international.org/5.1/#sec-9.2
|
398 |
-
|
399 |
-
module.exports = function ToBoolean(value) { return !!value; };
|
400 |
-
|
401 |
-
},{}],16:[function(require,module,exports){
|
402 |
-
'use strict';
|
403 |
-
|
404 |
-
var has = require('has');
|
405 |
-
|
406 |
-
var GetIntrinsic = require('get-intrinsic');
|
407 |
-
|
408 |
-
var $TypeError = GetIntrinsic('%TypeError%');
|
409 |
-
|
410 |
-
var Type = require('./Type');
|
411 |
-
var ToBoolean = require('./ToBoolean');
|
412 |
-
var IsCallable = require('./IsCallable');
|
413 |
-
|
414 |
-
// https://262.ecma-international.org/5.1/#sec-8.10.5
|
415 |
-
|
416 |
-
module.exports = function ToPropertyDescriptor(Obj) {
|
417 |
-
if (Type(Obj) !== 'Object') {
|
418 |
-
throw new $TypeError('ToPropertyDescriptor requires an object');
|
419 |
-
}
|
420 |
-
|
421 |
-
var desc = {};
|
422 |
-
if (has(Obj, 'enumerable')) {
|
423 |
-
desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable);
|
424 |
-
}
|
425 |
-
if (has(Obj, 'configurable')) {
|
426 |
-
desc['[[Configurable]]'] = ToBoolean(Obj.configurable);
|
427 |
-
}
|
428 |
-
if (has(Obj, 'value')) {
|
429 |
-
desc['[[Value]]'] = Obj.value;
|
430 |
-
}
|
431 |
-
if (has(Obj, 'writable')) {
|
432 |
-
desc['[[Writable]]'] = ToBoolean(Obj.writable);
|
433 |
-
}
|
434 |
-
if (has(Obj, 'get')) {
|
435 |
-
var getter = Obj.get;
|
436 |
-
if (typeof getter !== 'undefined' && !IsCallable(getter)) {
|
437 |
-
throw new $TypeError('getter must be a function');
|
438 |
-
}
|
439 |
-
desc['[[Get]]'] = getter;
|
440 |
-
}
|
441 |
-
if (has(Obj, 'set')) {
|
442 |
-
var setter = Obj.set;
|
443 |
-
if (typeof setter !== 'undefined' && !IsCallable(setter)) {
|
444 |
-
throw new $TypeError('setter must be a function');
|
445 |
-
}
|
446 |
-
desc['[[Set]]'] = setter;
|
447 |
-
}
|
448 |
-
|
449 |
-
if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) {
|
450 |
-
throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
|
451 |
-
}
|
452 |
-
return desc;
|
453 |
-
};
|
454 |
-
|
455 |
-
},{"./IsCallable":9,"./ToBoolean":15,"./Type":17,"get-intrinsic":26,"has":29}],17:[function(require,module,exports){
|
456 |
-
'use strict';
|
457 |
-
|
458 |
-
var ES5Type = require('../5/Type');
|
459 |
-
|
460 |
-
// https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values
|
461 |
-
|
462 |
-
module.exports = function Type(x) {
|
463 |
-
if (typeof x === 'symbol') {
|
464 |
-
return 'Symbol';
|
465 |
-
}
|
466 |
-
if (typeof x === 'bigint') {
|
467 |
-
return 'BigInt';
|
468 |
-
}
|
469 |
-
return ES5Type(x);
|
470 |
-
};
|
471 |
-
|
472 |
-
},{"../5/Type":18}],18:[function(require,module,exports){
|
473 |
-
'use strict';
|
474 |
-
|
475 |
-
// https://262.ecma-international.org/5.1/#sec-8
|
476 |
-
|
477 |
-
module.exports = function Type(x) {
|
478 |
-
if (x === null) {
|
479 |
-
return 'Null';
|
480 |
-
}
|
481 |
-
if (typeof x === 'undefined') {
|
482 |
-
return 'Undefined';
|
483 |
-
}
|
484 |
-
if (typeof x === 'function' || typeof x === 'object') {
|
485 |
-
return 'Object';
|
486 |
-
}
|
487 |
-
if (typeof x === 'number') {
|
488 |
-
return 'Number';
|
489 |
-
}
|
490 |
-
if (typeof x === 'boolean') {
|
491 |
-
return 'Boolean';
|
492 |
-
}
|
493 |
-
if (typeof x === 'string') {
|
494 |
-
return 'String';
|
495 |
-
}
|
496 |
-
};
|
497 |
-
|
498 |
-
},{}],19:[function(require,module,exports){
|
499 |
-
'use strict';
|
500 |
-
|
501 |
-
// TODO: remove, semver-major
|
502 |
-
|
503 |
-
module.exports = require('get-intrinsic');
|
504 |
-
|
505 |
-
},{"get-intrinsic":26}],20:[function(require,module,exports){
|
506 |
-
'use strict';
|
507 |
-
|
508 |
-
var GetIntrinsic = require('get-intrinsic');
|
509 |
-
|
510 |
-
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
511 |
-
|
512 |
-
if ($defineProperty) {
|
513 |
-
try {
|
514 |
-
$defineProperty({}, 'a', { value: 1 });
|
515 |
-
} catch (e) {
|
516 |
-
// IE 8 has a broken defineProperty
|
517 |
-
$defineProperty = null;
|
518 |
-
}
|
519 |
-
}
|
520 |
-
|
521 |
-
// node v0.6 has a bug where array lengths can be Set but not Defined
|
522 |
-
var hasArrayLengthDefineBug = Object.defineProperty && Object.defineProperty([], 'length', { value: 1 }).length === 0;
|
523 |
-
|
524 |
-
// eslint-disable-next-line global-require
|
525 |
-
var isArray = hasArrayLengthDefineBug && require('../2020/IsArray'); // this does not depend on any other AOs.
|
526 |
-
|
527 |
-
var callBound = require('call-bind/callBound');
|
528 |
-
|
529 |
-
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
|
530 |
-
|
531 |
-
// eslint-disable-next-line max-params
|
532 |
-
module.exports = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, desc) {
|
533 |
-
if (!$defineProperty) {
|
534 |
-
if (!IsDataDescriptor(desc)) {
|
535 |
-
// ES3 does not support getters/setters
|
536 |
-
return false;
|
537 |
-
}
|
538 |
-
if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {
|
539 |
-
return false;
|
540 |
-
}
|
541 |
-
|
542 |
-
// fallback for ES3
|
543 |
-
if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {
|
544 |
-
// a non-enumerable existing property
|
545 |
-
return false;
|
546 |
-
}
|
547 |
-
|
548 |
-
// property does not exist at all, or exists but is enumerable
|
549 |
-
var V = desc['[[Value]]'];
|
550 |
-
// eslint-disable-next-line no-param-reassign
|
551 |
-
O[P] = V; // will use [[Define]]
|
552 |
-
return SameValue(O[P], V);
|
553 |
-
}
|
554 |
-
if (
|
555 |
-
hasArrayLengthDefineBug
|
556 |
-
&& P === 'length'
|
557 |
-
&& '[[Value]]' in desc
|
558 |
-
&& isArray(O)
|
559 |
-
&& O.length !== desc['[[Value]]']
|
560 |
-
) {
|
561 |
-
// eslint-disable-next-line no-param-reassign
|
562 |
-
O.length = desc['[[Value]]'];
|
563 |
-
return O.length === desc['[[Value]]'];
|
564 |
-
}
|
565 |
-
|
566 |
-
$defineProperty(O, P, FromPropertyDescriptor(desc));
|
567 |
-
return true;
|
568 |
-
};
|
569 |
-
|
570 |
-
},{"../2020/IsArray":5,"call-bind/callBound":1,"get-intrinsic":26}],21:[function(require,module,exports){
|
571 |
-
'use strict';
|
572 |
-
|
573 |
-
var GetIntrinsic = require('get-intrinsic');
|
574 |
-
|
575 |
-
var $TypeError = GetIntrinsic('%TypeError%');
|
576 |
-
var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
577 |
-
|
578 |
-
var has = require('has');
|
579 |
-
|
580 |
-
var predicates = {
|
581 |
-
// https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type
|
582 |
-
'Property Descriptor': function isPropertyDescriptor(Type, Desc) {
|
583 |
-
if (Type(Desc) !== 'Object') {
|
584 |
-
return false;
|
585 |
-
}
|
586 |
-
var allowed = {
|
587 |
-
'[[Configurable]]': true,
|
588 |
-
'[[Enumerable]]': true,
|
589 |
-
'[[Get]]': true,
|
590 |
-
'[[Set]]': true,
|
591 |
-
'[[Value]]': true,
|
592 |
-
'[[Writable]]': true
|
593 |
-
};
|
594 |
-
|
595 |
-
for (var key in Desc) { // eslint-disable-line
|
596 |
-
if (has(Desc, key) && !allowed[key]) {
|
597 |
-
return false;
|
598 |
-
}
|
599 |
-
}
|
600 |
-
|
601 |
-
var isData = has(Desc, '[[Value]]');
|
602 |
-
var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]');
|
603 |
-
if (isData && IsAccessor) {
|
604 |
-
throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
|
605 |
-
}
|
606 |
-
return true;
|
607 |
-
}
|
608 |
-
};
|
609 |
-
|
610 |
-
module.exports = function assertRecord(Type, recordType, argumentName, value) {
|
611 |
-
var predicate = predicates[recordType];
|
612 |
-
if (typeof predicate !== 'function') {
|
613 |
-
throw new $SyntaxError('unknown record type: ' + recordType);
|
614 |
-
}
|
615 |
-
if (!predicate(Type, value)) {
|
616 |
-
throw new $TypeError(argumentName + ' must be a ' + recordType);
|
617 |
-
}
|
618 |
-
};
|
619 |
-
|
620 |
-
},{"get-intrinsic":26,"has":29}],22:[function(require,module,exports){
|
621 |
-
'use strict';
|
622 |
-
|
623 |
-
module.exports = Number.isNaN || function isNaN(a) {
|
624 |
-
return a !== a;
|
625 |
-
};
|
626 |
-
|
627 |
-
},{}],23:[function(require,module,exports){
|
628 |
-
'use strict';
|
629 |
-
|
630 |
-
var GetIntrinsic = require('get-intrinsic');
|
631 |
-
|
632 |
-
var has = require('has');
|
633 |
-
var $TypeError = GetIntrinsic('%TypeError%');
|
634 |
-
|
635 |
-
module.exports = function IsPropertyDescriptor(ES, Desc) {
|
636 |
-
if (ES.Type(Desc) !== 'Object') {
|
637 |
-
return false;
|
638 |
-
}
|
639 |
-
var allowed = {
|
640 |
-
'[[Configurable]]': true,
|
641 |
-
'[[Enumerable]]': true,
|
642 |
-
'[[Get]]': true,
|
643 |
-
'[[Set]]': true,
|
644 |
-
'[[Value]]': true,
|
645 |
-
'[[Writable]]': true
|
646 |
-
};
|
647 |
-
|
648 |
-
for (var key in Desc) { // eslint-disable-line no-restricted-syntax
|
649 |
-
if (has(Desc, key) && !allowed[key]) {
|
650 |
-
return false;
|
651 |
-
}
|
652 |
-
}
|
653 |
-
|
654 |
-
if (ES.IsDataDescriptor(Desc) && ES.IsAccessorDescriptor(Desc)) {
|
655 |
-
throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
|
656 |
-
}
|
657 |
-
return true;
|
658 |
-
};
|
659 |
-
|
660 |
-
},{"get-intrinsic":26,"has":29}],24:[function(require,module,exports){
|
661 |
-
'use strict';
|
662 |
-
|
663 |
-
/* eslint no-invalid-this: 1 */
|
664 |
-
|
665 |
-
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
666 |
-
var slice = Array.prototype.slice;
|
667 |
-
var toStr = Object.prototype.toString;
|
668 |
-
var funcType = '[object Function]';
|
669 |
-
|
670 |
-
module.exports = function bind(that) {
|
671 |
-
var target = this;
|
672 |
-
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
673 |
-
throw new TypeError(ERROR_MESSAGE + target);
|
674 |
-
}
|
675 |
-
var args = slice.call(arguments, 1);
|
676 |
-
|
677 |
-
var bound;
|
678 |
-
var binder = function () {
|
679 |
-
if (this instanceof bound) {
|
680 |
-
var result = target.apply(
|
681 |
-
this,
|
682 |
-
args.concat(slice.call(arguments))
|
683 |
-
);
|
684 |
-
if (Object(result) === result) {
|
685 |
-
return result;
|
686 |
-
}
|
687 |
-
return this;
|
688 |
-
} else {
|
689 |
-
return target.apply(
|
690 |
-
that,
|
691 |
-
args.concat(slice.call(arguments))
|
692 |
-
);
|
693 |
-
}
|
694 |
-
};
|
695 |
-
|
696 |
-
var boundLength = Math.max(0, target.length - args.length);
|
697 |
-
var boundArgs = [];
|
698 |
-
for (var i = 0; i < boundLength; i++) {
|
699 |
-
boundArgs.push('$' + i);
|
700 |
-
}
|
701 |
-
|
702 |
-
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
703 |
-
|
704 |
-
if (target.prototype) {
|
705 |
-
var Empty = function Empty() {};
|
706 |
-
Empty.prototype = target.prototype;
|
707 |
-
bound.prototype = new Empty();
|
708 |
-
Empty.prototype = null;
|
709 |
-
}
|
710 |
-
|
711 |
-
return bound;
|
712 |
-
};
|
713 |
-
|
714 |
-
},{}],25:[function(require,module,exports){
|
715 |
-
'use strict';
|
716 |
-
|
717 |
-
var implementation = require('./implementation');
|
718 |
-
|
719 |
-
module.exports = Function.prototype.bind || implementation;
|
720 |
-
|
721 |
-
},{"./implementation":24}],26:[function(require,module,exports){
|
722 |
-
'use strict';
|
723 |
-
|
724 |
-
var undefined;
|
725 |
-
|
726 |
-
var $SyntaxError = SyntaxError;
|
727 |
-
var $Function = Function;
|
728 |
-
var $TypeError = TypeError;
|
729 |
-
|
730 |
-
// eslint-disable-next-line consistent-return
|
731 |
-
var getEvalledConstructor = function (expressionSyntax) {
|
732 |
-
try {
|
733 |
-
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
734 |
-
} catch (e) {}
|
735 |
-
};
|
736 |
-
|
737 |
-
var $gOPD = Object.getOwnPropertyDescriptor;
|
738 |
-
if ($gOPD) {
|
739 |
-
try {
|
740 |
-
$gOPD({}, '');
|
741 |
-
} catch (e) {
|
742 |
-
$gOPD = null; // this is IE 8, which has a broken gOPD
|
743 |
-
}
|
744 |
-
}
|
745 |
-
|
746 |
-
var throwTypeError = function () {
|
747 |
-
throw new $TypeError();
|
748 |
-
};
|
749 |
-
var ThrowTypeError = $gOPD
|
750 |
-
? (function () {
|
751 |
-
try {
|
752 |
-
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
753 |
-
arguments.callee; // IE 8 does not throw here
|
754 |
-
return throwTypeError;
|
755 |
-
} catch (calleeThrows) {
|
756 |
-
try {
|
757 |
-
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
758 |
-
return $gOPD(arguments, 'callee').get;
|
759 |
-
} catch (gOPDthrows) {
|
760 |
-
return throwTypeError;
|
761 |
-
}
|
762 |
-
}
|
763 |
-
}())
|
764 |
-
: throwTypeError;
|
765 |
-
|
766 |
-
var hasSymbols = require('has-symbols')();
|
767 |
-
|
768 |
-
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
|
769 |
-
|
770 |
-
var needsEval = {};
|
771 |
-
|
772 |
-
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
|
773 |
-
|
774 |
-
var INTRINSICS = {
|
775 |
-
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
776 |
-
'%Array%': Array,
|
777 |
-
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
778 |
-
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
|
779 |
-
'%AsyncFromSyncIteratorPrototype%': undefined,
|
780 |
-
'%AsyncFunction%': needsEval,
|
781 |
-
'%AsyncGenerator%': needsEval,
|
782 |
-
'%AsyncGeneratorFunction%': needsEval,
|
783 |
-
'%AsyncIteratorPrototype%': needsEval,
|
784 |
-
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
785 |
-
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
786 |
-
'%Boolean%': Boolean,
|
787 |
-
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
788 |
-
'%Date%': Date,
|
789 |
-
'%decodeURI%': decodeURI,
|
790 |
-
'%decodeURIComponent%': decodeURIComponent,
|
791 |
-
'%encodeURI%': encodeURI,
|
792 |
-
'%encodeURIComponent%': encodeURIComponent,
|
793 |
-
'%Error%': Error,
|
794 |
-
'%eval%': eval, // eslint-disable-line no-eval
|
795 |
-
'%EvalError%': EvalError,
|
796 |
-
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
797 |
-
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
798 |
-
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
799 |
-
'%Function%': $Function,
|
800 |
-
'%GeneratorFunction%': needsEval,
|
801 |
-
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
|
802 |
-
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
|
803 |
-
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
804 |
-
'%isFinite%': isFinite,
|
805 |
-
'%isNaN%': isNaN,
|
806 |
-
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
807 |
-
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
808 |
-
'%Map%': typeof Map === 'undefined' ? undefined : Map,
|
809 |
-
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
810 |
-
'%Math%': Math,
|
811 |
-
'%Number%': Number,
|
812 |
-
'%Object%': Object,
|
813 |
-
'%parseFloat%': parseFloat,
|
814 |
-
'%parseInt%': parseInt,
|
815 |
-
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
816 |
-
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
817 |
-
'%RangeError%': RangeError,
|
818 |
-
'%ReferenceError%': ReferenceError,
|
819 |
-
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
820 |
-
'%RegExp%': RegExp,
|
821 |
-
'%Set%': typeof Set === 'undefined' ? undefined : Set,
|
822 |
-
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
823 |
-
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
824 |
-
'%String%': String,
|
825 |
-
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
826 |
-
'%Symbol%': hasSymbols ? Symbol : undefined,
|
827 |
-
'%SyntaxError%': $SyntaxError,
|
828 |
-
'%ThrowTypeError%': ThrowTypeError,
|
829 |
-
'%TypedArray%': TypedArray,
|
830 |
-
'%TypeError%': $TypeError,
|
831 |
-
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
|
832 |
-
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
833 |
-
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
834 |
-
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
835 |
-
'%URIError%': URIError,
|
836 |
-
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
837 |
-
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
838 |
-
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
839 |
-
};
|
840 |
-
|
841 |
-
var doEval = function doEval(name) {
|
842 |
-
var value;
|
843 |
-
if (name === '%AsyncFunction%') {
|
844 |
-
value = getEvalledConstructor('async function () {}');
|
845 |
-
} else if (name === '%GeneratorFunction%') {
|
846 |
-
value = getEvalledConstructor('function* () {}');
|
847 |
-
} else if (name === '%AsyncGeneratorFunction%') {
|
848 |
-
value = getEvalledConstructor('async function* () {}');
|
849 |
-
} else if (name === '%AsyncGenerator%') {
|
850 |
-
var fn = doEval('%AsyncGeneratorFunction%');
|
851 |
-
if (fn) {
|
852 |
-
value = fn.prototype;
|
853 |
-
}
|
854 |
-
} else if (name === '%AsyncIteratorPrototype%') {
|
855 |
-
var gen = doEval('%AsyncGenerator%');
|
856 |
-
if (gen) {
|
857 |
-
value = getProto(gen.prototype);
|
858 |
-
}
|
859 |
-
}
|
860 |
-
|
861 |
-
INTRINSICS[name] = value;
|
862 |
-
|
863 |
-
return value;
|
864 |
-
};
|
865 |
-
|
866 |
-
var LEGACY_ALIASES = {
|
867 |
-
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
868 |
-
'%ArrayPrototype%': ['Array', 'prototype'],
|
869 |
-
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
870 |
-
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
871 |
-
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
872 |
-
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
873 |
-
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
874 |
-
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
875 |
-
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
876 |
-
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
877 |
-
'%DataViewPrototype%': ['DataView', 'prototype'],
|
878 |
-
'%DatePrototype%': ['Date', 'prototype'],
|
879 |
-
'%ErrorPrototype%': ['Error', 'prototype'],
|
880 |
-
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
881 |
-
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
882 |
-
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
883 |
-
'%FunctionPrototype%': ['Function', 'prototype'],
|
884 |
-
'%Generator%': ['GeneratorFunction', 'prototype'],
|
885 |
-
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
886 |
-
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
887 |
-
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
888 |
-
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
889 |
-
'%JSONParse%': ['JSON', 'parse'],
|
890 |
-
'%JSONStringify%': ['JSON', 'stringify'],
|
891 |
-
'%MapPrototype%': ['Map', 'prototype'],
|
892 |
-
'%NumberPrototype%': ['Number', 'prototype'],
|
893 |
-
'%ObjectPrototype%': ['Object', 'prototype'],
|
894 |
-
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
895 |
-
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
896 |
-
'%PromisePrototype%': ['Promise', 'prototype'],
|
897 |
-
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
898 |
-
'%Promise_all%': ['Promise', 'all'],
|
899 |
-
'%Promise_reject%': ['Promise', 'reject'],
|
900 |
-
'%Promise_resolve%': ['Promise', 'resolve'],
|
901 |
-
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
902 |
-
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
903 |
-
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
904 |
-
'%SetPrototype%': ['Set', 'prototype'],
|
905 |
-
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
906 |
-
'%StringPrototype%': ['String', 'prototype'],
|
907 |
-
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
908 |
-
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
909 |
-
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
910 |
-
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
911 |
-
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
912 |
-
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
913 |
-
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
914 |
-
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
915 |
-
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
916 |
-
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
917 |
-
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
918 |
-
};
|
919 |
-
|
920 |
-
var bind = require('function-bind');
|
921 |
-
var hasOwn = require('has');
|
922 |
-
var $concat = bind.call(Function.call, Array.prototype.concat);
|
923 |
-
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
924 |
-
var $replace = bind.call(Function.call, String.prototype.replace);
|
925 |
-
var $strSlice = bind.call(Function.call, String.prototype.slice);
|
926 |
-
|
927 |
-
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
928 |
-
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
929 |
-
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
930 |
-
var stringToPath = function stringToPath(string) {
|
931 |
-
var first = $strSlice(string, 0, 1);
|
932 |
-
var last = $strSlice(string, -1);
|
933 |
-
if (first === '%' && last !== '%') {
|
934 |
-
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
935 |
-
} else if (last === '%' && first !== '%') {
|
936 |
-
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
937 |
-
}
|
938 |
-
var result = [];
|
939 |
-
$replace(string, rePropName, function (match, number, quote, subString) {
|
940 |
-
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
941 |
-
});
|
942 |
-
return result;
|
943 |
-
};
|
944 |
-
/* end adaptation */
|
945 |
-
|
946 |
-
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
947 |
-
var intrinsicName = name;
|
948 |
-
var alias;
|
949 |
-
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
950 |
-
alias = LEGACY_ALIASES[intrinsicName];
|
951 |
-
intrinsicName = '%' + alias[0] + '%';
|
952 |
-
}
|
953 |
-
|
954 |
-
if (hasOwn(INTRINSICS, intrinsicName)) {
|
955 |
-
var value = INTRINSICS[intrinsicName];
|
956 |
-
if (value === needsEval) {
|
957 |
-
value = doEval(intrinsicName);
|
958 |
-
}
|
959 |
-
if (typeof value === 'undefined' && !allowMissing) {
|
960 |
-
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
961 |
-
}
|
962 |
-
|
963 |
-
return {
|
964 |
-
alias: alias,
|
965 |
-
name: intrinsicName,
|
966 |
-
value: value
|
967 |
-
};
|
968 |
-
}
|
969 |
-
|
970 |
-
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
971 |
-
};
|
972 |
-
|
973 |
-
module.exports = function GetIntrinsic(name, allowMissing) {
|
974 |
-
if (typeof name !== 'string' || name.length === 0) {
|
975 |
-
throw new $TypeError('intrinsic name must be a non-empty string');
|
976 |
-
}
|
977 |
-
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
978 |
-
throw new $TypeError('"allowMissing" argument must be a boolean');
|
979 |
-
}
|
980 |
-
|
981 |
-
var parts = stringToPath(name);
|
982 |
-
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
983 |
-
|
984 |
-
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
985 |
-
var intrinsicRealName = intrinsic.name;
|
986 |
-
var value = intrinsic.value;
|
987 |
-
var skipFurtherCaching = false;
|
988 |
-
|
989 |
-
var alias = intrinsic.alias;
|
990 |
-
if (alias) {
|
991 |
-
intrinsicBaseName = alias[0];
|
992 |
-
$spliceApply(parts, $concat([0, 1], alias));
|
993 |
-
}
|
994 |
-
|
995 |
-
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
996 |
-
var part = parts[i];
|
997 |
-
var first = $strSlice(part, 0, 1);
|
998 |
-
var last = $strSlice(part, -1);
|
999 |
-
if (
|
1000 |
-
(
|
1001 |
-
(first === '"' || first === "'" || first === '`')
|
1002 |
-
|| (last === '"' || last === "'" || last === '`')
|
1003 |
-
)
|
1004 |
-
&& first !== last
|
1005 |
-
) {
|
1006 |
-
throw new $SyntaxError('property names with quotes must have matching quotes');
|
1007 |
-
}
|
1008 |
-
if (part === 'constructor' || !isOwn) {
|
1009 |
-
skipFurtherCaching = true;
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
intrinsicBaseName += '.' + part;
|
1013 |
-
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
1014 |
-
|
1015 |
-
if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
1016 |
-
value = INTRINSICS[intrinsicRealName];
|
1017 |
-
} else if (value != null) {
|
1018 |
-
if (!(part in value)) {
|
1019 |
-
if (!allowMissing) {
|
1020 |
-
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
1021 |
-
}
|
1022 |
-
return void undefined;
|
1023 |
-
}
|
1024 |
-
if ($gOPD && (i + 1) >= parts.length) {
|
1025 |
-
var desc = $gOPD(value, part);
|
1026 |
-
isOwn = !!desc;
|
1027 |
-
|
1028 |
-
// By convention, when a data property is converted to an accessor
|
1029 |
-
// property to emulate a data property that does not suffer from
|
1030 |
-
// the override mistake, that accessor's getter is marked with
|
1031 |
-
// an `originalValue` property. Here, when we detect this, we
|
1032 |
-
// uphold the illusion by pretending to see that original data
|
1033 |
-
// property, i.e., returning the value rather than the getter
|
1034 |
-
// itself.
|
1035 |
-
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
1036 |
-
value = desc.get;
|
1037 |
-
} else {
|
1038 |
-
value = value[part];
|
1039 |
-
}
|
1040 |
-
} else {
|
1041 |
-
isOwn = hasOwn(value, part);
|
1042 |
-
value = value[part];
|
1043 |
-
}
|
1044 |
-
|
1045 |
-
if (isOwn && !skipFurtherCaching) {
|
1046 |
-
INTRINSICS[intrinsicRealName] = value;
|
1047 |
-
}
|
1048 |
-
}
|
1049 |
-
}
|
1050 |
-
return value;
|
1051 |
-
};
|
1052 |
-
|
1053 |
-
},{"function-bind":25,"has":29,"has-symbols":27}],27:[function(require,module,exports){
|
1054 |
-
'use strict';
|
1055 |
-
|
1056 |
-
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
1057 |
-
var hasSymbolSham = require('./shams');
|
1058 |
-
|
1059 |
-
module.exports = function hasNativeSymbols() {
|
1060 |
-
if (typeof origSymbol !== 'function') { return false; }
|
1061 |
-
if (typeof Symbol !== 'function') { return false; }
|
1062 |
-
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
1063 |
-
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
1064 |
-
|
1065 |
-
return hasSymbolSham();
|
1066 |
-
};
|
1067 |
-
|
1068 |
-
},{"./shams":28}],28:[function(require,module,exports){
|
1069 |
-
'use strict';
|
1070 |
-
|
1071 |
-
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
1072 |
-
module.exports = function hasSymbols() {
|
1073 |
-
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
1074 |
-
if (typeof Symbol.iterator === 'symbol') { return true; }
|
1075 |
-
|
1076 |
-
var obj = {};
|
1077 |
-
var sym = Symbol('test');
|
1078 |
-
var symObj = Object(sym);
|
1079 |
-
if (typeof sym === 'string') { return false; }
|
1080 |
-
|
1081 |
-
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
1082 |
-
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
1083 |
-
|
1084 |
-
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
1085 |
-
// if (sym instanceof Symbol) { return false; }
|
1086 |
-
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
1087 |
-
// if (!(symObj instanceof Symbol)) { return false; }
|
1088 |
-
|
1089 |
-
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
1090 |
-
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
1091 |
-
|
1092 |
-
var symVal = 42;
|
1093 |
-
obj[sym] = symVal;
|
1094 |
-
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
1095 |
-
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
1096 |
-
|
1097 |
-
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
1098 |
-
|
1099 |
-
var syms = Object.getOwnPropertySymbols(obj);
|
1100 |
-
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
1101 |
-
|
1102 |
-
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
1103 |
-
|
1104 |
-
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
1105 |
-
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
1106 |
-
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
1107 |
-
}
|
1108 |
-
|
1109 |
-
return true;
|
1110 |
-
};
|
1111 |
-
|
1112 |
-
},{}],29:[function(require,module,exports){
|
1113 |
-
'use strict';
|
1114 |
-
|
1115 |
-
var bind = require('function-bind');
|
1116 |
-
|
1117 |
-
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
1118 |
-
|
1119 |
-
},{"function-bind":25}],30:[function(require,module,exports){
|
1120 |
-
'use strict';
|
1121 |
-
|
1122 |
-
var fnToStr = Function.prototype.toString;
|
1123 |
-
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
|
1124 |
-
var badArrayLike;
|
1125 |
-
var isCallableMarker;
|
1126 |
-
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
|
1127 |
-
try {
|
1128 |
-
badArrayLike = Object.defineProperty({}, 'length', {
|
1129 |
-
get: function () {
|
1130 |
-
throw isCallableMarker;
|
1131 |
-
}
|
1132 |
-
});
|
1133 |
-
isCallableMarker = {};
|
1134 |
-
// eslint-disable-next-line no-throw-literal
|
1135 |
-
reflectApply(function () { throw 42; }, null, badArrayLike);
|
1136 |
-
} catch (_) {
|
1137 |
-
if (_ !== isCallableMarker) {
|
1138 |
-
reflectApply = null;
|
1139 |
-
}
|
1140 |
-
}
|
1141 |
-
} else {
|
1142 |
-
reflectApply = null;
|
1143 |
-
}
|
1144 |
-
|
1145 |
-
var constructorRegex = /^\s*class\b/;
|
1146 |
-
var isES6ClassFn = function isES6ClassFunction(value) {
|
1147 |
-
try {
|
1148 |
-
var fnStr = fnToStr.call(value);
|
1149 |
-
return constructorRegex.test(fnStr);
|
1150 |
-
} catch (e) {
|
1151 |
-
return false; // not a function
|
1152 |
-
}
|
1153 |
-
};
|
1154 |
-
|
1155 |
-
var tryFunctionObject = function tryFunctionToStr(value) {
|
1156 |
-
try {
|
1157 |
-
if (isES6ClassFn(value)) { return false; }
|
1158 |
-
fnToStr.call(value);
|
1159 |
-
return true;
|
1160 |
-
} catch (e) {
|
1161 |
-
return false;
|
1162 |
-
}
|
1163 |
-
};
|
1164 |
-
var toStr = Object.prototype.toString;
|
1165 |
-
var fnClass = '[object Function]';
|
1166 |
-
var genClass = '[object GeneratorFunction]';
|
1167 |
-
var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
|
1168 |
-
/* globals document: false */
|
1169 |
-
var documentDotAll = typeof document === 'object' && typeof document.all === 'undefined' && document.all !== undefined ? document.all : {};
|
1170 |
-
|
1171 |
-
module.exports = reflectApply
|
1172 |
-
? function isCallable(value) {
|
1173 |
-
if (value === documentDotAll) { return true; }
|
1174 |
-
if (!value) { return false; }
|
1175 |
-
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
1176 |
-
if (typeof value === 'function' && !value.prototype) { return true; }
|
1177 |
-
try {
|
1178 |
-
reflectApply(value, null, badArrayLike);
|
1179 |
-
} catch (e) {
|
1180 |
-
if (e !== isCallableMarker) { return false; }
|
1181 |
-
}
|
1182 |
-
return !isES6ClassFn(value);
|
1183 |
-
}
|
1184 |
-
: function isCallable(value) {
|
1185 |
-
if (value === documentDotAll) { return true; }
|
1186 |
-
if (!value) { return false; }
|
1187 |
-
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
1188 |
-
if (typeof value === 'function' && !value.prototype) { return true; }
|
1189 |
-
if (hasToStringTag) { return tryFunctionObject(value); }
|
1190 |
-
if (isES6ClassFn(value)) { return false; }
|
1191 |
-
var strClass = toStr.call(value);
|
1192 |
-
return strClass === fnClass || strClass === genClass;
|
1193 |
-
};
|
1194 |
-
|
1195 |
-
},{}],31:[function(require,module,exports){
|
1196 |
-
'use strict';
|
1197 |
-
|
1198 |
-
var keysShim;
|
1199 |
-
if (!Object.keys) {
|
1200 |
-
// modified from https://github.com/es-shims/es5-shim
|
1201 |
-
var has = Object.prototype.hasOwnProperty;
|
1202 |
-
var toStr = Object.prototype.toString;
|
1203 |
-
var isArgs = require('./isArguments'); // eslint-disable-line global-require
|
1204 |
-
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
1205 |
-
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
|
1206 |
-
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
|
1207 |
-
var dontEnums = [
|
1208 |
-
'toString',
|
1209 |
-
'toLocaleString',
|
1210 |
-
'valueOf',
|
1211 |
-
'hasOwnProperty',
|
1212 |
-
'isPrototypeOf',
|
1213 |
-
'propertyIsEnumerable',
|
1214 |
-
'constructor'
|
1215 |
-
];
|
1216 |
-
var equalsConstructorPrototype = function (o) {
|
1217 |
-
var ctor = o.constructor;
|
1218 |
-
return ctor && ctor.prototype === o;
|
1219 |
-
};
|
1220 |
-
var excludedKeys = {
|
1221 |
-
$applicationCache: true,
|
1222 |
-
$console: true,
|
1223 |
-
$external: true,
|
1224 |
-
$frame: true,
|
1225 |
-
$frameElement: true,
|
1226 |
-
$frames: true,
|
1227 |
-
$innerHeight: true,
|
1228 |
-
$innerWidth: true,
|
1229 |
-
$onmozfullscreenchange: true,
|
1230 |
-
$onmozfullscreenerror: true,
|
1231 |
-
$outerHeight: true,
|
1232 |
-
$outerWidth: true,
|
1233 |
-
$pageXOffset: true,
|
1234 |
-
$pageYOffset: true,
|
1235 |
-
$parent: true,
|
1236 |
-
$scrollLeft: true,
|
1237 |
-
$scrollTop: true,
|
1238 |
-
$scrollX: true,
|
1239 |
-
$scrollY: true,
|
1240 |
-
$self: true,
|
1241 |
-
$webkitIndexedDB: true,
|
1242 |
-
$webkitStorageInfo: true,
|
1243 |
-
$window: true
|
1244 |
-
};
|
1245 |
-
var hasAutomationEqualityBug = (function () {
|
1246 |
-
/* global window */
|
1247 |
-
if (typeof window === 'undefined') { return false; }
|
1248 |
-
for (var k in window) {
|
1249 |
-
try {
|
1250 |
-
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
1251 |
-
try {
|
1252 |
-
equalsConstructorPrototype(window[k]);
|
1253 |
-
} catch (e) {
|
1254 |
-
return true;
|
1255 |
-
}
|
1256 |
-
}
|
1257 |
-
} catch (e) {
|
1258 |
-
return true;
|
1259 |
-
}
|
1260 |
-
}
|
1261 |
-
return false;
|
1262 |
-
}());
|
1263 |
-
var equalsConstructorPrototypeIfNotBuggy = function (o) {
|
1264 |
-
/* global window */
|
1265 |
-
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
|
1266 |
-
return equalsConstructorPrototype(o);
|
1267 |
-
}
|
1268 |
-
try {
|
1269 |
-
return equalsConstructorPrototype(o);
|
1270 |
-
} catch (e) {
|
1271 |
-
return false;
|
1272 |
-
}
|
1273 |
-
};
|
1274 |
-
|
1275 |
-
keysShim = function keys(object) {
|
1276 |
-
var isObject = object !== null && typeof object === 'object';
|
1277 |
-
var isFunction = toStr.call(object) === '[object Function]';
|
1278 |
-
var isArguments = isArgs(object);
|
1279 |
-
var isString = isObject && toStr.call(object) === '[object String]';
|
1280 |
-
var theKeys = [];
|
1281 |
-
|
1282 |
-
if (!isObject && !isFunction && !isArguments) {
|
1283 |
-
throw new TypeError('Object.keys called on a non-object');
|
1284 |
-
}
|
1285 |
-
|
1286 |
-
var skipProto = hasProtoEnumBug && isFunction;
|
1287 |
-
if (isString && object.length > 0 && !has.call(object, 0)) {
|
1288 |
-
for (var i = 0; i < object.length; ++i) {
|
1289 |
-
theKeys.push(String(i));
|
1290 |
-
}
|
1291 |
-
}
|
1292 |
-
|
1293 |
-
if (isArguments && object.length > 0) {
|
1294 |
-
for (var j = 0; j < object.length; ++j) {
|
1295 |
-
theKeys.push(String(j));
|
1296 |
-
}
|
1297 |
-
} else {
|
1298 |
-
for (var name in object) {
|
1299 |
-
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
1300 |
-
theKeys.push(String(name));
|
1301 |
-
}
|
1302 |
-
}
|
1303 |
-
}
|
1304 |
-
|
1305 |
-
if (hasDontEnumBug) {
|
1306 |
-
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
1307 |
-
|
1308 |
-
for (var k = 0; k < dontEnums.length; ++k) {
|
1309 |
-
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
1310 |
-
theKeys.push(dontEnums[k]);
|
1311 |
-
}
|
1312 |
-
}
|
1313 |
-
}
|
1314 |
-
return theKeys;
|
1315 |
-
};
|
1316 |
-
}
|
1317 |
-
module.exports = keysShim;
|
1318 |
-
|
1319 |
-
},{"./isArguments":33}],32:[function(require,module,exports){
|
1320 |
-
'use strict';
|
1321 |
-
|
1322 |
-
var slice = Array.prototype.slice;
|
1323 |
-
var isArgs = require('./isArguments');
|
1324 |
-
|
1325 |
-
var origKeys = Object.keys;
|
1326 |
-
var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
|
1327 |
-
|
1328 |
-
var originalKeys = Object.keys;
|
1329 |
-
|
1330 |
-
keysShim.shim = function shimObjectKeys() {
|
1331 |
-
if (Object.keys) {
|
1332 |
-
var keysWorksWithArguments = (function () {
|
1333 |
-
// Safari 5.0 bug
|
1334 |
-
var args = Object.keys(arguments);
|
1335 |
-
return args && args.length === arguments.length;
|
1336 |
-
}(1, 2));
|
1337 |
-
if (!keysWorksWithArguments) {
|
1338 |
-
Object.keys = function keys(object) { // eslint-disable-line func-name-matching
|
1339 |
-
if (isArgs(object)) {
|
1340 |
-
return originalKeys(slice.call(object));
|
1341 |
-
}
|
1342 |
-
return originalKeys(object);
|
1343 |
-
};
|
1344 |
-
}
|
1345 |
-
} else {
|
1346 |
-
Object.keys = keysShim;
|
1347 |
-
}
|
1348 |
-
return Object.keys || keysShim;
|
1349 |
-
};
|
1350 |
-
|
1351 |
-
module.exports = keysShim;
|
1352 |
-
|
1353 |
-
},{"./implementation":31,"./isArguments":33}],33:[function(require,module,exports){
|
1354 |
-
'use strict';
|
1355 |
-
|
1356 |
-
var toStr = Object.prototype.toString;
|
1357 |
-
|
1358 |
-
module.exports = function isArguments(value) {
|
1359 |
-
var str = toStr.call(value);
|
1360 |
-
var isArgs = str === '[object Arguments]';
|
1361 |
-
if (!isArgs) {
|
1362 |
-
isArgs = str !== '[object Array]' &&
|
1363 |
-
value !== null &&
|
1364 |
-
typeof value === 'object' &&
|
1365 |
-
typeof value.length === 'number' &&
|
1366 |
-
value.length >= 0 &&
|
1367 |
-
toStr.call(value.callee) === '[object Function]';
|
1368 |
-
}
|
1369 |
-
return isArgs;
|
1370 |
-
};
|
1371 |
-
|
1372 |
-
},{}],34:[function(require,module,exports){
|
1373 |
-
/**
|
1374 |
-
* @typedef {Object} Options
|
1375 |
-
*
|
1376 |
-
* @property {Number} [timeout=0] - Timeout in ms after that promise will be rejected automatically.
|
1377 |
-
* @property {String|Function} [timeoutReason] - Rejection reason for timeout.
|
1378 |
-
* Promise will be rejected with {@link PromiseController.TimeoutError} and this message. The message can contain
|
1379 |
-
* placeholder `{timeout}` for actual timeout value. If timeoutReason is a function,
|
1380 |
-
* it will be evaluated and returned value will be used as message.
|
1381 |
-
* @property {String|Function} [resetReason] - Rejection reason used when `.reset()` is called while promise is pending.
|
1382 |
-
* Promise will be rejected with {@link PromiseController.ResetError} and this message. If resetReason is a function,
|
1383 |
-
* it will be evaluated and returned value will be used as message.
|
1384 |
-
*/
|
1385 |
-
|
1386 |
-
module.exports = {
|
1387 |
-
timeout: 0,
|
1388 |
-
timeoutReason: 'Promise rejected by PromiseController timeout {timeout} ms.',
|
1389 |
-
resetReason: 'Promise rejected by PromiseController reset.',
|
1390 |
-
};
|
1391 |
-
|
1392 |
-
},{}],35:[function(require,module,exports){
|
1393 |
-
/**
|
1394 |
-
* @ignore
|
1395 |
-
*/
|
1396 |
-
const defaults = require('./defaults');
|
1397 |
-
const {isPromise, createErrorType, tryCall} = require('./utils');
|
1398 |
-
|
1399 |
-
/**
|
1400 |
-
* @typicalname pc
|
1401 |
-
*/
|
1402 |
-
class PromiseController {
|
1403 |
-
/**
|
1404 |
-
* Creates promise controller. Unlike original Promise, it does not immediately call any function.
|
1405 |
-
* Instead it has [.call()](#PromiseController+call) method that calls provided function
|
1406 |
-
* and stores `resolve / reject` methods for future access.
|
1407 |
-
*
|
1408 |
-
* @param {Options} [options]
|
1409 |
-
*/
|
1410 |
-
constructor(options) {
|
1411 |
-
this._options = Object.assign({}, defaults, options);
|
1412 |
-
this._resolve = null;
|
1413 |
-
this._reject = null;
|
1414 |
-
this._isPending = false;
|
1415 |
-
this._isFulfilled = false;
|
1416 |
-
this._isRejected = false;
|
1417 |
-
this._value = undefined;
|
1418 |
-
this._promise = null;
|
1419 |
-
this._timer = null;
|
1420 |
-
}
|
1421 |
-
|
1422 |
-
/**
|
1423 |
-
* Returns promise itself.
|
1424 |
-
*
|
1425 |
-
* @returns {Promise}
|
1426 |
-
*/
|
1427 |
-
get promise() {
|
1428 |
-
return this._promise;
|
1429 |
-
}
|
1430 |
-
|
1431 |
-
/**
|
1432 |
-
* Returns value with that promise was settled (fulfilled or rejected).
|
1433 |
-
*
|
1434 |
-
* @returns {*}
|
1435 |
-
*/
|
1436 |
-
get value() {
|
1437 |
-
return this._value;
|
1438 |
-
}
|
1439 |
-
|
1440 |
-
/**
|
1441 |
-
* Returns true if promise is pending.
|
1442 |
-
*
|
1443 |
-
* @returns {Boolean}
|
1444 |
-
*/
|
1445 |
-
get isPending() {
|
1446 |
-
return this._isPending;
|
1447 |
-
}
|
1448 |
-
|
1449 |
-
/**
|
1450 |
-
* Returns true if promise is fulfilled.
|
1451 |
-
*
|
1452 |
-
* @returns {Boolean}
|
1453 |
-
*/
|
1454 |
-
get isFulfilled() {
|
1455 |
-
return this._isFulfilled;
|
1456 |
-
}
|
1457 |
-
|
1458 |
-
/**
|
1459 |
-
* Returns true if promise rejected.
|
1460 |
-
*
|
1461 |
-
* @returns {Boolean}
|
1462 |
-
*/
|
1463 |
-
get isRejected() {
|
1464 |
-
return this._isRejected;
|
1465 |
-
}
|
1466 |
-
|
1467 |
-
/**
|
1468 |
-
* Returns true if promise is fulfilled or rejected.
|
1469 |
-
*
|
1470 |
-
* @returns {Boolean}
|
1471 |
-
*/
|
1472 |
-
get isSettled() {
|
1473 |
-
return this._isFulfilled || this._isRejected;
|
1474 |
-
}
|
1475 |
-
|
1476 |
-
/**
|
1477 |
-
* Calls `fn` and returns promise OR just returns existing promise from previous `call()` if it is still pending.
|
1478 |
-
* To fulfill returned promise you should use
|
1479 |
-
* {@link PromiseController#resolve} / {@link PromiseController#reject} methods.
|
1480 |
-
* If `fn` itself returns promise, then external promise is attached to it and fulfills together.
|
1481 |
-
* If no `fn` passed - promiseController is initialized as well.
|
1482 |
-
*
|
1483 |
-
* @param {Function} [fn] function to be called.
|
1484 |
-
* @returns {Promise}
|
1485 |
-
*/
|
1486 |
-
call(fn) {
|
1487 |
-
if (!this._isPending) {
|
1488 |
-
this.reset();
|
1489 |
-
this._createPromise();
|
1490 |
-
this._createTimer();
|
1491 |
-
this._callFn(fn);
|
1492 |
-
}
|
1493 |
-
return this._promise;
|
1494 |
-
}
|
1495 |
-
|
1496 |
-
/**
|
1497 |
-
* Resolves pending promise with specified `value`.
|
1498 |
-
*
|
1499 |
-
* @param {*} [value]
|
1500 |
-
*/
|
1501 |
-
resolve(value) {
|
1502 |
-
if (this._isPending) {
|
1503 |
-
if (isPromise(value)) {
|
1504 |
-
this._tryAttachToPromise(value);
|
1505 |
-
} else {
|
1506 |
-
this._settle(value);
|
1507 |
-
this._isFulfilled = true;
|
1508 |
-
this._resolve(value);
|
1509 |
-
}
|
1510 |
-
}
|
1511 |
-
}
|
1512 |
-
|
1513 |
-
/**
|
1514 |
-
* Rejects pending promise with specified `value`.
|
1515 |
-
*
|
1516 |
-
* @param {*} [value]
|
1517 |
-
*/
|
1518 |
-
reject(value) {
|
1519 |
-
if (this._isPending) {
|
1520 |
-
this._settle(value);
|
1521 |
-
this._isRejected = true;
|
1522 |
-
this._reject(value);
|
1523 |
-
}
|
1524 |
-
}
|
1525 |
-
|
1526 |
-
/**
|
1527 |
-
* Resets to initial state.
|
1528 |
-
* If promise is pending it will be rejected with {@link PromiseController.ResetError}.
|
1529 |
-
*/
|
1530 |
-
reset() {
|
1531 |
-
if (this._isPending) {
|
1532 |
-
const message = tryCall(this._options.resetReason);
|
1533 |
-
const error = new PromiseController.ResetError(message);
|
1534 |
-
this.reject(error);
|
1535 |
-
}
|
1536 |
-
this._promise = null;
|
1537 |
-
this._isPending = false;
|
1538 |
-
this._isFulfilled = false;
|
1539 |
-
this._isRejected = false;
|
1540 |
-
this._value = undefined;
|
1541 |
-
this._clearTimer();
|
1542 |
-
}
|
1543 |
-
|
1544 |
-
/**
|
1545 |
-
* Re-assign one or more options.
|
1546 |
-
*
|
1547 |
-
* @param {Options} options
|
1548 |
-
*/
|
1549 |
-
configure(options) {
|
1550 |
-
Object.assign(this._options, options);
|
1551 |
-
}
|
1552 |
-
|
1553 |
-
_createPromise() {
|
1554 |
-
this._promise = new Promise((resolve, reject) => {
|
1555 |
-
this._isPending = true;
|
1556 |
-
this._resolve = resolve;
|
1557 |
-
this._reject = reject;
|
1558 |
-
});
|
1559 |
-
}
|
1560 |
-
|
1561 |
-
_handleTimeout() {
|
1562 |
-
const messageTpl = tryCall(this._options.timeoutReason);
|
1563 |
-
const message = typeof messageTpl === 'string' ? messageTpl.replace('{timeout}', this._options.timeout) : '';
|
1564 |
-
const error = new PromiseController.TimeoutError(message);
|
1565 |
-
this.reject(error);
|
1566 |
-
}
|
1567 |
-
|
1568 |
-
_createTimer() {
|
1569 |
-
if (this._options.timeout) {
|
1570 |
-
this._timer = setTimeout(() => this._handleTimeout(), this._options.timeout);
|
1571 |
-
}
|
1572 |
-
}
|
1573 |
-
|
1574 |
-
_clearTimer() {
|
1575 |
-
if (this._timer) {
|
1576 |
-
clearTimeout(this._timer);
|
1577 |
-
this._timer = null;
|
1578 |
-
}
|
1579 |
-
}
|
1580 |
-
|
1581 |
-
_settle(value) {
|
1582 |
-
this._isPending = false;
|
1583 |
-
this._value = value;
|
1584 |
-
this._clearTimer();
|
1585 |
-
}
|
1586 |
-
|
1587 |
-
_callFn(fn) {
|
1588 |
-
if (typeof fn === 'function') {
|
1589 |
-
try {
|
1590 |
-
const result = fn();
|
1591 |
-
this._tryAttachToPromise(result);
|
1592 |
-
} catch (e) {
|
1593 |
-
this.reject(e);
|
1594 |
-
}
|
1595 |
-
}
|
1596 |
-
}
|
1597 |
-
|
1598 |
-
_tryAttachToPromise(p) {
|
1599 |
-
if (isPromise(p)) {
|
1600 |
-
p.then(value => this.resolve(value), e => this.reject(e));
|
1601 |
-
}
|
1602 |
-
}
|
1603 |
-
}
|
1604 |
-
|
1605 |
-
/**
|
1606 |
-
* Error for rejection in case of timeout.
|
1607 |
-
* @type {PromiseController.TimeoutError}
|
1608 |
-
*/
|
1609 |
-
PromiseController.TimeoutError = createErrorType('TimeoutError');
|
1610 |
-
|
1611 |
-
/**
|
1612 |
-
* Error for rejection in case of call `.reset()` while promise is pending.
|
1613 |
-
* @type {PromiseController.ResetError}
|
1614 |
-
*/
|
1615 |
-
PromiseController.ResetError = createErrorType('ResetError');
|
1616 |
-
|
1617 |
-
module.exports = PromiseController;
|
1618 |
-
|
1619 |
-
},{"./defaults":34,"./utils":36}],36:[function(require,module,exports){
|
1620 |
-
|
1621 |
-
/**
|
1622 |
-
* Simple check for Promise.
|
1623 |
-
* @param {*} p
|
1624 |
-
* @returns {Boolean}
|
1625 |
-
* @ignore
|
1626 |
-
*/
|
1627 |
-
exports.isPromise = function (p) {
|
1628 |
-
return p && typeof p.then === 'function';
|
1629 |
-
};
|
1630 |
-
|
1631 |
-
/**
|
1632 |
-
* Calls argument if it is function
|
1633 |
-
* @param {*} value
|
1634 |
-
* @returns {*}
|
1635 |
-
* @ignore
|
1636 |
-
*/
|
1637 |
-
exports.tryCall = function (value) {
|
1638 |
-
return typeof value === 'function' ? value() : value;
|
1639 |
-
};
|
1640 |
-
|
1641 |
-
/**
|
1642 |
-
* Just `class MyError extends Error` does not work with transpiler.
|
1643 |
-
* See: https://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript
|
1644 |
-
* @ignore
|
1645 |
-
*/
|
1646 |
-
exports.createErrorType = function (name) {
|
1647 |
-
function E(message) {
|
1648 |
-
if (!Error.captureStackTrace) {
|
1649 |
-
this.stack = (new Error()).stack;
|
1650 |
-
} else {
|
1651 |
-
Error.captureStackTrace(this, this.constructor);
|
1652 |
-
}
|
1653 |
-
this.message = message;
|
1654 |
-
}
|
1655 |
-
E.prototype = new Error();
|
1656 |
-
E.prototype.name = name;
|
1657 |
-
E.prototype.constructor = E;
|
1658 |
-
return E;
|
1659 |
-
};
|
1660 |
-
|
1661 |
-
},{}],37:[function(require,module,exports){
|
1662 |
-
'use strict';
|
1663 |
-
|
1664 |
-
var requirePromise = require('./requirePromise');
|
1665 |
-
|
1666 |
-
requirePromise();
|
1667 |
-
|
1668 |
-
var IsCallable = require('es-abstract/2021/IsCallable');
|
1669 |
-
var SpeciesConstructor = require('es-abstract/2021/SpeciesConstructor');
|
1670 |
-
var Type = require('es-abstract/2021/Type');
|
1671 |
-
|
1672 |
-
var promiseResolve = function PromiseResolve(C, value) {
|
1673 |
-
return new C(function (resolve) {
|
1674 |
-
resolve(value);
|
1675 |
-
});
|
1676 |
-
};
|
1677 |
-
|
1678 |
-
var OriginalPromise = Promise;
|
1679 |
-
|
1680 |
-
var createThenFinally = function CreateThenFinally(C, onFinally) {
|
1681 |
-
return function (value) {
|
1682 |
-
var result = onFinally();
|
1683 |
-
var promise = promiseResolve(C, result);
|
1684 |
-
var valueThunk = function () {
|
1685 |
-
return value;
|
1686 |
-
};
|
1687 |
-
return promise.then(valueThunk);
|
1688 |
-
};
|
1689 |
-
};
|
1690 |
-
|
1691 |
-
var createCatchFinally = function CreateCatchFinally(C, onFinally) {
|
1692 |
-
return function (reason) {
|
1693 |
-
var result = onFinally();
|
1694 |
-
var promise = promiseResolve(C, result);
|
1695 |
-
var thrower = function () {
|
1696 |
-
throw reason;
|
1697 |
-
};
|
1698 |
-
return promise.then(thrower);
|
1699 |
-
};
|
1700 |
-
};
|
1701 |
-
|
1702 |
-
var promiseFinally = function finally_(onFinally) {
|
1703 |
-
/* eslint no-invalid-this: 0 */
|
1704 |
-
|
1705 |
-
var promise = this;
|
1706 |
-
|
1707 |
-
if (Type(promise) !== 'Object') {
|
1708 |
-
throw new TypeError('receiver is not an Object');
|
1709 |
-
}
|
1710 |
-
|
1711 |
-
var C = SpeciesConstructor(promise, OriginalPromise); // may throw
|
1712 |
-
|
1713 |
-
var thenFinally = onFinally;
|
1714 |
-
var catchFinally = onFinally;
|
1715 |
-
if (IsCallable(onFinally)) {
|
1716 |
-
thenFinally = createThenFinally(C, onFinally);
|
1717 |
-
catchFinally = createCatchFinally(C, onFinally);
|
1718 |
-
}
|
1719 |
-
|
1720 |
-
return promise.then(thenFinally, catchFinally);
|
1721 |
-
};
|
1722 |
-
|
1723 |
-
if (Object.getOwnPropertyDescriptor) {
|
1724 |
-
var descriptor = Object.getOwnPropertyDescriptor(promiseFinally, 'name');
|
1725 |
-
if (descriptor && descriptor.configurable) {
|
1726 |
-
Object.defineProperty(promiseFinally, 'name', { configurable: true, value: 'finally' });
|
1727 |
-
}
|
1728 |
-
}
|
1729 |
-
|
1730 |
-
module.exports = promiseFinally;
|
1731 |
-
|
1732 |
-
},{"./requirePromise":40,"es-abstract/2021/IsCallable":9,"es-abstract/2021/SpeciesConstructor":14,"es-abstract/2021/Type":17}],38:[function(require,module,exports){
|
1733 |
-
'use strict';
|
1734 |
-
|
1735 |
-
var callBind = require('call-bind');
|
1736 |
-
var define = require('define-properties');
|
1737 |
-
|
1738 |
-
var implementation = require('./implementation');
|
1739 |
-
var getPolyfill = require('./polyfill');
|
1740 |
-
var shim = require('./shim');
|
1741 |
-
|
1742 |
-
var bound = callBind(getPolyfill());
|
1743 |
-
|
1744 |
-
define(bound, {
|
1745 |
-
getPolyfill: getPolyfill,
|
1746 |
-
implementation: implementation,
|
1747 |
-
shim: shim
|
1748 |
-
});
|
1749 |
-
|
1750 |
-
module.exports = bound;
|
1751 |
-
|
1752 |
-
},{"./implementation":37,"./polyfill":39,"./shim":41,"call-bind":2,"define-properties":4}],39:[function(require,module,exports){
|
1753 |
-
'use strict';
|
1754 |
-
|
1755 |
-
var requirePromise = require('./requirePromise');
|
1756 |
-
|
1757 |
-
var implementation = require('./implementation');
|
1758 |
-
|
1759 |
-
module.exports = function getPolyfill() {
|
1760 |
-
requirePromise();
|
1761 |
-
return typeof Promise.prototype['finally'] === 'function' ? Promise.prototype['finally'] : implementation;
|
1762 |
-
};
|
1763 |
-
|
1764 |
-
},{"./implementation":37,"./requirePromise":40}],40:[function(require,module,exports){
|
1765 |
-
'use strict';
|
1766 |
-
|
1767 |
-
module.exports = function requirePromise() {
|
1768 |
-
if (typeof Promise !== 'function') {
|
1769 |
-
throw new TypeError('`Promise.prototype.finally` requires a global `Promise` be available.');
|
1770 |
-
}
|
1771 |
-
};
|
1772 |
-
|
1773 |
-
},{}],41:[function(require,module,exports){
|
1774 |
-
'use strict';
|
1775 |
-
|
1776 |
-
var requirePromise = require('./requirePromise');
|
1777 |
-
|
1778 |
-
var getPolyfill = require('./polyfill');
|
1779 |
-
var define = require('define-properties');
|
1780 |
-
|
1781 |
-
module.exports = function shimPromiseFinally() {
|
1782 |
-
requirePromise();
|
1783 |
-
|
1784 |
-
var polyfill = getPolyfill();
|
1785 |
-
define(Promise.prototype, { 'finally': polyfill }, {
|
1786 |
-
'finally': function testFinally() {
|
1787 |
-
return Promise.prototype['finally'] !== polyfill;
|
1788 |
-
}
|
1789 |
-
});
|
1790 |
-
return polyfill;
|
1791 |
-
};
|
1792 |
-
|
1793 |
-
},{"./polyfill":39,"./requirePromise":40,"define-properties":4}],42:[function(require,module,exports){
|
1794 |
-
"use strict";
|
1795 |
-
Object.defineProperty(exports, "__esModule", { value: true });
|
1796 |
-
exports.PromisedMap = void 0;
|
1797 |
-
var PromisedMap = /** @class */ (function () {
|
1798 |
-
function PromisedMap() {
|
1799 |
-
this.map = new Map();
|
1800 |
-
}
|
1801 |
-
Object.defineProperty(PromisedMap.prototype, "size", {
|
1802 |
-
/**
|
1803 |
-
* Returns map size.
|
1804 |
-
*/
|
1805 |
-
get: function () {
|
1806 |
-
return this.map.size;
|
1807 |
-
},
|
1808 |
-
enumerable: false,
|
1809 |
-
configurable: true
|
1810 |
-
});
|
1811 |
-
/**
|
1812 |
-
* Sets key/data pair and creates related promise.
|
1813 |
-
* If key already exists in map - it will be replaced with new data and new promise.
|
1814 |
-
*/
|
1815 |
-
PromisedMap.prototype.set = function (key, data) {
|
1816 |
-
var item = this.createMapItem(data);
|
1817 |
-
this.map.set(key, item);
|
1818 |
-
return item.promise;
|
1819 |
-
};
|
1820 |
-
/**
|
1821 |
-
* Returns data for key.
|
1822 |
-
*/
|
1823 |
-
PromisedMap.prototype.get = function (key) {
|
1824 |
-
var item = this.map.get(key);
|
1825 |
-
return item && item.data;
|
1826 |
-
};
|
1827 |
-
/**
|
1828 |
-
* Checks if key exists.
|
1829 |
-
*/
|
1830 |
-
PromisedMap.prototype.has = function (key) {
|
1831 |
-
return this.map.has(key);
|
1832 |
-
};
|
1833 |
-
/**
|
1834 |
-
* Deletes key from map.
|
1835 |
-
* Caution: previously returned promise will no be resolved or rejected.
|
1836 |
-
*/
|
1837 |
-
PromisedMap.prototype.delete = function (key) {
|
1838 |
-
return this.map.delete(key);
|
1839 |
-
};
|
1840 |
-
/**
|
1841 |
-
* Resolves promise in map by key and removes key from map.
|
1842 |
-
* If no such key in map - nothing happens.
|
1843 |
-
*/
|
1844 |
-
PromisedMap.prototype.resolve = function (key, value) {
|
1845 |
-
var item = this.map.get(key);
|
1846 |
-
if (item) {
|
1847 |
-
this.delete(key);
|
1848 |
-
item.resolve(value);
|
1849 |
-
}
|
1850 |
-
};
|
1851 |
-
/**
|
1852 |
-
* Rejects promise in map by key and removes key from map.
|
1853 |
-
* If no such key in map - nothing happens.
|
1854 |
-
*/
|
1855 |
-
PromisedMap.prototype.reject = function (key, reason) {
|
1856 |
-
var item = this.map.get(key);
|
1857 |
-
if (item) {
|
1858 |
-
this.delete(key);
|
1859 |
-
item.reject(reason);
|
1860 |
-
}
|
1861 |
-
};
|
1862 |
-
/**
|
1863 |
-
* Resolves all promise in map and removes all keys.
|
1864 |
-
*/
|
1865 |
-
PromisedMap.prototype.resolveAll = function (value) {
|
1866 |
-
this.map.forEach(function (item) { return item.resolve(value); });
|
1867 |
-
this.map.clear();
|
1868 |
-
};
|
1869 |
-
/**
|
1870 |
-
* Rejects all promise in map and removes all keys.
|
1871 |
-
*/
|
1872 |
-
PromisedMap.prototype.rejectAll = function (reason) {
|
1873 |
-
this.map.forEach(function (item) { return item.reject(reason); });
|
1874 |
-
this.map.clear();
|
1875 |
-
};
|
1876 |
-
/**
|
1877 |
-
* Iterate map.
|
1878 |
-
*/
|
1879 |
-
PromisedMap.prototype.forEach = function (fn) {
|
1880 |
-
this.map.forEach(function (item, key, map) { return fn(item.data, key, map); });
|
1881 |
-
};
|
1882 |
-
/**
|
1883 |
-
* Clears map.
|
1884 |
-
*/
|
1885 |
-
PromisedMap.prototype.clear = function () {
|
1886 |
-
return this.map.clear();
|
1887 |
-
};
|
1888 |
-
PromisedMap.prototype.createMapItem = function (data) {
|
1889 |
-
var item = { data: data };
|
1890 |
-
item.promise = new Promise(function (resolve, reject) {
|
1891 |
-
item.resolve = resolve;
|
1892 |
-
item.reject = reject;
|
1893 |
-
});
|
1894 |
-
return item;
|
1895 |
-
};
|
1896 |
-
return PromisedMap;
|
1897 |
-
}());
|
1898 |
-
exports.PromisedMap = PromisedMap;
|
1899 |
-
|
1900 |
-
},{}],43:[function(require,module,exports){
|
1901 |
-
/**
|
1902 |
-
* Default options.
|
1903 |
-
*/
|
1904 |
-
|
1905 |
-
/**
|
1906 |
-
* @typedef {Object} Options
|
1907 |
-
* @property {Function} [createWebSocket=url => new WebSocket(url)] - custom function for WebSocket construction.
|
1908 |
-
*
|
1909 |
-
* @property {Function} [packMessage=noop] - packs message for sending. For example, `data => JSON.stringify(data)`.
|
1910 |
-
*
|
1911 |
-
* @property {Function} [unpackMessage=noop] - unpacks received message. For example, `data => JSON.parse(data)`.
|
1912 |
-
*
|
1913 |
-
* @property {Function} [attachRequestId=noop] - injects request id into data.
|
1914 |
-
* For example, `(data, requestId) => Object.assign({requestId}, data)`.
|
1915 |
-
*
|
1916 |
-
* @property {Function} [extractRequestId=noop] - extracts request id from received data.
|
1917 |
-
* For example, `data => data.requestId`.
|
1918 |
-
*
|
1919 |
-
* @property {Function} [extractMessageData=event => event.data] - extracts data from event object.
|
1920 |
-
*
|
1921 |
-
* @property {Number} timeout=0 - timeout for opening connection and sending messages.
|
1922 |
-
*
|
1923 |
-
* @property {Number} connectionTimeout=0 - special timeout for opening connection, by default equals to `timeout`.
|
1924 |
-
*
|
1925 |
-
* @defaults
|
1926 |
-
* please see [options.js](https://github.com/vitalets/websocket-as-promised/blob/master/src/options.js)
|
1927 |
-
*/
|
1928 |
-
|
1929 |
-
module.exports = {
|
1930 |
-
/**
|
1931 |
-
* See {@link Options.createWebSocket}
|
1932 |
-
*
|
1933 |
-
* @param {String} url
|
1934 |
-
* @returns {WebSocket}
|
1935 |
-
*/
|
1936 |
-
createWebSocket: url => new WebSocket(url),
|
1937 |
-
|
1938 |
-
/**
|
1939 |
-
* See {@link Options.packMessage}
|
1940 |
-
*
|
1941 |
-
* @param {*} data
|
1942 |
-
* @returns {String|ArrayBuffer|Blob}
|
1943 |
-
*/
|
1944 |
-
packMessage: null,
|
1945 |
-
|
1946 |
-
/**
|
1947 |
-
* See {@link Options.unpackMessage}
|
1948 |
-
*
|
1949 |
-
* @param {String|ArrayBuffer|Blob} data
|
1950 |
-
* @returns {*}
|
1951 |
-
*/
|
1952 |
-
unpackMessage: null,
|
1953 |
-
|
1954 |
-
/**
|
1955 |
-
* See {@link Options.attachRequestId}
|
1956 |
-
*
|
1957 |
-
* @param {*} data
|
1958 |
-
* @param {String|Number} requestId
|
1959 |
-
* @returns {*}
|
1960 |
-
*/
|
1961 |
-
attachRequestId: null,
|
1962 |
-
|
1963 |
-
/**
|
1964 |
-
* See {@link Options.extractRequestId}
|
1965 |
-
*
|
1966 |
-
* @param {*} data
|
1967 |
-
* @returns {String|Number|undefined}
|
1968 |
-
*/
|
1969 |
-
extractRequestId: null,
|
1970 |
-
|
1971 |
-
/**
|
1972 |
-
* See {@link Options.extractMessageData}
|
1973 |
-
*
|
1974 |
-
* @param {*} event
|
1975 |
-
* @returns {*}
|
1976 |
-
*/
|
1977 |
-
extractMessageData: event => event.data,
|
1978 |
-
|
1979 |
-
/**
|
1980 |
-
* See {@link Options.timeout}
|
1981 |
-
*/
|
1982 |
-
timeout: 0,
|
1983 |
-
|
1984 |
-
/**
|
1985 |
-
* See {@link Options.connectionTimeout}
|
1986 |
-
*/
|
1987 |
-
connectionTimeout: 0,
|
1988 |
-
};
|
1989 |
-
|
1990 |
-
},{}],44:[function(require,module,exports){
|
1991 |
-
/**
|
1992 |
-
* Class for manage pending requests.
|
1993 |
-
* @private
|
1994 |
-
*/
|
1995 |
-
|
1996 |
-
const PromiseController = require('promise-controller');
|
1997 |
-
const promiseFinally = require('promise.prototype.finally');
|
1998 |
-
|
1999 |
-
module.exports = class Requests {
|
2000 |
-
constructor() {
|
2001 |
-
this._items = new Map();
|
2002 |
-
}
|
2003 |
-
|
2004 |
-
/**
|
2005 |
-
* Creates new request and stores it in the list.
|
2006 |
-
*
|
2007 |
-
* @param {String|Number} requestId
|
2008 |
-
* @param {Function} fn
|
2009 |
-
* @param {Number} timeout
|
2010 |
-
* @returns {Promise}
|
2011 |
-
*/
|
2012 |
-
create(requestId, fn, timeout) {
|
2013 |
-
this._rejectExistingRequest(requestId);
|
2014 |
-
return this._createNewRequest(requestId, fn, timeout);
|
2015 |
-
}
|
2016 |
-
|
2017 |
-
resolve(requestId, data) {
|
2018 |
-
if (requestId && this._items.has(requestId)) {
|
2019 |
-
this._items.get(requestId).resolve(data);
|
2020 |
-
}
|
2021 |
-
}
|
2022 |
-
|
2023 |
-
rejectAll(error) {
|
2024 |
-
this._items.forEach(request => request.isPending ? request.reject(error) : null);
|
2025 |
-
}
|
2026 |
-
|
2027 |
-
_rejectExistingRequest(requestId) {
|
2028 |
-
const existingRequest = this._items.get(requestId);
|
2029 |
-
if (existingRequest && existingRequest.isPending) {
|
2030 |
-
existingRequest.reject(new Error(`WebSocket request is replaced, id: ${requestId}`));
|
2031 |
-
}
|
2032 |
-
}
|
2033 |
-
|
2034 |
-
_createNewRequest(requestId, fn, timeout) {
|
2035 |
-
const request = new PromiseController({
|
2036 |
-
timeout,
|
2037 |
-
timeoutReason: `WebSocket request was rejected by timeout (${timeout} ms). RequestId: ${requestId}`
|
2038 |
-
});
|
2039 |
-
this._items.set(requestId, request);
|
2040 |
-
return promiseFinally(request.call(fn), () => this._deleteRequest(requestId, request));
|
2041 |
-
}
|
2042 |
-
|
2043 |
-
_deleteRequest(requestId, request) {
|
2044 |
-
// this check is important when request was replaced
|
2045 |
-
if (this._items.get(requestId) === request) {
|
2046 |
-
this._items.delete(requestId);
|
2047 |
-
}
|
2048 |
-
}
|
2049 |
-
};
|
2050 |
-
|
2051 |
-
},{"promise-controller":35,"promise.prototype.finally":38}],45:[function(require,module,exports){
|
2052 |
-
|
2053 |
-
exports.throwIf = (condition, message) => {
|
2054 |
-
if (condition) {
|
2055 |
-
throw new Error(message);
|
2056 |
-
}
|
2057 |
-
};
|
2058 |
-
|
2059 |
-
exports.isPromise = value => {
|
2060 |
-
return value && typeof value.then === 'function';
|
2061 |
-
};
|
2062 |
-
|
2063 |
-
},{}],"websocket-as-promised":[function(require,module,exports){
|
2064 |
-
/**
|
2065 |
-
* WebSocket with promise api
|
2066 |
-
*/
|
2067 |
-
|
2068 |
-
/**
|
2069 |
-
* @external Channel
|
2070 |
-
*/
|
2071 |
-
|
2072 |
-
const Channel = require('chnl');
|
2073 |
-
// todo: maybe remove PromiseController and just use promised-map with 2 items?
|
2074 |
-
const PromiseController = require('promise-controller');
|
2075 |
-
const { PromisedMap } = require('promised-map');
|
2076 |
-
// todo: maybe remove Requests and just use promised-map?
|
2077 |
-
const Requests = require('./requests');
|
2078 |
-
const defaultOptions = require('./options');
|
2079 |
-
const {throwIf, isPromise} = require('./utils');
|
2080 |
-
|
2081 |
-
// see: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket#Ready_state_constants
|
2082 |
-
const STATE = {
|
2083 |
-
CONNECTING: 0,
|
2084 |
-
OPEN: 1,
|
2085 |
-
CLOSING: 2,
|
2086 |
-
CLOSED: 3,
|
2087 |
-
};
|
2088 |
-
|
2089 |
-
/**
|
2090 |
-
* @typicalname wsp
|
2091 |
-
*/
|
2092 |
-
class WebSocketAsPromised {
|
2093 |
-
/**
|
2094 |
-
* Constructor. Unlike original WebSocket it does not immediately open connection.
|
2095 |
-
* Please call `open()` method to connect.
|
2096 |
-
*
|
2097 |
-
* @param {String} url WebSocket URL
|
2098 |
-
* @param {Options} [options]
|
2099 |
-
*/
|
2100 |
-
constructor(url, options) {
|
2101 |
-
this._assertOptions(options);
|
2102 |
-
this._url = url;
|
2103 |
-
this._options = Object.assign({}, defaultOptions, options);
|
2104 |
-
this._requests = new Requests();
|
2105 |
-
this._promisedMap = new PromisedMap();
|
2106 |
-
this._ws = null;
|
2107 |
-
this._wsSubscription = null;
|
2108 |
-
this._createOpeningController();
|
2109 |
-
this._createClosingController();
|
2110 |
-
this._createChannels();
|
2111 |
-
}
|
2112 |
-
|
2113 |
-
/**
|
2114 |
-
* Returns original WebSocket instance created by `options.createWebSocket`.
|
2115 |
-
*
|
2116 |
-
* @returns {WebSocket}
|
2117 |
-
*/
|
2118 |
-
get ws() {
|
2119 |
-
return this._ws;
|
2120 |
-
}
|
2121 |
-
|
2122 |
-
/**
|
2123 |
-
* Returns WebSocket url.
|
2124 |
-
*
|
2125 |
-
* @returns {String}
|
2126 |
-
*/
|
2127 |
-
get url() {
|
2128 |
-
return this._url;
|
2129 |
-
}
|
2130 |
-
|
2131 |
-
/**
|
2132 |
-
* Is WebSocket connection in opening state.
|
2133 |
-
*
|
2134 |
-
* @returns {Boolean}
|
2135 |
-
*/
|
2136 |
-
get isOpening() {
|
2137 |
-
return Boolean(this._ws && this._ws.readyState === STATE.CONNECTING);
|
2138 |
-
}
|
2139 |
-
|
2140 |
-
/**
|
2141 |
-
* Is WebSocket connection opened.
|
2142 |
-
*
|
2143 |
-
* @returns {Boolean}
|
2144 |
-
*/
|
2145 |
-
get isOpened() {
|
2146 |
-
return Boolean(this._ws && this._ws.readyState === STATE.OPEN);
|
2147 |
-
}
|
2148 |
-
|
2149 |
-
/**
|
2150 |
-
* Is WebSocket connection in closing state.
|
2151 |
-
*
|
2152 |
-
* @returns {Boolean}
|
2153 |
-
*/
|
2154 |
-
get isClosing() {
|
2155 |
-
return Boolean(this._ws && this._ws.readyState === STATE.CLOSING);
|
2156 |
-
}
|
2157 |
-
|
2158 |
-
/**
|
2159 |
-
* Is WebSocket connection closed.
|
2160 |
-
*
|
2161 |
-
* @returns {Boolean}
|
2162 |
-
*/
|
2163 |
-
get isClosed() {
|
2164 |
-
return Boolean(!this._ws || this._ws.readyState === STATE.CLOSED);
|
2165 |
-
}
|
2166 |
-
|
2167 |
-
/**
|
2168 |
-
* Event channel triggered when connection is opened.
|
2169 |
-
*
|
2170 |
-
* @see https://vitalets.github.io/chnl/#channel
|
2171 |
-
* @example
|
2172 |
-
* wsp.onOpen.addListener(() => console.log('Connection opened'));
|
2173 |
-
*
|
2174 |
-
* @returns {Channel}
|
2175 |
-
*/
|
2176 |
-
get onOpen() {
|
2177 |
-
return this._onOpen;
|
2178 |
-
}
|
2179 |
-
|
2180 |
-
/**
|
2181 |
-
* Event channel triggered every time when message is sent to server.
|
2182 |
-
*
|
2183 |
-
* @see https://vitalets.github.io/chnl/#channel
|
2184 |
-
* @example
|
2185 |
-
* wsp.onSend.addListener(data => console.log('Message sent', data));
|
2186 |
-
*
|
2187 |
-
* @returns {Channel}
|
2188 |
-
*/
|
2189 |
-
get onSend() {
|
2190 |
-
return this._onSend;
|
2191 |
-
}
|
2192 |
-
|
2193 |
-
/**
|
2194 |
-
* Event channel triggered every time when message received from server.
|
2195 |
-
*
|
2196 |
-
* @see https://vitalets.github.io/chnl/#channel
|
2197 |
-
* @example
|
2198 |
-
* wsp.onMessage.addListener(message => console.log(message));
|
2199 |
-
*
|
2200 |
-
* @returns {Channel}
|
2201 |
-
*/
|
2202 |
-
get onMessage() {
|
2203 |
-
return this._onMessage;
|
2204 |
-
}
|
2205 |
-
|
2206 |
-
/**
|
2207 |
-
* Event channel triggered every time when received message is successfully unpacked.
|
2208 |
-
* For example, if you are using JSON transport, the listener will receive already JSON parsed data.
|
2209 |
-
*
|
2210 |
-
* @see https://vitalets.github.io/chnl/#channel
|
2211 |
-
* @example
|
2212 |
-
* wsp.onUnpackedMessage.addListener(data => console.log(data.foo));
|
2213 |
-
*
|
2214 |
-
* @returns {Channel}
|
2215 |
-
*/
|
2216 |
-
get onUnpackedMessage() {
|
2217 |
-
return this._onUnpackedMessage;
|
2218 |
-
}
|
2219 |
-
|
2220 |
-
/**
|
2221 |
-
* Event channel triggered every time when response to some request comes.
|
2222 |
-
* Received message considered a response if requestId is found in it.
|
2223 |
-
*
|
2224 |
-
* @see https://vitalets.github.io/chnl/#channel
|
2225 |
-
* @example
|
2226 |
-
* wsp.onResponse.addListener(data => console.log(data));
|
2227 |
-
*
|
2228 |
-
* @returns {Channel}
|
2229 |
-
*/
|
2230 |
-
get onResponse() {
|
2231 |
-
return this._onResponse;
|
2232 |
-
}
|
2233 |
-
|
2234 |
-
/**
|
2235 |
-
* Event channel triggered when connection closed.
|
2236 |
-
* Listener accepts single argument `{code, reason}`.
|
2237 |
-
*
|
2238 |
-
* @see https://vitalets.github.io/chnl/#channel
|
2239 |
-
* @example
|
2240 |
-
* wsp.onClose.addListener(event => console.log(`Connections closed: ${event.reason}`));
|
2241 |
-
*
|
2242 |
-
* @returns {Channel}
|
2243 |
-
*/
|
2244 |
-
get onClose() {
|
2245 |
-
return this._onClose;
|
2246 |
-
}
|
2247 |
-
|
2248 |
-
/**
|
2249 |
-
* Event channel triggered when by Websocket 'error' event.
|
2250 |
-
*
|
2251 |
-
* @see https://vitalets.github.io/chnl/#channel
|
2252 |
-
* @example
|
2253 |
-
* wsp.onError.addListener(event => console.error(event));
|
2254 |
-
*
|
2255 |
-
* @returns {Channel}
|
2256 |
-
*/
|
2257 |
-
get onError() {
|
2258 |
-
return this._onError;
|
2259 |
-
}
|
2260 |
-
|
2261 |
-
/**
|
2262 |
-
* Opens WebSocket connection. If connection already opened, promise will be resolved with "open event".
|
2263 |
-
*
|
2264 |
-
* @returns {Promise<Event>}
|
2265 |
-
*/
|
2266 |
-
open() {
|
2267 |
-
if (this.isClosing) {
|
2268 |
-
return Promise.reject(new Error(`Can't open WebSocket while closing.`));
|
2269 |
-
}
|
2270 |
-
if (this.isOpened) {
|
2271 |
-
return this._opening.promise;
|
2272 |
-
}
|
2273 |
-
return this._opening.call(() => {
|
2274 |
-
this._opening.promise.catch(e => this._cleanup(e));
|
2275 |
-
this._createWS();
|
2276 |
-
});
|
2277 |
-
}
|
2278 |
-
|
2279 |
-
/**
|
2280 |
-
* Performs request and waits for response.
|
2281 |
-
*
|
2282 |
-
* @param {*} data
|
2283 |
-
* @param {Object} [options]
|
2284 |
-
* @param {String|Number} [options.requestId=<auto-generated>]
|
2285 |
-
* @param {Number} [options.timeout=0]
|
2286 |
-
* @returns {Promise}
|
2287 |
-
*/
|
2288 |
-
sendRequest(data, options = {}) {
|
2289 |
-
const requestId = options.requestId || `${Math.random()}`;
|
2290 |
-
const timeout = options.timeout !== undefined ? options.timeout : this._options.timeout;
|
2291 |
-
return this._requests.create(requestId, () => {
|
2292 |
-
this._assertRequestIdHandlers();
|
2293 |
-
const finalData = this._options.attachRequestId(data, requestId);
|
2294 |
-
this.sendPacked(finalData);
|
2295 |
-
}, timeout);
|
2296 |
-
}
|
2297 |
-
|
2298 |
-
/**
|
2299 |
-
* Packs data with `options.packMessage` and sends to the server.
|
2300 |
-
*
|
2301 |
-
* @param {*} data
|
2302 |
-
*/
|
2303 |
-
sendPacked(data) {
|
2304 |
-
this._assertPackingHandlers();
|
2305 |
-
const message = this._options.packMessage(data);
|
2306 |
-
this.send(message);
|
2307 |
-
}
|
2308 |
-
|
2309 |
-
/**
|
2310 |
-
* Sends data without packing.
|
2311 |
-
*
|
2312 |
-
* @param {String|Blob|ArrayBuffer} data
|
2313 |
-
*/
|
2314 |
-
send(data) {
|
2315 |
-
throwIf(!this.isOpened, `Can't send data because WebSocket is not opened.`);
|
2316 |
-
this._ws.send(data);
|
2317 |
-
this._onSend.dispatchAsync(data);
|
2318 |
-
}
|
2319 |
-
|
2320 |
-
/**
|
2321 |
-
* Waits for particular message to come.
|
2322 |
-
*
|
2323 |
-
* @param {Function} predicate function to check incoming message.
|
2324 |
-
* @param {Object} [options]
|
2325 |
-
* @param {Number} [options.timeout=0]
|
2326 |
-
* @param {Error} [options.timeoutError]
|
2327 |
-
* @returns {Promise}
|
2328 |
-
*
|
2329 |
-
* @example
|
2330 |
-
* const response = await wsp.waitUnpackedMessage(data => data && data.foo === 'bar');
|
2331 |
-
*/
|
2332 |
-
waitUnpackedMessage(predicate, options = {}) {
|
2333 |
-
throwIf(typeof predicate !== 'function', `Predicate must be a function, got ${typeof predicate}`);
|
2334 |
-
if (options.timeout) {
|
2335 |
-
setTimeout(() => {
|
2336 |
-
if (this._promisedMap.has(predicate)) {
|
2337 |
-
const error = options.timeoutError || new Error('Timeout');
|
2338 |
-
this._promisedMap.reject(predicate, error);
|
2339 |
-
}
|
2340 |
-
}, options.timeout);
|
2341 |
-
}
|
2342 |
-
return this._promisedMap.set(predicate);
|
2343 |
-
}
|
2344 |
-
|
2345 |
-
/**
|
2346 |
-
* Closes WebSocket connection. If connection already closed, promise will be resolved with "close event".
|
2347 |
-
*
|
2348 |
-
* @param {number=} [code=1000] A numeric value indicating the status code.
|
2349 |
-
* @param {string=} [reason] A human-readable reason for closing connection.
|
2350 |
-
* @returns {Promise<Event>}
|
2351 |
-
*/
|
2352 |
-
close(code, reason) { // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close
|
2353 |
-
return this.isClosed
|
2354 |
-
? Promise.resolve(this._closing.value)
|
2355 |
-
: this._closing.call(() => this._ws.close(code, reason));
|
2356 |
-
}
|
2357 |
-
|
2358 |
-
/**
|
2359 |
-
* Removes all listeners from WSP instance. Useful for cleanup.
|
2360 |
-
*/
|
2361 |
-
removeAllListeners() {
|
2362 |
-
this._onOpen.removeAllListeners();
|
2363 |
-
this._onMessage.removeAllListeners();
|
2364 |
-
this._onUnpackedMessage.removeAllListeners();
|
2365 |
-
this._onResponse.removeAllListeners();
|
2366 |
-
this._onSend.removeAllListeners();
|
2367 |
-
this._onClose.removeAllListeners();
|
2368 |
-
this._onError.removeAllListeners();
|
2369 |
-
}
|
2370 |
-
|
2371 |
-
_createOpeningController() {
|
2372 |
-
const connectionTimeout = this._options.connectionTimeout || this._options.timeout;
|
2373 |
-
this._opening = new PromiseController({
|
2374 |
-
timeout: connectionTimeout,
|
2375 |
-
timeoutReason: `Can't open WebSocket within allowed timeout: ${connectionTimeout} ms.`
|
2376 |
-
});
|
2377 |
-
}
|
2378 |
-
|
2379 |
-
_createClosingController() {
|
2380 |
-
const closingTimeout = this._options.timeout;
|
2381 |
-
this._closing = new PromiseController({
|
2382 |
-
timeout: closingTimeout,
|
2383 |
-
timeoutReason: `Can't close WebSocket within allowed timeout: ${closingTimeout} ms.`
|
2384 |
-
});
|
2385 |
-
}
|
2386 |
-
|
2387 |
-
_createChannels() {
|
2388 |
-
this._onOpen = new Channel();
|
2389 |
-
this._onMessage = new Channel();
|
2390 |
-
this._onUnpackedMessage = new Channel();
|
2391 |
-
this._onResponse = new Channel();
|
2392 |
-
this._onSend = new Channel();
|
2393 |
-
this._onClose = new Channel();
|
2394 |
-
this._onError = new Channel();
|
2395 |
-
}
|
2396 |
-
|
2397 |
-
_createWS() {
|
2398 |
-
this._ws = this._options.createWebSocket(this._url);
|
2399 |
-
this._wsSubscription = new Channel.Subscription([
|
2400 |
-
{ channel: this._ws, event: 'open', listener: e => this._handleOpen(e) },
|
2401 |
-
{ channel: this._ws, event: 'message', listener: e => this._handleMessage(e) },
|
2402 |
-
{ channel: this._ws, event: 'error', listener: e => this._handleError(e) },
|
2403 |
-
{ channel: this._ws, event: 'close', listener: e => this._handleClose(e) },
|
2404 |
-
]).on();
|
2405 |
-
}
|
2406 |
-
|
2407 |
-
_handleOpen(event) {
|
2408 |
-
this._onOpen.dispatchAsync(event);
|
2409 |
-
this._opening.resolve(event);
|
2410 |
-
}
|
2411 |
-
|
2412 |
-
_handleMessage(event) {
|
2413 |
-
const data = this._options.extractMessageData(event);
|
2414 |
-
this._onMessage.dispatchAsync(data);
|
2415 |
-
this._tryUnpack(data);
|
2416 |
-
}
|
2417 |
-
|
2418 |
-
_tryUnpack(data) {
|
2419 |
-
if (this._options.unpackMessage) {
|
2420 |
-
data = this._options.unpackMessage(data);
|
2421 |
-
if (isPromise(data)) {
|
2422 |
-
data.then(data => this._handleUnpackedData(data));
|
2423 |
-
} else {
|
2424 |
-
this._handleUnpackedData(data);
|
2425 |
-
}
|
2426 |
-
}
|
2427 |
-
}
|
2428 |
-
|
2429 |
-
_handleUnpackedData(data) {
|
2430 |
-
if (data !== undefined) {
|
2431 |
-
// todo: maybe trigger onUnpackedMessage always?
|
2432 |
-
this._onUnpackedMessage.dispatchAsync(data);
|
2433 |
-
this._tryHandleResponse(data);
|
2434 |
-
}
|
2435 |
-
this._tryHandleWaitingMessage(data);
|
2436 |
-
}
|
2437 |
-
|
2438 |
-
_tryHandleResponse(data) {
|
2439 |
-
if (this._options.extractRequestId) {
|
2440 |
-
const requestId = this._options.extractRequestId(data);
|
2441 |
-
if (requestId) {
|
2442 |
-
this._onResponse.dispatchAsync(data, requestId);
|
2443 |
-
this._requests.resolve(requestId, data);
|
2444 |
-
}
|
2445 |
-
}
|
2446 |
-
}
|
2447 |
-
|
2448 |
-
_tryHandleWaitingMessage(data) {
|
2449 |
-
this._promisedMap.forEach((_, predicate) => {
|
2450 |
-
let isMatched = false;
|
2451 |
-
try {
|
2452 |
-
isMatched = predicate(data);
|
2453 |
-
} catch (e) {
|
2454 |
-
this._promisedMap.reject(predicate, e);
|
2455 |
-
return;
|
2456 |
-
}
|
2457 |
-
if (isMatched) {
|
2458 |
-
this._promisedMap.resolve(predicate, data);
|
2459 |
-
}
|
2460 |
-
});
|
2461 |
-
}
|
2462 |
-
|
2463 |
-
_handleError(event) {
|
2464 |
-
this._onError.dispatchAsync(event);
|
2465 |
-
}
|
2466 |
-
|
2467 |
-
_handleClose(event) {
|
2468 |
-
this._onClose.dispatchAsync(event);
|
2469 |
-
this._closing.resolve(event);
|
2470 |
-
const error = new Error(`WebSocket closed with reason: ${event.reason} (${event.code}).`);
|
2471 |
-
if (this._opening.isPending) {
|
2472 |
-
this._opening.reject(error);
|
2473 |
-
}
|
2474 |
-
this._cleanup(error);
|
2475 |
-
}
|
2476 |
-
|
2477 |
-
_cleanupWS() {
|
2478 |
-
if (this._wsSubscription) {
|
2479 |
-
this._wsSubscription.off();
|
2480 |
-
this._wsSubscription = null;
|
2481 |
-
}
|
2482 |
-
this._ws = null;
|
2483 |
-
}
|
2484 |
-
|
2485 |
-
_cleanup(error) {
|
2486 |
-
this._cleanupWS();
|
2487 |
-
this._requests.rejectAll(error);
|
2488 |
-
}
|
2489 |
-
|
2490 |
-
_assertOptions(options) {
|
2491 |
-
Object.keys(options || {}).forEach(key => {
|
2492 |
-
if (!defaultOptions.hasOwnProperty(key)) {
|
2493 |
-
throw new Error(`Unknown option: ${key}`);
|
2494 |
-
}
|
2495 |
-
});
|
2496 |
-
}
|
2497 |
-
|
2498 |
-
_assertPackingHandlers() {
|
2499 |
-
const { packMessage, unpackMessage } = this._options;
|
2500 |
-
throwIf(!packMessage || !unpackMessage,
|
2501 |
-
`Please define 'options.packMessage / options.unpackMessage' for sending packed messages.`
|
2502 |
-
);
|
2503 |
-
}
|
2504 |
-
|
2505 |
-
_assertRequestIdHandlers() {
|
2506 |
-
const { attachRequestId, extractRequestId } = this._options;
|
2507 |
-
throwIf(!attachRequestId || !extractRequestId,
|
2508 |
-
`Please define 'options.attachRequestId / options.extractRequestId' for sending requests.`
|
2509 |
-
);
|
2510 |
-
}
|
2511 |
-
}
|
2512 |
-
|
2513 |
-
module.exports = WebSocketAsPromised;
|
2514 |
-
|
2515 |
-
},{"./options":43,"./requests":44,"./utils":45,"chnl":3,"promise-controller":35,"promised-map":42}]},{},[]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/dat-gui/dat.gui.js
DELETED
@@ -1,2538 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* dat-gui JavaScript Controller Library
|
3 |
-
* http://code.google.com/p/dat-gui
|
4 |
-
*
|
5 |
-
* Copyright 2011 Data Arts Team, Google Creative Lab
|
6 |
-
*
|
7 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
8 |
-
* you may not use this file except in compliance with the License.
|
9 |
-
* You may obtain a copy of the License at
|
10 |
-
*
|
11 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
12 |
-
*/
|
13 |
-
|
14 |
-
(function (global, factory) {
|
15 |
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
16 |
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
17 |
-
(factory((global.dat = {})));
|
18 |
-
}(this, (function (exports) { 'use strict';
|
19 |
-
|
20 |
-
function ___$insertStyle(css) {
|
21 |
-
if (!css) {
|
22 |
-
return;
|
23 |
-
}
|
24 |
-
if (typeof window === 'undefined') {
|
25 |
-
return;
|
26 |
-
}
|
27 |
-
|
28 |
-
var style = document.createElement('style');
|
29 |
-
|
30 |
-
style.setAttribute('type', 'text/css');
|
31 |
-
style.innerHTML = css;
|
32 |
-
document.head.appendChild(style);
|
33 |
-
|
34 |
-
return css;
|
35 |
-
}
|
36 |
-
|
37 |
-
function colorToString (color, forceCSSHex) {
|
38 |
-
var colorFormat = color.__state.conversionName.toString();
|
39 |
-
var r = Math.round(color.r);
|
40 |
-
var g = Math.round(color.g);
|
41 |
-
var b = Math.round(color.b);
|
42 |
-
var a = color.a;
|
43 |
-
var h = Math.round(color.h);
|
44 |
-
var s = color.s.toFixed(1);
|
45 |
-
var v = color.v.toFixed(1);
|
46 |
-
if (forceCSSHex || colorFormat === 'THREE_CHAR_HEX' || colorFormat === 'SIX_CHAR_HEX') {
|
47 |
-
var str = color.hex.toString(16);
|
48 |
-
while (str.length < 6) {
|
49 |
-
str = '0' + str;
|
50 |
-
}
|
51 |
-
return '#' + str;
|
52 |
-
} else if (colorFormat === 'CSS_RGB') {
|
53 |
-
return 'rgb(' + r + ',' + g + ',' + b + ')';
|
54 |
-
} else if (colorFormat === 'CSS_RGBA') {
|
55 |
-
return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
|
56 |
-
} else if (colorFormat === 'HEX') {
|
57 |
-
return '0x' + color.hex.toString(16);
|
58 |
-
} else if (colorFormat === 'RGB_ARRAY') {
|
59 |
-
return '[' + r + ',' + g + ',' + b + ']';
|
60 |
-
} else if (colorFormat === 'RGBA_ARRAY') {
|
61 |
-
return '[' + r + ',' + g + ',' + b + ',' + a + ']';
|
62 |
-
} else if (colorFormat === 'RGB_OBJ') {
|
63 |
-
return '{r:' + r + ',g:' + g + ',b:' + b + '}';
|
64 |
-
} else if (colorFormat === 'RGBA_OBJ') {
|
65 |
-
return '{r:' + r + ',g:' + g + ',b:' + b + ',a:' + a + '}';
|
66 |
-
} else if (colorFormat === 'HSV_OBJ') {
|
67 |
-
return '{h:' + h + ',s:' + s + ',v:' + v + '}';
|
68 |
-
} else if (colorFormat === 'HSVA_OBJ') {
|
69 |
-
return '{h:' + h + ',s:' + s + ',v:' + v + ',a:' + a + '}';
|
70 |
-
}
|
71 |
-
return 'unknown format';
|
72 |
-
}
|
73 |
-
|
74 |
-
var ARR_EACH = Array.prototype.forEach;
|
75 |
-
var ARR_SLICE = Array.prototype.slice;
|
76 |
-
var Common = {
|
77 |
-
BREAK: {},
|
78 |
-
extend: function extend(target) {
|
79 |
-
this.each(ARR_SLICE.call(arguments, 1), function (obj) {
|
80 |
-
var keys = this.isObject(obj) ? Object.keys(obj) : [];
|
81 |
-
keys.forEach(function (key) {
|
82 |
-
if (!this.isUndefined(obj[key])) {
|
83 |
-
target[key] = obj[key];
|
84 |
-
}
|
85 |
-
}.bind(this));
|
86 |
-
}, this);
|
87 |
-
return target;
|
88 |
-
},
|
89 |
-
defaults: function defaults(target) {
|
90 |
-
this.each(ARR_SLICE.call(arguments, 1), function (obj) {
|
91 |
-
var keys = this.isObject(obj) ? Object.keys(obj) : [];
|
92 |
-
keys.forEach(function (key) {
|
93 |
-
if (this.isUndefined(target[key])) {
|
94 |
-
target[key] = obj[key];
|
95 |
-
}
|
96 |
-
}.bind(this));
|
97 |
-
}, this);
|
98 |
-
return target;
|
99 |
-
},
|
100 |
-
compose: function compose() {
|
101 |
-
var toCall = ARR_SLICE.call(arguments);
|
102 |
-
return function () {
|
103 |
-
var args = ARR_SLICE.call(arguments);
|
104 |
-
for (var i = toCall.length - 1; i >= 0; i--) {
|
105 |
-
args = [toCall[i].apply(this, args)];
|
106 |
-
}
|
107 |
-
return args[0];
|
108 |
-
};
|
109 |
-
},
|
110 |
-
each: function each(obj, itr, scope) {
|
111 |
-
if (!obj) {
|
112 |
-
return;
|
113 |
-
}
|
114 |
-
if (ARR_EACH && obj.forEach && obj.forEach === ARR_EACH) {
|
115 |
-
obj.forEach(itr, scope);
|
116 |
-
} else if (obj.length === obj.length + 0) {
|
117 |
-
var key = void 0;
|
118 |
-
var l = void 0;
|
119 |
-
for (key = 0, l = obj.length; key < l; key++) {
|
120 |
-
if (key in obj && itr.call(scope, obj[key], key) === this.BREAK) {
|
121 |
-
return;
|
122 |
-
}
|
123 |
-
}
|
124 |
-
} else {
|
125 |
-
for (var _key in obj) {
|
126 |
-
if (itr.call(scope, obj[_key], _key) === this.BREAK) {
|
127 |
-
return;
|
128 |
-
}
|
129 |
-
}
|
130 |
-
}
|
131 |
-
},
|
132 |
-
defer: function defer(fnc) {
|
133 |
-
setTimeout(fnc, 0);
|
134 |
-
},
|
135 |
-
debounce: function debounce(func, threshold, callImmediately) {
|
136 |
-
var timeout = void 0;
|
137 |
-
return function () {
|
138 |
-
var obj = this;
|
139 |
-
var args = arguments;
|
140 |
-
function delayed() {
|
141 |
-
timeout = null;
|
142 |
-
if (!callImmediately) func.apply(obj, args);
|
143 |
-
}
|
144 |
-
var callNow = callImmediately || !timeout;
|
145 |
-
clearTimeout(timeout);
|
146 |
-
timeout = setTimeout(delayed, threshold);
|
147 |
-
if (callNow) {
|
148 |
-
func.apply(obj, args);
|
149 |
-
}
|
150 |
-
};
|
151 |
-
},
|
152 |
-
toArray: function toArray(obj) {
|
153 |
-
if (obj.toArray) return obj.toArray();
|
154 |
-
return ARR_SLICE.call(obj);
|
155 |
-
},
|
156 |
-
isUndefined: function isUndefined(obj) {
|
157 |
-
return obj === undefined;
|
158 |
-
},
|
159 |
-
isNull: function isNull(obj) {
|
160 |
-
return obj === null;
|
161 |
-
},
|
162 |
-
isNaN: function (_isNaN) {
|
163 |
-
function isNaN(_x) {
|
164 |
-
return _isNaN.apply(this, arguments);
|
165 |
-
}
|
166 |
-
isNaN.toString = function () {
|
167 |
-
return _isNaN.toString();
|
168 |
-
};
|
169 |
-
return isNaN;
|
170 |
-
}(function (obj) {
|
171 |
-
return isNaN(obj);
|
172 |
-
}),
|
173 |
-
isArray: Array.isArray || function (obj) {
|
174 |
-
return obj.constructor === Array;
|
175 |
-
},
|
176 |
-
isObject: function isObject(obj) {
|
177 |
-
return obj === Object(obj);
|
178 |
-
},
|
179 |
-
isNumber: function isNumber(obj) {
|
180 |
-
return obj === obj + 0;
|
181 |
-
},
|
182 |
-
isString: function isString(obj) {
|
183 |
-
return obj === obj + '';
|
184 |
-
},
|
185 |
-
isBoolean: function isBoolean(obj) {
|
186 |
-
return obj === false || obj === true;
|
187 |
-
},
|
188 |
-
isFunction: function isFunction(obj) {
|
189 |
-
return obj instanceof Function;
|
190 |
-
}
|
191 |
-
};
|
192 |
-
|
193 |
-
var INTERPRETATIONS = [
|
194 |
-
{
|
195 |
-
litmus: Common.isString,
|
196 |
-
conversions: {
|
197 |
-
THREE_CHAR_HEX: {
|
198 |
-
read: function read(original) {
|
199 |
-
var test = original.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);
|
200 |
-
if (test === null) {
|
201 |
-
return false;
|
202 |
-
}
|
203 |
-
return {
|
204 |
-
space: 'HEX',
|
205 |
-
hex: parseInt('0x' + test[1].toString() + test[1].toString() + test[2].toString() + test[2].toString() + test[3].toString() + test[3].toString(), 0)
|
206 |
-
};
|
207 |
-
},
|
208 |
-
write: colorToString
|
209 |
-
},
|
210 |
-
SIX_CHAR_HEX: {
|
211 |
-
read: function read(original) {
|
212 |
-
var test = original.match(/^#([A-F0-9]{6})$/i);
|
213 |
-
if (test === null) {
|
214 |
-
return false;
|
215 |
-
}
|
216 |
-
return {
|
217 |
-
space: 'HEX',
|
218 |
-
hex: parseInt('0x' + test[1].toString(), 0)
|
219 |
-
};
|
220 |
-
},
|
221 |
-
write: colorToString
|
222 |
-
},
|
223 |
-
CSS_RGB: {
|
224 |
-
read: function read(original) {
|
225 |
-
var test = original.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
|
226 |
-
if (test === null) {
|
227 |
-
return false;
|
228 |
-
}
|
229 |
-
return {
|
230 |
-
space: 'RGB',
|
231 |
-
r: parseFloat(test[1]),
|
232 |
-
g: parseFloat(test[2]),
|
233 |
-
b: parseFloat(test[3])
|
234 |
-
};
|
235 |
-
},
|
236 |
-
write: colorToString
|
237 |
-
},
|
238 |
-
CSS_RGBA: {
|
239 |
-
read: function read(original) {
|
240 |
-
var test = original.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
|
241 |
-
if (test === null) {
|
242 |
-
return false;
|
243 |
-
}
|
244 |
-
return {
|
245 |
-
space: 'RGB',
|
246 |
-
r: parseFloat(test[1]),
|
247 |
-
g: parseFloat(test[2]),
|
248 |
-
b: parseFloat(test[3]),
|
249 |
-
a: parseFloat(test[4])
|
250 |
-
};
|
251 |
-
},
|
252 |
-
write: colorToString
|
253 |
-
}
|
254 |
-
}
|
255 |
-
},
|
256 |
-
{
|
257 |
-
litmus: Common.isNumber,
|
258 |
-
conversions: {
|
259 |
-
HEX: {
|
260 |
-
read: function read(original) {
|
261 |
-
return {
|
262 |
-
space: 'HEX',
|
263 |
-
hex: original,
|
264 |
-
conversionName: 'HEX'
|
265 |
-
};
|
266 |
-
},
|
267 |
-
write: function write(color) {
|
268 |
-
return color.hex;
|
269 |
-
}
|
270 |
-
}
|
271 |
-
}
|
272 |
-
},
|
273 |
-
{
|
274 |
-
litmus: Common.isArray,
|
275 |
-
conversions: {
|
276 |
-
RGB_ARRAY: {
|
277 |
-
read: function read(original) {
|
278 |
-
if (original.length !== 3) {
|
279 |
-
return false;
|
280 |
-
}
|
281 |
-
return {
|
282 |
-
space: 'RGB',
|
283 |
-
r: original[0],
|
284 |
-
g: original[1],
|
285 |
-
b: original[2]
|
286 |
-
};
|
287 |
-
},
|
288 |
-
write: function write(color) {
|
289 |
-
return [color.r, color.g, color.b];
|
290 |
-
}
|
291 |
-
},
|
292 |
-
RGBA_ARRAY: {
|
293 |
-
read: function read(original) {
|
294 |
-
if (original.length !== 4) return false;
|
295 |
-
return {
|
296 |
-
space: 'RGB',
|
297 |
-
r: original[0],
|
298 |
-
g: original[1],
|
299 |
-
b: original[2],
|
300 |
-
a: original[3]
|
301 |
-
};
|
302 |
-
},
|
303 |
-
write: function write(color) {
|
304 |
-
return [color.r, color.g, color.b, color.a];
|
305 |
-
}
|
306 |
-
}
|
307 |
-
}
|
308 |
-
},
|
309 |
-
{
|
310 |
-
litmus: Common.isObject,
|
311 |
-
conversions: {
|
312 |
-
RGBA_OBJ: {
|
313 |
-
read: function read(original) {
|
314 |
-
if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b) && Common.isNumber(original.a)) {
|
315 |
-
return {
|
316 |
-
space: 'RGB',
|
317 |
-
r: original.r,
|
318 |
-
g: original.g,
|
319 |
-
b: original.b,
|
320 |
-
a: original.a
|
321 |
-
};
|
322 |
-
}
|
323 |
-
return false;
|
324 |
-
},
|
325 |
-
write: function write(color) {
|
326 |
-
return {
|
327 |
-
r: color.r,
|
328 |
-
g: color.g,
|
329 |
-
b: color.b,
|
330 |
-
a: color.a
|
331 |
-
};
|
332 |
-
}
|
333 |
-
},
|
334 |
-
RGB_OBJ: {
|
335 |
-
read: function read(original) {
|
336 |
-
if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b)) {
|
337 |
-
return {
|
338 |
-
space: 'RGB',
|
339 |
-
r: original.r,
|
340 |
-
g: original.g,
|
341 |
-
b: original.b
|
342 |
-
};
|
343 |
-
}
|
344 |
-
return false;
|
345 |
-
},
|
346 |
-
write: function write(color) {
|
347 |
-
return {
|
348 |
-
r: color.r,
|
349 |
-
g: color.g,
|
350 |
-
b: color.b
|
351 |
-
};
|
352 |
-
}
|
353 |
-
},
|
354 |
-
HSVA_OBJ: {
|
355 |
-
read: function read(original) {
|
356 |
-
if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v) && Common.isNumber(original.a)) {
|
357 |
-
return {
|
358 |
-
space: 'HSV',
|
359 |
-
h: original.h,
|
360 |
-
s: original.s,
|
361 |
-
v: original.v,
|
362 |
-
a: original.a
|
363 |
-
};
|
364 |
-
}
|
365 |
-
return false;
|
366 |
-
},
|
367 |
-
write: function write(color) {
|
368 |
-
return {
|
369 |
-
h: color.h,
|
370 |
-
s: color.s,
|
371 |
-
v: color.v,
|
372 |
-
a: color.a
|
373 |
-
};
|
374 |
-
}
|
375 |
-
},
|
376 |
-
HSV_OBJ: {
|
377 |
-
read: function read(original) {
|
378 |
-
if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v)) {
|
379 |
-
return {
|
380 |
-
space: 'HSV',
|
381 |
-
h: original.h,
|
382 |
-
s: original.s,
|
383 |
-
v: original.v
|
384 |
-
};
|
385 |
-
}
|
386 |
-
return false;
|
387 |
-
},
|
388 |
-
write: function write(color) {
|
389 |
-
return {
|
390 |
-
h: color.h,
|
391 |
-
s: color.s,
|
392 |
-
v: color.v
|
393 |
-
};
|
394 |
-
}
|
395 |
-
}
|
396 |
-
}
|
397 |
-
}];
|
398 |
-
var result = void 0;
|
399 |
-
var toReturn = void 0;
|
400 |
-
var interpret = function interpret() {
|
401 |
-
toReturn = false;
|
402 |
-
var original = arguments.length > 1 ? Common.toArray(arguments) : arguments[0];
|
403 |
-
Common.each(INTERPRETATIONS, function (family) {
|
404 |
-
if (family.litmus(original)) {
|
405 |
-
Common.each(family.conversions, function (conversion, conversionName) {
|
406 |
-
result = conversion.read(original);
|
407 |
-
if (toReturn === false && result !== false) {
|
408 |
-
toReturn = result;
|
409 |
-
result.conversionName = conversionName;
|
410 |
-
result.conversion = conversion;
|
411 |
-
return Common.BREAK;
|
412 |
-
}
|
413 |
-
});
|
414 |
-
return Common.BREAK;
|
415 |
-
}
|
416 |
-
});
|
417 |
-
return toReturn;
|
418 |
-
};
|
419 |
-
|
420 |
-
var tmpComponent = void 0;
|
421 |
-
var ColorMath = {
|
422 |
-
hsv_to_rgb: function hsv_to_rgb(h, s, v) {
|
423 |
-
var hi = Math.floor(h / 60) % 6;
|
424 |
-
var f = h / 60 - Math.floor(h / 60);
|
425 |
-
var p = v * (1.0 - s);
|
426 |
-
var q = v * (1.0 - f * s);
|
427 |
-
var t = v * (1.0 - (1.0 - f) * s);
|
428 |
-
var c = [[v, t, p], [q, v, p], [p, v, t], [p, q, v], [t, p, v], [v, p, q]][hi];
|
429 |
-
return {
|
430 |
-
r: c[0] * 255,
|
431 |
-
g: c[1] * 255,
|
432 |
-
b: c[2] * 255
|
433 |
-
};
|
434 |
-
},
|
435 |
-
rgb_to_hsv: function rgb_to_hsv(r, g, b) {
|
436 |
-
var min = Math.min(r, g, b);
|
437 |
-
var max = Math.max(r, g, b);
|
438 |
-
var delta = max - min;
|
439 |
-
var h = void 0;
|
440 |
-
var s = void 0;
|
441 |
-
if (max !== 0) {
|
442 |
-
s = delta / max;
|
443 |
-
} else {
|
444 |
-
return {
|
445 |
-
h: NaN,
|
446 |
-
s: 0,
|
447 |
-
v: 0
|
448 |
-
};
|
449 |
-
}
|
450 |
-
if (r === max) {
|
451 |
-
h = (g - b) / delta;
|
452 |
-
} else if (g === max) {
|
453 |
-
h = 2 + (b - r) / delta;
|
454 |
-
} else {
|
455 |
-
h = 4 + (r - g) / delta;
|
456 |
-
}
|
457 |
-
h /= 6;
|
458 |
-
if (h < 0) {
|
459 |
-
h += 1;
|
460 |
-
}
|
461 |
-
return {
|
462 |
-
h: h * 360,
|
463 |
-
s: s,
|
464 |
-
v: max / 255
|
465 |
-
};
|
466 |
-
},
|
467 |
-
rgb_to_hex: function rgb_to_hex(r, g, b) {
|
468 |
-
var hex = this.hex_with_component(0, 2, r);
|
469 |
-
hex = this.hex_with_component(hex, 1, g);
|
470 |
-
hex = this.hex_with_component(hex, 0, b);
|
471 |
-
return hex;
|
472 |
-
},
|
473 |
-
component_from_hex: function component_from_hex(hex, componentIndex) {
|
474 |
-
return hex >> componentIndex * 8 & 0xFF;
|
475 |
-
},
|
476 |
-
hex_with_component: function hex_with_component(hex, componentIndex, value) {
|
477 |
-
return value << (tmpComponent = componentIndex * 8) | hex & ~(0xFF << tmpComponent);
|
478 |
-
}
|
479 |
-
};
|
480 |
-
|
481 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
482 |
-
return typeof obj;
|
483 |
-
} : function (obj) {
|
484 |
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
485 |
-
};
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
var classCallCheck = function (instance, Constructor) {
|
498 |
-
if (!(instance instanceof Constructor)) {
|
499 |
-
throw new TypeError("Cannot call a class as a function");
|
500 |
-
}
|
501 |
-
};
|
502 |
-
|
503 |
-
var createClass = function () {
|
504 |
-
function defineProperties(target, props) {
|
505 |
-
for (var i = 0; i < props.length; i++) {
|
506 |
-
var descriptor = props[i];
|
507 |
-
descriptor.enumerable = descriptor.enumerable || false;
|
508 |
-
descriptor.configurable = true;
|
509 |
-
if ("value" in descriptor) descriptor.writable = true;
|
510 |
-
Object.defineProperty(target, descriptor.key, descriptor);
|
511 |
-
}
|
512 |
-
}
|
513 |
-
|
514 |
-
return function (Constructor, protoProps, staticProps) {
|
515 |
-
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
516 |
-
if (staticProps) defineProperties(Constructor, staticProps);
|
517 |
-
return Constructor;
|
518 |
-
};
|
519 |
-
}();
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
var get = function get(object, property, receiver) {
|
528 |
-
if (object === null) object = Function.prototype;
|
529 |
-
var desc = Object.getOwnPropertyDescriptor(object, property);
|
530 |
-
|
531 |
-
if (desc === undefined) {
|
532 |
-
var parent = Object.getPrototypeOf(object);
|
533 |
-
|
534 |
-
if (parent === null) {
|
535 |
-
return undefined;
|
536 |
-
} else {
|
537 |
-
return get(parent, property, receiver);
|
538 |
-
}
|
539 |
-
} else if ("value" in desc) {
|
540 |
-
return desc.value;
|
541 |
-
} else {
|
542 |
-
var getter = desc.get;
|
543 |
-
|
544 |
-
if (getter === undefined) {
|
545 |
-
return undefined;
|
546 |
-
}
|
547 |
-
|
548 |
-
return getter.call(receiver);
|
549 |
-
}
|
550 |
-
};
|
551 |
-
|
552 |
-
var inherits = function (subClass, superClass) {
|
553 |
-
if (typeof superClass !== "function" && superClass !== null) {
|
554 |
-
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
555 |
-
}
|
556 |
-
|
557 |
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
558 |
-
constructor: {
|
559 |
-
value: subClass,
|
560 |
-
enumerable: false,
|
561 |
-
writable: true,
|
562 |
-
configurable: true
|
563 |
-
}
|
564 |
-
});
|
565 |
-
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
566 |
-
};
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
var possibleConstructorReturn = function (self, call) {
|
579 |
-
if (!self) {
|
580 |
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
581 |
-
}
|
582 |
-
|
583 |
-
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
584 |
-
};
|
585 |
-
|
586 |
-
var Color = function () {
|
587 |
-
function Color() {
|
588 |
-
classCallCheck(this, Color);
|
589 |
-
this.__state = interpret.apply(this, arguments);
|
590 |
-
if (this.__state === false) {
|
591 |
-
throw new Error('Failed to interpret color arguments');
|
592 |
-
}
|
593 |
-
this.__state.a = this.__state.a || 1;
|
594 |
-
}
|
595 |
-
createClass(Color, [{
|
596 |
-
key: 'toString',
|
597 |
-
value: function toString() {
|
598 |
-
return colorToString(this);
|
599 |
-
}
|
600 |
-
}, {
|
601 |
-
key: 'toHexString',
|
602 |
-
value: function toHexString() {
|
603 |
-
return colorToString(this, true);
|
604 |
-
}
|
605 |
-
}, {
|
606 |
-
key: 'toOriginal',
|
607 |
-
value: function toOriginal() {
|
608 |
-
return this.__state.conversion.write(this);
|
609 |
-
}
|
610 |
-
}]);
|
611 |
-
return Color;
|
612 |
-
}();
|
613 |
-
function defineRGBComponent(target, component, componentHexIndex) {
|
614 |
-
Object.defineProperty(target, component, {
|
615 |
-
get: function get$$1() {
|
616 |
-
if (this.__state.space === 'RGB') {
|
617 |
-
return this.__state[component];
|
618 |
-
}
|
619 |
-
Color.recalculateRGB(this, component, componentHexIndex);
|
620 |
-
return this.__state[component];
|
621 |
-
},
|
622 |
-
set: function set$$1(v) {
|
623 |
-
if (this.__state.space !== 'RGB') {
|
624 |
-
Color.recalculateRGB(this, component, componentHexIndex);
|
625 |
-
this.__state.space = 'RGB';
|
626 |
-
}
|
627 |
-
this.__state[component] = v;
|
628 |
-
}
|
629 |
-
});
|
630 |
-
}
|
631 |
-
function defineHSVComponent(target, component) {
|
632 |
-
Object.defineProperty(target, component, {
|
633 |
-
get: function get$$1() {
|
634 |
-
if (this.__state.space === 'HSV') {
|
635 |
-
return this.__state[component];
|
636 |
-
}
|
637 |
-
Color.recalculateHSV(this);
|
638 |
-
return this.__state[component];
|
639 |
-
},
|
640 |
-
set: function set$$1(v) {
|
641 |
-
if (this.__state.space !== 'HSV') {
|
642 |
-
Color.recalculateHSV(this);
|
643 |
-
this.__state.space = 'HSV';
|
644 |
-
}
|
645 |
-
this.__state[component] = v;
|
646 |
-
}
|
647 |
-
});
|
648 |
-
}
|
649 |
-
Color.recalculateRGB = function (color, component, componentHexIndex) {
|
650 |
-
if (color.__state.space === 'HEX') {
|
651 |
-
color.__state[component] = ColorMath.component_from_hex(color.__state.hex, componentHexIndex);
|
652 |
-
} else if (color.__state.space === 'HSV') {
|
653 |
-
Common.extend(color.__state, ColorMath.hsv_to_rgb(color.__state.h, color.__state.s, color.__state.v));
|
654 |
-
} else {
|
655 |
-
throw new Error('Corrupted color state');
|
656 |
-
}
|
657 |
-
};
|
658 |
-
Color.recalculateHSV = function (color) {
|
659 |
-
var result = ColorMath.rgb_to_hsv(color.r, color.g, color.b);
|
660 |
-
Common.extend(color.__state, {
|
661 |
-
s: result.s,
|
662 |
-
v: result.v
|
663 |
-
});
|
664 |
-
if (!Common.isNaN(result.h)) {
|
665 |
-
color.__state.h = result.h;
|
666 |
-
} else if (Common.isUndefined(color.__state.h)) {
|
667 |
-
color.__state.h = 0;
|
668 |
-
}
|
669 |
-
};
|
670 |
-
Color.COMPONENTS = ['r', 'g', 'b', 'h', 's', 'v', 'hex', 'a'];
|
671 |
-
defineRGBComponent(Color.prototype, 'r', 2);
|
672 |
-
defineRGBComponent(Color.prototype, 'g', 1);
|
673 |
-
defineRGBComponent(Color.prototype, 'b', 0);
|
674 |
-
defineHSVComponent(Color.prototype, 'h');
|
675 |
-
defineHSVComponent(Color.prototype, 's');
|
676 |
-
defineHSVComponent(Color.prototype, 'v');
|
677 |
-
Object.defineProperty(Color.prototype, 'a', {
|
678 |
-
get: function get$$1() {
|
679 |
-
return this.__state.a;
|
680 |
-
},
|
681 |
-
set: function set$$1(v) {
|
682 |
-
this.__state.a = v;
|
683 |
-
}
|
684 |
-
});
|
685 |
-
Object.defineProperty(Color.prototype, 'hex', {
|
686 |
-
get: function get$$1() {
|
687 |
-
if (this.__state.space !== 'HEX') {
|
688 |
-
this.__state.hex = ColorMath.rgb_to_hex(this.r, this.g, this.b);
|
689 |
-
this.__state.space = 'HEX';
|
690 |
-
}
|
691 |
-
return this.__state.hex;
|
692 |
-
},
|
693 |
-
set: function set$$1(v) {
|
694 |
-
this.__state.space = 'HEX';
|
695 |
-
this.__state.hex = v;
|
696 |
-
}
|
697 |
-
});
|
698 |
-
|
699 |
-
var Controller = function () {
|
700 |
-
function Controller(object, property) {
|
701 |
-
classCallCheck(this, Controller);
|
702 |
-
this.initialValue = object[property];
|
703 |
-
this.domElement = document.createElement('div');
|
704 |
-
this.object = object;
|
705 |
-
this.property = property;
|
706 |
-
this.__onChange = undefined;
|
707 |
-
this.__onFinishChange = undefined;
|
708 |
-
}
|
709 |
-
createClass(Controller, [{
|
710 |
-
key: 'onChange',
|
711 |
-
value: function onChange(fnc) {
|
712 |
-
this.__onChange = fnc;
|
713 |
-
return this;
|
714 |
-
}
|
715 |
-
}, {
|
716 |
-
key: 'onFinishChange',
|
717 |
-
value: function onFinishChange(fnc) {
|
718 |
-
this.__onFinishChange = fnc;
|
719 |
-
return this;
|
720 |
-
}
|
721 |
-
}, {
|
722 |
-
key: 'setValue',
|
723 |
-
value: function setValue(newValue) {
|
724 |
-
this.object[this.property] = newValue;
|
725 |
-
if (this.__onChange) {
|
726 |
-
this.__onChange.call(this, newValue);
|
727 |
-
}
|
728 |
-
this.updateDisplay();
|
729 |
-
return this;
|
730 |
-
}
|
731 |
-
}, {
|
732 |
-
key: 'getValue',
|
733 |
-
value: function getValue() {
|
734 |
-
return this.object[this.property];
|
735 |
-
}
|
736 |
-
}, {
|
737 |
-
key: 'updateDisplay',
|
738 |
-
value: function updateDisplay() {
|
739 |
-
return this;
|
740 |
-
}
|
741 |
-
}, {
|
742 |
-
key: 'isModified',
|
743 |
-
value: function isModified() {
|
744 |
-
return this.initialValue !== this.getValue();
|
745 |
-
}
|
746 |
-
}]);
|
747 |
-
return Controller;
|
748 |
-
}();
|
749 |
-
|
750 |
-
var EVENT_MAP = {
|
751 |
-
HTMLEvents: ['change'],
|
752 |
-
MouseEvents: ['click', 'mousemove', 'mousedown', 'mouseup', 'mouseover'],
|
753 |
-
KeyboardEvents: ['keydown']
|
754 |
-
};
|
755 |
-
var EVENT_MAP_INV = {};
|
756 |
-
Common.each(EVENT_MAP, function (v, k) {
|
757 |
-
Common.each(v, function (e) {
|
758 |
-
EVENT_MAP_INV[e] = k;
|
759 |
-
});
|
760 |
-
});
|
761 |
-
var CSS_VALUE_PIXELS = /(\d+(\.\d+)?)px/;
|
762 |
-
function cssValueToPixels(val) {
|
763 |
-
if (val === '0' || Common.isUndefined(val)) {
|
764 |
-
return 0;
|
765 |
-
}
|
766 |
-
var match = val.match(CSS_VALUE_PIXELS);
|
767 |
-
if (!Common.isNull(match)) {
|
768 |
-
return parseFloat(match[1]);
|
769 |
-
}
|
770 |
-
return 0;
|
771 |
-
}
|
772 |
-
var dom = {
|
773 |
-
makeSelectable: function makeSelectable(elem, selectable) {
|
774 |
-
if (elem === undefined || elem.style === undefined) return;
|
775 |
-
elem.onselectstart = selectable ? function () {
|
776 |
-
return false;
|
777 |
-
} : function () {};
|
778 |
-
elem.style.MozUserSelect = selectable ? 'auto' : 'none';
|
779 |
-
elem.style.KhtmlUserSelect = selectable ? 'auto' : 'none';
|
780 |
-
elem.unselectable = selectable ? 'on' : 'off';
|
781 |
-
},
|
782 |
-
makeFullscreen: function makeFullscreen(elem, hor, vert) {
|
783 |
-
var vertical = vert;
|
784 |
-
var horizontal = hor;
|
785 |
-
if (Common.isUndefined(horizontal)) {
|
786 |
-
horizontal = true;
|
787 |
-
}
|
788 |
-
if (Common.isUndefined(vertical)) {
|
789 |
-
vertical = true;
|
790 |
-
}
|
791 |
-
elem.style.position = 'absolute';
|
792 |
-
if (horizontal) {
|
793 |
-
elem.style.left = 0;
|
794 |
-
elem.style.right = 0;
|
795 |
-
}
|
796 |
-
if (vertical) {
|
797 |
-
elem.style.top = 0;
|
798 |
-
elem.style.bottom = 0;
|
799 |
-
}
|
800 |
-
},
|
801 |
-
fakeEvent: function fakeEvent(elem, eventType, pars, aux) {
|
802 |
-
var params = pars || {};
|
803 |
-
var className = EVENT_MAP_INV[eventType];
|
804 |
-
if (!className) {
|
805 |
-
throw new Error('Event type ' + eventType + ' not supported.');
|
806 |
-
}
|
807 |
-
var evt = document.createEvent(className);
|
808 |
-
switch (className) {
|
809 |
-
case 'MouseEvents':
|
810 |
-
{
|
811 |
-
var clientX = params.x || params.clientX || 0;
|
812 |
-
var clientY = params.y || params.clientY || 0;
|
813 |
-
evt.initMouseEvent(eventType, params.bubbles || false, params.cancelable || true, window, params.clickCount || 1, 0,
|
814 |
-
0,
|
815 |
-
clientX,
|
816 |
-
clientY,
|
817 |
-
false, false, false, false, 0, null);
|
818 |
-
break;
|
819 |
-
}
|
820 |
-
case 'KeyboardEvents':
|
821 |
-
{
|
822 |
-
var init = evt.initKeyboardEvent || evt.initKeyEvent;
|
823 |
-
Common.defaults(params, {
|
824 |
-
cancelable: true,
|
825 |
-
ctrlKey: false,
|
826 |
-
altKey: false,
|
827 |
-
shiftKey: false,
|
828 |
-
metaKey: false,
|
829 |
-
keyCode: undefined,
|
830 |
-
charCode: undefined
|
831 |
-
});
|
832 |
-
init(eventType, params.bubbles || false, params.cancelable, window, params.ctrlKey, params.altKey, params.shiftKey, params.metaKey, params.keyCode, params.charCode);
|
833 |
-
break;
|
834 |
-
}
|
835 |
-
default:
|
836 |
-
{
|
837 |
-
evt.initEvent(eventType, params.bubbles || false, params.cancelable || true);
|
838 |
-
break;
|
839 |
-
}
|
840 |
-
}
|
841 |
-
Common.defaults(evt, aux);
|
842 |
-
elem.dispatchEvent(evt);
|
843 |
-
},
|
844 |
-
bind: function bind(elem, event, func, newBool) {
|
845 |
-
var bool = newBool || false;
|
846 |
-
if (elem.addEventListener) {
|
847 |
-
elem.addEventListener(event, func, bool);
|
848 |
-
} else if (elem.attachEvent) {
|
849 |
-
elem.attachEvent('on' + event, func);
|
850 |
-
}
|
851 |
-
return dom;
|
852 |
-
},
|
853 |
-
unbind: function unbind(elem, event, func, newBool) {
|
854 |
-
var bool = newBool || false;
|
855 |
-
if (elem.removeEventListener) {
|
856 |
-
elem.removeEventListener(event, func, bool);
|
857 |
-
} else if (elem.detachEvent) {
|
858 |
-
elem.detachEvent('on' + event, func);
|
859 |
-
}
|
860 |
-
return dom;
|
861 |
-
},
|
862 |
-
addClass: function addClass(elem, className) {
|
863 |
-
if (elem.className === undefined) {
|
864 |
-
elem.className = className;
|
865 |
-
} else if (elem.className !== className) {
|
866 |
-
var classes = elem.className.split(/ +/);
|
867 |
-
if (classes.indexOf(className) === -1) {
|
868 |
-
classes.push(className);
|
869 |
-
elem.className = classes.join(' ').replace(/^\s+/, '').replace(/\s+$/, '');
|
870 |
-
}
|
871 |
-
}
|
872 |
-
return dom;
|
873 |
-
},
|
874 |
-
removeClass: function removeClass(elem, className) {
|
875 |
-
if (className) {
|
876 |
-
if (elem.className === className) {
|
877 |
-
elem.removeAttribute('class');
|
878 |
-
} else {
|
879 |
-
var classes = elem.className.split(/ +/);
|
880 |
-
var index = classes.indexOf(className);
|
881 |
-
if (index !== -1) {
|
882 |
-
classes.splice(index, 1);
|
883 |
-
elem.className = classes.join(' ');
|
884 |
-
}
|
885 |
-
}
|
886 |
-
} else {
|
887 |
-
elem.className = undefined;
|
888 |
-
}
|
889 |
-
return dom;
|
890 |
-
},
|
891 |
-
hasClass: function hasClass(elem, className) {
|
892 |
-
return new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)').test(elem.className) || false;
|
893 |
-
},
|
894 |
-
getWidth: function getWidth(elem) {
|
895 |
-
var style = getComputedStyle(elem);
|
896 |
-
return cssValueToPixels(style['border-left-width']) + cssValueToPixels(style['border-right-width']) + cssValueToPixels(style['padding-left']) + cssValueToPixels(style['padding-right']) + cssValueToPixels(style.width);
|
897 |
-
},
|
898 |
-
getHeight: function getHeight(elem) {
|
899 |
-
var style = getComputedStyle(elem);
|
900 |
-
return cssValueToPixels(style['border-top-width']) + cssValueToPixels(style['border-bottom-width']) + cssValueToPixels(style['padding-top']) + cssValueToPixels(style['padding-bottom']) + cssValueToPixels(style.height);
|
901 |
-
},
|
902 |
-
getOffset: function getOffset(el) {
|
903 |
-
var elem = el;
|
904 |
-
var offset = { left: 0, top: 0 };
|
905 |
-
if (elem.offsetParent) {
|
906 |
-
do {
|
907 |
-
offset.left += elem.offsetLeft;
|
908 |
-
offset.top += elem.offsetTop;
|
909 |
-
elem = elem.offsetParent;
|
910 |
-
} while (elem);
|
911 |
-
}
|
912 |
-
return offset;
|
913 |
-
},
|
914 |
-
isActive: function isActive(elem) {
|
915 |
-
return elem === document.activeElement && (elem.type || elem.href);
|
916 |
-
}
|
917 |
-
};
|
918 |
-
|
919 |
-
var BooleanController = function (_Controller) {
|
920 |
-
inherits(BooleanController, _Controller);
|
921 |
-
function BooleanController(object, property) {
|
922 |
-
classCallCheck(this, BooleanController);
|
923 |
-
var _this2 = possibleConstructorReturn(this, (BooleanController.__proto__ || Object.getPrototypeOf(BooleanController)).call(this, object, property));
|
924 |
-
var _this = _this2;
|
925 |
-
_this2.__prev = _this2.getValue();
|
926 |
-
_this2.__checkbox = document.createElement('input');
|
927 |
-
_this2.__checkbox.setAttribute('type', 'checkbox');
|
928 |
-
function onChange() {
|
929 |
-
_this.setValue(!_this.__prev);
|
930 |
-
}
|
931 |
-
dom.bind(_this2.__checkbox, 'change', onChange, false);
|
932 |
-
_this2.domElement.appendChild(_this2.__checkbox);
|
933 |
-
_this2.updateDisplay();
|
934 |
-
return _this2;
|
935 |
-
}
|
936 |
-
createClass(BooleanController, [{
|
937 |
-
key: 'setValue',
|
938 |
-
value: function setValue(v) {
|
939 |
-
var toReturn = get(BooleanController.prototype.__proto__ || Object.getPrototypeOf(BooleanController.prototype), 'setValue', this).call(this, v);
|
940 |
-
if (this.__onFinishChange) {
|
941 |
-
this.__onFinishChange.call(this, this.getValue());
|
942 |
-
}
|
943 |
-
this.__prev = this.getValue();
|
944 |
-
return toReturn;
|
945 |
-
}
|
946 |
-
}, {
|
947 |
-
key: 'updateDisplay',
|
948 |
-
value: function updateDisplay() {
|
949 |
-
if (this.getValue() === true) {
|
950 |
-
this.__checkbox.setAttribute('checked', 'checked');
|
951 |
-
this.__checkbox.checked = true;
|
952 |
-
this.__prev = true;
|
953 |
-
} else {
|
954 |
-
this.__checkbox.checked = false;
|
955 |
-
this.__prev = false;
|
956 |
-
}
|
957 |
-
return get(BooleanController.prototype.__proto__ || Object.getPrototypeOf(BooleanController.prototype), 'updateDisplay', this).call(this);
|
958 |
-
}
|
959 |
-
}]);
|
960 |
-
return BooleanController;
|
961 |
-
}(Controller);
|
962 |
-
|
963 |
-
var OptionController = function (_Controller) {
|
964 |
-
inherits(OptionController, _Controller);
|
965 |
-
function OptionController(object, property, opts) {
|
966 |
-
classCallCheck(this, OptionController);
|
967 |
-
var _this2 = possibleConstructorReturn(this, (OptionController.__proto__ || Object.getPrototypeOf(OptionController)).call(this, object, property));
|
968 |
-
var options = opts;
|
969 |
-
var _this = _this2;
|
970 |
-
_this2.__select = document.createElement('select');
|
971 |
-
if (Common.isArray(options)) {
|
972 |
-
var map = {};
|
973 |
-
Common.each(options, function (element) {
|
974 |
-
map[element] = element;
|
975 |
-
});
|
976 |
-
options = map;
|
977 |
-
}
|
978 |
-
Common.each(options, function (value, key) {
|
979 |
-
var opt = document.createElement('option');
|
980 |
-
opt.innerHTML = key;
|
981 |
-
opt.setAttribute('value', value);
|
982 |
-
_this.__select.appendChild(opt);
|
983 |
-
});
|
984 |
-
_this2.updateDisplay();
|
985 |
-
dom.bind(_this2.__select, 'change', function () {
|
986 |
-
var desiredValue = this.options[this.selectedIndex].value;
|
987 |
-
_this.setValue(desiredValue);
|
988 |
-
});
|
989 |
-
_this2.domElement.appendChild(_this2.__select);
|
990 |
-
return _this2;
|
991 |
-
}
|
992 |
-
createClass(OptionController, [{
|
993 |
-
key: 'setValue',
|
994 |
-
value: function setValue(v) {
|
995 |
-
var toReturn = get(OptionController.prototype.__proto__ || Object.getPrototypeOf(OptionController.prototype), 'setValue', this).call(this, v);
|
996 |
-
if (this.__onFinishChange) {
|
997 |
-
this.__onFinishChange.call(this, this.getValue());
|
998 |
-
}
|
999 |
-
return toReturn;
|
1000 |
-
}
|
1001 |
-
}, {
|
1002 |
-
key: 'updateDisplay',
|
1003 |
-
value: function updateDisplay() {
|
1004 |
-
if (dom.isActive(this.__select)) return this;
|
1005 |
-
this.__select.value = this.getValue();
|
1006 |
-
return get(OptionController.prototype.__proto__ || Object.getPrototypeOf(OptionController.prototype), 'updateDisplay', this).call(this);
|
1007 |
-
}
|
1008 |
-
}]);
|
1009 |
-
return OptionController;
|
1010 |
-
}(Controller);
|
1011 |
-
|
1012 |
-
var StringController = function (_Controller) {
|
1013 |
-
inherits(StringController, _Controller);
|
1014 |
-
function StringController(object, property) {
|
1015 |
-
classCallCheck(this, StringController);
|
1016 |
-
var _this2 = possibleConstructorReturn(this, (StringController.__proto__ || Object.getPrototypeOf(StringController)).call(this, object, property));
|
1017 |
-
var _this = _this2;
|
1018 |
-
function onChange() {
|
1019 |
-
_this.setValue(_this.__input.value);
|
1020 |
-
}
|
1021 |
-
function onBlur() {
|
1022 |
-
if (_this.__onFinishChange) {
|
1023 |
-
_this.__onFinishChange.call(_this, _this.getValue());
|
1024 |
-
}
|
1025 |
-
}
|
1026 |
-
_this2.__input = document.createElement('input');
|
1027 |
-
_this2.__input.setAttribute('type', 'text');
|
1028 |
-
dom.bind(_this2.__input, 'keyup', onChange);
|
1029 |
-
dom.bind(_this2.__input, 'change', onChange);
|
1030 |
-
dom.bind(_this2.__input, 'blur', onBlur);
|
1031 |
-
dom.bind(_this2.__input, 'keydown', function (e) {
|
1032 |
-
if (e.keyCode === 13) {
|
1033 |
-
this.blur();
|
1034 |
-
}
|
1035 |
-
});
|
1036 |
-
_this2.updateDisplay();
|
1037 |
-
_this2.domElement.appendChild(_this2.__input);
|
1038 |
-
return _this2;
|
1039 |
-
}
|
1040 |
-
createClass(StringController, [{
|
1041 |
-
key: 'updateDisplay',
|
1042 |
-
value: function updateDisplay() {
|
1043 |
-
if (!dom.isActive(this.__input)) {
|
1044 |
-
this.__input.value = this.getValue();
|
1045 |
-
}
|
1046 |
-
return get(StringController.prototype.__proto__ || Object.getPrototypeOf(StringController.prototype), 'updateDisplay', this).call(this);
|
1047 |
-
}
|
1048 |
-
}]);
|
1049 |
-
return StringController;
|
1050 |
-
}(Controller);
|
1051 |
-
|
1052 |
-
function numDecimals(x) {
|
1053 |
-
var _x = x.toString();
|
1054 |
-
if (_x.indexOf('.') > -1) {
|
1055 |
-
return _x.length - _x.indexOf('.') - 1;
|
1056 |
-
}
|
1057 |
-
return 0;
|
1058 |
-
}
|
1059 |
-
var NumberController = function (_Controller) {
|
1060 |
-
inherits(NumberController, _Controller);
|
1061 |
-
function NumberController(object, property, params) {
|
1062 |
-
classCallCheck(this, NumberController);
|
1063 |
-
var _this = possibleConstructorReturn(this, (NumberController.__proto__ || Object.getPrototypeOf(NumberController)).call(this, object, property));
|
1064 |
-
var _params = params || {};
|
1065 |
-
_this.__min = _params.min;
|
1066 |
-
_this.__max = _params.max;
|
1067 |
-
_this.__step = _params.step;
|
1068 |
-
if (Common.isUndefined(_this.__step)) {
|
1069 |
-
if (_this.initialValue === 0) {
|
1070 |
-
_this.__impliedStep = 1;
|
1071 |
-
} else {
|
1072 |
-
_this.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(_this.initialValue)) / Math.LN10)) / 10;
|
1073 |
-
}
|
1074 |
-
} else {
|
1075 |
-
_this.__impliedStep = _this.__step;
|
1076 |
-
}
|
1077 |
-
_this.__precision = numDecimals(_this.__impliedStep);
|
1078 |
-
return _this;
|
1079 |
-
}
|
1080 |
-
createClass(NumberController, [{
|
1081 |
-
key: 'setValue',
|
1082 |
-
value: function setValue(v) {
|
1083 |
-
var _v = v;
|
1084 |
-
if (this.__min !== undefined && _v < this.__min) {
|
1085 |
-
_v = this.__min;
|
1086 |
-
} else if (this.__max !== undefined && _v > this.__max) {
|
1087 |
-
_v = this.__max;
|
1088 |
-
}
|
1089 |
-
if (this.__step !== undefined && _v % this.__step !== 0) {
|
1090 |
-
_v = Math.round(_v / this.__step) * this.__step;
|
1091 |
-
}
|
1092 |
-
return get(NumberController.prototype.__proto__ || Object.getPrototypeOf(NumberController.prototype), 'setValue', this).call(this, _v);
|
1093 |
-
}
|
1094 |
-
}, {
|
1095 |
-
key: 'min',
|
1096 |
-
value: function min(minValue) {
|
1097 |
-
this.__min = minValue;
|
1098 |
-
return this;
|
1099 |
-
}
|
1100 |
-
}, {
|
1101 |
-
key: 'max',
|
1102 |
-
value: function max(maxValue) {
|
1103 |
-
this.__max = maxValue;
|
1104 |
-
return this;
|
1105 |
-
}
|
1106 |
-
}, {
|
1107 |
-
key: 'step',
|
1108 |
-
value: function step(stepValue) {
|
1109 |
-
this.__step = stepValue;
|
1110 |
-
this.__impliedStep = stepValue;
|
1111 |
-
this.__precision = numDecimals(stepValue);
|
1112 |
-
return this;
|
1113 |
-
}
|
1114 |
-
}]);
|
1115 |
-
return NumberController;
|
1116 |
-
}(Controller);
|
1117 |
-
|
1118 |
-
function roundToDecimal(value, decimals) {
|
1119 |
-
var tenTo = Math.pow(10, decimals);
|
1120 |
-
return Math.round(value * tenTo) / tenTo;
|
1121 |
-
}
|
1122 |
-
var NumberControllerBox = function (_NumberController) {
|
1123 |
-
inherits(NumberControllerBox, _NumberController);
|
1124 |
-
function NumberControllerBox(object, property, params) {
|
1125 |
-
classCallCheck(this, NumberControllerBox);
|
1126 |
-
var _this2 = possibleConstructorReturn(this, (NumberControllerBox.__proto__ || Object.getPrototypeOf(NumberControllerBox)).call(this, object, property, params));
|
1127 |
-
_this2.__truncationSuspended = false;
|
1128 |
-
var _this = _this2;
|
1129 |
-
var prevY = void 0;
|
1130 |
-
function onChange() {
|
1131 |
-
var attempted = parseFloat(_this.__input.value);
|
1132 |
-
if (!Common.isNaN(attempted)) {
|
1133 |
-
_this.setValue(attempted);
|
1134 |
-
}
|
1135 |
-
}
|
1136 |
-
function onFinish() {
|
1137 |
-
if (_this.__onFinishChange) {
|
1138 |
-
_this.__onFinishChange.call(_this, _this.getValue());
|
1139 |
-
}
|
1140 |
-
}
|
1141 |
-
function onBlur() {
|
1142 |
-
onFinish();
|
1143 |
-
}
|
1144 |
-
function onMouseDrag(e) {
|
1145 |
-
var diff = prevY - e.clientY;
|
1146 |
-
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
1147 |
-
prevY = e.clientY;
|
1148 |
-
}
|
1149 |
-
function onMouseUp() {
|
1150 |
-
dom.unbind(window, 'mousemove', onMouseDrag);
|
1151 |
-
dom.unbind(window, 'mouseup', onMouseUp);
|
1152 |
-
onFinish();
|
1153 |
-
}
|
1154 |
-
function onMouseDown(e) {
|
1155 |
-
dom.bind(window, 'mousemove', onMouseDrag);
|
1156 |
-
dom.bind(window, 'mouseup', onMouseUp);
|
1157 |
-
prevY = e.clientY;
|
1158 |
-
}
|
1159 |
-
_this2.__input = document.createElement('input');
|
1160 |
-
_this2.__input.setAttribute('type', 'text');
|
1161 |
-
dom.bind(_this2.__input, 'change', onChange);
|
1162 |
-
dom.bind(_this2.__input, 'blur', onBlur);
|
1163 |
-
dom.bind(_this2.__input, 'mousedown', onMouseDown);
|
1164 |
-
dom.bind(_this2.__input, 'keydown', function (e) {
|
1165 |
-
if (e.keyCode === 13) {
|
1166 |
-
_this.__truncationSuspended = true;
|
1167 |
-
this.blur();
|
1168 |
-
_this.__truncationSuspended = false;
|
1169 |
-
onFinish();
|
1170 |
-
}
|
1171 |
-
});
|
1172 |
-
_this2.updateDisplay();
|
1173 |
-
_this2.domElement.appendChild(_this2.__input);
|
1174 |
-
return _this2;
|
1175 |
-
}
|
1176 |
-
createClass(NumberControllerBox, [{
|
1177 |
-
key: 'updateDisplay',
|
1178 |
-
value: function updateDisplay() {
|
1179 |
-
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
|
1180 |
-
return get(NumberControllerBox.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox.prototype), 'updateDisplay', this).call(this);
|
1181 |
-
}
|
1182 |
-
}]);
|
1183 |
-
return NumberControllerBox;
|
1184 |
-
}(NumberController);
|
1185 |
-
|
1186 |
-
function map(v, i1, i2, o1, o2) {
|
1187 |
-
return o1 + (o2 - o1) * ((v - i1) / (i2 - i1));
|
1188 |
-
}
|
1189 |
-
var NumberControllerSlider = function (_NumberController) {
|
1190 |
-
inherits(NumberControllerSlider, _NumberController);
|
1191 |
-
function NumberControllerSlider(object, property, min, max, step) {
|
1192 |
-
classCallCheck(this, NumberControllerSlider);
|
1193 |
-
var _this2 = possibleConstructorReturn(this, (NumberControllerSlider.__proto__ || Object.getPrototypeOf(NumberControllerSlider)).call(this, object, property, { min: min, max: max, step: step }));
|
1194 |
-
var _this = _this2;
|
1195 |
-
_this2.__background = document.createElement('div');
|
1196 |
-
_this2.__foreground = document.createElement('div');
|
1197 |
-
dom.bind(_this2.__background, 'mousedown', onMouseDown);
|
1198 |
-
dom.bind(_this2.__background, 'touchstart', onTouchStart);
|
1199 |
-
dom.addClass(_this2.__background, 'slider');
|
1200 |
-
dom.addClass(_this2.__foreground, 'slider-fg');
|
1201 |
-
function onMouseDown(e) {
|
1202 |
-
document.activeElement.blur();
|
1203 |
-
dom.bind(window, 'mousemove', onMouseDrag);
|
1204 |
-
dom.bind(window, 'mouseup', onMouseUp);
|
1205 |
-
onMouseDrag(e);
|
1206 |
-
}
|
1207 |
-
function onMouseDrag(e) {
|
1208 |
-
e.preventDefault();
|
1209 |
-
var bgRect = _this.__background.getBoundingClientRect();
|
1210 |
-
_this.setValue(map(e.clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
|
1211 |
-
return false;
|
1212 |
-
}
|
1213 |
-
function onMouseUp() {
|
1214 |
-
dom.unbind(window, 'mousemove', onMouseDrag);
|
1215 |
-
dom.unbind(window, 'mouseup', onMouseUp);
|
1216 |
-
if (_this.__onFinishChange) {
|
1217 |
-
_this.__onFinishChange.call(_this, _this.getValue());
|
1218 |
-
}
|
1219 |
-
}
|
1220 |
-
function onTouchStart(e) {
|
1221 |
-
if (e.touches.length !== 1) {
|
1222 |
-
return;
|
1223 |
-
}
|
1224 |
-
dom.bind(window, 'touchmove', onTouchMove);
|
1225 |
-
dom.bind(window, 'touchend', onTouchEnd);
|
1226 |
-
onTouchMove(e);
|
1227 |
-
}
|
1228 |
-
function onTouchMove(e) {
|
1229 |
-
var clientX = e.touches[0].clientX;
|
1230 |
-
var bgRect = _this.__background.getBoundingClientRect();
|
1231 |
-
_this.setValue(map(clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
|
1232 |
-
}
|
1233 |
-
function onTouchEnd() {
|
1234 |
-
dom.unbind(window, 'touchmove', onTouchMove);
|
1235 |
-
dom.unbind(window, 'touchend', onTouchEnd);
|
1236 |
-
if (_this.__onFinishChange) {
|
1237 |
-
_this.__onFinishChange.call(_this, _this.getValue());
|
1238 |
-
}
|
1239 |
-
}
|
1240 |
-
_this2.updateDisplay();
|
1241 |
-
_this2.__background.appendChild(_this2.__foreground);
|
1242 |
-
_this2.domElement.appendChild(_this2.__background);
|
1243 |
-
return _this2;
|
1244 |
-
}
|
1245 |
-
createClass(NumberControllerSlider, [{
|
1246 |
-
key: 'updateDisplay',
|
1247 |
-
value: function updateDisplay() {
|
1248 |
-
var pct = (this.getValue() - this.__min) / (this.__max - this.__min);
|
1249 |
-
this.__foreground.style.width = pct * 100 + '%';
|
1250 |
-
return get(NumberControllerSlider.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider.prototype), 'updateDisplay', this).call(this);
|
1251 |
-
}
|
1252 |
-
}]);
|
1253 |
-
return NumberControllerSlider;
|
1254 |
-
}(NumberController);
|
1255 |
-
|
1256 |
-
var FunctionController = function (_Controller) {
|
1257 |
-
inherits(FunctionController, _Controller);
|
1258 |
-
function FunctionController(object, property, text) {
|
1259 |
-
classCallCheck(this, FunctionController);
|
1260 |
-
var _this2 = possibleConstructorReturn(this, (FunctionController.__proto__ || Object.getPrototypeOf(FunctionController)).call(this, object, property));
|
1261 |
-
var _this = _this2;
|
1262 |
-
_this2.__button = document.createElement('div');
|
1263 |
-
_this2.__button.innerHTML = text === undefined ? 'Fire' : text;
|
1264 |
-
dom.bind(_this2.__button, 'click', function (e) {
|
1265 |
-
e.preventDefault();
|
1266 |
-
_this.fire();
|
1267 |
-
return false;
|
1268 |
-
});
|
1269 |
-
dom.addClass(_this2.__button, 'button');
|
1270 |
-
_this2.domElement.appendChild(_this2.__button);
|
1271 |
-
return _this2;
|
1272 |
-
}
|
1273 |
-
createClass(FunctionController, [{
|
1274 |
-
key: 'fire',
|
1275 |
-
value: function fire() {
|
1276 |
-
if (this.__onChange) {
|
1277 |
-
this.__onChange.call(this);
|
1278 |
-
}
|
1279 |
-
this.getValue().call(this.object);
|
1280 |
-
if (this.__onFinishChange) {
|
1281 |
-
this.__onFinishChange.call(this, this.getValue());
|
1282 |
-
}
|
1283 |
-
}
|
1284 |
-
}]);
|
1285 |
-
return FunctionController;
|
1286 |
-
}(Controller);
|
1287 |
-
|
1288 |
-
var ColorController = function (_Controller) {
|
1289 |
-
inherits(ColorController, _Controller);
|
1290 |
-
function ColorController(object, property) {
|
1291 |
-
classCallCheck(this, ColorController);
|
1292 |
-
var _this2 = possibleConstructorReturn(this, (ColorController.__proto__ || Object.getPrototypeOf(ColorController)).call(this, object, property));
|
1293 |
-
_this2.__color = new Color(_this2.getValue());
|
1294 |
-
_this2.__temp = new Color(0);
|
1295 |
-
var _this = _this2;
|
1296 |
-
_this2.domElement = document.createElement('div');
|
1297 |
-
dom.makeSelectable(_this2.domElement, false);
|
1298 |
-
_this2.__selector = document.createElement('div');
|
1299 |
-
_this2.__selector.className = 'selector';
|
1300 |
-
_this2.__saturation_field = document.createElement('div');
|
1301 |
-
_this2.__saturation_field.className = 'saturation-field';
|
1302 |
-
_this2.__field_knob = document.createElement('div');
|
1303 |
-
_this2.__field_knob.className = 'field-knob';
|
1304 |
-
_this2.__field_knob_border = '2px solid ';
|
1305 |
-
_this2.__hue_knob = document.createElement('div');
|
1306 |
-
_this2.__hue_knob.className = 'hue-knob';
|
1307 |
-
_this2.__hue_field = document.createElement('div');
|
1308 |
-
_this2.__hue_field.className = 'hue-field';
|
1309 |
-
_this2.__input = document.createElement('input');
|
1310 |
-
_this2.__input.type = 'text';
|
1311 |
-
_this2.__input_textShadow = '0 1px 1px ';
|
1312 |
-
dom.bind(_this2.__input, 'keydown', function (e) {
|
1313 |
-
if (e.keyCode === 13) {
|
1314 |
-
onBlur.call(this);
|
1315 |
-
}
|
1316 |
-
});
|
1317 |
-
dom.bind(_this2.__input, 'blur', onBlur);
|
1318 |
-
dom.bind(_this2.__selector, 'mousedown', function () {
|
1319 |
-
dom.addClass(this, 'drag').bind(window, 'mouseup', function () {
|
1320 |
-
dom.removeClass(_this.__selector, 'drag');
|
1321 |
-
});
|
1322 |
-
});
|
1323 |
-
dom.bind(_this2.__selector, 'touchstart', function () {
|
1324 |
-
dom.addClass(this, 'drag').bind(window, 'touchend', function () {
|
1325 |
-
dom.removeClass(_this.__selector, 'drag');
|
1326 |
-
});
|
1327 |
-
});
|
1328 |
-
var valueField = document.createElement('div');
|
1329 |
-
Common.extend(_this2.__selector.style, {
|
1330 |
-
width: '122px',
|
1331 |
-
height: '102px',
|
1332 |
-
padding: '3px',
|
1333 |
-
backgroundColor: '#222',
|
1334 |
-
boxShadow: '0px 1px 3px rgba(0,0,0,0.3)'
|
1335 |
-
});
|
1336 |
-
Common.extend(_this2.__field_knob.style, {
|
1337 |
-
position: 'absolute',
|
1338 |
-
width: '12px',
|
1339 |
-
height: '12px',
|
1340 |
-
border: _this2.__field_knob_border + (_this2.__color.v < 0.5 ? '#fff' : '#000'),
|
1341 |
-
boxShadow: '0px 1px 3px rgba(0,0,0,0.5)',
|
1342 |
-
borderRadius: '12px',
|
1343 |
-
zIndex: 1
|
1344 |
-
});
|
1345 |
-
Common.extend(_this2.__hue_knob.style, {
|
1346 |
-
position: 'absolute',
|
1347 |
-
width: '15px',
|
1348 |
-
height: '2px',
|
1349 |
-
borderRight: '4px solid #fff',
|
1350 |
-
zIndex: 1
|
1351 |
-
});
|
1352 |
-
Common.extend(_this2.__saturation_field.style, {
|
1353 |
-
width: '100px',
|
1354 |
-
height: '100px',
|
1355 |
-
border: '1px solid #555',
|
1356 |
-
marginRight: '3px',
|
1357 |
-
display: 'inline-block',
|
1358 |
-
cursor: 'pointer'
|
1359 |
-
});
|
1360 |
-
Common.extend(valueField.style, {
|
1361 |
-
width: '100%',
|
1362 |
-
height: '100%',
|
1363 |
-
background: 'none'
|
1364 |
-
});
|
1365 |
-
linearGradient(valueField, 'top', 'rgba(0,0,0,0)', '#000');
|
1366 |
-
Common.extend(_this2.__hue_field.style, {
|
1367 |
-
width: '15px',
|
1368 |
-
height: '100px',
|
1369 |
-
border: '1px solid #555',
|
1370 |
-
cursor: 'ns-resize',
|
1371 |
-
position: 'absolute',
|
1372 |
-
top: '3px',
|
1373 |
-
right: '3px'
|
1374 |
-
});
|
1375 |
-
hueGradient(_this2.__hue_field);
|
1376 |
-
Common.extend(_this2.__input.style, {
|
1377 |
-
outline: 'none',
|
1378 |
-
textAlign: 'center',
|
1379 |
-
color: '#fff',
|
1380 |
-
border: 0,
|
1381 |
-
fontWeight: 'bold',
|
1382 |
-
textShadow: _this2.__input_textShadow + 'rgba(0,0,0,0.7)'
|
1383 |
-
});
|
1384 |
-
dom.bind(_this2.__saturation_field, 'mousedown', fieldDown);
|
1385 |
-
dom.bind(_this2.__saturation_field, 'touchstart', fieldDown);
|
1386 |
-
dom.bind(_this2.__field_knob, 'mousedown', fieldDown);
|
1387 |
-
dom.bind(_this2.__field_knob, 'touchstart', fieldDown);
|
1388 |
-
dom.bind(_this2.__hue_field, 'mousedown', fieldDownH);
|
1389 |
-
dom.bind(_this2.__hue_field, 'touchstart', fieldDownH);
|
1390 |
-
function fieldDown(e) {
|
1391 |
-
setSV(e);
|
1392 |
-
dom.bind(window, 'mousemove', setSV);
|
1393 |
-
dom.bind(window, 'touchmove', setSV);
|
1394 |
-
dom.bind(window, 'mouseup', fieldUpSV);
|
1395 |
-
dom.bind(window, 'touchend', fieldUpSV);
|
1396 |
-
}
|
1397 |
-
function fieldDownH(e) {
|
1398 |
-
setH(e);
|
1399 |
-
dom.bind(window, 'mousemove', setH);
|
1400 |
-
dom.bind(window, 'touchmove', setH);
|
1401 |
-
dom.bind(window, 'mouseup', fieldUpH);
|
1402 |
-
dom.bind(window, 'touchend', fieldUpH);
|
1403 |
-
}
|
1404 |
-
function fieldUpSV() {
|
1405 |
-
dom.unbind(window, 'mousemove', setSV);
|
1406 |
-
dom.unbind(window, 'touchmove', setSV);
|
1407 |
-
dom.unbind(window, 'mouseup', fieldUpSV);
|
1408 |
-
dom.unbind(window, 'touchend', fieldUpSV);
|
1409 |
-
onFinish();
|
1410 |
-
}
|
1411 |
-
function fieldUpH() {
|
1412 |
-
dom.unbind(window, 'mousemove', setH);
|
1413 |
-
dom.unbind(window, 'touchmove', setH);
|
1414 |
-
dom.unbind(window, 'mouseup', fieldUpH);
|
1415 |
-
dom.unbind(window, 'touchend', fieldUpH);
|
1416 |
-
onFinish();
|
1417 |
-
}
|
1418 |
-
function onBlur() {
|
1419 |
-
var i = interpret(this.value);
|
1420 |
-
if (i !== false) {
|
1421 |
-
_this.__color.__state = i;
|
1422 |
-
_this.setValue(_this.__color.toOriginal());
|
1423 |
-
} else {
|
1424 |
-
this.value = _this.__color.toString();
|
1425 |
-
}
|
1426 |
-
}
|
1427 |
-
function onFinish() {
|
1428 |
-
if (_this.__onFinishChange) {
|
1429 |
-
_this.__onFinishChange.call(_this, _this.__color.toOriginal());
|
1430 |
-
}
|
1431 |
-
}
|
1432 |
-
_this2.__saturation_field.appendChild(valueField);
|
1433 |
-
_this2.__selector.appendChild(_this2.__field_knob);
|
1434 |
-
_this2.__selector.appendChild(_this2.__saturation_field);
|
1435 |
-
_this2.__selector.appendChild(_this2.__hue_field);
|
1436 |
-
_this2.__hue_field.appendChild(_this2.__hue_knob);
|
1437 |
-
_this2.domElement.appendChild(_this2.__input);
|
1438 |
-
_this2.domElement.appendChild(_this2.__selector);
|
1439 |
-
_this2.updateDisplay();
|
1440 |
-
function setSV(e) {
|
1441 |
-
if (e.type.indexOf('touch') === -1) {
|
1442 |
-
e.preventDefault();
|
1443 |
-
}
|
1444 |
-
var fieldRect = _this.__saturation_field.getBoundingClientRect();
|
1445 |
-
var _ref = e.touches && e.touches[0] || e,
|
1446 |
-
clientX = _ref.clientX,
|
1447 |
-
clientY = _ref.clientY;
|
1448 |
-
var s = (clientX - fieldRect.left) / (fieldRect.right - fieldRect.left);
|
1449 |
-
var v = 1 - (clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
|
1450 |
-
if (v > 1) {
|
1451 |
-
v = 1;
|
1452 |
-
} else if (v < 0) {
|
1453 |
-
v = 0;
|
1454 |
-
}
|
1455 |
-
if (s > 1) {
|
1456 |
-
s = 1;
|
1457 |
-
} else if (s < 0) {
|
1458 |
-
s = 0;
|
1459 |
-
}
|
1460 |
-
_this.__color.v = v;
|
1461 |
-
_this.__color.s = s;
|
1462 |
-
_this.setValue(_this.__color.toOriginal());
|
1463 |
-
return false;
|
1464 |
-
}
|
1465 |
-
function setH(e) {
|
1466 |
-
if (e.type.indexOf('touch') === -1) {
|
1467 |
-
e.preventDefault();
|
1468 |
-
}
|
1469 |
-
var fieldRect = _this.__hue_field.getBoundingClientRect();
|
1470 |
-
var _ref2 = e.touches && e.touches[0] || e,
|
1471 |
-
clientY = _ref2.clientY;
|
1472 |
-
var h = 1 - (clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
|
1473 |
-
if (h > 1) {
|
1474 |
-
h = 1;
|
1475 |
-
} else if (h < 0) {
|
1476 |
-
h = 0;
|
1477 |
-
}
|
1478 |
-
_this.__color.h = h * 360;
|
1479 |
-
_this.setValue(_this.__color.toOriginal());
|
1480 |
-
return false;
|
1481 |
-
}
|
1482 |
-
return _this2;
|
1483 |
-
}
|
1484 |
-
createClass(ColorController, [{
|
1485 |
-
key: 'updateDisplay',
|
1486 |
-
value: function updateDisplay() {
|
1487 |
-
var i = interpret(this.getValue());
|
1488 |
-
if (i !== false) {
|
1489 |
-
var mismatch = false;
|
1490 |
-
Common.each(Color.COMPONENTS, function (component) {
|
1491 |
-
if (!Common.isUndefined(i[component]) && !Common.isUndefined(this.__color.__state[component]) && i[component] !== this.__color.__state[component]) {
|
1492 |
-
mismatch = true;
|
1493 |
-
return {};
|
1494 |
-
}
|
1495 |
-
}, this);
|
1496 |
-
if (mismatch) {
|
1497 |
-
Common.extend(this.__color.__state, i);
|
1498 |
-
}
|
1499 |
-
}
|
1500 |
-
Common.extend(this.__temp.__state, this.__color.__state);
|
1501 |
-
this.__temp.a = 1;
|
1502 |
-
var flip = this.__color.v < 0.5 || this.__color.s > 0.5 ? 255 : 0;
|
1503 |
-
var _flip = 255 - flip;
|
1504 |
-
Common.extend(this.__field_knob.style, {
|
1505 |
-
marginLeft: 100 * this.__color.s - 7 + 'px',
|
1506 |
-
marginTop: 100 * (1 - this.__color.v) - 7 + 'px',
|
1507 |
-
backgroundColor: this.__temp.toHexString(),
|
1508 |
-
border: this.__field_knob_border + 'rgb(' + flip + ',' + flip + ',' + flip + ')'
|
1509 |
-
});
|
1510 |
-
this.__hue_knob.style.marginTop = (1 - this.__color.h / 360) * 100 + 'px';
|
1511 |
-
this.__temp.s = 1;
|
1512 |
-
this.__temp.v = 1;
|
1513 |
-
linearGradient(this.__saturation_field, 'left', '#fff', this.__temp.toHexString());
|
1514 |
-
this.__input.value = this.__color.toString();
|
1515 |
-
Common.extend(this.__input.style, {
|
1516 |
-
backgroundColor: this.__color.toHexString(),
|
1517 |
-
color: 'rgb(' + flip + ',' + flip + ',' + flip + ')',
|
1518 |
-
textShadow: this.__input_textShadow + 'rgba(' + _flip + ',' + _flip + ',' + _flip + ',.7)'
|
1519 |
-
});
|
1520 |
-
}
|
1521 |
-
}]);
|
1522 |
-
return ColorController;
|
1523 |
-
}(Controller);
|
1524 |
-
var vendors = ['-moz-', '-o-', '-webkit-', '-ms-', ''];
|
1525 |
-
function linearGradient(elem, x, a, b) {
|
1526 |
-
elem.style.background = '';
|
1527 |
-
Common.each(vendors, function (vendor) {
|
1528 |
-
elem.style.cssText += 'background: ' + vendor + 'linear-gradient(' + x + ', ' + a + ' 0%, ' + b + ' 100%); ';
|
1529 |
-
});
|
1530 |
-
}
|
1531 |
-
function hueGradient(elem) {
|
1532 |
-
elem.style.background = '';
|
1533 |
-
elem.style.cssText += 'background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);';
|
1534 |
-
elem.style.cssText += 'background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);';
|
1535 |
-
elem.style.cssText += 'background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);';
|
1536 |
-
elem.style.cssText += 'background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);';
|
1537 |
-
elem.style.cssText += 'background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);';
|
1538 |
-
}
|
1539 |
-
|
1540 |
-
var css = {
|
1541 |
-
load: function load(url, indoc) {
|
1542 |
-
var doc = indoc || document;
|
1543 |
-
var link = doc.createElement('link');
|
1544 |
-
link.type = 'text/css';
|
1545 |
-
link.rel = 'stylesheet';
|
1546 |
-
link.href = url;
|
1547 |
-
doc.getElementsByTagName('head')[0].appendChild(link);
|
1548 |
-
},
|
1549 |
-
inject: function inject(cssContent, indoc) {
|
1550 |
-
var doc = indoc || document;
|
1551 |
-
var injected = document.createElement('style');
|
1552 |
-
injected.type = 'text/css';
|
1553 |
-
injected.innerHTML = cssContent;
|
1554 |
-
var head = doc.getElementsByTagName('head')[0];
|
1555 |
-
try {
|
1556 |
-
head.appendChild(injected);
|
1557 |
-
} catch (e) {
|
1558 |
-
}
|
1559 |
-
}
|
1560 |
-
};
|
1561 |
-
|
1562 |
-
var saveDialogContents = "<div id=\"dg-save\" class=\"dg dialogue\">\n\n Here's the new load parameter for your <code>GUI</code>'s constructor:\n\n <textarea id=\"dg-new-constructor\"></textarea>\n\n <div id=\"dg-save-locally\">\n\n <input id=\"dg-local-storage\" type=\"checkbox\"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id=\"dg-local-explain\">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>";
|
1563 |
-
|
1564 |
-
var ControllerFactory = function ControllerFactory(object, property) {
|
1565 |
-
var initialValue = object[property];
|
1566 |
-
if (Common.isArray(arguments[2]) || Common.isObject(arguments[2])) {
|
1567 |
-
return new OptionController(object, property, arguments[2]);
|
1568 |
-
}
|
1569 |
-
if (Common.isNumber(initialValue)) {
|
1570 |
-
if (Common.isNumber(arguments[2]) && Common.isNumber(arguments[3])) {
|
1571 |
-
if (Common.isNumber(arguments[4])) {
|
1572 |
-
return new NumberControllerSlider(object, property, arguments[2], arguments[3], arguments[4]);
|
1573 |
-
}
|
1574 |
-
return new NumberControllerSlider(object, property, arguments[2], arguments[3]);
|
1575 |
-
}
|
1576 |
-
if (Common.isNumber(arguments[4])) {
|
1577 |
-
return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3], step: arguments[4] });
|
1578 |
-
}
|
1579 |
-
return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] });
|
1580 |
-
}
|
1581 |
-
if (Common.isString(initialValue)) {
|
1582 |
-
return new StringController(object, property);
|
1583 |
-
}
|
1584 |
-
if (Common.isFunction(initialValue)) {
|
1585 |
-
return new FunctionController(object, property, '');
|
1586 |
-
}
|
1587 |
-
if (Common.isBoolean(initialValue)) {
|
1588 |
-
return new BooleanController(object, property);
|
1589 |
-
}
|
1590 |
-
return null;
|
1591 |
-
};
|
1592 |
-
|
1593 |
-
function requestAnimationFrame(callback) {
|
1594 |
-
setTimeout(callback, 1000 / 60);
|
1595 |
-
}
|
1596 |
-
var requestAnimationFrame$1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || requestAnimationFrame;
|
1597 |
-
|
1598 |
-
var CenteredDiv = function () {
|
1599 |
-
function CenteredDiv() {
|
1600 |
-
classCallCheck(this, CenteredDiv);
|
1601 |
-
this.backgroundElement = document.createElement('div');
|
1602 |
-
Common.extend(this.backgroundElement.style, {
|
1603 |
-
backgroundColor: 'rgba(0,0,0,0.8)',
|
1604 |
-
top: 0,
|
1605 |
-
left: 0,
|
1606 |
-
display: 'none',
|
1607 |
-
zIndex: '1000',
|
1608 |
-
opacity: 0,
|
1609 |
-
WebkitTransition: 'opacity 0.2s linear',
|
1610 |
-
transition: 'opacity 0.2s linear'
|
1611 |
-
});
|
1612 |
-
dom.makeFullscreen(this.backgroundElement);
|
1613 |
-
this.backgroundElement.style.position = 'fixed';
|
1614 |
-
this.domElement = document.createElement('div');
|
1615 |
-
Common.extend(this.domElement.style, {
|
1616 |
-
position: 'fixed',
|
1617 |
-
display: 'none',
|
1618 |
-
zIndex: '1001',
|
1619 |
-
opacity: 0,
|
1620 |
-
WebkitTransition: '-webkit-transform 0.2s ease-out, opacity 0.2s linear',
|
1621 |
-
transition: 'transform 0.2s ease-out, opacity 0.2s linear'
|
1622 |
-
});
|
1623 |
-
document.body.appendChild(this.backgroundElement);
|
1624 |
-
document.body.appendChild(this.domElement);
|
1625 |
-
var _this = this;
|
1626 |
-
dom.bind(this.backgroundElement, 'click', function () {
|
1627 |
-
_this.hide();
|
1628 |
-
});
|
1629 |
-
}
|
1630 |
-
createClass(CenteredDiv, [{
|
1631 |
-
key: 'show',
|
1632 |
-
value: function show() {
|
1633 |
-
var _this = this;
|
1634 |
-
this.backgroundElement.style.display = 'block';
|
1635 |
-
this.domElement.style.display = 'block';
|
1636 |
-
this.domElement.style.opacity = 0;
|
1637 |
-
this.domElement.style.webkitTransform = 'scale(1.1)';
|
1638 |
-
this.layout();
|
1639 |
-
Common.defer(function () {
|
1640 |
-
_this.backgroundElement.style.opacity = 1;
|
1641 |
-
_this.domElement.style.opacity = 1;
|
1642 |
-
_this.domElement.style.webkitTransform = 'scale(1)';
|
1643 |
-
});
|
1644 |
-
}
|
1645 |
-
}, {
|
1646 |
-
key: 'hide',
|
1647 |
-
value: function hide() {
|
1648 |
-
var _this = this;
|
1649 |
-
var hide = function hide() {
|
1650 |
-
_this.domElement.style.display = 'none';
|
1651 |
-
_this.backgroundElement.style.display = 'none';
|
1652 |
-
dom.unbind(_this.domElement, 'webkitTransitionEnd', hide);
|
1653 |
-
dom.unbind(_this.domElement, 'transitionend', hide);
|
1654 |
-
dom.unbind(_this.domElement, 'oTransitionEnd', hide);
|
1655 |
-
};
|
1656 |
-
dom.bind(this.domElement, 'webkitTransitionEnd', hide);
|
1657 |
-
dom.bind(this.domElement, 'transitionend', hide);
|
1658 |
-
dom.bind(this.domElement, 'oTransitionEnd', hide);
|
1659 |
-
this.backgroundElement.style.opacity = 0;
|
1660 |
-
this.domElement.style.opacity = 0;
|
1661 |
-
this.domElement.style.webkitTransform = 'scale(1.1)';
|
1662 |
-
}
|
1663 |
-
}, {
|
1664 |
-
key: 'layout',
|
1665 |
-
value: function layout() {
|
1666 |
-
this.domElement.style.left = window.innerWidth / 2 - dom.getWidth(this.domElement) / 2 + 'px';
|
1667 |
-
this.domElement.style.top = window.innerHeight / 2 - dom.getHeight(this.domElement) / 2 + 'px';
|
1668 |
-
}
|
1669 |
-
}]);
|
1670 |
-
return CenteredDiv;
|
1671 |
-
}();
|
1672 |
-
|
1673 |
-
var styleSheet = ___$insertStyle(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");
|
1674 |
-
|
1675 |
-
css.inject(styleSheet);
|
1676 |
-
var CSS_NAMESPACE = 'dg';
|
1677 |
-
var HIDE_KEY_CODE = 72;
|
1678 |
-
var CLOSE_BUTTON_HEIGHT = 20;
|
1679 |
-
var DEFAULT_DEFAULT_PRESET_NAME = 'Default';
|
1680 |
-
var SUPPORTS_LOCAL_STORAGE = function () {
|
1681 |
-
try {
|
1682 |
-
return !!window.localStorage;
|
1683 |
-
} catch (e) {
|
1684 |
-
return false;
|
1685 |
-
}
|
1686 |
-
}();
|
1687 |
-
var SAVE_DIALOGUE = void 0;
|
1688 |
-
var autoPlaceVirgin = true;
|
1689 |
-
var autoPlaceContainer = void 0;
|
1690 |
-
var hide = false;
|
1691 |
-
var hideableGuis = [];
|
1692 |
-
var GUI = function GUI(pars) {
|
1693 |
-
var _this = this;
|
1694 |
-
var params = pars || {};
|
1695 |
-
this.domElement = document.createElement('div');
|
1696 |
-
this.__ul = document.createElement('ul');
|
1697 |
-
this.domElement.appendChild(this.__ul);
|
1698 |
-
dom.addClass(this.domElement, CSS_NAMESPACE);
|
1699 |
-
this.__folders = {};
|
1700 |
-
this.__controllers = [];
|
1701 |
-
this.__rememberedObjects = [];
|
1702 |
-
this.__rememberedObjectIndecesToControllers = [];
|
1703 |
-
this.__listening = [];
|
1704 |
-
params = Common.defaults(params, {
|
1705 |
-
closeOnTop: false,
|
1706 |
-
autoPlace: true,
|
1707 |
-
width: GUI.DEFAULT_WIDTH
|
1708 |
-
});
|
1709 |
-
params = Common.defaults(params, {
|
1710 |
-
resizable: params.autoPlace,
|
1711 |
-
hideable: params.autoPlace
|
1712 |
-
});
|
1713 |
-
if (!Common.isUndefined(params.load)) {
|
1714 |
-
if (params.preset) {
|
1715 |
-
params.load.preset = params.preset;
|
1716 |
-
}
|
1717 |
-
} else {
|
1718 |
-
params.load = { preset: DEFAULT_DEFAULT_PRESET_NAME };
|
1719 |
-
}
|
1720 |
-
if (Common.isUndefined(params.parent) && params.hideable) {
|
1721 |
-
hideableGuis.push(this);
|
1722 |
-
}
|
1723 |
-
params.resizable = Common.isUndefined(params.parent) && params.resizable;
|
1724 |
-
if (params.autoPlace && Common.isUndefined(params.scrollable)) {
|
1725 |
-
params.scrollable = true;
|
1726 |
-
}
|
1727 |
-
var useLocalStorage = SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(this, 'isLocal')) === 'true';
|
1728 |
-
var saveToLocalStorage = void 0;
|
1729 |
-
var titleRow = void 0;
|
1730 |
-
Object.defineProperties(this,
|
1731 |
-
{
|
1732 |
-
parent: {
|
1733 |
-
get: function get$$1() {
|
1734 |
-
return params.parent;
|
1735 |
-
}
|
1736 |
-
},
|
1737 |
-
scrollable: {
|
1738 |
-
get: function get$$1() {
|
1739 |
-
return params.scrollable;
|
1740 |
-
}
|
1741 |
-
},
|
1742 |
-
autoPlace: {
|
1743 |
-
get: function get$$1() {
|
1744 |
-
return params.autoPlace;
|
1745 |
-
}
|
1746 |
-
},
|
1747 |
-
closeOnTop: {
|
1748 |
-
get: function get$$1() {
|
1749 |
-
return params.closeOnTop;
|
1750 |
-
}
|
1751 |
-
},
|
1752 |
-
preset: {
|
1753 |
-
get: function get$$1() {
|
1754 |
-
if (_this.parent) {
|
1755 |
-
return _this.getRoot().preset;
|
1756 |
-
}
|
1757 |
-
return params.load.preset;
|
1758 |
-
},
|
1759 |
-
set: function set$$1(v) {
|
1760 |
-
if (_this.parent) {
|
1761 |
-
_this.getRoot().preset = v;
|
1762 |
-
} else {
|
1763 |
-
params.load.preset = v;
|
1764 |
-
}
|
1765 |
-
setPresetSelectIndex(this);
|
1766 |
-
_this.revert();
|
1767 |
-
}
|
1768 |
-
},
|
1769 |
-
width: {
|
1770 |
-
get: function get$$1() {
|
1771 |
-
return params.width;
|
1772 |
-
},
|
1773 |
-
set: function set$$1(v) {
|
1774 |
-
params.width = v;
|
1775 |
-
setWidth(_this, v);
|
1776 |
-
}
|
1777 |
-
},
|
1778 |
-
name: {
|
1779 |
-
get: function get$$1() {
|
1780 |
-
return params.name;
|
1781 |
-
},
|
1782 |
-
set: function set$$1(v) {
|
1783 |
-
params.name = v;
|
1784 |
-
if (titleRow) {
|
1785 |
-
titleRow.innerHTML = params.name;
|
1786 |
-
}
|
1787 |
-
}
|
1788 |
-
},
|
1789 |
-
closed: {
|
1790 |
-
get: function get$$1() {
|
1791 |
-
return params.closed;
|
1792 |
-
},
|
1793 |
-
set: function set$$1(v) {
|
1794 |
-
params.closed = v;
|
1795 |
-
if (params.closed) {
|
1796 |
-
dom.addClass(_this.__ul, GUI.CLASS_CLOSED);
|
1797 |
-
} else {
|
1798 |
-
dom.removeClass(_this.__ul, GUI.CLASS_CLOSED);
|
1799 |
-
}
|
1800 |
-
this.onResize();
|
1801 |
-
if (_this.__closeButton) {
|
1802 |
-
_this.__closeButton.innerHTML = v ? GUI.TEXT_OPEN : GUI.TEXT_CLOSED;
|
1803 |
-
}
|
1804 |
-
}
|
1805 |
-
},
|
1806 |
-
load: {
|
1807 |
-
get: function get$$1() {
|
1808 |
-
return params.load;
|
1809 |
-
}
|
1810 |
-
},
|
1811 |
-
useLocalStorage: {
|
1812 |
-
get: function get$$1() {
|
1813 |
-
return useLocalStorage;
|
1814 |
-
},
|
1815 |
-
set: function set$$1(bool) {
|
1816 |
-
if (SUPPORTS_LOCAL_STORAGE) {
|
1817 |
-
useLocalStorage = bool;
|
1818 |
-
if (bool) {
|
1819 |
-
dom.bind(window, 'unload', saveToLocalStorage);
|
1820 |
-
} else {
|
1821 |
-
dom.unbind(window, 'unload', saveToLocalStorage);
|
1822 |
-
}
|
1823 |
-
localStorage.setItem(getLocalStorageHash(_this, 'isLocal'), bool);
|
1824 |
-
}
|
1825 |
-
}
|
1826 |
-
}
|
1827 |
-
});
|
1828 |
-
if (Common.isUndefined(params.parent)) {
|
1829 |
-
this.closed = params.closed || false;
|
1830 |
-
dom.addClass(this.domElement, GUI.CLASS_MAIN);
|
1831 |
-
dom.makeSelectable(this.domElement, false);
|
1832 |
-
if (SUPPORTS_LOCAL_STORAGE) {
|
1833 |
-
if (useLocalStorage) {
|
1834 |
-
_this.useLocalStorage = true;
|
1835 |
-
var savedGui = localStorage.getItem(getLocalStorageHash(this, 'gui'));
|
1836 |
-
if (savedGui) {
|
1837 |
-
params.load = JSON.parse(savedGui);
|
1838 |
-
}
|
1839 |
-
}
|
1840 |
-
}
|
1841 |
-
this.__closeButton = document.createElement('div');
|
1842 |
-
this.__closeButton.innerHTML = GUI.TEXT_CLOSED;
|
1843 |
-
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BUTTON);
|
1844 |
-
if (params.closeOnTop) {
|
1845 |
-
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_TOP);
|
1846 |
-
this.domElement.insertBefore(this.__closeButton, this.domElement.childNodes[0]);
|
1847 |
-
} else {
|
1848 |
-
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BOTTOM);
|
1849 |
-
this.domElement.appendChild(this.__closeButton);
|
1850 |
-
}
|
1851 |
-
dom.bind(this.__closeButton, 'click', function () {
|
1852 |
-
_this.closed = !_this.closed;
|
1853 |
-
});
|
1854 |
-
} else {
|
1855 |
-
if (params.closed === undefined) {
|
1856 |
-
params.closed = true;
|
1857 |
-
}
|
1858 |
-
var titleRowName = document.createTextNode(params.name);
|
1859 |
-
dom.addClass(titleRowName, 'controller-name');
|
1860 |
-
titleRow = addRow(_this, titleRowName);
|
1861 |
-
var onClickTitle = function onClickTitle(e) {
|
1862 |
-
e.preventDefault();
|
1863 |
-
_this.closed = !_this.closed;
|
1864 |
-
return false;
|
1865 |
-
};
|
1866 |
-
dom.addClass(this.__ul, GUI.CLASS_CLOSED);
|
1867 |
-
dom.addClass(titleRow, 'title');
|
1868 |
-
dom.bind(titleRow, 'click', onClickTitle);
|
1869 |
-
if (!params.closed) {
|
1870 |
-
this.closed = false;
|
1871 |
-
}
|
1872 |
-
}
|
1873 |
-
if (params.autoPlace) {
|
1874 |
-
if (Common.isUndefined(params.parent)) {
|
1875 |
-
if (autoPlaceVirgin) {
|
1876 |
-
autoPlaceContainer = document.createElement('div');
|
1877 |
-
dom.addClass(autoPlaceContainer, CSS_NAMESPACE);
|
1878 |
-
dom.addClass(autoPlaceContainer, GUI.CLASS_AUTO_PLACE_CONTAINER);
|
1879 |
-
document.body.appendChild(autoPlaceContainer);
|
1880 |
-
autoPlaceVirgin = false;
|
1881 |
-
}
|
1882 |
-
autoPlaceContainer.appendChild(this.domElement);
|
1883 |
-
dom.addClass(this.domElement, GUI.CLASS_AUTO_PLACE);
|
1884 |
-
}
|
1885 |
-
if (!this.parent) {
|
1886 |
-
setWidth(_this, params.width);
|
1887 |
-
}
|
1888 |
-
}
|
1889 |
-
this.__resizeHandler = function () {
|
1890 |
-
_this.onResizeDebounced();
|
1891 |
-
};
|
1892 |
-
dom.bind(window, 'resize', this.__resizeHandler);
|
1893 |
-
dom.bind(this.__ul, 'webkitTransitionEnd', this.__resizeHandler);
|
1894 |
-
dom.bind(this.__ul, 'transitionend', this.__resizeHandler);
|
1895 |
-
dom.bind(this.__ul, 'oTransitionEnd', this.__resizeHandler);
|
1896 |
-
this.onResize();
|
1897 |
-
if (params.resizable) {
|
1898 |
-
addResizeHandle(this);
|
1899 |
-
}
|
1900 |
-
saveToLocalStorage = function saveToLocalStorage() {
|
1901 |
-
if (SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(_this, 'isLocal')) === 'true') {
|
1902 |
-
localStorage.setItem(getLocalStorageHash(_this, 'gui'), JSON.stringify(_this.getSaveObject()));
|
1903 |
-
}
|
1904 |
-
};
|
1905 |
-
this.saveToLocalStorageIfPossible = saveToLocalStorage;
|
1906 |
-
function resetWidth() {
|
1907 |
-
var root = _this.getRoot();
|
1908 |
-
root.width += 1;
|
1909 |
-
Common.defer(function () {
|
1910 |
-
root.width -= 1;
|
1911 |
-
});
|
1912 |
-
}
|
1913 |
-
if (!params.parent) {
|
1914 |
-
resetWidth();
|
1915 |
-
}
|
1916 |
-
};
|
1917 |
-
GUI.toggleHide = function () {
|
1918 |
-
hide = !hide;
|
1919 |
-
Common.each(hideableGuis, function (gui) {
|
1920 |
-
gui.domElement.style.display = hide ? 'none' : '';
|
1921 |
-
});
|
1922 |
-
};
|
1923 |
-
GUI.CLASS_AUTO_PLACE = 'a';
|
1924 |
-
GUI.CLASS_AUTO_PLACE_CONTAINER = 'ac';
|
1925 |
-
GUI.CLASS_MAIN = 'main';
|
1926 |
-
GUI.CLASS_CONTROLLER_ROW = 'cr';
|
1927 |
-
GUI.CLASS_TOO_TALL = 'taller-than-window';
|
1928 |
-
GUI.CLASS_CLOSED = 'closed';
|
1929 |
-
GUI.CLASS_CLOSE_BUTTON = 'close-button';
|
1930 |
-
GUI.CLASS_CLOSE_TOP = 'close-top';
|
1931 |
-
GUI.CLASS_CLOSE_BOTTOM = 'close-bottom';
|
1932 |
-
GUI.CLASS_DRAG = 'drag';
|
1933 |
-
GUI.DEFAULT_WIDTH = 245;
|
1934 |
-
GUI.TEXT_CLOSED = 'Close Controls';
|
1935 |
-
GUI.TEXT_OPEN = 'Open Controls';
|
1936 |
-
GUI._keydownHandler = function (e) {
|
1937 |
-
if (document.activeElement.type !== 'text' && (e.which === HIDE_KEY_CODE || e.keyCode === HIDE_KEY_CODE)) {
|
1938 |
-
GUI.toggleHide();
|
1939 |
-
}
|
1940 |
-
};
|
1941 |
-
dom.bind(window, 'keydown', GUI._keydownHandler, false);
|
1942 |
-
Common.extend(GUI.prototype,
|
1943 |
-
{
|
1944 |
-
add: function add(object, property) {
|
1945 |
-
return _add(this, object, property, {
|
1946 |
-
factoryArgs: Array.prototype.slice.call(arguments, 2)
|
1947 |
-
});
|
1948 |
-
},
|
1949 |
-
addColor: function addColor(object, property) {
|
1950 |
-
return _add(this, object, property, {
|
1951 |
-
color: true
|
1952 |
-
});
|
1953 |
-
},
|
1954 |
-
remove: function remove(controller) {
|
1955 |
-
this.__ul.removeChild(controller.__li);
|
1956 |
-
this.__controllers.splice(this.__controllers.indexOf(controller), 1);
|
1957 |
-
var _this = this;
|
1958 |
-
Common.defer(function () {
|
1959 |
-
_this.onResize();
|
1960 |
-
});
|
1961 |
-
},
|
1962 |
-
destroy: function destroy() {
|
1963 |
-
if (this.parent) {
|
1964 |
-
throw new Error('Only the root GUI should be removed with .destroy(). ' + 'For subfolders, use gui.removeFolder(folder) instead.');
|
1965 |
-
}
|
1966 |
-
if (this.autoPlace) {
|
1967 |
-
autoPlaceContainer.removeChild(this.domElement);
|
1968 |
-
}
|
1969 |
-
var _this = this;
|
1970 |
-
Common.each(this.__folders, function (subfolder) {
|
1971 |
-
_this.removeFolder(subfolder);
|
1972 |
-
});
|
1973 |
-
dom.unbind(window, 'keydown', GUI._keydownHandler, false);
|
1974 |
-
removeListeners(this);
|
1975 |
-
},
|
1976 |
-
addFolder: function addFolder(name) {
|
1977 |
-
if (this.__folders[name] !== undefined) {
|
1978 |
-
throw new Error('You already have a folder in this GUI by the' + ' name "' + name + '"');
|
1979 |
-
}
|
1980 |
-
var newGuiParams = { name: name, parent: this };
|
1981 |
-
newGuiParams.autoPlace = this.autoPlace;
|
1982 |
-
if (this.load &&
|
1983 |
-
this.load.folders &&
|
1984 |
-
this.load.folders[name]) {
|
1985 |
-
newGuiParams.closed = this.load.folders[name].closed;
|
1986 |
-
newGuiParams.load = this.load.folders[name];
|
1987 |
-
}
|
1988 |
-
var gui = new GUI(newGuiParams);
|
1989 |
-
this.__folders[name] = gui;
|
1990 |
-
var li = addRow(this, gui.domElement);
|
1991 |
-
dom.addClass(li, 'folder');
|
1992 |
-
return gui;
|
1993 |
-
},
|
1994 |
-
removeFolder: function removeFolder(folder) {
|
1995 |
-
this.__ul.removeChild(folder.domElement.parentElement);
|
1996 |
-
delete this.__folders[folder.name];
|
1997 |
-
if (this.load &&
|
1998 |
-
this.load.folders &&
|
1999 |
-
this.load.folders[folder.name]) {
|
2000 |
-
delete this.load.folders[folder.name];
|
2001 |
-
}
|
2002 |
-
removeListeners(folder);
|
2003 |
-
var _this = this;
|
2004 |
-
Common.each(folder.__folders, function (subfolder) {
|
2005 |
-
folder.removeFolder(subfolder);
|
2006 |
-
});
|
2007 |
-
Common.defer(function () {
|
2008 |
-
_this.onResize();
|
2009 |
-
});
|
2010 |
-
},
|
2011 |
-
open: function open() {
|
2012 |
-
this.closed = false;
|
2013 |
-
},
|
2014 |
-
close: function close() {
|
2015 |
-
this.closed = true;
|
2016 |
-
},
|
2017 |
-
hide: function hide() {
|
2018 |
-
this.domElement.style.display = 'none';
|
2019 |
-
},
|
2020 |
-
show: function show() {
|
2021 |
-
this.domElement.style.display = '';
|
2022 |
-
},
|
2023 |
-
onResize: function onResize() {
|
2024 |
-
var root = this.getRoot();
|
2025 |
-
if (root.scrollable) {
|
2026 |
-
var top = dom.getOffset(root.__ul).top;
|
2027 |
-
var h = 0;
|
2028 |
-
Common.each(root.__ul.childNodes, function (node) {
|
2029 |
-
if (!(root.autoPlace && node === root.__save_row)) {
|
2030 |
-
h += dom.getHeight(node);
|
2031 |
-
}
|
2032 |
-
});
|
2033 |
-
if (window.innerHeight - top - CLOSE_BUTTON_HEIGHT < h) {
|
2034 |
-
dom.addClass(root.domElement, GUI.CLASS_TOO_TALL);
|
2035 |
-
root.__ul.style.height = window.innerHeight - top - CLOSE_BUTTON_HEIGHT + 'px';
|
2036 |
-
} else {
|
2037 |
-
dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL);
|
2038 |
-
root.__ul.style.height = 'auto';
|
2039 |
-
}
|
2040 |
-
}
|
2041 |
-
if (root.__resize_handle) {
|
2042 |
-
Common.defer(function () {
|
2043 |
-
root.__resize_handle.style.height = root.__ul.offsetHeight + 'px';
|
2044 |
-
});
|
2045 |
-
}
|
2046 |
-
if (root.__closeButton) {
|
2047 |
-
root.__closeButton.style.width = root.width + 'px';
|
2048 |
-
}
|
2049 |
-
},
|
2050 |
-
onResizeDebounced: Common.debounce(function () {
|
2051 |
-
this.onResize();
|
2052 |
-
}, 50),
|
2053 |
-
remember: function remember() {
|
2054 |
-
if (Common.isUndefined(SAVE_DIALOGUE)) {
|
2055 |
-
SAVE_DIALOGUE = new CenteredDiv();
|
2056 |
-
SAVE_DIALOGUE.domElement.innerHTML = saveDialogContents;
|
2057 |
-
}
|
2058 |
-
if (this.parent) {
|
2059 |
-
throw new Error('You can only call remember on a top level GUI.');
|
2060 |
-
}
|
2061 |
-
var _this = this;
|
2062 |
-
Common.each(Array.prototype.slice.call(arguments), function (object) {
|
2063 |
-
if (_this.__rememberedObjects.length === 0) {
|
2064 |
-
addSaveMenu(_this);
|
2065 |
-
}
|
2066 |
-
if (_this.__rememberedObjects.indexOf(object) === -1) {
|
2067 |
-
_this.__rememberedObjects.push(object);
|
2068 |
-
}
|
2069 |
-
});
|
2070 |
-
if (this.autoPlace) {
|
2071 |
-
setWidth(this, this.width);
|
2072 |
-
}
|
2073 |
-
},
|
2074 |
-
getRoot: function getRoot() {
|
2075 |
-
var gui = this;
|
2076 |
-
while (gui.parent) {
|
2077 |
-
gui = gui.parent;
|
2078 |
-
}
|
2079 |
-
return gui;
|
2080 |
-
},
|
2081 |
-
getSaveObject: function getSaveObject() {
|
2082 |
-
var toReturn = this.load;
|
2083 |
-
toReturn.closed = this.closed;
|
2084 |
-
if (this.__rememberedObjects.length > 0) {
|
2085 |
-
toReturn.preset = this.preset;
|
2086 |
-
if (!toReturn.remembered) {
|
2087 |
-
toReturn.remembered = {};
|
2088 |
-
}
|
2089 |
-
toReturn.remembered[this.preset] = getCurrentPreset(this);
|
2090 |
-
}
|
2091 |
-
toReturn.folders = {};
|
2092 |
-
Common.each(this.__folders, function (element, key) {
|
2093 |
-
toReturn.folders[key] = element.getSaveObject();
|
2094 |
-
});
|
2095 |
-
return toReturn;
|
2096 |
-
},
|
2097 |
-
save: function save() {
|
2098 |
-
if (!this.load.remembered) {
|
2099 |
-
this.load.remembered = {};
|
2100 |
-
}
|
2101 |
-
this.load.remembered[this.preset] = getCurrentPreset(this);
|
2102 |
-
markPresetModified(this, false);
|
2103 |
-
this.saveToLocalStorageIfPossible();
|
2104 |
-
},
|
2105 |
-
saveAs: function saveAs(presetName) {
|
2106 |
-
if (!this.load.remembered) {
|
2107 |
-
this.load.remembered = {};
|
2108 |
-
this.load.remembered[DEFAULT_DEFAULT_PRESET_NAME] = getCurrentPreset(this, true);
|
2109 |
-
}
|
2110 |
-
this.load.remembered[presetName] = getCurrentPreset(this);
|
2111 |
-
this.preset = presetName;
|
2112 |
-
addPresetOption(this, presetName, true);
|
2113 |
-
this.saveToLocalStorageIfPossible();
|
2114 |
-
},
|
2115 |
-
revert: function revert(gui) {
|
2116 |
-
Common.each(this.__controllers, function (controller) {
|
2117 |
-
if (!this.getRoot().load.remembered) {
|
2118 |
-
controller.setValue(controller.initialValue);
|
2119 |
-
} else {
|
2120 |
-
recallSavedValue(gui || this.getRoot(), controller);
|
2121 |
-
}
|
2122 |
-
if (controller.__onFinishChange) {
|
2123 |
-
controller.__onFinishChange.call(controller, controller.getValue());
|
2124 |
-
}
|
2125 |
-
}, this);
|
2126 |
-
Common.each(this.__folders, function (folder) {
|
2127 |
-
folder.revert(folder);
|
2128 |
-
});
|
2129 |
-
if (!gui) {
|
2130 |
-
markPresetModified(this.getRoot(), false);
|
2131 |
-
}
|
2132 |
-
},
|
2133 |
-
listen: function listen(controller) {
|
2134 |
-
var init = this.__listening.length === 0;
|
2135 |
-
this.__listening.push(controller);
|
2136 |
-
if (init) {
|
2137 |
-
updateDisplays(this.__listening);
|
2138 |
-
}
|
2139 |
-
},
|
2140 |
-
updateDisplay: function updateDisplay() {
|
2141 |
-
Common.each(this.__controllers, function (controller) {
|
2142 |
-
controller.updateDisplay();
|
2143 |
-
});
|
2144 |
-
Common.each(this.__folders, function (folder) {
|
2145 |
-
folder.updateDisplay();
|
2146 |
-
});
|
2147 |
-
}
|
2148 |
-
});
|
2149 |
-
function addRow(gui, newDom, liBefore) {
|
2150 |
-
var li = document.createElement('li');
|
2151 |
-
if (newDom) {
|
2152 |
-
li.appendChild(newDom);
|
2153 |
-
}
|
2154 |
-
if (liBefore) {
|
2155 |
-
gui.__ul.insertBefore(li, liBefore);
|
2156 |
-
} else {
|
2157 |
-
gui.__ul.appendChild(li);
|
2158 |
-
}
|
2159 |
-
gui.onResize();
|
2160 |
-
return li;
|
2161 |
-
}
|
2162 |
-
function removeListeners(gui) {
|
2163 |
-
dom.unbind(window, 'resize', gui.__resizeHandler);
|
2164 |
-
if (gui.saveToLocalStorageIfPossible) {
|
2165 |
-
dom.unbind(window, 'unload', gui.saveToLocalStorageIfPossible);
|
2166 |
-
}
|
2167 |
-
}
|
2168 |
-
function markPresetModified(gui, modified) {
|
2169 |
-
var opt = gui.__preset_select[gui.__preset_select.selectedIndex];
|
2170 |
-
if (modified) {
|
2171 |
-
opt.innerHTML = opt.value + '*';
|
2172 |
-
} else {
|
2173 |
-
opt.innerHTML = opt.value;
|
2174 |
-
}
|
2175 |
-
}
|
2176 |
-
function augmentController(gui, li, controller) {
|
2177 |
-
controller.__li = li;
|
2178 |
-
controller.__gui = gui;
|
2179 |
-
Common.extend(controller, {
|
2180 |
-
options: function options(_options) {
|
2181 |
-
if (arguments.length > 1) {
|
2182 |
-
var nextSibling = controller.__li.nextElementSibling;
|
2183 |
-
controller.remove();
|
2184 |
-
return _add(gui, controller.object, controller.property, {
|
2185 |
-
before: nextSibling,
|
2186 |
-
factoryArgs: [Common.toArray(arguments)]
|
2187 |
-
});
|
2188 |
-
}
|
2189 |
-
if (Common.isArray(_options) || Common.isObject(_options)) {
|
2190 |
-
var _nextSibling = controller.__li.nextElementSibling;
|
2191 |
-
controller.remove();
|
2192 |
-
return _add(gui, controller.object, controller.property, {
|
2193 |
-
before: _nextSibling,
|
2194 |
-
factoryArgs: [_options]
|
2195 |
-
});
|
2196 |
-
}
|
2197 |
-
},
|
2198 |
-
name: function name(_name) {
|
2199 |
-
controller.__li.firstElementChild.firstElementChild.innerHTML = _name;
|
2200 |
-
return controller;
|
2201 |
-
},
|
2202 |
-
listen: function listen() {
|
2203 |
-
controller.__gui.listen(controller);
|
2204 |
-
return controller;
|
2205 |
-
},
|
2206 |
-
remove: function remove() {
|
2207 |
-
controller.__gui.remove(controller);
|
2208 |
-
return controller;
|
2209 |
-
}
|
2210 |
-
});
|
2211 |
-
if (controller instanceof NumberControllerSlider) {
|
2212 |
-
var box = new NumberControllerBox(controller.object, controller.property, { min: controller.__min, max: controller.__max, step: controller.__step });
|
2213 |
-
Common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step', 'min', 'max'], function (method) {
|
2214 |
-
var pc = controller[method];
|
2215 |
-
var pb = box[method];
|
2216 |
-
controller[method] = box[method] = function () {
|
2217 |
-
var args = Array.prototype.slice.call(arguments);
|
2218 |
-
pb.apply(box, args);
|
2219 |
-
return pc.apply(controller, args);
|
2220 |
-
};
|
2221 |
-
});
|
2222 |
-
dom.addClass(li, 'has-slider');
|
2223 |
-
controller.domElement.insertBefore(box.domElement, controller.domElement.firstElementChild);
|
2224 |
-
} else if (controller instanceof NumberControllerBox) {
|
2225 |
-
var r = function r(returned) {
|
2226 |
-
if (Common.isNumber(controller.__min) && Common.isNumber(controller.__max)) {
|
2227 |
-
var oldName = controller.__li.firstElementChild.firstElementChild.innerHTML;
|
2228 |
-
var wasListening = controller.__gui.__listening.indexOf(controller) > -1;
|
2229 |
-
controller.remove();
|
2230 |
-
var newController = _add(gui, controller.object, controller.property, {
|
2231 |
-
before: controller.__li.nextElementSibling,
|
2232 |
-
factoryArgs: [controller.__min, controller.__max, controller.__step]
|
2233 |
-
});
|
2234 |
-
newController.name(oldName);
|
2235 |
-
if (wasListening) newController.listen();
|
2236 |
-
return newController;
|
2237 |
-
}
|
2238 |
-
return returned;
|
2239 |
-
};
|
2240 |
-
controller.min = Common.compose(r, controller.min);
|
2241 |
-
controller.max = Common.compose(r, controller.max);
|
2242 |
-
} else if (controller instanceof BooleanController) {
|
2243 |
-
dom.bind(li, 'click', function () {
|
2244 |
-
dom.fakeEvent(controller.__checkbox, 'click');
|
2245 |
-
});
|
2246 |
-
dom.bind(controller.__checkbox, 'click', function (e) {
|
2247 |
-
e.stopPropagation();
|
2248 |
-
});
|
2249 |
-
} else if (controller instanceof FunctionController) {
|
2250 |
-
dom.bind(li, 'click', function () {
|
2251 |
-
dom.fakeEvent(controller.__button, 'click');
|
2252 |
-
});
|
2253 |
-
dom.bind(li, 'mouseover', function () {
|
2254 |
-
dom.addClass(controller.__button, 'hover');
|
2255 |
-
});
|
2256 |
-
dom.bind(li, 'mouseout', function () {
|
2257 |
-
dom.removeClass(controller.__button, 'hover');
|
2258 |
-
});
|
2259 |
-
} else if (controller instanceof ColorController) {
|
2260 |
-
dom.addClass(li, 'color');
|
2261 |
-
controller.updateDisplay = Common.compose(function (val) {
|
2262 |
-
li.style.borderLeftColor = controller.__color.toString();
|
2263 |
-
return val;
|
2264 |
-
}, controller.updateDisplay);
|
2265 |
-
controller.updateDisplay();
|
2266 |
-
}
|
2267 |
-
controller.setValue = Common.compose(function (val) {
|
2268 |
-
if (gui.getRoot().__preset_select && controller.isModified()) {
|
2269 |
-
markPresetModified(gui.getRoot(), true);
|
2270 |
-
}
|
2271 |
-
return val;
|
2272 |
-
}, controller.setValue);
|
2273 |
-
}
|
2274 |
-
function recallSavedValue(gui, controller) {
|
2275 |
-
var root = gui.getRoot();
|
2276 |
-
var matchedIndex = root.__rememberedObjects.indexOf(controller.object);
|
2277 |
-
if (matchedIndex !== -1) {
|
2278 |
-
var controllerMap = root.__rememberedObjectIndecesToControllers[matchedIndex];
|
2279 |
-
if (controllerMap === undefined) {
|
2280 |
-
controllerMap = {};
|
2281 |
-
root.__rememberedObjectIndecesToControllers[matchedIndex] = controllerMap;
|
2282 |
-
}
|
2283 |
-
controllerMap[controller.property] = controller;
|
2284 |
-
if (root.load && root.load.remembered) {
|
2285 |
-
var presetMap = root.load.remembered;
|
2286 |
-
var preset = void 0;
|
2287 |
-
if (presetMap[gui.preset]) {
|
2288 |
-
preset = presetMap[gui.preset];
|
2289 |
-
} else if (presetMap[DEFAULT_DEFAULT_PRESET_NAME]) {
|
2290 |
-
preset = presetMap[DEFAULT_DEFAULT_PRESET_NAME];
|
2291 |
-
} else {
|
2292 |
-
return;
|
2293 |
-
}
|
2294 |
-
if (preset[matchedIndex] && preset[matchedIndex][controller.property] !== undefined) {
|
2295 |
-
var value = preset[matchedIndex][controller.property];
|
2296 |
-
controller.initialValue = value;
|
2297 |
-
controller.setValue(value);
|
2298 |
-
}
|
2299 |
-
}
|
2300 |
-
}
|
2301 |
-
}
|
2302 |
-
function _add(gui, object, property, params) {
|
2303 |
-
if (object[property] === undefined) {
|
2304 |
-
throw new Error('Object "' + object + '" has no property "' + property + '"');
|
2305 |
-
}
|
2306 |
-
var controller = void 0;
|
2307 |
-
if (params.color) {
|
2308 |
-
controller = new ColorController(object, property);
|
2309 |
-
} else {
|
2310 |
-
var factoryArgs = [object, property].concat(params.factoryArgs);
|
2311 |
-
controller = ControllerFactory.apply(gui, factoryArgs);
|
2312 |
-
}
|
2313 |
-
if (params.before instanceof Controller) {
|
2314 |
-
params.before = params.before.__li;
|
2315 |
-
}
|
2316 |
-
recallSavedValue(gui, controller);
|
2317 |
-
dom.addClass(controller.domElement, 'c');
|
2318 |
-
var name = document.createElement('span');
|
2319 |
-
dom.addClass(name, 'property-name');
|
2320 |
-
name.innerHTML = controller.property;
|
2321 |
-
var container = document.createElement('div');
|
2322 |
-
container.appendChild(name);
|
2323 |
-
container.appendChild(controller.domElement);
|
2324 |
-
var li = addRow(gui, container, params.before);
|
2325 |
-
dom.addClass(li, GUI.CLASS_CONTROLLER_ROW);
|
2326 |
-
if (controller instanceof ColorController) {
|
2327 |
-
dom.addClass(li, 'color');
|
2328 |
-
} else {
|
2329 |
-
dom.addClass(li, _typeof(controller.getValue()));
|
2330 |
-
}
|
2331 |
-
augmentController(gui, li, controller);
|
2332 |
-
gui.__controllers.push(controller);
|
2333 |
-
return controller;
|
2334 |
-
}
|
2335 |
-
function getLocalStorageHash(gui, key) {
|
2336 |
-
return document.location.href + '.' + key;
|
2337 |
-
}
|
2338 |
-
function addPresetOption(gui, name, setSelected) {
|
2339 |
-
var opt = document.createElement('option');
|
2340 |
-
opt.innerHTML = name;
|
2341 |
-
opt.value = name;
|
2342 |
-
gui.__preset_select.appendChild(opt);
|
2343 |
-
if (setSelected) {
|
2344 |
-
gui.__preset_select.selectedIndex = gui.__preset_select.length - 1;
|
2345 |
-
}
|
2346 |
-
}
|
2347 |
-
function showHideExplain(gui, explain) {
|
2348 |
-
explain.style.display = gui.useLocalStorage ? 'block' : 'none';
|
2349 |
-
}
|
2350 |
-
function addSaveMenu(gui) {
|
2351 |
-
var div = gui.__save_row = document.createElement('li');
|
2352 |
-
dom.addClass(gui.domElement, 'has-save');
|
2353 |
-
gui.__ul.insertBefore(div, gui.__ul.firstChild);
|
2354 |
-
dom.addClass(div, 'save-row');
|
2355 |
-
var gears = document.createElement('span');
|
2356 |
-
gears.innerHTML = ' ';
|
2357 |
-
dom.addClass(gears, 'button gears');
|
2358 |
-
var button = document.createElement('span');
|
2359 |
-
button.innerHTML = 'Save';
|
2360 |
-
dom.addClass(button, 'button');
|
2361 |
-
dom.addClass(button, 'save');
|
2362 |
-
var button2 = document.createElement('span');
|
2363 |
-
button2.innerHTML = 'New';
|
2364 |
-
dom.addClass(button2, 'button');
|
2365 |
-
dom.addClass(button2, 'save-as');
|
2366 |
-
var button3 = document.createElement('span');
|
2367 |
-
button3.innerHTML = 'Revert';
|
2368 |
-
dom.addClass(button3, 'button');
|
2369 |
-
dom.addClass(button3, 'revert');
|
2370 |
-
var select = gui.__preset_select = document.createElement('select');
|
2371 |
-
if (gui.load && gui.load.remembered) {
|
2372 |
-
Common.each(gui.load.remembered, function (value, key) {
|
2373 |
-
addPresetOption(gui, key, key === gui.preset);
|
2374 |
-
});
|
2375 |
-
} else {
|
2376 |
-
addPresetOption(gui, DEFAULT_DEFAULT_PRESET_NAME, false);
|
2377 |
-
}
|
2378 |
-
dom.bind(select, 'change', function () {
|
2379 |
-
for (var index = 0; index < gui.__preset_select.length; index++) {
|
2380 |
-
gui.__preset_select[index].innerHTML = gui.__preset_select[index].value;
|
2381 |
-
}
|
2382 |
-
gui.preset = this.value;
|
2383 |
-
});
|
2384 |
-
div.appendChild(select);
|
2385 |
-
div.appendChild(gears);
|
2386 |
-
div.appendChild(button);
|
2387 |
-
div.appendChild(button2);
|
2388 |
-
div.appendChild(button3);
|
2389 |
-
if (SUPPORTS_LOCAL_STORAGE) {
|
2390 |
-
var explain = document.getElementById('dg-local-explain');
|
2391 |
-
var localStorageCheckBox = document.getElementById('dg-local-storage');
|
2392 |
-
var saveLocally = document.getElementById('dg-save-locally');
|
2393 |
-
saveLocally.style.display = 'block';
|
2394 |
-
if (localStorage.getItem(getLocalStorageHash(gui, 'isLocal')) === 'true') {
|
2395 |
-
localStorageCheckBox.setAttribute('checked', 'checked');
|
2396 |
-
}
|
2397 |
-
showHideExplain(gui, explain);
|
2398 |
-
dom.bind(localStorageCheckBox, 'change', function () {
|
2399 |
-
gui.useLocalStorage = !gui.useLocalStorage;
|
2400 |
-
showHideExplain(gui, explain);
|
2401 |
-
});
|
2402 |
-
}
|
2403 |
-
var newConstructorTextArea = document.getElementById('dg-new-constructor');
|
2404 |
-
dom.bind(newConstructorTextArea, 'keydown', function (e) {
|
2405 |
-
if (e.metaKey && (e.which === 67 || e.keyCode === 67)) {
|
2406 |
-
SAVE_DIALOGUE.hide();
|
2407 |
-
}
|
2408 |
-
});
|
2409 |
-
dom.bind(gears, 'click', function () {
|
2410 |
-
newConstructorTextArea.innerHTML = JSON.stringify(gui.getSaveObject(), undefined, 2);
|
2411 |
-
SAVE_DIALOGUE.show();
|
2412 |
-
newConstructorTextArea.focus();
|
2413 |
-
newConstructorTextArea.select();
|
2414 |
-
});
|
2415 |
-
dom.bind(button, 'click', function () {
|
2416 |
-
gui.save();
|
2417 |
-
});
|
2418 |
-
dom.bind(button2, 'click', function () {
|
2419 |
-
var presetName = prompt('Enter a new preset name.');
|
2420 |
-
if (presetName) {
|
2421 |
-
gui.saveAs(presetName);
|
2422 |
-
}
|
2423 |
-
});
|
2424 |
-
dom.bind(button3, 'click', function () {
|
2425 |
-
gui.revert();
|
2426 |
-
});
|
2427 |
-
}
|
2428 |
-
function addResizeHandle(gui) {
|
2429 |
-
var pmouseX = void 0;
|
2430 |
-
gui.__resize_handle = document.createElement('div');
|
2431 |
-
Common.extend(gui.__resize_handle.style, {
|
2432 |
-
width: '6px',
|
2433 |
-
marginLeft: '-3px',
|
2434 |
-
height: '200px',
|
2435 |
-
cursor: 'ew-resize',
|
2436 |
-
position: 'absolute'
|
2437 |
-
});
|
2438 |
-
function drag(e) {
|
2439 |
-
e.preventDefault();
|
2440 |
-
gui.width += pmouseX - e.clientX;
|
2441 |
-
gui.onResize();
|
2442 |
-
pmouseX = e.clientX;
|
2443 |
-
return false;
|
2444 |
-
}
|
2445 |
-
function dragStop() {
|
2446 |
-
dom.removeClass(gui.__closeButton, GUI.CLASS_DRAG);
|
2447 |
-
dom.unbind(window, 'mousemove', drag);
|
2448 |
-
dom.unbind(window, 'mouseup', dragStop);
|
2449 |
-
}
|
2450 |
-
function dragStart(e) {
|
2451 |
-
e.preventDefault();
|
2452 |
-
pmouseX = e.clientX;
|
2453 |
-
dom.addClass(gui.__closeButton, GUI.CLASS_DRAG);
|
2454 |
-
dom.bind(window, 'mousemove', drag);
|
2455 |
-
dom.bind(window, 'mouseup', dragStop);
|
2456 |
-
return false;
|
2457 |
-
}
|
2458 |
-
dom.bind(gui.__resize_handle, 'mousedown', dragStart);
|
2459 |
-
dom.bind(gui.__closeButton, 'mousedown', dragStart);
|
2460 |
-
gui.domElement.insertBefore(gui.__resize_handle, gui.domElement.firstElementChild);
|
2461 |
-
}
|
2462 |
-
function setWidth(gui, w) {
|
2463 |
-
gui.domElement.style.width = w + 'px';
|
2464 |
-
if (gui.__save_row && gui.autoPlace) {
|
2465 |
-
gui.__save_row.style.width = w + 'px';
|
2466 |
-
}
|
2467 |
-
if (gui.__closeButton) {
|
2468 |
-
gui.__closeButton.style.width = w + 'px';
|
2469 |
-
}
|
2470 |
-
}
|
2471 |
-
function getCurrentPreset(gui, useInitialValues) {
|
2472 |
-
var toReturn = {};
|
2473 |
-
Common.each(gui.__rememberedObjects, function (val, index) {
|
2474 |
-
var savedValues = {};
|
2475 |
-
var controllerMap = gui.__rememberedObjectIndecesToControllers[index];
|
2476 |
-
Common.each(controllerMap, function (controller, property) {
|
2477 |
-
savedValues[property] = useInitialValues ? controller.initialValue : controller.getValue();
|
2478 |
-
});
|
2479 |
-
toReturn[index] = savedValues;
|
2480 |
-
});
|
2481 |
-
return toReturn;
|
2482 |
-
}
|
2483 |
-
function setPresetSelectIndex(gui) {
|
2484 |
-
for (var index = 0; index < gui.__preset_select.length; index++) {
|
2485 |
-
if (gui.__preset_select[index].value === gui.preset) {
|
2486 |
-
gui.__preset_select.selectedIndex = index;
|
2487 |
-
}
|
2488 |
-
}
|
2489 |
-
}
|
2490 |
-
function updateDisplays(controllerArray) {
|
2491 |
-
if (controllerArray.length !== 0) {
|
2492 |
-
requestAnimationFrame$1.call(window, function () {
|
2493 |
-
updateDisplays(controllerArray);
|
2494 |
-
});
|
2495 |
-
}
|
2496 |
-
Common.each(controllerArray, function (c) {
|
2497 |
-
c.updateDisplay();
|
2498 |
-
});
|
2499 |
-
}
|
2500 |
-
|
2501 |
-
var color = {
|
2502 |
-
Color: Color,
|
2503 |
-
math: ColorMath,
|
2504 |
-
interpret: interpret
|
2505 |
-
};
|
2506 |
-
var controllers = {
|
2507 |
-
Controller: Controller,
|
2508 |
-
BooleanController: BooleanController,
|
2509 |
-
OptionController: OptionController,
|
2510 |
-
StringController: StringController,
|
2511 |
-
NumberController: NumberController,
|
2512 |
-
NumberControllerBox: NumberControllerBox,
|
2513 |
-
NumberControllerSlider: NumberControllerSlider,
|
2514 |
-
FunctionController: FunctionController,
|
2515 |
-
ColorController: ColorController
|
2516 |
-
};
|
2517 |
-
var dom$1 = { dom: dom };
|
2518 |
-
var gui = { GUI: GUI };
|
2519 |
-
var GUI$1 = GUI;
|
2520 |
-
var index = {
|
2521 |
-
color: color,
|
2522 |
-
controllers: controllers,
|
2523 |
-
dom: dom$1,
|
2524 |
-
gui: gui,
|
2525 |
-
GUI: GUI$1
|
2526 |
-
};
|
2527 |
-
|
2528 |
-
exports.color = color;
|
2529 |
-
exports.controllers = controllers;
|
2530 |
-
exports.dom = dom$1;
|
2531 |
-
exports.gui = gui;
|
2532 |
-
exports.GUI = GUI$1;
|
2533 |
-
exports['default'] = index;
|
2534 |
-
|
2535 |
-
Object.defineProperty(exports, '__esModule', { value: true });
|
2536 |
-
|
2537 |
-
})));
|
2538 |
-
//# sourceMappingURL=dat.gui.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/dat-gui/dat.gui.js.map
DELETED
The diff for this file is too large to render.
See raw diff
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/font-awesome/all.min.css
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Font Awesome Free 6.0.0-beta2 by @fontawesome - https://fontawesome.com
|
3 |
-
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
4 |
-
*/
|
5 |
-
.fa{font-family:"Font Awesome 6 Free";font-family:var(--fa-style-family,"Font Awesome 6 Free");font-weight:900;font-weight:var(--fa-style,900)}.fa,.fa-brands,.fa-duotone,.fa-light,.fa-regular,.fa-solid,.fa-thin,.fab,.fad,.fal,.far,.fas,.fat{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;display:var(--fa-display,inline-block);font-style:normal;font-variant:normal;line-height:1;text-rendering:auto}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-2xs{font-size:.625em;line-height:.1em;vertical-align:.225em}.fa-xs{font-size:.75em;line-height:.08333em;vertical-align:.125em}.fa-sm{font-size:.875em;line-height:.07143em;vertical-align:.05357em}.fa-lg{font-size:1.25em;line-height:.05em;vertical-align:-.075em}.fa-xl{font-size:1.5em;line-height:.04167em;vertical-align:-.125em}.fa-2xl{font-size:2em;line-height:.03125em;vertical-align:-.1875em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;margin-left:var(--fa-li-margin,2.5em);padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;left:calc(var(--fa-li-width, 2em)*-1);position:absolute;text-align:center;width:2em;width:var(--fa-li-width,2em);line-height:inherit}.fa-border{border-radius:.1em;border-radius:var(--fa-border-radius,.1em);border:.08em solid #eee;border:var(--fa-border-width,.08em) var(--fa-border-style,solid) var(--fa-border-color,#eee);padding:.2em .25em .15em;padding:var(--fa-border-padding,.2em .25em .15em)}.fa-pull-left{float:left;margin-right:.3em;margin-right:var(--fa-pull-margin,.3em)}.fa-pull-right{float:right;margin-left:.3em;margin-left:var(--fa-pull-margin,.3em)}.fa-beat{-webkit-animation-name:fa-beat;animation-name:fa-beat;-webkit-animation-delay:0;animation-delay:0;-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:normal;animation-direction:normal;-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out;-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-fade{-webkit-animation-name:fa-fade;animation-name:fa-fade;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:cubic-bezier(.4,0,.6,1);animation-timing-function:cubic-bezier(.4,0,.6,1);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-fade,.fa-flash{-webkit-animation-delay:0;animation-delay:0;-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:normal;animation-direction:normal;-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s)}.fa-flash{-webkit-animation-name:fa-flash;animation-name:fa-flash;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:cubic-bezier(.4,0,.6,1);animation-timing-function:cubic-bezier(.4,0,.6,1);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-flip{-webkit-animation-name:fa-flip;animation-name:fa-flip;-webkit-animation-delay:0;animation-delay:0;-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:normal;animation-direction:normal;-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out;-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-spin{-webkit-animation-name:fa-spin;animation-name:fa-spin;-webkit-animation-delay:0;animation-delay:0;-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:normal;animation-direction:normal;-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:2s;animation-duration:2s;-webkit-animation-duration:var(--fa-animation-duration,2s);animation-duration:var(--fa-animation-duration,2s);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-timing-function:var(--fa-animation-timing,linear);animation-timing-function:var(--fa-animation-timing,linear)}.fa-spin-reverse{--fa-animation-direction:reverse}.fa-pulse,.fa-spin-pulse{-webkit-animation-name:fa-spin;animation-name:fa-spin;-webkit-animation-direction:normal;animation-direction:normal;-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:steps(8);animation-timing-function:steps(8);-webkit-animation-timing-function:var(--fa-animation-timing,steps(8));animation-timing-function:var(--fa-animation-timing,steps(8))}@media (prefers-reduced-motion:reduce){.fa-beat,.fa-fade,.fa-flash,.fa-flip,.fa-pulse,.fa-spin,.fa-spin-pulse{-webkit-animation-delay:-1ms;animation-delay:-1ms;-webkit-animation-duration:1ms;animation-duration:1ms;-webkit-animation-iteration-count:1;animation-iteration-count:1;-webkit-transition-delay:0s;transition-delay:0s;-webkit-transition-duration:0s;transition-duration:0s}}@-webkit-keyframes fa-beat{0%,90%{-webkit-transform:scale(1);transform:scale(1)}45%{-webkit-transform:scale(1.25);transform:scale(1.25);-webkit-transform:scale(var(--fa-beat-scale,1.25));transform:scale(var(--fa-beat-scale,1.25))}}@keyframes fa-beat{0%,90%{-webkit-transform:scale(1);transform:scale(1)}45%{-webkit-transform:scale(1.25);transform:scale(1.25);-webkit-transform:scale(var(--fa-beat-scale,1.25));transform:scale(var(--fa-beat-scale,1.25))}}@-webkit-keyframes fa-fade{50%{opacity:.4;opacity:var(--fa-fade-opacity,.4)}}@keyframes fa-fade{50%{opacity:.4;opacity:var(--fa-fade-opacity,.4)}}@-webkit-keyframes fa-flash{0%,to{opacity:.4;opacity:var(--fa-flash-opacity,.4);-webkit-transform:scale(1);transform:scale(1)}50%{opacity:1;-webkit-transform:scale(1.125);transform:scale(1.125);-webkit-transform:scale(var(--fa-flash-scale,1.125));transform:scale(var(--fa-flash-scale,1.125))}}@keyframes fa-flash{0%,to{opacity:.4;opacity:var(--fa-flash-opacity,.4);-webkit-transform:scale(1);transform:scale(1)}50%{opacity:1;-webkit-transform:scale(1.125);transform:scale(1.125);-webkit-transform:scale(var(--fa-flash-scale,1.125));transform:scale(var(--fa-flash-scale,1.125))}}@-webkit-keyframes fa-flip{50%{-webkit-transform:rotateY(-180deg);transform:rotateY(-180deg);-webkit-transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg));transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg))}}@keyframes fa-flip{50%{-webkit-transform:rotateY(-180deg);transform:rotateY(-180deg);-webkit-transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg));transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg))}}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1);transform:scale(-1)}.fa-rotate-by{-webkit-transform:rotate(none);transform:rotate(none);-webkit-transform:rotate(var(--fa-rotate-angle,none));transform:rotate(var(--fa-rotate-angle,none))}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%;z-index:auto;z-index:var(--fa-stack-z-index,auto)}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff;color:var(--fa-inverse,#fff)}.fa-0:before{content:"\30"}.fa-1:before{content:"\31"}.fa-2:before{content:"\32"}.fa-3:before{content:"\33"}.fa-4:before{content:"\34"}.fa-5:before{content:"\35"}.fa-6:before{content:"\36"}.fa-7:before{content:"\37"}.fa-8:before{content:"\38"}.fa-9:before{content:"\39"}.fa-a:before{content:"\41"}.fa-address-book:before,.fa-contact-book:before{content:"\f2b9"}.fa-address-card:before,.fa-contact-card:before,.fa-vcard:before{content:"\f2bb"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-anchor:before{content:"\f13d"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-double-down:before,.fa-angles-down:before{content:"\f103"}.fa-angle-double-left:before,.fa-angles-left:before{content:"\f100"}.fa-angle-double-right:before,.fa-angles-right:before{content:"\f101"}.fa-angle-double-up:before,.fa-angles-up:before{content:"\f102"}.fa-ankh:before{content:"\f644"}.fa-apple-alt:before,.fa-apple-whole:before{content:"\f5d1"}.fa-archway:before{content:"\f557"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-down-1-9:before,.fa-sort-numeric-asc:before,.fa-sort-numeric-down:before{content:"\f162"}.fa-arrow-down-9-1:before,.fa-sort-numeric-desc:before,.fa-sort-numeric-down-alt:before{content:"\f886"}.fa-arrow-down-a-z:before,.fa-sort-alpha-asc:before,.fa-sort-alpha-down:before{content:"\f15d"}.fa-arrow-down-short-wide:before,.fa-sort-amount-desc:before,.fa-sort-amount-down-alt:before{content:"\f884"}.fa-arrow-down-wide-short:before,.fa-sort-amount-asc:before,.fa-sort-amount-down:before{content:"\f160"}.fa-arrow-down-z-a:before,.fa-sort-alpha-desc:before,.fa-sort-alpha-down-alt:before{content:"\f881"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-pointer:before,.fa-mouse-pointer:before{content:"\f245"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-left-rotate:before,.fa-arrow-rotate-back:before,.fa-arrow-rotate-backward:before,.fa-arrow-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-arrow-right-rotate:before,.fa-arrow-rotate-forward:before,.fa-arrow-rotate-right:before,.fa-redo:before{content:"\f01e"}.fa-arrow-trend-down:before{content:"\e097"}.fa-arrow-trend-up:before{content:"\e098"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-up-1-9:before,.fa-sort-numeric-up:before{content:"\f163"}.fa-arrow-up-9-1:before,.fa-sort-numeric-up-alt:before{content:"\f887"}.fa-arrow-up-a-z:before,.fa-sort-alpha-up:before{content:"\f15e"}.fa-arrow-up-from-bracket:before{content:"\e09a"}.fa-arrow-up-short-wide:before,.fa-sort-amount-up-alt:before{content:"\f885"}.fa-arrow-up-wide-short:before,.fa-sort-amount-up:before{content:"\f161"}.fa-arrow-up-z-a:before,.fa-sort-alpha-up-alt:before{content:"\f882"}.fa-arrows-rotate:before,.fa-refresh:before,.fa-sync:before{content:"\f021"}.fa-asterisk:before{content:"\2a"}.fa-at:before{content:"\40"}.fa-atom:before{content:"\f5d2"}.fa-audio-description:before{content:"\f29e"}.fa-austral-sign:before{content:"\e0a9"}.fa-award:before{content:"\f559"}.fa-b:before{content:"\42"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before,.fa-carriage-baby:before{content:"\f77d"}.fa-backward:before{content:"\f04a"}.fa-backward-fast:before,.fa-fast-backward:before{content:"\f049"}.fa-backward-step:before,.fa-step-backward:before{content:"\f048"}.fa-bacon:before{content:"\f7e5"}.fa-bacteria:before{content:"\e059"}.fa-bacterium:before{content:"\e05a"}.fa-bag-shopping:before,.fa-shopping-bag:before{content:"\f290"}.fa-bahai:before{content:"\f666"}.fa-baht-sign:before{content:"\e0ac"}.fa-ban:before,.fa-cancel:before{content:"\f05e"}.fa-ban-smoking:before,.fa-smoking-ban:before{content:"\f54d"}.fa-band-aid:before,.fa-bandage:before{content:"\f462"}.fa-bank:before,.fa-institution:before,.fa-university:before{content:"\f19c"}.fa-barcode:before{content:"\f02a"}.fa-bars:before,.fa-navicon:before{content:"\f0c9"}.fa-bars-staggered:before,.fa-reorder:before,.fa-stream:before{content:"\f550"}.fa-baseball-ball:before,.fa-baseball:before{content:"\f433"}.fa-basket-shopping:before,.fa-shopping-basket:before{content:"\f291"}.fa-basketball-ball:before,.fa-basketball:before{content:"\f434"}.fa-bath:before,.fa-bathtub:before{content:"\f2cd"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-battery-5:before,.fa-battery-full:before,.fa-battery:before{content:"\f240"}.fa-battery-3:before,.fa-battery-half:before{content:"\f242"}.fa-battery-2:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-4:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-bed:before{content:"\f236"}.fa-bed-pulse:before,.fa-procedures:before{content:"\f487"}.fa-beer-mug-empty:before,.fa-beer:before{content:"\f0fc"}.fa-bell:before{content:"\f0f3"}.fa-bell-concierge:before,.fa-concierge-bell:before{content:"\f562"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bicycle:before{content:"\f206"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-bitcoin-sign:before{content:"\e0b4"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blog:before{content:"\f781"}.fa-bold:before{content:"\f032"}.fa-bolt:before,.fa-flash:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-atlas:before,.fa-book-atlas:before{content:"\f558"}.fa-bible:before,.fa-book-bible:before{content:"\f647"}.fa-book-journal-whills:before,.fa-journal-whills:before{content:"\f66a"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-open-reader:before,.fa-book-reader:before{content:"\f5da"}.fa-book-quran:before,.fa-quran:before{content:"\f687"}.fa-book-dead:before,.fa-book-skull:before{content:"\f6b7"}.fa-bookmark:before{content:"\f02e"}.fa-border-all:before{content:"\f84c"}.fa-border-none:before{content:"\f850"}.fa-border-style:before,.fa-border-top-left:before{content:"\f853"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-archive:before,.fa-box-archive:before{content:"\f187"}.fa-box-open:before{content:"\f49e"}.fa-box-tissue:before{content:"\e05b"}.fa-boxes-alt:before,.fa-boxes-stacked:before,.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burger:before,.fa-hamburger:before{content:"\f805"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before,.fa-bus-simple:before{content:"\f55e"}.fa-briefcase-clock:before,.fa-business-time:before{content:"\f64a"}.fa-c:before{content:"\43"}.fa-birthday-cake:before,.fa-cake-candles:before{content:"\f1fd"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-alt:before,.fa-calendar-days:before{content:"\f073"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-week:before{content:"\f784"}.fa-calendar-times:before,.fa-calendar-xmark:before{content:"\f273"}.fa-camera-alt:before,.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-camera-rotate:before{content:"\e0d8"}.fa-campground:before{content:"\f6bb"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-battery-car:before,.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-alt:before,.fa-car-rear:before{content:"\f5de"}.fa-car-side:before{content:"\f5e4"}.fa-caravan:before{content:"\f8ff"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-flatbed:before,.fa-dolly-flatbed:before{content:"\f474"}.fa-cart-flatbed-suitcase:before,.fa-luggage-cart:before{content:"\f59d"}.fa-cart-plus:before{content:"\f217"}.fa-cart-shopping:before,.fa-shopping-cart:before{content:"\f07a"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cedi-sign:before{content:"\e0df"}.fa-cent-sign:before{content:"\e3f5"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-blackboard:before,.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before,.fa-chalkboard-user:before{content:"\f51c"}.fa-champagne-glasses:before,.fa-glass-cheers:before{content:"\f79f"}.fa-charging-station:before{content:"\f5e7"}.fa-area-chart:before,.fa-chart-area:before{content:"\f1fe"}.fa-bar-chart:before,.fa-chart-bar:before{content:"\f080"}.fa-chart-gantt:before{content:"\e0e4"}.fa-chart-line:before,.fa-line-chart:before{content:"\f201"}.fa-chart-pie:before,.fa-pie-chart:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-double:before{content:"\f560"}.fa-check-to-slot:before,.fa-vote-yea:before{content:"\f772"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-arrow-circle-down:before,.fa-circle-arrow-down:before{content:"\f0ab"}.fa-arrow-circle-left:before,.fa-circle-arrow-left:before{content:"\f0a8"}.fa-arrow-circle-right:before,.fa-circle-arrow-right:before{content:"\f0a9"}.fa-arrow-circle-up:before,.fa-circle-arrow-up:before{content:"\f0aa"}.fa-check-circle:before,.fa-circle-check:before{content:"\f058"}.fa-chevron-circle-down:before,.fa-circle-chevron-down:before{content:"\f13a"}.fa-chevron-circle-left:before,.fa-circle-chevron-left:before{content:"\f137"}.fa-chevron-circle-right:before,.fa-circle-chevron-right:before{content:"\f138"}.fa-chevron-circle-up:before,.fa-circle-chevron-up:before{content:"\f139"}.fa-circle-dollar-to-slot:before,.fa-donate:before{content:"\f4b9"}.fa-circle-dot:before,.fa-dot-circle:before{content:"\f192"}.fa-arrow-alt-circle-down:before,.fa-circle-down:before{content:"\f358"}.fa-circle-exclamation:before,.fa-exclamation-circle:before{content:"\f06a"}.fa-circle-h:before,.fa-hospital-symbol:before{content:"\f47e"}.fa-adjust:before,.fa-circle-half-stroke:before{content:"\f042"}.fa-circle-info:before,.fa-info-circle:before{content:"\f05a"}.fa-arrow-alt-circle-left:before,.fa-circle-left:before{content:"\f359"}.fa-circle-minus:before,.fa-minus-circle:before{content:"\f056"}.fa-circle-notch:before{content:"\f1ce"}.fa-circle-pause:before,.fa-pause-circle:before{content:"\f28b"}.fa-circle-play:before,.fa-play-circle:before{content:"\f144"}.fa-circle-plus:before,.fa-plus-circle:before{content:"\f055"}.fa-circle-question:before,.fa-question-circle:before{content:"\f059"}.fa-circle-radiation:before,.fa-radiation-alt:before{content:"\f7ba"}.fa-arrow-alt-circle-right:before,.fa-circle-right:before{content:"\f35a"}.fa-circle-stop:before,.fa-stop-circle:before{content:"\f28d"}.fa-arrow-alt-circle-up:before,.fa-circle-up:before{content:"\f35b"}.fa-circle-user:before,.fa-user-circle:before{content:"\f2bd"}.fa-circle-xmark:before,.fa-times-circle:before,.fa-xmark-circle:before{content:"\f057"}.fa-city:before{content:"\f64f"}.fa-clapperboard:before{content:"\e131"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock-four:before,.fa-clock:before{content:"\f017"}.fa-clock-rotate-left:before,.fa-history:before{content:"\f1da"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-arrow-down:before,.fa-cloud-download-alt:before,.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-arrow-up:before,.fa-cloud-upload-alt:before,.fa-cloud-upload:before{content:"\f0ee"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-clover:before{content:"\e139"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-code-commit:before{content:"\f386"}.fa-code-compare:before{content:"\e13a"}.fa-code-fork:before{content:"\e13b"}.fa-code-merge:before{content:"\f387"}.fa-code-pull-request:before{content:"\e13c"}.fa-coins:before{content:"\f51e"}.fa-colon-sign:before{content:"\e140"}.fa-comment:before{content:"\f075"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before,.fa-commenting:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comment-sms:before,.fa-sms:before{content:"\f7cd"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compass-drafting:before,.fa-drafting-compass:before{content:"\f568"}.fa-compress:before{content:"\f066"}.fa-computer-mouse:before,.fa-mouse:before{content:"\f8cc"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-couch:before{content:"\f4b8"}.fa-credit-card-alt:before,.fa-credit-card:before{content:"\f09d"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before,.fa-crop-simple:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-cruzeiro-sign:before{content:"\e152"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-d:before{content:"\44"}.fa-database:before{content:"\f1c0"}.fa-backspace:before,.fa-delete-left:before{content:"\f55a"}.fa-democrat:before{content:"\f747"}.fa-desktop-alt:before,.fa-desktop:before{content:"\f390"}.fa-dharmachakra:before{content:"\f655"}.fa-diagram-project:before,.fa-project-diagram:before{content:"\f542"}.fa-diamond-turn-right:before,.fa-directions:before{content:"\f5eb"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-disease:before{content:"\f7fa"}.fa-divide:before{content:"\f529"}.fa-dna:before{content:"\f471"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before,.fa-dollar:before,.fa-usd:before{content:"\24"}.fa-dolly-box:before,.fa-dolly:before{content:"\f472"}.fa-dong-sign:before{content:"\e169"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dove:before{content:"\f4ba"}.fa-compress-alt:before,.fa-down-left-and-up-right-to-center:before{content:"\f422"}.fa-down-long:before,.fa-long-arrow-alt-down:before{content:"\f309"}.fa-download:before{content:"\f019"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-droplet:before,.fa-tint:before{content:"\f043"}.fa-droplet-slash:before,.fa-tint-slash:before{content:"\f5c7"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-e:before{content:"\45"}.fa-deaf:before,.fa-deafness:before,.fa-ear-deaf:before,.fa-hard-of-hearing:before{content:"\f2a4"}.fa-assistive-listening-systems:before,.fa-ear-listen:before{content:"\f2a2"}.fa-earth-africa:before,.fa-globe-africa:before{content:"\f57c"}.fa-earth-americas:before,.fa-earth:before,.fa-globe-americas:before{content:"\f57d"}.fa-earth-asia:before,.fa-globe-asia:before{content:"\f57e"}.fa-earth-europa:before,.fa-globe-europe:before{content:"\f7a2"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elevator:before{content:"\e16d"}.fa-ellipsis-h:before,.fa-ellipsis:before{content:"\f141"}.fa-ellipsis-v:before,.fa-ellipsis-vertical:before{content:"\f142"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelopes-bulk:before,.fa-mail-bulk:before{content:"\f674"}.fa-equals:before{content:"\3d"}.fa-eraser:before{content:"\f12d"}.fa-ethernet:before{content:"\f796"}.fa-eur:before,.fa-euro-sign:before,.fa-euro:before{content:"\f153"}.fa-exclamation:before{content:"\21"}.fa-expand:before{content:"\f065"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper-empty:before,.fa-eye-dropper:before,.fa-eyedropper:before{content:"\f1fb"}.fa-eye-low-vision:before,.fa-low-vision:before{content:"\f2a8"}.fa-eye-slash:before{content:"\f070"}.fa-f:before{content:"\46"}.fa-angry:before,.fa-face-angry:before{content:"\f556"}.fa-dizzy:before,.fa-face-dizzy:before{content:"\f567"}.fa-face-flushed:before,.fa-flushed:before{content:"\f579"}.fa-face-frown:before,.fa-frown:before{content:"\f119"}.fa-face-frown-open:before,.fa-frown-open:before{content:"\f57a"}.fa-face-grimace:before,.fa-grimace:before{content:"\f57f"}.fa-face-grin:before,.fa-grin:before{content:"\f580"}.fa-face-grin-beam:before,.fa-grin-beam:before{content:"\f582"}.fa-face-grin-beam-sweat:before,.fa-grin-beam-sweat:before{content:"\f583"}.fa-face-grin-hearts:before,.fa-grin-hearts:before{content:"\f584"}.fa-face-grin-squint:before,.fa-grin-squint:before{content:"\f585"}.fa-face-grin-squint-tears:before,.fa-grin-squint-tears:before{content:"\f586"}.fa-face-grin-stars:before,.fa-grin-stars:before{content:"\f587"}.fa-face-grin-tears:before,.fa-grin-tears:before{content:"\f588"}.fa-face-grin-tongue:before,.fa-grin-tongue:before{content:"\f589"}.fa-face-grin-tongue-squint:before,.fa-grin-tongue-squint:before{content:"\f58a"}.fa-face-grin-tongue-wink:before,.fa-grin-tongue-wink:before{content:"\f58b"}.fa-face-grin-wide:before,.fa-grin-alt:before{content:"\f581"}.fa-face-grin-wink:before,.fa-grin-wink:before{content:"\f58c"}.fa-face-kiss:before,.fa-kiss:before{content:"\f596"}.fa-face-kiss-beam:before,.fa-kiss-beam:before{content:"\f597"}.fa-face-kiss-wink-heart:before,.fa-kiss-wink-heart:before{content:"\f598"}.fa-face-laugh:before,.fa-laugh:before{content:"\f599"}.fa-face-laugh-beam:before,.fa-laugh-beam:before{content:"\f59a"}.fa-face-laugh-squint:before,.fa-laugh-squint:before{content:"\f59b"}.fa-face-laugh-wink:before,.fa-laugh-wink:before{content:"\f59c"}.fa-face-meh:before,.fa-meh:before{content:"\f11a"}.fa-face-meh-blank:before,.fa-meh-blank:before{content:"\f5a4"}.fa-face-rolling-eyes:before,.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-face-sad-cry:before,.fa-sad-cry:before{content:"\f5b3"}.fa-face-sad-tear:before,.fa-sad-tear:before{content:"\f5b4"}.fa-face-smile:before,.fa-smile:before{content:"\f118"}.fa-face-smile-beam:before,.fa-smile-beam:before{content:"\f5b8"}.fa-face-smile-wink:before,.fa-smile-wink:before{content:"\f4da"}.fa-face-surprise:before,.fa-surprise:before{content:"\f5c2"}.fa-face-tired:before,.fa-tired:before{content:"\f5c8"}.fa-fan:before{content:"\f863"}.fa-faucet:before{content:"\e005"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before,.fa-feather-pointed:before{content:"\f56b"}.fa-file:before{content:"\f15b"}.fa-file-arrow-down:before,.fa-file-download:before{content:"\f56d"}.fa-file-arrow-up:before,.fa-file-upload:before{content:"\f574"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-excel:before{content:"\f1c3"}.fa-arrow-right-from-file:before,.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-arrow-right-to-file:before,.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-alt:before,.fa-file-lines:before,.fa-file-text:before{content:"\f15c"}.fa-file-medical:before{content:"\f477"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-video:before{content:"\f1c8"}.fa-file-medical-alt:before,.fa-file-waveform:before{content:"\f478"}.fa-file-word:before{content:"\f1c2"}.fa-file-archive:before,.fa-file-zipper:before{content:"\f1c6"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-filter-circle-dollar:before,.fa-funnel-dollar:before{content:"\f662"}.fa-filter-circle-xmark:before{content:"\e17b"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-extinguisher:before{content:"\f134"}.fa-fire-alt:before,.fa-fire-flame-curved:before{content:"\f7e4"}.fa-burn:before,.fa-fire-flame-simple:before{content:"\f46a"}.fa-fish:before{content:"\f578"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-floppy-disk:before,.fa-save:before{content:"\f0c7"}.fa-florin-sign:before{content:"\e184"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-folder-tree:before{content:"\f802"}.fa-font:before{content:"\f031"}.fa-football-ball:before,.fa-football:before{content:"\f44e"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before,.fa-forward-fast:before{content:"\f050"}.fa-forward-step:before,.fa-step-forward:before{content:"\f051"}.fa-franc-sign:before{content:"\e18f"}.fa-frog:before{content:"\f52e"}.fa-futbol-ball:before,.fa-futbol:before,.fa-soccer-ball:before{content:"\f1e3"}.fa-g:before{content:"\47"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gauge-simple-high:before,.fa-gauge-simple:before,.fa-tachometer:before{content:"\f62a"}.fa-gavel:before,.fa-legal:before{content:"\f0e3"}.fa-cog:before,.fa-gear:before{content:"\f013"}.fa-cogs:before,.fa-gears:before{content:"\f085"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-glasses:before{content:"\f530"}.fa-globe:before{content:"\f0ac"}.fa-golf-ball-tee:before,.fa-golf-ball:before{content:"\f450"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}.fa-greater-than:before{content:"\3e"}.fa-greater-than-equal:before{content:"\f532"}.fa-grip-horizontal:before,.fa-grip:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-guarani-sign:before{content:"\e19a"}.fa-guitar:before{content:"\f7a6"}.fa-gun:before{content:"\e19b"}.fa-h:before{content:"\48"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-paper:before,.fa-hand:before{content:"\f256"}.fa-hand-back-fist:before,.fa-hand-rock:before{content:"\f255"}.fa-allergies:before,.fa-hand-dots:before{content:"\f461"}.fa-fist-raised:before,.fa-hand-fist:before{content:"\f6de"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-dollar:before,.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-holding-droplet:before,.fa-hand-holding-water:before{content:"\f4c1"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-medical:before{content:"\e05c"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-sparkles:before{content:"\e05d"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before,.fa-sign-language:before,.fa-signing:before{content:"\f2a7"}.fa-american-sign-language-interpreting:before,.fa-asl-interpreting:before,.fa-hands-american-sign-language-interpreting:before,.fa-hands-asl-interpreting:before{content:"\f2a3"}.fa-hands-bubbles:before,.fa-hands-wash:before{content:"\e05e"}.fa-hands-clapping:before{content:"\e1a8"}.fa-hands-holding:before{content:"\f4c2"}.fa-hands-praying:before,.fa-praying-hands:before{content:"\f684"}.fa-handshake:before{content:"\f2b5"}.fa-hands-helping:before,.fa-handshake-angle:before{content:"\f4c4"}.fa-handshake-alt-slash:before,.fa-handshake-simple-slash:before{content:"\e05f"}.fa-handshake-slash:before{content:"\e060"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-drive:before,.fa-hdd:before{content:"\f0a0"}.fa-hashtag:before{content:"\23"}.fa-hat-cowboy:before{content:"\f8c0"}.fa-hat-cowboy-side:before{content:"\f8c1"}.fa-hat-wizard:before{content:"\f6e8"}.fa-head-side-cough:before{content:"\e061"}.fa-head-side-cough-slash:before{content:"\e062"}.fa-head-side-mask:before{content:"\e063"}.fa-head-side-virus:before{content:"\e064"}.fa-header:before,.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before,.fa-headphones-simple:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before,.fa-heart-crack:before{content:"\f7a9"}.fa-heart-pulse:before,.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-hard-hat:before,.fa-hat-hard:before,.fa-helmet-safety:before{content:"\f807"}.fa-highlighter:before{content:"\f591"}.fa-hippo:before{content:"\f6ed"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-user:before{content:"\f80d"}.fa-hospital-alt:before,.fa-hospital-wide:before{content:"\f47d"}.fa-hot-tub-person:before,.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hourglass-2:before,.fa-hourglass-half:before,.fa-hourglass:before{content:"\f254"}.fa-hourglass-empty:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-home:before,.fa-house:before{content:"\f015"}.fa-home-lg:before,.fa-house-chimney:before{content:"\e3af"}.fa-house-crack:before{content:"\e3b1"}.fa-house-laptop:before,.fa-laptop-house:before{content:"\e066"}.fa-house-medical:before{content:"\e3b2"}.fa-home-user:before,.fa-house-user:before{content:"\e1b0"}.fa-hryvnia-sign:before,.fa-hryvnia:before{content:"\f6f2"}.fa-i:before{content:"\49"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-heart-music-camera-bolt:before,.fa-icons:before{content:"\f86d"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before,.fa-id-card-clip:before{content:"\f47f"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-image-portrait:before,.fa-portrait:before{content:"\f3e0"}.fa-images:before{content:"\f302"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-indian-rupee-sign:before,.fa-indian-rupee:before,.fa-inr:before{content:"\e1bc"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-italic:before{content:"\f033"}.fa-j:before{content:"\4a"}.fa-jedi:before{content:"\f669"}.fa-fighter-jet:before,.fa-jet-fighter:before{content:"\f0fb"}.fa-joint:before{content:"\f595"}.fa-k:before{content:"\4b"}.fa-kaaba:before{content:"\f66b"}.fa-key:before{content:"\f084"}.fa-keyboard:before{content:"\f11c"}.fa-khanda:before{content:"\f66d"}.fa-kip-sign:before{content:"\e1c4"}.fa-first-aid:before,.fa-kit-medical:before{content:"\f479"}.fa-kiwi-bird:before{content:"\f535"}.fa-l:before{content:"\4c"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-medical:before{content:"\f812"}.fa-lari-sign:before{content:"\e1c8"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-left-long:before,.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-arrows-alt-h:before,.fa-left-right:before{content:"\f337"}.fa-lemon:before{content:"\f094"}.fa-less-than:before{content:"\3c"}.fa-less-than-equal:before{content:"\f537"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-chain-broken:before,.fa-chain-slash:before,.fa-link-slash:before,.fa-unlink:before{content:"\f127"}.fa-lira-sign:before{content:"\f195"}.fa-list-squares:before,.fa-list:before{content:"\f03a"}.fa-list-check:before,.fa-tasks:before{content:"\f0ae"}.fa-list-1-2:before,.fa-list-numeric:before,.fa-list-ol:before{content:"\f0cb"}.fa-list-dots:before,.fa-list-ul:before{content:"\f0ca"}.fa-litecoin-sign:before{content:"\e1d3"}.fa-location-arrow:before{content:"\f124"}.fa-location-crosshairs:before,.fa-location:before{content:"\f601"}.fa-location-dot:before,.fa-map-marker-alt:before{content:"\f3c5"}.fa-location-pin:before,.fa-map-marker:before{content:"\f041"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-lungs:before{content:"\f604"}.fa-lungs-virus:before{content:"\e067"}.fa-m:before{content:"\4d"}.fa-magnet:before{content:"\f076"}.fa-magnifying-glass:before,.fa-search:before{content:"\f002"}.fa-magnifying-glass-dollar:before,.fa-search-dollar:before{content:"\f688"}.fa-magnifying-glass-location:before,.fa-search-location:before{content:"\f689"}.fa-magnifying-glass-minus:before,.fa-search-minus:before{content:"\f010"}.fa-magnifying-glass-plus:before,.fa-search-plus:before{content:"\f00e"}.fa-manat-sign:before{content:"\e1d5"}.fa-map:before{content:"\f279"}.fa-map-location:before,.fa-map-marked:before{content:"\f59f"}.fa-map-location-dot:before,.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-pin:before{content:"\f276"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-and-venus:before{content:"\f224"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before,.fa-mars-stroke-right:before{content:"\f22b"}.fa-mars-stroke-up:before,.fa-mars-stroke-v:before{content:"\f22a"}.fa-glass-martini-alt:before,.fa-martini-glass:before{content:"\f57b"}.fa-cocktail:before,.fa-martini-glass-citrus:before{content:"\f561"}.fa-glass-martini:before,.fa-martini-glass-empty:before{content:"\f000"}.fa-mask:before{content:"\f6fa"}.fa-mask-face:before{content:"\e1d7"}.fa-masks-theater:before,.fa-theater-masks:before{content:"\f630"}.fa-expand-arrows-alt:before,.fa-maximize:before{content:"\f31e"}.fa-medal:before{content:"\f5a2"}.fa-memory:before{content:"\f538"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-comment-alt:before,.fa-message:before{content:"\f27a"}.fa-meteor:before{content:"\f753"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before,.fa-microphone-lines:before{content:"\f3c9"}.fa-microphone-alt-slash:before,.fa-microphone-lines-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-mill-sign:before{content:"\e1ed"}.fa-compress-arrows-alt:before,.fa-minimize:before{content:"\f78c"}.fa-minus:before,.fa-subtract:before{content:"\f068"}.fa-mitten:before{content:"\f7b5"}.fa-mobile-button:before{content:"\f10b"}.fa-mobile-alt:before,.fa-mobile-screen-button:before{content:"\f3cd"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-1:before,.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-1-wave:before,.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before,.fa-money-check-dollar:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mug-hot:before{content:"\f7b6"}.fa-coffee:before,.fa-mug-saucer:before{content:"\f0f4"}.fa-music:before{content:"\f001"}.fa-n:before{content:"\4e"}.fa-naira-sign:before{content:"\e1f6"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-not-equal:before{content:"\f53e"}.fa-note-sticky:before,.fa-sticky-note:before{content:"\f249"}.fa-notes-medical:before{content:"\f481"}.fa-o:before{content:"\4f"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-oil-can:before{content:"\f613"}.fa-om:before{content:"\f679"}.fa-otter:before{content:"\f700"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-p:before{content:"\50"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-pallet:before{content:"\f482"}.fa-panorama:before{content:"\e209"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-passport:before{content:"\f5ab"}.fa-file-clipboard:before,.fa-paste:before{content:"\f0ea"}.fa-pause:before{content:"\f04c"}.fa-paw:before{content:"\f1b0"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before,.fa-pen-clip:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-ruler:before,.fa-pencil-ruler:before{content:"\f5ae"}.fa-edit:before,.fa-pen-to-square:before{content:"\f044"}.fa-pencil-alt:before,.fa-pencil:before{content:"\f303"}.fa-people-arrows-left-right:before,.fa-people-arrows:before{content:"\e068"}.fa-people-carry-box:before,.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before,.fa-percentage:before{content:"\25"}.fa-male:before,.fa-person:before{content:"\f183"}.fa-biking:before,.fa-person-biking:before{content:"\f84a"}.fa-person-booth:before{content:"\f756"}.fa-diagnoses:before,.fa-person-dots-from-line:before{content:"\f470"}.fa-female:before,.fa-person-dress:before{content:"\f182"}.fa-hiking:before,.fa-person-hiking:before{content:"\f6ec"}.fa-person-praying:before,.fa-pray:before{content:"\f683"}.fa-person-running:before,.fa-running:before{content:"\f70c"}.fa-person-skating:before,.fa-skating:before{content:"\f7c5"}.fa-person-skiing:before,.fa-skiing:before{content:"\f7c9"}.fa-person-skiing-nordic:before,.fa-skiing-nordic:before{content:"\f7ca"}.fa-person-snowboarding:before,.fa-snowboarding:before{content:"\f7ce"}.fa-person-swimming:before,.fa-swimmer:before{content:"\f5c4"}.fa-person-walking:before,.fa-walking:before{content:"\f554"}.fa-blind:before,.fa-person-walking-with-cane:before{content:"\f29d"}.fa-peseta-sign:before{content:"\e221"}.fa-peso-sign:before{content:"\e222"}.fa-phone:before{content:"\f095"}.fa-phone-alt:before,.fa-phone-flip:before{content:"\f879"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-volume:before,.fa-volume-control-phone:before{content:"\f2a0"}.fa-photo-film:before,.fa-photo-video:before{content:"\f87c"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-plane-slash:before{content:"\e069"}.fa-play:before{content:"\f04b"}.fa-plug:before{content:"\f1e6"}.fa-add:before,.fa-plus:before{content:"\2b"}.fa-plus-minus:before{content:"\e43c"}.fa-podcast:before{content:"\f2ce"}.fa-poo:before{content:"\f2fe"}.fa-poo-bolt:before,.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-power-off:before{content:"\f011"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before,.fa-prescription-bottle-medical:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-pump-medical:before{content:"\e06a"}.fa-pump-soap:before{content:"\e06b"}.fa-puzzle-piece:before{content:"\f12e"}.fa-q:before{content:"\51"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\3f"}.fa-broom-ball:before,.fa-quidditch-broom-ball:before,.fa-quidditch:before{content:"\f458"}.fa-quote-left-alt:before,.fa-quote-left:before{content:"\f10d"}.fa-quote-right-alt:before,.fa-quote-right:before{content:"\f10e"}.fa-r:before{content:"\52"}.fa-radiation:before{content:"\f7b9"}.fa-rainbow:before{content:"\f75b"}.fa-receipt:before{content:"\f543"}.fa-record-vinyl:before{content:"\f8d9"}.fa-ad:before,.fa-rectangle-ad:before{content:"\f641"}.fa-list-alt:before,.fa-rectangle-list:before{content:"\f022"}.fa-rectangle-times:before,.fa-rectangle-xmark:before,.fa-times-rectangle:before,.fa-window-close:before{content:"\f410"}.fa-recycle:before{content:"\f1b8"}.fa-registered:before{content:"\f25d"}.fa-repeat:before{content:"\f363"}.fa-mail-reply:before,.fa-reply:before{content:"\f3e5"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-republican:before{content:"\f75e"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-ribbon:before{content:"\f4d6"}.fa-right-from-bracket:before,.fa-sign-out-alt:before{content:"\f2f5"}.fa-exchange-alt:before,.fa-right-left:before{content:"\f362"}.fa-long-arrow-alt-right:before,.fa-right-long:before{content:"\f30b"}.fa-right-to-bracket:before,.fa-sign-in-alt:before{content:"\f2f6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rotate:before,.fa-sync-alt:before{content:"\f2f1"}.fa-rotate-back:before,.fa-rotate-backward:before,.fa-rotate-left:before,.fa-undo-alt:before{content:"\f2ea"}.fa-route:before{content:"\f4d7"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-rouble:before,.fa-rub:before,.fa-ruble-sign:before,.fa-ruble:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-rupee-sign:before,.fa-rupee:before{content:"\f156"}.fa-rupiah-sign:before{content:"\e23d"}.fa-s:before{content:"\53"}.fa-sailboat:before{content:"\e445"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-balance-scale:before,.fa-scale-balanced:before{content:"\f24e"}.fa-balance-scale-left:before,.fa-scale-unbalanced:before{content:"\f515"}.fa-balance-scale-right:before,.fa-scale-unbalanced-flip:before{content:"\f516"}.fa-school:before{content:"\f549"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-screwdriver:before{content:"\f54a"}.fa-screwdriver-wrench:before,.fa-tools:before{content:"\f7d9"}.fa-scroll:before{content:"\f70e"}.fa-scroll-torah:before,.fa-torah:before{content:"\f6a0"}.fa-sd-card:before{content:"\f7c2"}.fa-section:before{content:"\e447"}.fa-seedling:before,.fa-sprout:before{content:"\f4d8"}.fa-server:before{content:"\f233"}.fa-shapes:before,.fa-triangle-circle-square:before{content:"\f61f"}.fa-arrow-turn-right:before,.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-share-from-square:before,.fa-share-square:before{content:"\f14d"}.fa-share-alt:before,.fa-share-nodes:before{content:"\f1e0"}.fa-ils:before,.fa-shekel-sign:before,.fa-shekel:before,.fa-sheqel-sign:before,.fa-sheqel:before{content:"\f20b"}.fa-shield-alt:before,.fa-shield-blank:before{content:"\f3ed"}.fa-shield-virus:before{content:"\e06c"}.fa-ship:before{content:"\f21a"}.fa-shirt:before,.fa-t-shirt:before,.fa-tshirt:before{content:"\f553"}.fa-shoe-prints:before{content:"\f54b"}.fa-shop:before,.fa-store-alt:before{content:"\f54f"}.fa-shop-slash:before,.fa-store-alt-slash:before{content:"\e070"}.fa-shower:before{content:"\f2cc"}.fa-random:before,.fa-shuffle:before{content:"\f074"}.fa-shuttle-space:before,.fa-space-shuttle:before{content:"\f197"}.fa-sign-hanging:before,.fa-sign:before{content:"\f4d9"}.fa-signal-5:before,.fa-signal-perfect:before,.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-map-signs:before,.fa-signs-post:before{content:"\f277"}.fa-sim-card:before{content:"\f7c4"}.fa-sink:before{content:"\e06d"}.fa-sitemap:before{content:"\f0e8"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before,.fa-sliders:before{content:"\f1de"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-soap:before{content:"\e06e"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before,.fa-unsorted:before{content:"\f0dc"}.fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}.fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}.fa-spa:before{content:"\f5bb"}.fa-pastafarianism:before,.fa-spaghetti-monster-flying:before{content:"\f67b"}.fa-spell-check:before{content:"\f891"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spoon:before,.fa-utensil-spoon:before{content:"\f2e5"}.fa-spray-can:before{content:"\f5bd"}.fa-air-freshener:before,.fa-spray-can-sparkles:before{content:"\f5d0"}.fa-square:before{content:"\f0c8"}.fa-caret-square-down:before,.fa-square-caret-down:before{content:"\f150"}.fa-caret-square-left:before,.fa-square-caret-left:before{content:"\f191"}.fa-caret-square-right:before,.fa-square-caret-right:before{content:"\f152"}.fa-caret-square-up:before,.fa-square-caret-up:before{content:"\f151"}.fa-check-square:before,.fa-square-check:before{content:"\f14a"}.fa-envelope-square:before,.fa-square-envelope:before{content:"\f199"}.fa-square-full:before{content:"\f45c"}.fa-h-square:before,.fa-square-h:before{content:"\f0fd"}.fa-minus-square:before,.fa-square-minus:before{content:"\f146"}.fa-parking:before,.fa-square-parking:before{content:"\f540"}.fa-pen-square:before,.fa-pencil-square:before,.fa-square-pen:before{content:"\f14b"}.fa-phone-square:before,.fa-square-phone:before{content:"\f098"}.fa-phone-square-alt:before,.fa-square-phone-flip:before{content:"\f87b"}.fa-plus-square:before,.fa-square-plus:before{content:"\f0fe"}.fa-poll-h:before,.fa-square-poll-horizontal:before{content:"\f682"}.fa-poll:before,.fa-square-poll-vertical:before{content:"\f681"}.fa-square-root-alt:before,.fa-square-root-variable:before{content:"\f698"}.fa-rss-square:before,.fa-square-rss:before{content:"\f143"}.fa-share-alt-square:before,.fa-square-share-nodes:before{content:"\f1e1"}.fa-external-link-square-alt:before,.fa-square-up-right:before{content:"\f360"}.fa-stairs:before{content:"\e289"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before,.fa-star-half-stroke:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-gbp:before,.fa-pound-sign:before,.fa-sterling-sign:before{content:"\f154"}.fa-stethoscope:before{content:"\f0f1"}.fa-stop:before{content:"\f04d"}.fa-stopwatch:before{content:"\f2f2"}.fa-stopwatch-20:before{content:"\e06f"}.fa-store:before{content:"\f54e"}.fa-store-slash:before{content:"\e071"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stroopwafel:before{content:"\f551"}.fa-subscript:before{content:"\f12c"}.fa-suitcase:before{content:"\f0f2"}.fa-medkit:before,.fa-suitcase-medical:before{content:"\f0fa"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superscript:before{content:"\f12b"}.fa-swatchbook:before{content:"\f5c3"}.fa-synagogue:before{content:"\f69b"}.fa-syringe:before{content:"\f48e"}.fa-t:before{content:"\54"}.fa-table:before{content:"\f0ce"}.fa-table-cells:before,.fa-th:before{content:"\f00a"}.fa-table-cells-large:before,.fa-th-large:before{content:"\f009"}.fa-columns:before,.fa-table-columns:before{content:"\f0db"}.fa-table-list:before,.fa-th-list:before{content:"\f00b"}.fa-ping-pong-paddle-ball:before,.fa-table-tennis-paddle-ball:before,.fa-table-tennis:before{content:"\f45d"}.fa-tablet-button:before{content:"\f10a"}.fa-tablet-alt:before,.fa-tablet-screen-button:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-digital-tachograph:before,.fa-tachograph-digital:before{content:"\f566"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-temperature-0:before,.fa-temperature-empty:before,.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-temperature-4:before,.fa-temperature-full:before,.fa-thermometer-4:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-temperature-2:before,.fa-temperature-half:before,.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-temperature-1:before,.fa-temperature-quarter:before,.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-temperature-3:before,.fa-temperature-three-quarters:before,.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-tenge-sign:before,.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-remove-format:before,.fa-text-slash:before{content:"\f87d"}.fa-text-width:before{content:"\f035"}.fa-thermometer:before{content:"\f491"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumb-tack:before,.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before,.fa-ticket-simple:before{content:"\f3ff"}.fa-timeline:before{content:"\e29c"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toilet-paper-slash:before{content:"\e072"}.fa-toolbox:before{content:"\f552"}.fa-tooth:before{content:"\f5c9"}.fa-torii-gate:before{content:"\f6a1"}.fa-broadcast-tower:before,.fa-tower-broadcast:before{content:"\f519"}.fa-tractor:before{content:"\f722"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-trailer:before{content:"\e041"}.fa-train:before{content:"\f238"}.fa-subway:before,.fa-train-subway:before{content:"\f239"}.fa-train-tram:before,.fa-tram:before{content:"\f7da"}.fa-transgender-alt:before,.fa-transgender:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-arrow-up:before,.fa-trash-restore:before{content:"\f829"}.fa-trash-alt:before,.fa-trash-can:before{content:"\f2ed"}.fa-trash-can-arrow-up:before,.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-exclamation-triangle:before,.fa-triangle-exclamation:before,.fa-warning:before{content:"\f071"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-shipping-fast:before,.fa-truck-fast:before{content:"\f48b"}.fa-ambulance:before,.fa-truck-medical:before{content:"\f0f9"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-truck-loading:before,.fa-truck-ramp-box:before{content:"\f4de"}.fa-teletype:before,.fa-tty:before{content:"\f1e4"}.fa-try:before,.fa-turkish-lira-sign:before,.fa-turkish-lira:before{content:"\e2bb"}.fa-level-down-alt:before,.fa-turn-down:before{content:"\f3be"}.fa-level-up-alt:before,.fa-turn-up:before{content:"\f3bf"}.fa-television:before,.fa-tv-alt:before,.fa-tv:before{content:"\f26c"}.fa-u:before{content:"\55"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-universal-access:before{content:"\f29a"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before,.fa-unlock-keyhole:before{content:"\f13e"}.fa-arrows-alt-v:before,.fa-up-down:before{content:"\f338"}.fa-arrows-alt:before,.fa-up-down-left-right:before{content:"\f0b2"}.fa-long-arrow-alt-up:before,.fa-up-long:before{content:"\f30c"}.fa-expand-alt:before,.fa-up-right-and-down-left-from-center:before{content:"\f424"}.fa-external-link-alt:before,.fa-up-right-from-square:before{content:"\f35d"}.fa-upload:before{content:"\f093"}.fa-user:before{content:"\f007"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-clock:before{content:"\f4fd"}.fa-user-doctor:before,.fa-user-md:before{content:"\f0f0"}.fa-user-cog:before,.fa-user-gear:before{content:"\f4fe"}.fa-user-graduate:before{content:"\f501"}.fa-user-friends:before,.fa-user-group:before{content:"\f500"}.fa-user-injured:before{content:"\f728"}.fa-user-alt:before,.fa-user-large:before{content:"\f406"}.fa-user-alt-slash:before,.fa-user-large-slash:before{content:"\f4fa"}.fa-user-lock:before{content:"\f502"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-edit:before,.fa-user-pen:before{content:"\f4ff"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before,.fa-user-xmark:before{content:"\f235"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-users-cog:before,.fa-users-gear:before{content:"\f509"}.fa-users-slash:before{content:"\e073"}.fa-cutlery:before,.fa-utensils:before{content:"\f2e7"}.fa-v:before{content:"\56"}.fa-shuttle-van:before,.fa-van-shuttle:before{content:"\f5b6"}.fa-vault:before{content:"\e2c5"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-vest:before{content:"\e085"}.fa-vest-patches:before{content:"\e086"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-video-camera:before,.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-virus:before{content:"\e074"}.fa-virus-slash:before{content:"\e075"}.fa-viruses:before{content:"\e076"}.fa-voicemail:before{content:"\f897"}.fa-volleyball-ball:before,.fa-volleyball:before{content:"\f45f"}.fa-volume-high:before,.fa-volume-up:before{content:"\f028"}.fa-volume-down:before,.fa-volume-low:before{content:"\f027"}.fa-volume-off:before{content:"\f026"}.fa-volume-mute:before,.fa-volume-times:before,.fa-volume-xmark:before{content:"\f6a9"}.fa-vr-cardboard:before{content:"\f729"}.fa-w:before{content:"\57"}.fa-wallet:before{content:"\f555"}.fa-magic:before,.fa-wand-magic:before{content:"\f0d0"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-ladder-water:before,.fa-swimming-pool:before,.fa-water-ladder:before{content:"\f5c5"}.fa-wave-square:before{content:"\f83e"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weight-scale:before,.fa-weight:before{content:"\f496"}.fa-wheelchair:before{content:"\f193"}.fa-glass-whiskey:before,.fa-whiskey-glass:before{content:"\f7a0"}.fa-wifi-3:before,.fa-wifi-strong:before,.fa-wifi:before{content:"\f1eb"}.fa-wind:before{content:"\f72e"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before,.fa-wine-glass-empty:before{content:"\f5ce"}.fa-krw:before,.fa-won-sign:before,.fa-won:before{content:"\f159"}.fa-wrench:before{content:"\f0ad"}.fa-x:before{content:"\58"}.fa-x-ray:before{content:"\f497"}.fa-close:before,.fa-multiply:before,.fa-remove:before,.fa-times:before,.fa-xmark:before{content:"\f00d"}.fa-y:before{content:"\59"}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen-sign:before,.fa-yen:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-z:before{content:"\5a"}.fa-sr-only,.fa-sr-only-focusable:not(:focus),.sr-only,.sr-only-focusable:not(:focus){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}@font-face{font-family:"Font Awesome 6 Brands";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.ttf) format("truetype")}.fa-brands,.fab{font-family:"Font Awesome 6 Brands";font-weight:400}.fa-42-group:before,.fa-innosoft:before{content:"\e080"}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-adn:before{content:"\f170"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-alipay:before{content:"\f642"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-amilia:before{content:"\f36d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-pay:before{content:"\f415"}.fa-artstation:before{content:"\f77a"}.fa-asymmetrik:before{content:"\f372"}.fa-atlassian:before{content:"\f77b"}.fa-audible:before{content:"\f373"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-aws:before{content:"\f375"}.fa-bandcamp:before{content:"\f2d5"}.fa-battle-net:before{content:"\f835"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bilibili:before{content:"\e3d9"}.fa-bimobject:before{content:"\f378"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bootstrap:before{content:"\f836"}.fa-bots:before{content:"\e340"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-buromobelexperte:before{content:"\f37f"}.fa-buy-n-large:before{content:"\f8a6"}.fa-buysellads:before{content:"\f20d"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-cloudflare:before{content:"\e07d"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cmplid:before{content:"\e360"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cotton-bureau:before{content:"\f89e"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-critical-role:before{content:"\f6c9"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dailymotion:before{content:"\e052"}.fa-dashcube:before{content:"\f210"}.fa-deezer:before{content:"\e077"}.fa-delicious:before{content:"\f1a5"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dhl:before{content:"\f790"}.fa-diaspora:before{content:"\f791"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-draft2digital:before{content:"\f396"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drupal:before{content:"\f1a9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edge-legacy:before{content:"\e078"}.fa-elementor:before{content:"\f430"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envira:before{content:"\f299"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-etsy:before{content:"\f2d7"}.fa-evernote:before{content:"\f839"}.fa-expeditedssl:before{content:"\f23e"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-figma:before{content:"\f799"}.fa-firefox:before{content:"\f269"}.fa-firefox-browser:before{content:"\e007"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-fly:before{content:"\f417"}.fa-font-awesome-flag:before,.fa-font-awesome-logo-full:before,.fa-font-awesome:before{content:"\f2b4"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-fulcrum:before{content:"\f50b"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-git:before{content:"\f1d3"}.fa-git-alt:before{content:"\f841"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-gofore:before{content:"\f3a7"}.fa-golang:before{content:"\e40f"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-pay:before{content:"\e079"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guilded:before{content:"\e07e"}.fa-gulp:before{content:"\f3ae"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-hive:before{content:"\e07f"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-hotjar:before{content:"\f3b1"}.fa-houzz:before{content:"\f27c"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-ideal:before{content:"\e013"}.fa-imdb:before{content:"\f2d8"}.fa-instagram:before{content:"\f16d"}.fa-instagram-square:before{content:"\e055"}.fa-instalod:before{content:"\e081"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joomla:before{content:"\f1aa"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaggle:before{content:"\f5fa"}.fa-keybase:before{content:"\f4f5"}.fa-keycdn:before{content:"\f3ba"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-korvue:before{content:"\f42f"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-leanpub:before{content:"\f212"}.fa-less:before{content:"\f41d"}.fa-line:before{content:"\f3c0"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-mailchimp:before{content:"\f59e"}.fa-mandalorian:before{content:"\f50f"}.fa-markdown:before{content:"\f60f"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-mdb:before{content:"\f8ca"}.fa-medapps:before{content:"\f3c6"}.fa-medium-m:before,.fa-medium:before{content:"\f23a"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-mendeley:before{content:"\f7b3"}.fa-microblog:before{content:"\e01a"}.fa-microsoft:before{content:"\f3ca"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mixer:before{content:"\e056"}.fa-mizuni:before{content:"\f3cc"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-nimblr:before{content:"\f5a8"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-octopus-deploy:before{content:"\e082"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-old-republic:before{content:"\f510"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-orcid:before{content:"\f8d2"}.fa-osi:before{content:"\f41a"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-palfed:before{content:"\f3d8"}.fa-patreon:before{content:"\f3d9"}.fa-paypal:before{content:"\f1ed"}.fa-penny-arcade:before{content:"\f704"}.fa-perbyte:before{content:"\e083"}.fa-periscope:before{content:"\f3da"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-square:before{content:"\e01e"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pix:before{content:"\e43a"}.fa-playstation:before{content:"\f3df"}.fa-product-hunt:before{content:"\f288"}.fa-pushed:before{content:"\f3e1"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-r-project:before{content:"\f4f7"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-renren:before{content:"\f18b"}.fa-replyd:before{content:"\f3e6"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-rev:before{content:"\f5b2"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-rust:before{content:"\e07a"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-schlix:before{content:"\f3ea"}.fa-scribd:before{content:"\f28a"}.fa-searchengin:before{content:"\f3eb"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-servicestack:before{content:"\f3ec"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shopify:before{content:"\e057"}.fa-shopware:before{content:"\f5b5"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sith:before{content:"\f512"}.fa-sitrox:before{content:"\e44a"}.fa-sketch:before{content:"\f7c6"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack-hash:before,.fa-slack:before{content:"\f198"}.fa-slideshare:before{content:"\f1e7"}.fa-snapchat-ghost:before,.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-square:before{content:"\f2ad"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spotify:before{content:"\f1bc"}.fa-square-font-awesome:before{content:"\f425"}.fa-font-awesome-alt:before,.fa-square-font-awesome-stroke:before{content:"\f35c"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stackpath:before{content:"\f842"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-sticker-mule:before{content:"\f3f7"}.fa-strava:before{content:"\f428"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-superpowers:before{content:"\f2dd"}.fa-supple:before{content:"\f3f9"}.fa-suse:before{content:"\f7d6"}.fa-swift:before{content:"\f8e1"}.fa-symfony:before{content:"\f83d"}.fa-teamspeak:before{content:"\f4f9"}.fa-telegram-plane:before,.fa-telegram:before{content:"\f2c6"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-the-red-yeti:before{content:"\f69d"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-think-peaks:before{content:"\f731"}.fa-tiktok:before{content:"\e07b"}.fa-trade-federation:before{content:"\f513"}.fa-trello:before{content:"\f181"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbraco:before{content:"\f8e8"}.fa-uncharted:before{content:"\e084"}.fa-uniregistry:before{content:"\f404"}.fa-unity:before{content:"\e049"}.fa-unsplash:before{content:"\e07c"}.fa-untappd:before{content:"\f405"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-vaadin:before{content:"\f408"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-viber:before{content:"\f409"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-vuejs:before{content:"\f41f"}.fa-watchman-monitoring:before{content:"\e087"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-whmcs:before{content:"\f40d"}.fa-wikipedia-w:before{content:"\f266"}.fa-windows:before{content:"\f17a"}.fa-wirsindhandwerk:before,.fa-wsh:before{content:"\e2d0"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wodu:before{content:"\e088"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.ttf) format("truetype")}.fa-regular,.far{font-weight:400}@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.ttf) format("truetype")}.fa-regular,.fa-solid,.far,.fas{font-family:"Font Awesome 6 Free"}.fa-solid,.fas{font-weight:900}
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/font-awesome/all.min.js
DELETED
The diff for this file is too large to render.
See raw diff
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/jquery/jquery-3.6.0.min.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */
|
2 |
-
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),j=function(e,t){return e===t&&(l=!0),0},D={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="<a id='"+S+"'></a><select id='"+S+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&D.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(j),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(B," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace($,"$1"));return s[S]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split("").sort(j).join("")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);S.find=d,S.expr=d.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1<i.call(n,e)!==r}):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,function(e){return 1===e.nodeType}))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter(function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var D,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(S.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&S(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},S.each(e.match(P)||[],function(e,t){n[t]=!0}),n):S.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){S.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<S.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},S.extend({Deferred:function(e){var o=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return S.Deferred(function(r){S.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout(function(){throw e})};var F=S.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),S.ready()}S.fn.ready=function(e){return F.then(e)["catch"](function(e){S.readyException(e)}),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){Q.set(this,n)}):$(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){S.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),S.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each(function(){var e=S.queue(this,t,n);S._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&S.dequeue(this,t)})},dequeue:function(e){return this.each(function(){S.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=S.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===S.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,"")},u=s(),l=n&&n[3]||(S.cssNumber[t]?"":"px"),c=e.nodeType&&(S.cssNumber[t]||"px"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?S(this).show():S(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",y.option=!!ce.lastChild;var ge={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function Ce(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ee(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ee(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Te;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,i,r,n)})}function Se(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n&&n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,we)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=be.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=be.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=S.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=S.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((S.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<S(i,this).index(l):S.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Se(t,"click",we),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Se(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?we:Te,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Te,isPropagationStopped:Te,isImmediatePropagationStopped:Te,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=we,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=we,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=we,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},S.event.addProp),S.each({focus:"focusin",blur:"focusout"},function(e,t){S.event.special[e]={setup:function(){return Se(this,e,Ce),!1},trigger:function(){return Se(this,e),!0},_default:function(){return!0},delegateType:t}}),S.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),S.fn.extend({on:function(e,t,n,r){return Ee(this,e,t,n,r)},one:function(e,t,n,r){return Ee(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Te),this.each(function(){S.event.remove(this,e,n,t)})}});var ke=/<script|<style|<link/i,Ae=/checked\s*(?:[^=]|=\s*.checked.)/i,Ne=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function He(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&Ae.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),He(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,"script"),De)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,qe),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&S.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(Ne,""),u,l))}return n}function Oe(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Le(o[r],a[r]);else Le(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Oe(this,e,!0)},remove:function(e){return Oe(this,e)},text:function(e){return $(this,function(e){return void 0===e?S.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return He(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||je(this,e).appendChild(e)})},prepend:function(){return He(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=je(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return S.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ke.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return He(this,arguments,function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),S.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Pe=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Re=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},Me=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ie=new RegExp(ne.join("|"),"i");function We(e,t,n){var r,i,o,a,s=e.style;return(n=n||Re(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Pe.test(a)&&Ie.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function Fe(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement("div"),l=E.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===l.style.backgroundClip,S.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=E.createElement("table"),t=E.createElement("tr"),n=E.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,re.removeChild(e)),a}}))}();var Be=["Webkit","Moz","ms"],$e=E.createElement("div").style,_e={};function ze(e){var t=S.cssProps[e]||_e[e];return t||(e in $e?e:_e[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Be.length;while(n--)if((e=Be[n]+t)in $e)return e}(e)||e)}var Ue=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ve={position:"absolute",visibility:"hidden",display:"block"},Ge={letterSpacing:"0",fontWeight:"400"};function Ye(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Qe(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=S.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=S.css(e,"border"+ne[a]+"Width",!0,i))):(u+=S.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=S.css(e,"border"+ne[a]+"Width",!0,i):s+=S.css(e,"border"+ne[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Je(e,t,n){var r=Re(e),i=(!y.boxSizingReliable()||n)&&"border-box"===S.css(e,"boxSizing",!1,r),o=i,a=We(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Pe.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Qe(e,t,n||(i?"border":"content"),o,r,a)+"px"}function Ke(e,t,n,r,i){return new Ke.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=We(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Xe.test(t),l=e.style;if(u||(t=ze(s)),a=S.cssHooks[t]||S.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Xe.test(t)||(t=ze(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=We(e,t,r)),"normal"===i&&t in Ge&&(i=Ge[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ue.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Je(e,u,n):Me(e,Ve,function(){return Je(e,u,n)})},set:function(e,t,n){var r,i=Re(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,i),s=n?Qe(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Qe(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=S.css(e,u)),Ye(0,t,s)}}}),S.cssHooks.marginLeft=Fe(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(We(e,"marginLeft"))||e.getBoundingClientRect().left-Me(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),S.each({margin:"",padding:"",border:"Width"},function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(S.cssHooks[i+o].set=Ye)}),S.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Re(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)},e,t,1<arguments.length)}}),((S.Tween=Ke).prototype={constructor:Ke,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var e=Ke.propHooks[this.prop];return e&&e.get?e.get(this):Ke.propHooks._default.get(this)},run:function(e){var t,n=Ke.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ke.propHooks._default.set(this),this}}).init.prototype=Ke.prototype,(Ke.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[ze(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=Ke.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=Ke.prototype.init,S.fx.step={};var Ze,et,tt,nt,rt=/^(?:toggle|show|hide)$/,it=/queueHooks$/;function ot(){et&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(ot):C.setTimeout(ot,S.fx.interval),S.fx.tick())}function at(){return C.setTimeout(function(){Ze=void 0}),Ze=Date.now()}function st(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ut(e,t,n){for(var r,i=(lt.tweeners[t]||[]).concat(lt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function lt(o,e,t){var n,a,r=0,i=lt.prefilters.length,s=S.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=Ze||at(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:Ze||at(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=lt.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ut,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(lt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],lt.tweeners[n]=lt.tweeners[n]||[],lt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),v=Y.get(e,"fxshow");for(r in n.queue||(null==(a=S._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,S.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],rt.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,"display")),"none"===(c=S.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===S.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=Y.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)S.style(e,r,d[r])})),u=ut(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?lt.prefilters.unshift(e):lt.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&"object"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=lt(this,S.extend({},t),o);(i||Y.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&it.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||S.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),S.each(["toggle","show","hide"],function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(st(r,!0),e,t,n)}}),S.each({slideDown:st("show"),slideUp:st("hide"),slideToggle:st("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(Ze=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),Ze=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){et||(et=!0,ot())},S.fx.stop=function(){et=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},tt=E.createElement("input"),nt=E.createElement("select").appendChild(E.createElement("option")),tt.type="checkbox",y.checkOn=""!==tt.value,y.optSelected=nt.selected,(tt=E.createElement("input")).value="t",tt.type="radio",y.radioValue="t"===tt.value;var ct,ft=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){S.removeAttr(this,e)})}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?ct:void 0)),void 0!==n?null===n?void S.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),ct={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),function(e,t){var a=ft[t]||S.find.attr;ft[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=ft[o],ft[o]=r,r=null!=a(e,t,n)?o:null,ft[o]=i),r}});var pt=/^(?:input|select|textarea|button)$/i,dt=/^(?:a|area)$/i;function ht(e){return(e.match(P)||[]).join(" ")}function gt(e){return e.getAttribute&&e.getAttribute("class")||""}function vt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[S.propFix[e]||e]})}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,"tabindex");return t?parseInt(t,10):pt.test(e.nodeName)||dt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){S.propFix[this.toLowerCase()]=this}),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).addClass(t.call(this,e,gt(this)))});if((e=vt(t)).length)while(n=this[u++])if(i=gt(n),r=1===n.nodeType&&" "+ht(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=ht(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).removeClass(t.call(this,e,gt(this)))});if(!arguments.length)return this.attr("class","");if((e=vt(t)).length)while(n=this[u++])if(i=gt(n),r=1===n.nodeType&&" "+ht(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=ht(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){S(this).toggleClass(i.call(this,e,gt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=S(this),r=vt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=gt(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Y.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+ht(gt(n))+" ").indexOf(t))return!0;return!1}});var yt=/\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=S.map(t,function(e){return null==e?"":e+""})),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(yt,""):null==e?"":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:ht(S.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),y.focusin="onfocusin"in C;var mt=/^(?:focusinfocus|focusoutblur)$/,xt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!mt.test(d+S.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[S.expando]?e:new S.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,mt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,xt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,xt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each(function(){S.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var bt=C.location,wt={guid:Date.now()},Tt=/\?/;S.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||S.error("Invalid XML: "+(n?S.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Ct=/\[\]$/,Et=/\r?\n/g,St=/^(?:submit|button|image|reset|file)$/i,kt=/^(?:input|select|textarea|keygen)/i;function At(n,e,r,i){var t;if(Array.isArray(e))S.each(e,function(e,t){r||Ct.test(n)?i(n,t):At(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)At(n+"["+t+"]",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,function(){i(this.name,this.value)});else for(n in e)At(n,e[n],t,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&kt.test(this.nodeName)&&!St.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,function(e){return{name:t.name,value:e.replace(Et,"\r\n")}}):{name:t.name,value:n.replace(Et,"\r\n")}}).get()}});var Nt=/%20/g,jt=/#.*$/,Dt=/([?&])_=[^&]*/,qt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Lt=/^(?:GET|HEAD)$/,Ht=/^\/\//,Ot={},Pt={},Rt="*/".concat("*"),Mt=E.createElement("a");function It(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Wt(t,i,o,a){var s={},u=t===Pt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function Ft(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Mt.href=bt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:bt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(bt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Rt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ft(Ft(e,S.ajaxSettings),t):Ft(S.ajaxSettings,e)},ajaxPrefilter:It(Ot),ajaxTransport:It(Pt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=qt.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||bt.href)+"").replace(Ht,bt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Mt.protocol+"//"+Mt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Wt(Ot,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Lt.test(v.type),f=v.url.replace(jt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Nt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Tt.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Dt,"$1"),o=(Tt.test(f)?"&":"?")+"_="+wt.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),S.etag[f]&&T.setRequestHeader("If-None-Match",S.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+Rt+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Wt(Pt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<S.inArray("script",v.dataTypes)&&S.inArray("json",v.dataTypes)<0&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(S.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(S.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--S.active||S.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}),S.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){S(this).wrapInner(n.call(this,e))}):this.each(function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){S(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){S(this).replaceWith(this.childNodes)}),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var Bt={0:200,1223:204},$t=S.ajaxSettings.xhr();y.cors=!!$t&&"withCredentials"in $t,y.ajax=$t=!!$t,S.ajaxTransport(function(i){var o,a;if(y.cors||$t&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(Bt[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),S.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),S.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=ht(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&S.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?S("<div>").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Xt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?"":(e+"").replace(Xt,"")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return S});var Vt=C.jQuery,Gt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Gt),e&&C.jQuery===S&&(C.jQuery=Vt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S});
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/json5/json5.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(u,D){"object"==typeof exports&&"undefined"!=typeof module?module.exports=D():"function"==typeof define&&define.amd?define(D):u.JSON5=D()}(this,function(){"use strict";function u(u,D){return u(D={exports:{}},D.exports),D.exports}var D=u(function(u){var D=u.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=D)}),e=u(function(u){var D=u.exports={version:"2.6.5"};"number"==typeof __e&&(__e=D)}),t=(e.version,function(u){return"object"==typeof u?null!==u:"function"==typeof u}),r=function(u){if(!t(u))throw TypeError(u+" is not an object!");return u},F=function(u){try{return!!u()}catch(u){return!0}},n=!F(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),C=D.document,A=t(C)&&t(C.createElement),i=!n&&!F(function(){return 7!=Object.defineProperty((u="div",A?C.createElement(u):{}),"a",{get:function(){return 7}}).a;var u}),E=Object.defineProperty,o={f:n?Object.defineProperty:function(u,D,e){if(r(u),D=function(u,D){if(!t(u))return u;var e,r;if(D&&"function"==typeof(e=u.toString)&&!t(r=e.call(u)))return r;if("function"==typeof(e=u.valueOf)&&!t(r=e.call(u)))return r;if(!D&&"function"==typeof(e=u.toString)&&!t(r=e.call(u)))return r;throw TypeError("Can't convert object to primitive value")}(D,!0),r(e),i)try{return E(u,D,e)}catch(u){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(u[D]=e.value),u}},a=n?function(u,D,e){return o.f(u,D,function(u,D){return{enumerable:!(1&u),configurable:!(2&u),writable:!(4&u),value:D}}(1,e))}:function(u,D,e){return u[D]=e,u},c={}.hasOwnProperty,B=function(u,D){return c.call(u,D)},s=0,f=Math.random(),l=u(function(u){var t=D["__core-js_shared__"]||(D["__core-js_shared__"]={});(u.exports=function(u,D){return t[u]||(t[u]=void 0!==D?D:{})})("versions",[]).push({version:e.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})("native-function-to-string",Function.toString),d=u(function(u){var t,r="Symbol(".concat(void 0===(t="src")?"":t,")_",(++s+f).toString(36)),F=(""+l).split("toString");e.inspectSource=function(u){return l.call(u)},(u.exports=function(u,e,t,n){var C="function"==typeof t;C&&(B(t,"name")||a(t,"name",e)),u[e]!==t&&(C&&(B(t,r)||a(t,r,u[e]?""+u[e]:F.join(String(e)))),u===D?u[e]=t:n?u[e]?u[e]=t:a(u,e,t):(delete u[e],a(u,e,t)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[r]||l.call(this)})}),v=function(u,D,e){if(function(u){if("function"!=typeof u)throw TypeError(u+" is not a function!")}(u),void 0===D)return u;switch(e){case 1:return function(e){return u.call(D,e)};case 2:return function(e,t){return u.call(D,e,t)};case 3:return function(e,t,r){return u.call(D,e,t,r)}}return function(){return u.apply(D,arguments)}},p=function(u,t,r){var F,n,C,A,i=u&p.F,E=u&p.G,o=u&p.S,c=u&p.P,B=u&p.B,s=E?D:o?D[t]||(D[t]={}):(D[t]||{}).prototype,f=E?e:e[t]||(e[t]={}),l=f.prototype||(f.prototype={});for(F in E&&(r=t),r)C=((n=!i&&s&&void 0!==s[F])?s:r)[F],A=B&&n?v(C,D):c&&"function"==typeof C?v(Function.call,C):C,s&&d(s,F,C,u&p.U),f[F]!=C&&a(f,F,A),c&&l[F]!=C&&(l[F]=C)};D.core=e,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128;var h,m=p,g=Math.ceil,y=Math.floor,w=function(u){return isNaN(u=+u)?0:(u>0?y:g)(u)},S=(h=!1,function(u,D){var e,t,r=String(function(u){if(null==u)throw TypeError("Can't call method on "+u);return u}(u)),F=w(D),n=r.length;return F<0||F>=n?h?"":void 0:(e=r.charCodeAt(F))<55296||e>56319||F+1===n||(t=r.charCodeAt(F+1))<56320||t>57343?h?r.charAt(F):e:h?r.slice(F,F+2):t-56320+(e-55296<<10)+65536});m(m.P,"String",{codePointAt:function(u){return S(this,u)}});e.String.codePointAt;var b=Math.max,x=Math.min,N=String.fromCharCode,P=String.fromCodePoint;m(m.S+m.F*(!!P&&1!=P.length),"String",{fromCodePoint:function(u){for(var D,e,t,r=arguments,F=[],n=arguments.length,C=0;n>C;){if(D=+r[C++],t=1114111,((e=w(e=D))<0?b(e+t,0):x(e,t))!==D)throw RangeError(D+" is not a valid code point");F.push(D<65536?N(D):N(55296+((D-=65536)>>10),D%1024+56320))}return F.join("")}});e.String.fromCodePoint;var _,I,O,j,V,J,M,k,L,T,z,H,$,R,G={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},U={isSpaceSeparator:function(u){return"string"==typeof u&&G.Space_Separator.test(u)},isIdStartChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||G.ID_Start.test(u))},isIdContinueChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||""===u||""===u||G.ID_Continue.test(u))},isDigit:function(u){return"string"==typeof u&&/[0-9]/.test(u)},isHexDigit:function(u){return"string"==typeof u&&/[0-9A-Fa-f]/.test(u)}};function Z(){for(T="default",z="",H=!1,$=1;;){R=q();var u=X[T]();if(u)return u}}function q(){if(_[j])return String.fromCodePoint(_.codePointAt(j))}function W(){var u=q();return"\n"===u?(V++,J=0):u?J+=u.length:J++,u&&(j+=u.length),u}var X={default:function(){switch(R){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void W();case"/":return W(),void(T="comment");case void 0:return W(),K("eof")}if(!U.isSpaceSeparator(R))return X[I]();W()},comment:function(){switch(R){case"*":return W(),void(T="multiLineComment");case"/":return W(),void(T="singleLineComment")}throw tu(W())},multiLineComment:function(){switch(R){case"*":return W(),void(T="multiLineCommentAsterisk");case void 0:throw tu(W())}W()},multiLineCommentAsterisk:function(){switch(R){case"*":return void W();case"/":return W(),void(T="default");case void 0:throw tu(W())}W(),T="multiLineComment"},singleLineComment:function(){switch(R){case"\n":case"\r":case"\u2028":case"\u2029":return W(),void(T="default");case void 0:return W(),K("eof")}W()},value:function(){switch(R){case"{":case"[":return K("punctuator",W());case"n":return W(),Q("ull"),K("null",null);case"t":return W(),Q("rue"),K("boolean",!0);case"f":return W(),Q("alse"),K("boolean",!1);case"-":case"+":return"-"===W()&&($=-1),void(T="sign");case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",1/0);case"N":return W(),Q("aN"),K("numeric",NaN);case'"':case"'":return H='"'===W(),z="",void(T="string")}throw tu(W())},identifierNameStartEscape:function(){if("u"!==R)throw tu(W());W();var u=Y();switch(u){case"$":case"_":break;default:if(!U.isIdStartChar(u))throw Fu()}z+=u,T="identifierName"},identifierName:function(){switch(R){case"$":case"_":case"":case"":return void(z+=W());case"\\":return W(),void(T="identifierNameEscape")}if(!U.isIdContinueChar(R))return K("identifier",z);z+=W()},identifierNameEscape:function(){if("u"!==R)throw tu(W());W();var u=Y();switch(u){case"$":case"_":case"":case"":break;default:if(!U.isIdContinueChar(u))throw Fu()}z+=u,T="identifierName"},sign:function(){switch(R){case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",$*(1/0));case"N":return W(),Q("aN"),K("numeric",NaN)}throw tu(W())},zero:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent");case"x":case"X":return z+=W(),void(T="hexadecimal")}return K("numeric",0*$)},decimalInteger:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalPointLeading:function(){if(U.isDigit(R))return z+=W(),void(T="decimalFraction");throw tu(W())},decimalPoint:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}return U.isDigit(R)?(z+=W(),void(T="decimalFraction")):K("numeric",$*Number(z))},decimalFraction:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalExponent:function(){switch(R){case"+":case"-":return z+=W(),void(T="decimalExponentSign")}if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw tu(W())},decimalExponentSign:function(){if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw tu(W())},decimalExponentInteger:function(){if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},hexadecimal:function(){if(U.isHexDigit(R))return z+=W(),void(T="hexadecimalInteger");throw tu(W())},hexadecimalInteger:function(){if(!U.isHexDigit(R))return K("numeric",$*Number(z));z+=W()},string:function(){switch(R){case"\\":return W(),void(z+=function(){switch(q()){case"b":return W(),"\b";case"f":return W(),"\f";case"n":return W(),"\n";case"r":return W(),"\r";case"t":return W(),"\t";case"v":return W(),"\v";case"0":if(W(),U.isDigit(q()))throw tu(W());return"\0";case"x":return W(),function(){var u="",D=q();if(!U.isHexDigit(D))throw tu(W());if(u+=W(),D=q(),!U.isHexDigit(D))throw tu(W());return u+=W(),String.fromCodePoint(parseInt(u,16))}();case"u":return W(),Y();case"\n":case"\u2028":case"\u2029":return W(),"";case"\r":return W(),"\n"===q()&&W(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw tu(W())}return W()}());case'"':return H?(W(),K("string",z)):void(z+=W());case"'":return H?void(z+=W()):(W(),K("string",z));case"\n":case"\r":throw tu(W());case"\u2028":case"\u2029":!function(u){console.warn("JSON5: '"+nu(u)+"' in strings is not valid ECMAScript; consider escaping")}(R);break;case void 0:throw tu(W())}z+=W()},start:function(){switch(R){case"{":case"[":return K("punctuator",W())}T="value"},beforePropertyName:function(){switch(R){case"$":case"_":return z=W(),void(T="identifierName");case"\\":return W(),void(T="identifierNameStartEscape");case"}":return K("punctuator",W());case'"':case"'":return H='"'===W(),void(T="string")}if(U.isIdStartChar(R))return z+=W(),void(T="identifierName");throw tu(W())},afterPropertyName:function(){if(":"===R)return K("punctuator",W());throw tu(W())},beforePropertyValue:function(){T="value"},afterPropertyValue:function(){switch(R){case",":case"}":return K("punctuator",W())}throw tu(W())},beforeArrayValue:function(){if("]"===R)return K("punctuator",W());T="value"},afterArrayValue:function(){switch(R){case",":case"]":return K("punctuator",W())}throw tu(W())},end:function(){throw tu(W())}};function K(u,D){return{type:u,value:D,line:V,column:J}}function Q(u){for(var D=0,e=u;D<e.length;D+=1){var t=e[D];if(q()!==t)throw tu(W());W()}}function Y(){for(var u="",D=4;D-- >0;){var e=q();if(!U.isHexDigit(e))throw tu(W());u+=W()}return String.fromCodePoint(parseInt(u,16))}var uu={start:function(){if("eof"===M.type)throw ru();Du()},beforePropertyName:function(){switch(M.type){case"identifier":case"string":return k=M.value,void(I="afterPropertyName");case"punctuator":return void eu();case"eof":throw ru()}},afterPropertyName:function(){if("eof"===M.type)throw ru();I="beforePropertyValue"},beforePropertyValue:function(){if("eof"===M.type)throw ru();Du()},beforeArrayValue:function(){if("eof"===M.type)throw ru();"punctuator"!==M.type||"]"!==M.value?Du():eu()},afterPropertyValue:function(){if("eof"===M.type)throw ru();switch(M.value){case",":return void(I="beforePropertyName");case"}":eu()}},afterArrayValue:function(){if("eof"===M.type)throw ru();switch(M.value){case",":return void(I="beforeArrayValue");case"]":eu()}},end:function(){}};function Du(){var u;switch(M.type){case"punctuator":switch(M.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=M.value}if(void 0===L)L=u;else{var D=O[O.length-1];Array.isArray(D)?D.push(u):D[k]=u}if(null!==u&&"object"==typeof u)O.push(u),I=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{var e=O[O.length-1];I=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function eu(){O.pop();var u=O[O.length-1];I=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}function tu(u){return Cu(void 0===u?"JSON5: invalid end of input at "+V+":"+J:"JSON5: invalid character '"+nu(u)+"' at "+V+":"+J)}function ru(){return Cu("JSON5: invalid end of input at "+V+":"+J)}function Fu(){return Cu("JSON5: invalid identifier character at "+V+":"+(J-=5))}function nu(u){var D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){var e=u.charCodeAt(0).toString(16);return"\\x"+("00"+e).substring(e.length)}return u}function Cu(u){var D=new SyntaxError(u);return D.lineNumber=V,D.columnNumber=J,D}return{parse:function(u,D){_=String(u),I="start",O=[],j=0,V=1,J=0,M=void 0,k=void 0,L=void 0;do{M=Z(),uu[I]()}while("eof"!==M.type);return"function"==typeof D?function u(D,e,t){var r=D[e];if(null!=r&&"object"==typeof r)for(var F in r){var n=u(r,F,t);void 0===n?delete r[F]:r[F]=n}return t.call(D,e,r)}({"":L},"",D):L},stringify:function(u,D,e){var t,r,F,n=[],C="",A="";if(null==D||"object"!=typeof D||Array.isArray(D)||(e=D.space,F=D.quote,D=D.replacer),"function"==typeof D)r=D;else if(Array.isArray(D)){t=[];for(var i=0,E=D;i<E.length;i+=1){var o=E[i],a=void 0;"string"==typeof o?a=o:("number"==typeof o||o instanceof String||o instanceof Number)&&(a=String(o)),void 0!==a&&t.indexOf(a)<0&&t.push(a)}}return e instanceof Number?e=Number(e):e instanceof String&&(e=String(e)),"number"==typeof e?e>0&&(e=Math.min(10,Math.floor(e)),A=" ".substr(0,e)):"string"==typeof e&&(A=e.substr(0,10)),c("",{"":u});function c(u,D){var e=D[u];switch(null!=e&&("function"==typeof e.toJSON5?e=e.toJSON5(u):"function"==typeof e.toJSON&&(e=e.toJSON(u))),r&&(e=r.call(D,u,e)),e instanceof Number?e=Number(e):e instanceof String?e=String(e):e instanceof Boolean&&(e=e.valueOf()),e){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof e?B(e):"number"==typeof e?String(e):"object"==typeof e?Array.isArray(e)?function(u){if(n.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");n.push(u);var D=C;C+=A;for(var e,t=[],r=0;r<u.length;r++){var F=c(String(r),u);t.push(void 0!==F?F:"null")}if(0===t.length)e="[]";else if(""===A){var i=t.join(",");e="["+i+"]"}else{var E=",\n"+C,o=t.join(E);e="[\n"+C+o+",\n"+D+"]"}return n.pop(),C=D,e}(e):function(u){if(n.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");n.push(u);var D=C;C+=A;for(var e,r,F=t||Object.keys(u),i=[],E=0,o=F;E<o.length;E+=1){var a=o[E],B=c(a,u);if(void 0!==B){var f=s(a)+":";""!==A&&(f+=" "),f+=B,i.push(f)}}if(0===i.length)e="{}";else if(""===A)r=i.join(","),e="{"+r+"}";else{var l=",\n"+C;r=i.join(l),e="{\n"+C+r+",\n"+D+"}"}return n.pop(),C=D,e}(e):void 0}function B(u){for(var D={"'":.1,'"':.2},e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},t="",r=0;r<u.length;r++){var n=u[r];switch(n){case"'":case'"':D[n]++,t+=n;continue;case"\0":if(U.isDigit(u[r+1])){t+="\\x00";continue}}if(e[n])t+=e[n];else if(n<" "){var C=n.charCodeAt(0).toString(16);t+="\\x"+("00"+C).substring(C.length)}else t+=n}var A=F||Object.keys(D).reduce(function(u,e){return D[u]<D[e]?u:e});return A+(t=t.replace(new RegExp(A,"g"),e[A]))+A}function s(u){if(0===u.length)return B(u);var D=String.fromCodePoint(u.codePointAt(0));if(!U.isIdStartChar(D))return B(u);for(var e=D.length;e<u.length;e++)if(!U.isIdContinueChar(String.fromCodePoint(u.codePointAt(e))))return B(u);return u}}}});
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/reconnecting-websocket/reconnecting-websocket.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.ReconnectingWebSocket=b()}(this,function(){function a(b,c,d){function l(a,b){var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!1,!1,b),c}var e={debug:!1,automaticOpen:!0,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1.5,timeoutInterval:2e3};d||(d={});for(var f in e)this[f]="undefined"!=typeof d[f]?d[f]:e[f];this.url=b,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var h,g=this,i=!1,j=!1,k=document.createElement("div");k.addEventListener("open",function(a){g.onopen(a)}),k.addEventListener("close",function(a){g.onclose(a)}),k.addEventListener("connecting",function(a){g.onconnecting(a)}),k.addEventListener("message",function(a){g.onmessage(a)}),k.addEventListener("error",function(a){g.onerror(a)}),this.addEventListener=k.addEventListener.bind(k),this.removeEventListener=k.removeEventListener.bind(k),this.dispatchEvent=k.dispatchEvent.bind(k),this.open=function(b){h=new WebSocket(g.url,c||[]),b||k.dispatchEvent(l("connecting")),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",g.url);var d=h,e=setTimeout(function(){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",g.url),j=!0,d.close(),j=!1},g.timeoutInterval);h.onopen=function(){clearTimeout(e),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onopen",g.url),g.protocol=h.protocol,g.readyState=WebSocket.OPEN,g.reconnectAttempts=0;var d=l("open");d.isReconnect=b,b=!1,k.dispatchEvent(d)},h.onclose=function(c){if(clearTimeout(e),h=null,i)g.readyState=WebSocket.CLOSED,k.dispatchEvent(l("close"));else{g.readyState=WebSocket.CONNECTING;var d=l("connecting");d.code=c.code,d.reason=c.reason,d.wasClean=c.wasClean,k.dispatchEvent(d),b||j||((g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onclose",g.url),k.dispatchEvent(l("close")));var e=g.reconnectInterval*Math.pow(g.reconnectDecay,g.reconnectAttempts);setTimeout(function(){g.reconnectAttempts++,g.open(!0)},e>g.maxReconnectInterval?g.maxReconnectInterval:e)}},h.onmessage=function(b){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",g.url,b.data);var c=l("message");c.data=b.data,k.dispatchEvent(c)},h.onerror=function(b){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onerror",g.url,b),k.dispatchEvent(l("error"))}},1==this.automaticOpen&&this.open(!1),this.send=function(b){if(h)return(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","send",g.url,b),h.send(b);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(a,b){"undefined"==typeof a&&(a=1e3),i=!0,h&&h.close(a,b)},this.refresh=function(){h&&h.close()}}return a.prototype.onopen=function(){},a.prototype.onclose=function(){},a.prototype.onconnecting=function(){},a.prototype.onmessage=function(){},a.prototype.onerror=function(){},a.debugAll=!1,a.CONNECTING=WebSocket.CONNECTING,a.OPEN=WebSocket.OPEN,a.CLOSING=WebSocket.CLOSING,a.CLOSED=WebSocket.CLOSED,a});
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/renderjson/renderjson.js
DELETED
@@ -1,216 +0,0 @@
|
|
1 |
-
// Copyright © 2013-2017 David Caldwell <david@porkrind.org>
|
2 |
-
//
|
3 |
-
// Permission to use, copy, modify, and/or distribute this software for any
|
4 |
-
// purpose with or without fee is hereby granted, provided that the above
|
5 |
-
// copyright notice and this permission notice appear in all copies.
|
6 |
-
//
|
7 |
-
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8 |
-
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9 |
-
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
10 |
-
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11 |
-
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
12 |
-
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
13 |
-
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14 |
-
|
15 |
-
// Usage
|
16 |
-
// -----
|
17 |
-
// The module exports one entry point, the `renderjson()` function. It takes in
|
18 |
-
// the JSON you want to render as a single argument and returns an HTML
|
19 |
-
// element.
|
20 |
-
//
|
21 |
-
// Options
|
22 |
-
// -------
|
23 |
-
// renderjson.set_icons("+", "-")
|
24 |
-
// This Allows you to override the disclosure icons.
|
25 |
-
//
|
26 |
-
// renderjson.set_show_to_level(level)
|
27 |
-
// Pass the number of levels to expand when rendering. The default is 0, which
|
28 |
-
// starts with everything collapsed. As a special case, if level is the string
|
29 |
-
// "all" then it will start with everything expanded.
|
30 |
-
//
|
31 |
-
// renderjson.set_max_string_length(length)
|
32 |
-
// Strings will be truncated and made expandable if they are longer than
|
33 |
-
// `length`. As a special case, if `length` is the string "none" then
|
34 |
-
// there will be no truncation. The default is "none".
|
35 |
-
//
|
36 |
-
// renderjson.set_sort_objects(sort_bool)
|
37 |
-
// Sort objects by key (default: false)
|
38 |
-
//
|
39 |
-
// renderjson.set_replacer(replacer_function)
|
40 |
-
// Equivalent of JSON.stringify() `replacer` argument when it's a function
|
41 |
-
//
|
42 |
-
// renderjson.set_collapse_msg(collapse_function)
|
43 |
-
// Accepts a function (len:number):string => {} where len is the length of the
|
44 |
-
// object collapsed. Function should return the message displayed when a
|
45 |
-
// object is collapsed. The default message is "X items"
|
46 |
-
//
|
47 |
-
// renderjson.set_property_list(property_list)
|
48 |
-
// Equivalent of JSON.stringify() `replacer` argument when it's an array
|
49 |
-
//
|
50 |
-
// Theming
|
51 |
-
// -------
|
52 |
-
// The HTML output uses a number of classes so that you can theme it the way
|
53 |
-
// you'd like:
|
54 |
-
// .disclosure ("⊕", "⊖")
|
55 |
-
// .syntax (",", ":", "{", "}", "[", "]")
|
56 |
-
// .string (includes quotes)
|
57 |
-
// .number
|
58 |
-
// .boolean
|
59 |
-
// .key (object key)
|
60 |
-
// .keyword ("null", "undefined")
|
61 |
-
// .object.syntax ("{", "}")
|
62 |
-
// .array.syntax ("[", "]")
|
63 |
-
|
64 |
-
var module, window, define, renderjson=(function() {
|
65 |
-
var themetext = function(/* [class, text]+ */) {
|
66 |
-
var spans = [];
|
67 |
-
while (arguments.length)
|
68 |
-
spans.push(append(span(Array.prototype.shift.call(arguments)),
|
69 |
-
text(Array.prototype.shift.call(arguments))));
|
70 |
-
return spans;
|
71 |
-
};
|
72 |
-
var append = function(/* el, ... */) {
|
73 |
-
var el = Array.prototype.shift.call(arguments);
|
74 |
-
for (var a=0; a<arguments.length; a++)
|
75 |
-
if (arguments[a].constructor == Array)
|
76 |
-
append.apply(this, [el].concat(arguments[a]));
|
77 |
-
else
|
78 |
-
el.appendChild(arguments[a]);
|
79 |
-
return el;
|
80 |
-
};
|
81 |
-
var prepend = function(el, child) {
|
82 |
-
el.insertBefore(child, el.firstChild);
|
83 |
-
return el;
|
84 |
-
}
|
85 |
-
var isempty = function(obj, pl) { var keys = pl || Object.keys(obj);
|
86 |
-
for (var i in keys) if (Object.hasOwnProperty.call(obj, keys[i])) return false;
|
87 |
-
return true; }
|
88 |
-
var text = function(txt) { return document.createTextNode(txt) };
|
89 |
-
var div = function() { return document.createElement("div") };
|
90 |
-
var span = function(classname) { var s = document.createElement("span");
|
91 |
-
if (classname) s.className = classname;
|
92 |
-
return s; };
|
93 |
-
var A = function A(txt, classname, callback) { var a = document.createElement("a");
|
94 |
-
if (classname) a.className = classname;
|
95 |
-
a.appendChild(text(txt));
|
96 |
-
a.href = '#';
|
97 |
-
a.onclick = function(e) { callback(); if (e) e.stopPropagation(); return false; };
|
98 |
-
return a; };
|
99 |
-
|
100 |
-
function _renderjson(json, indent, dont_indent, show_level, options) {
|
101 |
-
var my_indent = dont_indent ? "" : indent;
|
102 |
-
|
103 |
-
var disclosure = function(open, placeholder, close, type, builder) {
|
104 |
-
var content;
|
105 |
-
var empty = span(type);
|
106 |
-
var show = function() { if (!content) append(empty.parentNode,
|
107 |
-
content = prepend(builder(),
|
108 |
-
A(options.hide, "disclosure",
|
109 |
-
function() { content.style.display="none";
|
110 |
-
empty.style.display="inline"; } )));
|
111 |
-
content.style.display="inline";
|
112 |
-
empty.style.display="none"; };
|
113 |
-
append(empty,
|
114 |
-
A(options.show, "disclosure", show),
|
115 |
-
themetext(type+ " syntax", open),
|
116 |
-
A(placeholder, null, show),
|
117 |
-
themetext(type+ " syntax", close));
|
118 |
-
|
119 |
-
var el = append(span(), text(my_indent.slice(0,-1)), empty);
|
120 |
-
if (show_level > 0 && type != "string")
|
121 |
-
show();
|
122 |
-
return el;
|
123 |
-
};
|
124 |
-
|
125 |
-
if (json === null) return themetext(null, my_indent, "keyword", "null");
|
126 |
-
if (json === void 0) return themetext(null, my_indent, "keyword", "undefined");
|
127 |
-
|
128 |
-
if (typeof(json) == "string" && json.length > options.max_string_length)
|
129 |
-
return disclosure('"', json.substr(0,options.max_string_length)+" ...", '"', "string", function () {
|
130 |
-
return append(span("string"), themetext(null, my_indent, "string", JSON.stringify(json)));
|
131 |
-
});
|
132 |
-
|
133 |
-
if (typeof(json) != "object" || [Number, String, Boolean, Date].indexOf(json.constructor) >= 0) // Strings, numbers and bools
|
134 |
-
return themetext(null, my_indent, typeof(json), JSON.stringify(json));
|
135 |
-
|
136 |
-
if (json.constructor == Array) {
|
137 |
-
if (json.length == 0) return themetext(null, my_indent, "array syntax", "[]");
|
138 |
-
|
139 |
-
return disclosure("[", options.collapse_msg(json.length), "]", "array", function () {
|
140 |
-
var as = append(span("array"), themetext("array syntax", "[", null, "\n"));
|
141 |
-
for (var i=0; i<json.length; i++)
|
142 |
-
append(as,
|
143 |
-
_renderjson(options.replacer.call(json, i, json[i]), indent+" ", false, show_level-1, options),
|
144 |
-
i != json.length-1 ? themetext("syntax", ",") : [],
|
145 |
-
text("\n"));
|
146 |
-
append(as, themetext(null, indent, "array syntax", "]"));
|
147 |
-
return as;
|
148 |
-
});
|
149 |
-
}
|
150 |
-
|
151 |
-
// object
|
152 |
-
if (isempty(json, options.property_list))
|
153 |
-
return themetext(null, my_indent, "object syntax", "{}");
|
154 |
-
|
155 |
-
return disclosure("{", options.collapse_msg(Object.keys(json).length), "}", "object", function () {
|
156 |
-
var os = append(span("object"), themetext("object syntax", "{", null, "\n"));
|
157 |
-
for (var k in json) var last = k;
|
158 |
-
var keys = options.property_list || Object.keys(json);
|
159 |
-
if (options.sort_objects)
|
160 |
-
keys = keys.sort();
|
161 |
-
for (var i in keys) {
|
162 |
-
var k = keys[i];
|
163 |
-
if (!(k in json)) continue;
|
164 |
-
append(os, themetext(null, indent+" ", "key", '"'+k+'"', "object syntax", ': '),
|
165 |
-
_renderjson(options.replacer.call(json, k, json[k]), indent+" ", true, show_level-1, options),
|
166 |
-
k != last ? themetext("syntax", ",") : [],
|
167 |
-
text("\n"));
|
168 |
-
}
|
169 |
-
append(os, themetext(null, indent, "object syntax", "}"));
|
170 |
-
return os;
|
171 |
-
});
|
172 |
-
}
|
173 |
-
|
174 |
-
var renderjson = function renderjson(json)
|
175 |
-
{
|
176 |
-
var options = new Object(renderjson.options);
|
177 |
-
options.replacer = typeof(options.replacer) == "function" ? options.replacer : function(k,v) { return v; };
|
178 |
-
var pre = append(document.createElement("pre"), _renderjson(json, "", false, options.show_to_level, options));
|
179 |
-
pre.className = "renderjson";
|
180 |
-
return pre;
|
181 |
-
}
|
182 |
-
renderjson.set_icons = function(show, hide) { renderjson.options.show = show;
|
183 |
-
renderjson.options.hide = hide;
|
184 |
-
return renderjson; };
|
185 |
-
renderjson.set_show_to_level = function(level) { renderjson.options.show_to_level = typeof level == "string" &&
|
186 |
-
level.toLowerCase() === "all" ? Number.MAX_VALUE
|
187 |
-
: level;
|
188 |
-
return renderjson; };
|
189 |
-
renderjson.set_max_string_length = function(length) { renderjson.options.max_string_length = typeof length == "string" &&
|
190 |
-
length.toLowerCase() === "none" ? Number.MAX_VALUE
|
191 |
-
: length;
|
192 |
-
return renderjson; };
|
193 |
-
renderjson.set_sort_objects = function(sort_bool) { renderjson.options.sort_objects = sort_bool;
|
194 |
-
return renderjson; };
|
195 |
-
renderjson.set_replacer = function(replacer) { renderjson.options.replacer = replacer;
|
196 |
-
return renderjson; };
|
197 |
-
renderjson.set_collapse_msg = function(collapse_msg) { renderjson.options.collapse_msg = collapse_msg;
|
198 |
-
return renderjson; };
|
199 |
-
renderjson.set_property_list = function(prop_list) { renderjson.options.property_list = prop_list;
|
200 |
-
return renderjson; };
|
201 |
-
// Backwards compatiblity. Use set_show_to_level() for new code.
|
202 |
-
renderjson.set_show_by_default = function(show) { renderjson.options.show_to_level = show ? Number.MAX_VALUE : 0;
|
203 |
-
return renderjson; };
|
204 |
-
renderjson.options = {};
|
205 |
-
renderjson.set_icons('⊕', '⊖');
|
206 |
-
renderjson.set_show_by_default(false);
|
207 |
-
renderjson.set_sort_objects(false);
|
208 |
-
renderjson.set_max_string_length("none");
|
209 |
-
renderjson.set_replacer(void 0);
|
210 |
-
renderjson.set_property_list(void 0);
|
211 |
-
renderjson.set_collapse_msg(function(len) { return len + " item" + (len==1 ? "" : "s") })
|
212 |
-
return renderjson;
|
213 |
-
})();
|
214 |
-
|
215 |
-
if (define) define({renderjson:renderjson})
|
216 |
-
else (module||{}).exports = (window||{}).renderjson = renderjson;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/controls/OrbitControls.js
DELETED
@@ -1,1079 +0,0 @@
|
|
1 |
-
( function () {
|
2 |
-
|
3 |
-
// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
|
4 |
-
//
|
5 |
-
// Orbit - left mouse / touch: one-finger move
|
6 |
-
// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
|
7 |
-
// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
|
8 |
-
|
9 |
-
const _changeEvent = {
|
10 |
-
type: 'change'
|
11 |
-
};
|
12 |
-
const _startEvent = {
|
13 |
-
type: 'start'
|
14 |
-
};
|
15 |
-
const _endEvent = {
|
16 |
-
type: 'end'
|
17 |
-
};
|
18 |
-
|
19 |
-
class OrbitControls extends THREE.EventDispatcher {
|
20 |
-
|
21 |
-
constructor( object, domElement ) {
|
22 |
-
|
23 |
-
super();
|
24 |
-
if ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' );
|
25 |
-
if ( domElement === document ) console.error( 'THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.' );
|
26 |
-
this.object = object;
|
27 |
-
this.domElement = domElement;
|
28 |
-
this.domElement.style.touchAction = 'none'; // disable touch scroll
|
29 |
-
// Set to false to disable this control
|
30 |
-
|
31 |
-
this.enabled = true; // "target" sets the location of focus, where the object orbits around
|
32 |
-
|
33 |
-
this.target = new THREE.Vector3(); // How far you can dolly in and out ( PerspectiveCamera only )
|
34 |
-
|
35 |
-
this.minDistance = 0;
|
36 |
-
this.maxDistance = Infinity; // How far you can zoom in and out ( OrthographicCamera only )
|
37 |
-
|
38 |
-
this.minZoom = 0;
|
39 |
-
this.maxZoom = Infinity; // How far you can orbit vertically, upper and lower limits.
|
40 |
-
// Range is 0 to Math.PI radians.
|
41 |
-
|
42 |
-
this.minPolarAngle = 0; // radians
|
43 |
-
|
44 |
-
this.maxPolarAngle = Math.PI; // radians
|
45 |
-
// How far you can orbit horizontally, upper and lower limits.
|
46 |
-
// If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
|
47 |
-
|
48 |
-
this.minAzimuthAngle = - Infinity; // radians
|
49 |
-
|
50 |
-
this.maxAzimuthAngle = Infinity; // radians
|
51 |
-
// Set to true to enable damping (inertia)
|
52 |
-
// If damping is enabled, you must call controls.update() in your animation loop
|
53 |
-
|
54 |
-
this.enableDamping = false;
|
55 |
-
this.dampingFactor = 0.05; // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
|
56 |
-
// Set to false to disable zooming
|
57 |
-
|
58 |
-
this.enableZoom = true;
|
59 |
-
this.zoomSpeed = 1.0; // Set to false to disable rotating
|
60 |
-
|
61 |
-
this.enableRotate = true;
|
62 |
-
this.rotateSpeed = 1.0; // Set to false to disable panning
|
63 |
-
|
64 |
-
this.enablePan = true;
|
65 |
-
this.panSpeed = 1.0;
|
66 |
-
this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up
|
67 |
-
|
68 |
-
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
|
69 |
-
// Set to true to automatically rotate around the target
|
70 |
-
// If auto-rotate is enabled, you must call controls.update() in your animation loop
|
71 |
-
|
72 |
-
this.autoRotate = false;
|
73 |
-
this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60
|
74 |
-
// The four arrow keys
|
75 |
-
|
76 |
-
this.keys = {
|
77 |
-
LEFT: 'ArrowLeft',
|
78 |
-
UP: 'ArrowUp',
|
79 |
-
RIGHT: 'ArrowRight',
|
80 |
-
BOTTOM: 'ArrowDown'
|
81 |
-
}; // Mouse buttons
|
82 |
-
|
83 |
-
this.mouseButtons = {
|
84 |
-
LEFT: THREE.MOUSE.ROTATE,
|
85 |
-
MIDDLE: THREE.MOUSE.DOLLY,
|
86 |
-
RIGHT: THREE.MOUSE.PAN
|
87 |
-
}; // Touch fingers
|
88 |
-
|
89 |
-
this.touches = {
|
90 |
-
ONE: THREE.TOUCH.ROTATE,
|
91 |
-
TWO: THREE.TOUCH.DOLLY_PAN
|
92 |
-
}; // for reset
|
93 |
-
|
94 |
-
this.target0 = this.target.clone();
|
95 |
-
this.position0 = this.object.position.clone();
|
96 |
-
this.zoom0 = this.object.zoom; // the target DOM element for key events
|
97 |
-
|
98 |
-
this._domElementKeyEvents = null; //
|
99 |
-
// public methods
|
100 |
-
//
|
101 |
-
|
102 |
-
this.getPolarAngle = function () {
|
103 |
-
|
104 |
-
return spherical.phi;
|
105 |
-
|
106 |
-
};
|
107 |
-
|
108 |
-
this.getAzimuthalAngle = function () {
|
109 |
-
|
110 |
-
return spherical.theta;
|
111 |
-
|
112 |
-
};
|
113 |
-
|
114 |
-
this.getDistance = function () {
|
115 |
-
|
116 |
-
return this.object.position.distanceTo( this.target );
|
117 |
-
|
118 |
-
};
|
119 |
-
|
120 |
-
this.listenToKeyEvents = function ( domElement ) {
|
121 |
-
|
122 |
-
domElement.addEventListener( 'keydown', onKeyDown );
|
123 |
-
this._domElementKeyEvents = domElement;
|
124 |
-
|
125 |
-
};
|
126 |
-
|
127 |
-
this.saveState = function () {
|
128 |
-
|
129 |
-
scope.target0.copy( scope.target );
|
130 |
-
scope.position0.copy( scope.object.position );
|
131 |
-
scope.zoom0 = scope.object.zoom;
|
132 |
-
|
133 |
-
};
|
134 |
-
|
135 |
-
this.reset = function () {
|
136 |
-
|
137 |
-
scope.target.copy( scope.target0 );
|
138 |
-
scope.object.position.copy( scope.position0 );
|
139 |
-
scope.object.zoom = scope.zoom0;
|
140 |
-
scope.object.updateProjectionMatrix();
|
141 |
-
scope.dispatchEvent( _changeEvent );
|
142 |
-
scope.update();
|
143 |
-
state = STATE.NONE;
|
144 |
-
|
145 |
-
}; // this method is exposed, but perhaps it would be better if we can make it private...
|
146 |
-
|
147 |
-
|
148 |
-
this.update = function () {
|
149 |
-
|
150 |
-
const offset = new THREE.Vector3(); // so camera.up is the orbit axis
|
151 |
-
|
152 |
-
const quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );
|
153 |
-
const quatInverse = quat.clone().invert();
|
154 |
-
const lastPosition = new THREE.Vector3();
|
155 |
-
const lastQuaternion = new THREE.Quaternion();
|
156 |
-
const twoPI = 2 * Math.PI;
|
157 |
-
return function update() {
|
158 |
-
|
159 |
-
const position = scope.object.position;
|
160 |
-
offset.copy( position ).sub( scope.target ); // rotate offset to "y-axis-is-up" space
|
161 |
-
|
162 |
-
offset.applyQuaternion( quat ); // angle from z-axis around y-axis
|
163 |
-
|
164 |
-
spherical.setFromVector3( offset );
|
165 |
-
|
166 |
-
if ( scope.autoRotate && state === STATE.NONE ) {
|
167 |
-
|
168 |
-
rotateLeft( getAutoRotationAngle() );
|
169 |
-
|
170 |
-
}
|
171 |
-
|
172 |
-
if ( scope.enableDamping ) {
|
173 |
-
|
174 |
-
spherical.theta += sphericalDelta.theta * scope.dampingFactor;
|
175 |
-
spherical.phi += sphericalDelta.phi * scope.dampingFactor;
|
176 |
-
|
177 |
-
} else {
|
178 |
-
|
179 |
-
spherical.theta += sphericalDelta.theta;
|
180 |
-
spherical.phi += sphericalDelta.phi;
|
181 |
-
|
182 |
-
} // restrict theta to be between desired limits
|
183 |
-
|
184 |
-
|
185 |
-
let min = scope.minAzimuthAngle;
|
186 |
-
let max = scope.maxAzimuthAngle;
|
187 |
-
|
188 |
-
if ( isFinite( min ) && isFinite( max ) ) {
|
189 |
-
|
190 |
-
if ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI;
|
191 |
-
if ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI;
|
192 |
-
|
193 |
-
if ( min <= max ) {
|
194 |
-
|
195 |
-
spherical.theta = Math.max( min, Math.min( max, spherical.theta ) );
|
196 |
-
|
197 |
-
} else {
|
198 |
-
|
199 |
-
spherical.theta = spherical.theta > ( min + max ) / 2 ? Math.max( min, spherical.theta ) : Math.min( max, spherical.theta );
|
200 |
-
|
201 |
-
}
|
202 |
-
|
203 |
-
} // restrict phi to be between desired limits
|
204 |
-
|
205 |
-
|
206 |
-
spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );
|
207 |
-
spherical.makeSafe();
|
208 |
-
spherical.radius *= scale; // restrict radius to be between desired limits
|
209 |
-
|
210 |
-
spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) ); // move target to panned location
|
211 |
-
|
212 |
-
if ( scope.enableDamping === true ) {
|
213 |
-
|
214 |
-
scope.target.addScaledVector( panOffset, scope.dampingFactor );
|
215 |
-
|
216 |
-
} else {
|
217 |
-
|
218 |
-
scope.target.add( panOffset );
|
219 |
-
|
220 |
-
}
|
221 |
-
|
222 |
-
offset.setFromSpherical( spherical ); // rotate offset back to "camera-up-vector-is-up" space
|
223 |
-
|
224 |
-
offset.applyQuaternion( quatInverse );
|
225 |
-
position.copy( scope.target ).add( offset );
|
226 |
-
scope.object.lookAt( scope.target );
|
227 |
-
|
228 |
-
if ( scope.enableDamping === true ) {
|
229 |
-
|
230 |
-
sphericalDelta.theta *= 1 - scope.dampingFactor;
|
231 |
-
sphericalDelta.phi *= 1 - scope.dampingFactor;
|
232 |
-
panOffset.multiplyScalar( 1 - scope.dampingFactor );
|
233 |
-
|
234 |
-
} else {
|
235 |
-
|
236 |
-
sphericalDelta.set( 0, 0, 0 );
|
237 |
-
panOffset.set( 0, 0, 0 );
|
238 |
-
|
239 |
-
}
|
240 |
-
|
241 |
-
scale = 1; // update condition is:
|
242 |
-
// min(camera displacement, camera rotation in radians)^2 > EPS
|
243 |
-
// using small-angle approximation cos(x/2) = 1 - x^2 / 8
|
244 |
-
|
245 |
-
if ( zoomChanged || lastPosition.distanceToSquared( scope.object.position ) > EPS || 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {
|
246 |
-
|
247 |
-
scope.dispatchEvent( _changeEvent );
|
248 |
-
lastPosition.copy( scope.object.position );
|
249 |
-
lastQuaternion.copy( scope.object.quaternion );
|
250 |
-
zoomChanged = false;
|
251 |
-
return true;
|
252 |
-
|
253 |
-
}
|
254 |
-
|
255 |
-
return false;
|
256 |
-
|
257 |
-
};
|
258 |
-
|
259 |
-
}();
|
260 |
-
|
261 |
-
this.dispose = function () {
|
262 |
-
|
263 |
-
scope.domElement.removeEventListener( 'contextmenu', onContextMenu );
|
264 |
-
scope.domElement.removeEventListener( 'pointerdown', onPointerDown );
|
265 |
-
scope.domElement.removeEventListener( 'pointercancel', onPointerCancel );
|
266 |
-
scope.domElement.removeEventListener( 'wheel', onMouseWheel );
|
267 |
-
scope.domElement.removeEventListener( 'pointermove', onPointerMove );
|
268 |
-
scope.domElement.removeEventListener( 'pointerup', onPointerUp );
|
269 |
-
|
270 |
-
if ( scope._domElementKeyEvents !== null ) {
|
271 |
-
|
272 |
-
scope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown );
|
273 |
-
|
274 |
-
} //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
|
275 |
-
|
276 |
-
}; //
|
277 |
-
// internals
|
278 |
-
//
|
279 |
-
|
280 |
-
|
281 |
-
const scope = this;
|
282 |
-
const STATE = {
|
283 |
-
NONE: - 1,
|
284 |
-
ROTATE: 0,
|
285 |
-
DOLLY: 1,
|
286 |
-
PAN: 2,
|
287 |
-
TOUCH_ROTATE: 3,
|
288 |
-
TOUCH_PAN: 4,
|
289 |
-
TOUCH_DOLLY_PAN: 5,
|
290 |
-
TOUCH_DOLLY_ROTATE: 6
|
291 |
-
};
|
292 |
-
let state = STATE.NONE;
|
293 |
-
const EPS = 0.000001; // current position in spherical coordinates
|
294 |
-
|
295 |
-
const spherical = new THREE.Spherical();
|
296 |
-
const sphericalDelta = new THREE.Spherical();
|
297 |
-
let scale = 1;
|
298 |
-
const panOffset = new THREE.Vector3();
|
299 |
-
let zoomChanged = false;
|
300 |
-
const rotateStart = new THREE.Vector2();
|
301 |
-
const rotateEnd = new THREE.Vector2();
|
302 |
-
const rotateDelta = new THREE.Vector2();
|
303 |
-
const panStart = new THREE.Vector2();
|
304 |
-
const panEnd = new THREE.Vector2();
|
305 |
-
const panDelta = new THREE.Vector2();
|
306 |
-
const dollyStart = new THREE.Vector2();
|
307 |
-
const dollyEnd = new THREE.Vector2();
|
308 |
-
const dollyDelta = new THREE.Vector2();
|
309 |
-
const pointers = [];
|
310 |
-
const pointerPositions = {};
|
311 |
-
|
312 |
-
function getAutoRotationAngle() {
|
313 |
-
|
314 |
-
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
|
315 |
-
|
316 |
-
}
|
317 |
-
|
318 |
-
function getZoomScale() {
|
319 |
-
|
320 |
-
return Math.pow( 0.95, scope.zoomSpeed );
|
321 |
-
|
322 |
-
}
|
323 |
-
|
324 |
-
function rotateLeft( angle ) {
|
325 |
-
|
326 |
-
sphericalDelta.theta -= angle;
|
327 |
-
|
328 |
-
}
|
329 |
-
|
330 |
-
function rotateUp( angle ) {
|
331 |
-
|
332 |
-
sphericalDelta.phi -= angle;
|
333 |
-
|
334 |
-
}
|
335 |
-
|
336 |
-
const panLeft = function () {
|
337 |
-
|
338 |
-
const v = new THREE.Vector3();
|
339 |
-
return function panLeft( distance, objectMatrix ) {
|
340 |
-
|
341 |
-
v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix
|
342 |
-
|
343 |
-
v.multiplyScalar( - distance );
|
344 |
-
panOffset.add( v );
|
345 |
-
|
346 |
-
};
|
347 |
-
|
348 |
-
}();
|
349 |
-
|
350 |
-
const panUp = function () {
|
351 |
-
|
352 |
-
const v = new THREE.Vector3();
|
353 |
-
return function panUp( distance, objectMatrix ) {
|
354 |
-
|
355 |
-
if ( scope.screenSpacePanning === true ) {
|
356 |
-
|
357 |
-
v.setFromMatrixColumn( objectMatrix, 1 );
|
358 |
-
|
359 |
-
} else {
|
360 |
-
|
361 |
-
v.setFromMatrixColumn( objectMatrix, 0 );
|
362 |
-
v.crossVectors( scope.object.up, v );
|
363 |
-
|
364 |
-
}
|
365 |
-
|
366 |
-
v.multiplyScalar( distance );
|
367 |
-
panOffset.add( v );
|
368 |
-
|
369 |
-
};
|
370 |
-
|
371 |
-
}(); // deltaX and deltaY are in pixels; right and down are positive
|
372 |
-
|
373 |
-
|
374 |
-
const pan = function () {
|
375 |
-
|
376 |
-
const offset = new THREE.Vector3();
|
377 |
-
return function pan( deltaX, deltaY ) {
|
378 |
-
|
379 |
-
const element = scope.domElement;
|
380 |
-
|
381 |
-
if ( scope.object.isPerspectiveCamera ) {
|
382 |
-
|
383 |
-
// perspective
|
384 |
-
const position = scope.object.position;
|
385 |
-
offset.copy( position ).sub( scope.target );
|
386 |
-
let targetDistance = offset.length(); // half of the fov is center to top of screen
|
387 |
-
|
388 |
-
targetDistance *= Math.tan( scope.object.fov / 2 * Math.PI / 180.0 ); // we use only clientHeight here so aspect ratio does not distort speed
|
389 |
-
|
390 |
-
panLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );
|
391 |
-
panUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );
|
392 |
-
|
393 |
-
} else if ( scope.object.isOrthographicCamera ) {
|
394 |
-
|
395 |
-
// orthographic
|
396 |
-
panLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix );
|
397 |
-
panUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix );
|
398 |
-
|
399 |
-
} else {
|
400 |
-
|
401 |
-
// camera neither orthographic nor perspective
|
402 |
-
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
|
403 |
-
scope.enablePan = false;
|
404 |
-
|
405 |
-
}
|
406 |
-
|
407 |
-
};
|
408 |
-
|
409 |
-
}();
|
410 |
-
|
411 |
-
function dollyOut( dollyScale ) {
|
412 |
-
|
413 |
-
if ( scope.object.isPerspectiveCamera ) {
|
414 |
-
|
415 |
-
scale /= dollyScale;
|
416 |
-
|
417 |
-
} else if ( scope.object.isOrthographicCamera ) {
|
418 |
-
|
419 |
-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
|
420 |
-
scope.object.updateProjectionMatrix();
|
421 |
-
zoomChanged = true;
|
422 |
-
|
423 |
-
} else {
|
424 |
-
|
425 |
-
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
|
426 |
-
scope.enableZoom = false;
|
427 |
-
|
428 |
-
}
|
429 |
-
|
430 |
-
}
|
431 |
-
|
432 |
-
function dollyIn( dollyScale ) {
|
433 |
-
|
434 |
-
if ( scope.object.isPerspectiveCamera ) {
|
435 |
-
|
436 |
-
scale *= dollyScale;
|
437 |
-
|
438 |
-
} else if ( scope.object.isOrthographicCamera ) {
|
439 |
-
|
440 |
-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
|
441 |
-
scope.object.updateProjectionMatrix();
|
442 |
-
zoomChanged = true;
|
443 |
-
|
444 |
-
} else {
|
445 |
-
|
446 |
-
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
|
447 |
-
scope.enableZoom = false;
|
448 |
-
|
449 |
-
}
|
450 |
-
|
451 |
-
} //
|
452 |
-
// event callbacks - update the object state
|
453 |
-
//
|
454 |
-
|
455 |
-
|
456 |
-
function handleMouseDownRotate( event ) {
|
457 |
-
|
458 |
-
rotateStart.set( event.clientX, event.clientY );
|
459 |
-
|
460 |
-
}
|
461 |
-
|
462 |
-
function handleMouseDownDolly( event ) {
|
463 |
-
|
464 |
-
dollyStart.set( event.clientX, event.clientY );
|
465 |
-
|
466 |
-
}
|
467 |
-
|
468 |
-
function handleMouseDownPan( event ) {
|
469 |
-
|
470 |
-
panStart.set( event.clientX, event.clientY );
|
471 |
-
|
472 |
-
}
|
473 |
-
|
474 |
-
function handleMouseMoveRotate( event ) {
|
475 |
-
|
476 |
-
rotateEnd.set( event.clientX, event.clientY );
|
477 |
-
rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );
|
478 |
-
const element = scope.domElement;
|
479 |
-
rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height
|
480 |
-
|
481 |
-
rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
|
482 |
-
rotateStart.copy( rotateEnd );
|
483 |
-
scope.update();
|
484 |
-
|
485 |
-
}
|
486 |
-
|
487 |
-
function handleMouseMoveDolly( event ) {
|
488 |
-
|
489 |
-
dollyEnd.set( event.clientX, event.clientY );
|
490 |
-
dollyDelta.subVectors( dollyEnd, dollyStart );
|
491 |
-
|
492 |
-
if ( dollyDelta.y > 0 ) {
|
493 |
-
|
494 |
-
dollyOut( getZoomScale() );
|
495 |
-
|
496 |
-
} else if ( dollyDelta.y < 0 ) {
|
497 |
-
|
498 |
-
dollyIn( getZoomScale() );
|
499 |
-
|
500 |
-
}
|
501 |
-
|
502 |
-
dollyStart.copy( dollyEnd );
|
503 |
-
scope.update();
|
504 |
-
|
505 |
-
}
|
506 |
-
|
507 |
-
function handleMouseMovePan( event ) {
|
508 |
-
|
509 |
-
panEnd.set( event.clientX, event.clientY );
|
510 |
-
panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );
|
511 |
-
pan( panDelta.x, panDelta.y );
|
512 |
-
panStart.copy( panEnd );
|
513 |
-
scope.update();
|
514 |
-
|
515 |
-
}
|
516 |
-
|
517 |
-
function handleMouseWheel( event ) {
|
518 |
-
|
519 |
-
if ( event.deltaY < 0 ) {
|
520 |
-
|
521 |
-
dollyIn( getZoomScale() );
|
522 |
-
|
523 |
-
} else if ( event.deltaY > 0 ) {
|
524 |
-
|
525 |
-
dollyOut( getZoomScale() );
|
526 |
-
|
527 |
-
}
|
528 |
-
|
529 |
-
scope.update();
|
530 |
-
|
531 |
-
}
|
532 |
-
|
533 |
-
function handleKeyDown( event ) {
|
534 |
-
|
535 |
-
let needsUpdate = false;
|
536 |
-
|
537 |
-
switch ( event.code ) {
|
538 |
-
|
539 |
-
case scope.keys.UP:
|
540 |
-
pan( 0, scope.keyPanSpeed );
|
541 |
-
needsUpdate = true;
|
542 |
-
break;
|
543 |
-
|
544 |
-
case scope.keys.BOTTOM:
|
545 |
-
pan( 0, - scope.keyPanSpeed );
|
546 |
-
needsUpdate = true;
|
547 |
-
break;
|
548 |
-
|
549 |
-
case scope.keys.LEFT:
|
550 |
-
pan( scope.keyPanSpeed, 0 );
|
551 |
-
needsUpdate = true;
|
552 |
-
break;
|
553 |
-
|
554 |
-
case scope.keys.RIGHT:
|
555 |
-
pan( - scope.keyPanSpeed, 0 );
|
556 |
-
needsUpdate = true;
|
557 |
-
break;
|
558 |
-
|
559 |
-
}
|
560 |
-
|
561 |
-
if ( needsUpdate ) {
|
562 |
-
|
563 |
-
// prevent the browser from scrolling on cursor keys
|
564 |
-
event.preventDefault();
|
565 |
-
scope.update();
|
566 |
-
|
567 |
-
}
|
568 |
-
|
569 |
-
}
|
570 |
-
|
571 |
-
function handleTouchStartRotate() {
|
572 |
-
|
573 |
-
if ( pointers.length === 1 ) {
|
574 |
-
|
575 |
-
rotateStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
|
576 |
-
|
577 |
-
} else {
|
578 |
-
|
579 |
-
const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
|
580 |
-
const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
|
581 |
-
rotateStart.set( x, y );
|
582 |
-
|
583 |
-
}
|
584 |
-
|
585 |
-
}
|
586 |
-
|
587 |
-
function handleTouchStartPan() {
|
588 |
-
|
589 |
-
if ( pointers.length === 1 ) {
|
590 |
-
|
591 |
-
panStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
|
592 |
-
|
593 |
-
} else {
|
594 |
-
|
595 |
-
const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
|
596 |
-
const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
|
597 |
-
panStart.set( x, y );
|
598 |
-
|
599 |
-
}
|
600 |
-
|
601 |
-
}
|
602 |
-
|
603 |
-
function handleTouchStartDolly() {
|
604 |
-
|
605 |
-
const dx = pointers[ 0 ].pageX - pointers[ 1 ].pageX;
|
606 |
-
const dy = pointers[ 0 ].pageY - pointers[ 1 ].pageY;
|
607 |
-
const distance = Math.sqrt( dx * dx + dy * dy );
|
608 |
-
dollyStart.set( 0, distance );
|
609 |
-
|
610 |
-
}
|
611 |
-
|
612 |
-
function handleTouchStartDollyPan() {
|
613 |
-
|
614 |
-
if ( scope.enableZoom ) handleTouchStartDolly();
|
615 |
-
if ( scope.enablePan ) handleTouchStartPan();
|
616 |
-
|
617 |
-
}
|
618 |
-
|
619 |
-
function handleTouchStartDollyRotate() {
|
620 |
-
|
621 |
-
if ( scope.enableZoom ) handleTouchStartDolly();
|
622 |
-
if ( scope.enableRotate ) handleTouchStartRotate();
|
623 |
-
|
624 |
-
}
|
625 |
-
|
626 |
-
function handleTouchMoveRotate( event ) {
|
627 |
-
|
628 |
-
if ( pointers.length == 1 ) {
|
629 |
-
|
630 |
-
rotateEnd.set( event.pageX, event.pageY );
|
631 |
-
|
632 |
-
} else {
|
633 |
-
|
634 |
-
const position = getSecondPointerPosition( event );
|
635 |
-
const x = 0.5 * ( event.pageX + position.x );
|
636 |
-
const y = 0.5 * ( event.pageY + position.y );
|
637 |
-
rotateEnd.set( x, y );
|
638 |
-
|
639 |
-
}
|
640 |
-
|
641 |
-
rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );
|
642 |
-
const element = scope.domElement;
|
643 |
-
rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height
|
644 |
-
|
645 |
-
rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
|
646 |
-
rotateStart.copy( rotateEnd );
|
647 |
-
|
648 |
-
}
|
649 |
-
|
650 |
-
function handleTouchMovePan( event ) {
|
651 |
-
|
652 |
-
if ( pointers.length === 1 ) {
|
653 |
-
|
654 |
-
panEnd.set( event.pageX, event.pageY );
|
655 |
-
|
656 |
-
} else {
|
657 |
-
|
658 |
-
const position = getSecondPointerPosition( event );
|
659 |
-
const x = 0.5 * ( event.pageX + position.x );
|
660 |
-
const y = 0.5 * ( event.pageY + position.y );
|
661 |
-
panEnd.set( x, y );
|
662 |
-
|
663 |
-
}
|
664 |
-
|
665 |
-
panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );
|
666 |
-
pan( panDelta.x, panDelta.y );
|
667 |
-
panStart.copy( panEnd );
|
668 |
-
|
669 |
-
}
|
670 |
-
|
671 |
-
function handleTouchMoveDolly( event ) {
|
672 |
-
|
673 |
-
const position = getSecondPointerPosition( event );
|
674 |
-
const dx = event.pageX - position.x;
|
675 |
-
const dy = event.pageY - position.y;
|
676 |
-
const distance = Math.sqrt( dx * dx + dy * dy );
|
677 |
-
dollyEnd.set( 0, distance );
|
678 |
-
dollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) );
|
679 |
-
dollyOut( dollyDelta.y );
|
680 |
-
dollyStart.copy( dollyEnd );
|
681 |
-
|
682 |
-
}
|
683 |
-
|
684 |
-
function handleTouchMoveDollyPan( event ) {
|
685 |
-
|
686 |
-
if ( scope.enableZoom ) handleTouchMoveDolly( event );
|
687 |
-
if ( scope.enablePan ) handleTouchMovePan( event );
|
688 |
-
|
689 |
-
}
|
690 |
-
|
691 |
-
function handleTouchMoveDollyRotate( event ) {
|
692 |
-
|
693 |
-
if ( scope.enableZoom ) handleTouchMoveDolly( event );
|
694 |
-
if ( scope.enableRotate ) handleTouchMoveRotate( event );
|
695 |
-
|
696 |
-
} //
|
697 |
-
// event handlers - FSM: listen for events and reset state
|
698 |
-
//
|
699 |
-
|
700 |
-
|
701 |
-
function onPointerDown( event ) {
|
702 |
-
|
703 |
-
if ( scope.enabled === false ) return;
|
704 |
-
|
705 |
-
if ( pointers.length === 0 ) {
|
706 |
-
|
707 |
-
scope.domElement.setPointerCapture( event.pointerId );
|
708 |
-
scope.domElement.addEventListener( 'pointermove', onPointerMove );
|
709 |
-
scope.domElement.addEventListener( 'pointerup', onPointerUp );
|
710 |
-
|
711 |
-
} //
|
712 |
-
|
713 |
-
|
714 |
-
addPointer( event );
|
715 |
-
|
716 |
-
if ( event.pointerType === 'touch' ) {
|
717 |
-
|
718 |
-
onTouchStart( event );
|
719 |
-
|
720 |
-
} else {
|
721 |
-
|
722 |
-
onMouseDown( event );
|
723 |
-
|
724 |
-
}
|
725 |
-
|
726 |
-
}
|
727 |
-
|
728 |
-
function onPointerMove( event ) {
|
729 |
-
|
730 |
-
if ( scope.enabled === false ) return;
|
731 |
-
|
732 |
-
if ( event.pointerType === 'touch' ) {
|
733 |
-
|
734 |
-
onTouchMove( event );
|
735 |
-
|
736 |
-
} else {
|
737 |
-
|
738 |
-
onMouseMove( event );
|
739 |
-
|
740 |
-
}
|
741 |
-
|
742 |
-
}
|
743 |
-
|
744 |
-
function onPointerUp( event ) {
|
745 |
-
|
746 |
-
removePointer( event );
|
747 |
-
|
748 |
-
if ( pointers.length === 0 ) {
|
749 |
-
|
750 |
-
scope.domElement.releasePointerCapture( event.pointerId );
|
751 |
-
scope.domElement.removeEventListener( 'pointermove', onPointerMove );
|
752 |
-
scope.domElement.removeEventListener( 'pointerup', onPointerUp );
|
753 |
-
|
754 |
-
}
|
755 |
-
|
756 |
-
scope.dispatchEvent( _endEvent );
|
757 |
-
state = STATE.NONE;
|
758 |
-
|
759 |
-
}
|
760 |
-
|
761 |
-
function onPointerCancel( event ) {
|
762 |
-
|
763 |
-
removePointer( event );
|
764 |
-
|
765 |
-
}
|
766 |
-
|
767 |
-
function onMouseDown( event ) {
|
768 |
-
|
769 |
-
let mouseAction;
|
770 |
-
|
771 |
-
switch ( event.button ) {
|
772 |
-
|
773 |
-
case 0:
|
774 |
-
mouseAction = scope.mouseButtons.LEFT;
|
775 |
-
break;
|
776 |
-
|
777 |
-
case 1:
|
778 |
-
mouseAction = scope.mouseButtons.MIDDLE;
|
779 |
-
break;
|
780 |
-
|
781 |
-
case 2:
|
782 |
-
mouseAction = scope.mouseButtons.RIGHT;
|
783 |
-
break;
|
784 |
-
|
785 |
-
default:
|
786 |
-
mouseAction = - 1;
|
787 |
-
|
788 |
-
}
|
789 |
-
|
790 |
-
switch ( mouseAction ) {
|
791 |
-
|
792 |
-
case THREE.MOUSE.DOLLY:
|
793 |
-
if ( scope.enableZoom === false ) return;
|
794 |
-
handleMouseDownDolly( event );
|
795 |
-
state = STATE.DOLLY;
|
796 |
-
break;
|
797 |
-
|
798 |
-
case THREE.MOUSE.ROTATE:
|
799 |
-
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
|
800 |
-
|
801 |
-
if ( scope.enablePan === false ) return;
|
802 |
-
handleMouseDownPan( event );
|
803 |
-
state = STATE.PAN;
|
804 |
-
|
805 |
-
} else {
|
806 |
-
|
807 |
-
if ( scope.enableRotate === false ) return;
|
808 |
-
handleMouseDownRotate( event );
|
809 |
-
state = STATE.ROTATE;
|
810 |
-
|
811 |
-
}
|
812 |
-
|
813 |
-
break;
|
814 |
-
|
815 |
-
case THREE.MOUSE.PAN:
|
816 |
-
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
|
817 |
-
|
818 |
-
if ( scope.enableRotate === false ) return;
|
819 |
-
handleMouseDownRotate( event );
|
820 |
-
state = STATE.ROTATE;
|
821 |
-
|
822 |
-
} else {
|
823 |
-
|
824 |
-
if ( scope.enablePan === false ) return;
|
825 |
-
handleMouseDownPan( event );
|
826 |
-
state = STATE.PAN;
|
827 |
-
|
828 |
-
}
|
829 |
-
|
830 |
-
break;
|
831 |
-
|
832 |
-
default:
|
833 |
-
state = STATE.NONE;
|
834 |
-
|
835 |
-
}
|
836 |
-
|
837 |
-
if ( state !== STATE.NONE ) {
|
838 |
-
|
839 |
-
scope.dispatchEvent( _startEvent );
|
840 |
-
|
841 |
-
}
|
842 |
-
|
843 |
-
}
|
844 |
-
|
845 |
-
function onMouseMove( event ) {
|
846 |
-
|
847 |
-
if ( scope.enabled === false ) return;
|
848 |
-
|
849 |
-
switch ( state ) {
|
850 |
-
|
851 |
-
case STATE.ROTATE:
|
852 |
-
if ( scope.enableRotate === false ) return;
|
853 |
-
handleMouseMoveRotate( event );
|
854 |
-
break;
|
855 |
-
|
856 |
-
case STATE.DOLLY:
|
857 |
-
if ( scope.enableZoom === false ) return;
|
858 |
-
handleMouseMoveDolly( event );
|
859 |
-
break;
|
860 |
-
|
861 |
-
case STATE.PAN:
|
862 |
-
if ( scope.enablePan === false ) return;
|
863 |
-
handleMouseMovePan( event );
|
864 |
-
break;
|
865 |
-
|
866 |
-
}
|
867 |
-
|
868 |
-
}
|
869 |
-
|
870 |
-
function onMouseWheel( event ) {
|
871 |
-
|
872 |
-
if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
|
873 |
-
event.preventDefault();
|
874 |
-
scope.dispatchEvent( _startEvent );
|
875 |
-
handleMouseWheel( event );
|
876 |
-
scope.dispatchEvent( _endEvent );
|
877 |
-
|
878 |
-
}
|
879 |
-
|
880 |
-
function onKeyDown( event ) {
|
881 |
-
|
882 |
-
if ( scope.enabled === false || scope.enablePan === false ) return;
|
883 |
-
handleKeyDown( event );
|
884 |
-
|
885 |
-
}
|
886 |
-
|
887 |
-
function onTouchStart( event ) {
|
888 |
-
|
889 |
-
trackPointer( event );
|
890 |
-
|
891 |
-
switch ( pointers.length ) {
|
892 |
-
|
893 |
-
case 1:
|
894 |
-
switch ( scope.touches.ONE ) {
|
895 |
-
|
896 |
-
case THREE.TOUCH.ROTATE:
|
897 |
-
if ( scope.enableRotate === false ) return;
|
898 |
-
handleTouchStartRotate();
|
899 |
-
state = STATE.TOUCH_ROTATE;
|
900 |
-
break;
|
901 |
-
|
902 |
-
case THREE.TOUCH.PAN:
|
903 |
-
if ( scope.enablePan === false ) return;
|
904 |
-
handleTouchStartPan();
|
905 |
-
state = STATE.TOUCH_PAN;
|
906 |
-
break;
|
907 |
-
|
908 |
-
default:
|
909 |
-
state = STATE.NONE;
|
910 |
-
|
911 |
-
}
|
912 |
-
|
913 |
-
break;
|
914 |
-
|
915 |
-
case 2:
|
916 |
-
switch ( scope.touches.TWO ) {
|
917 |
-
|
918 |
-
case THREE.TOUCH.DOLLY_PAN:
|
919 |
-
if ( scope.enableZoom === false && scope.enablePan === false ) return;
|
920 |
-
handleTouchStartDollyPan();
|
921 |
-
state = STATE.TOUCH_DOLLY_PAN;
|
922 |
-
break;
|
923 |
-
|
924 |
-
case THREE.TOUCH.DOLLY_ROTATE:
|
925 |
-
if ( scope.enableZoom === false && scope.enableRotate === false ) return;
|
926 |
-
handleTouchStartDollyRotate();
|
927 |
-
state = STATE.TOUCH_DOLLY_ROTATE;
|
928 |
-
break;
|
929 |
-
|
930 |
-
default:
|
931 |
-
state = STATE.NONE;
|
932 |
-
|
933 |
-
}
|
934 |
-
|
935 |
-
break;
|
936 |
-
|
937 |
-
default:
|
938 |
-
state = STATE.NONE;
|
939 |
-
|
940 |
-
}
|
941 |
-
|
942 |
-
if ( state !== STATE.NONE ) {
|
943 |
-
|
944 |
-
scope.dispatchEvent( _startEvent );
|
945 |
-
|
946 |
-
}
|
947 |
-
|
948 |
-
}
|
949 |
-
|
950 |
-
function onTouchMove( event ) {
|
951 |
-
|
952 |
-
trackPointer( event );
|
953 |
-
|
954 |
-
switch ( state ) {
|
955 |
-
|
956 |
-
case STATE.TOUCH_ROTATE:
|
957 |
-
if ( scope.enableRotate === false ) return;
|
958 |
-
handleTouchMoveRotate( event );
|
959 |
-
scope.update();
|
960 |
-
break;
|
961 |
-
|
962 |
-
case STATE.TOUCH_PAN:
|
963 |
-
if ( scope.enablePan === false ) return;
|
964 |
-
handleTouchMovePan( event );
|
965 |
-
scope.update();
|
966 |
-
break;
|
967 |
-
|
968 |
-
case STATE.TOUCH_DOLLY_PAN:
|
969 |
-
if ( scope.enableZoom === false && scope.enablePan === false ) return;
|
970 |
-
handleTouchMoveDollyPan( event );
|
971 |
-
scope.update();
|
972 |
-
break;
|
973 |
-
|
974 |
-
case STATE.TOUCH_DOLLY_ROTATE:
|
975 |
-
if ( scope.enableZoom === false && scope.enableRotate === false ) return;
|
976 |
-
handleTouchMoveDollyRotate( event );
|
977 |
-
scope.update();
|
978 |
-
break;
|
979 |
-
|
980 |
-
default:
|
981 |
-
state = STATE.NONE;
|
982 |
-
|
983 |
-
}
|
984 |
-
|
985 |
-
}
|
986 |
-
|
987 |
-
function onContextMenu( event ) {
|
988 |
-
|
989 |
-
if ( scope.enabled === false ) return;
|
990 |
-
event.preventDefault();
|
991 |
-
|
992 |
-
}
|
993 |
-
|
994 |
-
function addPointer( event ) {
|
995 |
-
|
996 |
-
pointers.push( event );
|
997 |
-
|
998 |
-
}
|
999 |
-
|
1000 |
-
function removePointer( event ) {
|
1001 |
-
|
1002 |
-
delete pointerPositions[ event.pointerId ];
|
1003 |
-
|
1004 |
-
for ( let i = 0; i < pointers.length; i ++ ) {
|
1005 |
-
|
1006 |
-
if ( pointers[ i ].pointerId == event.pointerId ) {
|
1007 |
-
|
1008 |
-
pointers.splice( i, 1 );
|
1009 |
-
return;
|
1010 |
-
|
1011 |
-
}
|
1012 |
-
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
}
|
1016 |
-
|
1017 |
-
function trackPointer( event ) {
|
1018 |
-
|
1019 |
-
let position = pointerPositions[ event.pointerId ];
|
1020 |
-
|
1021 |
-
if ( position === undefined ) {
|
1022 |
-
|
1023 |
-
position = new THREE.Vector2();
|
1024 |
-
pointerPositions[ event.pointerId ] = position;
|
1025 |
-
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
position.set( event.pageX, event.pageY );
|
1029 |
-
|
1030 |
-
}
|
1031 |
-
|
1032 |
-
function getSecondPointerPosition( event ) {
|
1033 |
-
|
1034 |
-
const pointer = event.pointerId === pointers[ 0 ].pointerId ? pointers[ 1 ] : pointers[ 0 ];
|
1035 |
-
return pointerPositions[ pointer.pointerId ];
|
1036 |
-
|
1037 |
-
} //
|
1038 |
-
|
1039 |
-
|
1040 |
-
scope.domElement.addEventListener( 'contextmenu', onContextMenu );
|
1041 |
-
scope.domElement.addEventListener( 'pointerdown', onPointerDown );
|
1042 |
-
scope.domElement.addEventListener( 'pointercancel', onPointerCancel );
|
1043 |
-
scope.domElement.addEventListener( 'wheel', onMouseWheel, {
|
1044 |
-
passive: false
|
1045 |
-
} ); // force an update at start
|
1046 |
-
|
1047 |
-
this.update();
|
1048 |
-
|
1049 |
-
}
|
1050 |
-
|
1051 |
-
} // This set of controls performs orbiting, dollying (zooming), and panning.
|
1052 |
-
// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
|
1053 |
-
// This is very similar to OrbitControls, another set of touch behavior
|
1054 |
-
//
|
1055 |
-
// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate
|
1056 |
-
// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
|
1057 |
-
// Pan - left mouse, or arrow keys / touch: one-finger move
|
1058 |
-
|
1059 |
-
|
1060 |
-
class MapControls extends OrbitControls {
|
1061 |
-
|
1062 |
-
constructor( object, domElement ) {
|
1063 |
-
|
1064 |
-
super( object, domElement );
|
1065 |
-
this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up
|
1066 |
-
|
1067 |
-
this.mouseButtons.LEFT = THREE.MOUSE.PAN;
|
1068 |
-
this.mouseButtons.RIGHT = THREE.MOUSE.ROTATE;
|
1069 |
-
this.touches.ONE = THREE.TOUCH.PAN;
|
1070 |
-
this.touches.TWO = THREE.TOUCH.DOLLY_ROTATE;
|
1071 |
-
|
1072 |
-
}
|
1073 |
-
|
1074 |
-
}
|
1075 |
-
|
1076 |
-
THREE.MapControls = MapControls;
|
1077 |
-
THREE.OrbitControls = OrbitControls;
|
1078 |
-
|
1079 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/controls/TransformControls.js
DELETED
@@ -1,1383 +0,0 @@
|
|
1 |
-
( function () {
|
2 |
-
|
3 |
-
const _raycaster = new THREE.Raycaster();
|
4 |
-
|
5 |
-
const _tempVector = new THREE.Vector3();
|
6 |
-
|
7 |
-
const _tempVector2 = new THREE.Vector3();
|
8 |
-
|
9 |
-
const _tempQuaternion = new THREE.Quaternion();
|
10 |
-
|
11 |
-
const _unit = {
|
12 |
-
X: new THREE.Vector3( 1, 0, 0 ),
|
13 |
-
Y: new THREE.Vector3( 0, 1, 0 ),
|
14 |
-
Z: new THREE.Vector3( 0, 0, 1 )
|
15 |
-
};
|
16 |
-
const _changeEvent = {
|
17 |
-
type: 'change'
|
18 |
-
};
|
19 |
-
const _mouseDownEvent = {
|
20 |
-
type: 'mouseDown'
|
21 |
-
};
|
22 |
-
const _mouseUpEvent = {
|
23 |
-
type: 'mouseUp',
|
24 |
-
mode: null
|
25 |
-
};
|
26 |
-
const _objectChangeEvent = {
|
27 |
-
type: 'objectChange'
|
28 |
-
};
|
29 |
-
|
30 |
-
class TransformControls extends THREE.Object3D {
|
31 |
-
|
32 |
-
constructor( camera, domElement ) {
|
33 |
-
|
34 |
-
super();
|
35 |
-
|
36 |
-
if ( domElement === undefined ) {
|
37 |
-
|
38 |
-
console.warn( 'THREE.TransformControls: The second parameter "domElement" is now mandatory.' );
|
39 |
-
domElement = document;
|
40 |
-
|
41 |
-
}
|
42 |
-
|
43 |
-
this.visible = false;
|
44 |
-
this.domElement = domElement;
|
45 |
-
this.domElement.style.touchAction = 'none'; // disable touch scroll
|
46 |
-
|
47 |
-
const _gizmo = new TransformControlsGizmo();
|
48 |
-
|
49 |
-
this._gizmo = _gizmo;
|
50 |
-
this.add( _gizmo );
|
51 |
-
|
52 |
-
const _plane = new TransformControlsPlane();
|
53 |
-
|
54 |
-
this._plane = _plane;
|
55 |
-
this.add( _plane );
|
56 |
-
const scope = this; // Defined getter, setter and store for a property
|
57 |
-
|
58 |
-
function defineProperty( propName, defaultValue ) {
|
59 |
-
|
60 |
-
let propValue = defaultValue;
|
61 |
-
Object.defineProperty( scope, propName, {
|
62 |
-
get: function () {
|
63 |
-
|
64 |
-
return propValue !== undefined ? propValue : defaultValue;
|
65 |
-
|
66 |
-
},
|
67 |
-
set: function ( value ) {
|
68 |
-
|
69 |
-
if ( propValue !== value ) {
|
70 |
-
|
71 |
-
propValue = value;
|
72 |
-
_plane[ propName ] = value;
|
73 |
-
_gizmo[ propName ] = value;
|
74 |
-
scope.dispatchEvent( {
|
75 |
-
type: propName + '-changed',
|
76 |
-
value: value
|
77 |
-
} );
|
78 |
-
scope.dispatchEvent( _changeEvent );
|
79 |
-
|
80 |
-
}
|
81 |
-
|
82 |
-
}
|
83 |
-
} );
|
84 |
-
scope[ propName ] = defaultValue;
|
85 |
-
_plane[ propName ] = defaultValue;
|
86 |
-
_gizmo[ propName ] = defaultValue;
|
87 |
-
|
88 |
-
} // Define properties with getters/setter
|
89 |
-
// Setting the defined property will automatically trigger change event
|
90 |
-
// Defined properties are passed down to gizmo and plane
|
91 |
-
|
92 |
-
|
93 |
-
defineProperty( 'camera', camera );
|
94 |
-
defineProperty( 'object', undefined );
|
95 |
-
defineProperty( 'enabled', true );
|
96 |
-
defineProperty( 'axis', null );
|
97 |
-
defineProperty( 'mode', 'translate' );
|
98 |
-
defineProperty( 'translationSnap', null );
|
99 |
-
defineProperty( 'rotationSnap', null );
|
100 |
-
defineProperty( 'scaleSnap', null );
|
101 |
-
defineProperty( 'space', 'world' );
|
102 |
-
defineProperty( 'size', 1 );
|
103 |
-
defineProperty( 'dragging', false );
|
104 |
-
defineProperty( 'showX', true );
|
105 |
-
defineProperty( 'showY', true );
|
106 |
-
defineProperty( 'showZ', true ); // Reusable utility variables
|
107 |
-
|
108 |
-
const worldPosition = new THREE.Vector3();
|
109 |
-
const worldPositionStart = new THREE.Vector3();
|
110 |
-
const worldQuaternion = new THREE.Quaternion();
|
111 |
-
const worldQuaternionStart = new THREE.Quaternion();
|
112 |
-
const cameraPosition = new THREE.Vector3();
|
113 |
-
const cameraQuaternion = new THREE.Quaternion();
|
114 |
-
const pointStart = new THREE.Vector3();
|
115 |
-
const pointEnd = new THREE.Vector3();
|
116 |
-
const rotationAxis = new THREE.Vector3();
|
117 |
-
const rotationAngle = 0;
|
118 |
-
const eye = new THREE.Vector3(); // TODO: remove properties unused in plane and gizmo
|
119 |
-
|
120 |
-
defineProperty( 'worldPosition', worldPosition );
|
121 |
-
defineProperty( 'worldPositionStart', worldPositionStart );
|
122 |
-
defineProperty( 'worldQuaternion', worldQuaternion );
|
123 |
-
defineProperty( 'worldQuaternionStart', worldQuaternionStart );
|
124 |
-
defineProperty( 'cameraPosition', cameraPosition );
|
125 |
-
defineProperty( 'cameraQuaternion', cameraQuaternion );
|
126 |
-
defineProperty( 'pointStart', pointStart );
|
127 |
-
defineProperty( 'pointEnd', pointEnd );
|
128 |
-
defineProperty( 'rotationAxis', rotationAxis );
|
129 |
-
defineProperty( 'rotationAngle', rotationAngle );
|
130 |
-
defineProperty( 'eye', eye );
|
131 |
-
this._offset = new THREE.Vector3();
|
132 |
-
this._startNorm = new THREE.Vector3();
|
133 |
-
this._endNorm = new THREE.Vector3();
|
134 |
-
this._cameraScale = new THREE.Vector3();
|
135 |
-
this._parentPosition = new THREE.Vector3();
|
136 |
-
this._parentQuaternion = new THREE.Quaternion();
|
137 |
-
this._parentQuaternionInv = new THREE.Quaternion();
|
138 |
-
this._parentScale = new THREE.Vector3();
|
139 |
-
this._worldScaleStart = new THREE.Vector3();
|
140 |
-
this._worldQuaternionInv = new THREE.Quaternion();
|
141 |
-
this._worldScale = new THREE.Vector3();
|
142 |
-
this._positionStart = new THREE.Vector3();
|
143 |
-
this._quaternionStart = new THREE.Quaternion();
|
144 |
-
this._scaleStart = new THREE.Vector3();
|
145 |
-
this._getPointer = getPointer.bind( this );
|
146 |
-
this._onPointerDown = onPointerDown.bind( this );
|
147 |
-
this._onPointerHover = onPointerHover.bind( this );
|
148 |
-
this._onPointerMove = onPointerMove.bind( this );
|
149 |
-
this._onPointerUp = onPointerUp.bind( this );
|
150 |
-
this.domElement.addEventListener( 'pointerdown', this._onPointerDown );
|
151 |
-
this.domElement.addEventListener( 'pointermove', this._onPointerHover );
|
152 |
-
this.domElement.addEventListener( 'pointerup', this._onPointerUp );
|
153 |
-
|
154 |
-
} // updateMatrixWorld updates key transformation variables
|
155 |
-
|
156 |
-
|
157 |
-
updateMatrixWorld() {
|
158 |
-
|
159 |
-
if ( this.object !== undefined ) {
|
160 |
-
|
161 |
-
this.object.updateMatrixWorld();
|
162 |
-
|
163 |
-
if ( this.object.parent === null ) {
|
164 |
-
|
165 |
-
console.error( 'TransformControls: The attached 3D object must be a part of the scene graph.' );
|
166 |
-
|
167 |
-
} else {
|
168 |
-
|
169 |
-
this.object.parent.matrixWorld.decompose( this._parentPosition, this._parentQuaternion, this._parentScale );
|
170 |
-
|
171 |
-
}
|
172 |
-
|
173 |
-
this.object.matrixWorld.decompose( this.worldPosition, this.worldQuaternion, this._worldScale );
|
174 |
-
|
175 |
-
this._parentQuaternionInv.copy( this._parentQuaternion ).invert();
|
176 |
-
|
177 |
-
this._worldQuaternionInv.copy( this.worldQuaternion ).invert();
|
178 |
-
|
179 |
-
}
|
180 |
-
|
181 |
-
this.camera.updateMatrixWorld();
|
182 |
-
this.camera.matrixWorld.decompose( this.cameraPosition, this.cameraQuaternion, this._cameraScale );
|
183 |
-
this.eye.copy( this.cameraPosition ).sub( this.worldPosition ).normalize();
|
184 |
-
super.updateMatrixWorld( this );
|
185 |
-
|
186 |
-
}
|
187 |
-
|
188 |
-
pointerHover( pointer ) {
|
189 |
-
|
190 |
-
if ( this.object === undefined || this.dragging === true ) return;
|
191 |
-
|
192 |
-
_raycaster.setFromCamera( pointer, this.camera );
|
193 |
-
|
194 |
-
const intersect = intersectObjectWithRay( this._gizmo.picker[ this.mode ], _raycaster );
|
195 |
-
|
196 |
-
if ( intersect ) {
|
197 |
-
|
198 |
-
this.axis = intersect.object.name;
|
199 |
-
|
200 |
-
} else {
|
201 |
-
|
202 |
-
this.axis = null;
|
203 |
-
|
204 |
-
}
|
205 |
-
|
206 |
-
}
|
207 |
-
|
208 |
-
pointerDown( pointer ) {
|
209 |
-
|
210 |
-
if ( this.object === undefined || this.dragging === true || pointer.button !== 0 ) return;
|
211 |
-
|
212 |
-
if ( this.axis !== null ) {
|
213 |
-
|
214 |
-
_raycaster.setFromCamera( pointer, this.camera );
|
215 |
-
|
216 |
-
const planeIntersect = intersectObjectWithRay( this._plane, _raycaster, true );
|
217 |
-
|
218 |
-
if ( planeIntersect ) {
|
219 |
-
|
220 |
-
this.object.updateMatrixWorld();
|
221 |
-
this.object.parent.updateMatrixWorld();
|
222 |
-
|
223 |
-
this._positionStart.copy( this.object.position );
|
224 |
-
|
225 |
-
this._quaternionStart.copy( this.object.quaternion );
|
226 |
-
|
227 |
-
this._scaleStart.copy( this.object.scale );
|
228 |
-
|
229 |
-
this.object.matrixWorld.decompose( this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart );
|
230 |
-
this.pointStart.copy( planeIntersect.point ).sub( this.worldPositionStart );
|
231 |
-
|
232 |
-
}
|
233 |
-
|
234 |
-
this.dragging = true;
|
235 |
-
_mouseDownEvent.mode = this.mode;
|
236 |
-
this.dispatchEvent( _mouseDownEvent );
|
237 |
-
|
238 |
-
}
|
239 |
-
|
240 |
-
}
|
241 |
-
|
242 |
-
pointerMove( pointer ) {
|
243 |
-
|
244 |
-
const axis = this.axis;
|
245 |
-
const mode = this.mode;
|
246 |
-
const object = this.object;
|
247 |
-
let space = this.space;
|
248 |
-
|
249 |
-
if ( mode === 'scale' ) {
|
250 |
-
|
251 |
-
space = 'local';
|
252 |
-
|
253 |
-
} else if ( axis === 'E' || axis === 'XYZE' || axis === 'XYZ' ) {
|
254 |
-
|
255 |
-
space = 'world';
|
256 |
-
|
257 |
-
}
|
258 |
-
|
259 |
-
if ( object === undefined || axis === null || this.dragging === false || pointer.button !== - 1 ) return;
|
260 |
-
|
261 |
-
_raycaster.setFromCamera( pointer, this.camera );
|
262 |
-
|
263 |
-
const planeIntersect = intersectObjectWithRay( this._plane, _raycaster, true );
|
264 |
-
if ( ! planeIntersect ) return;
|
265 |
-
this.pointEnd.copy( planeIntersect.point ).sub( this.worldPositionStart );
|
266 |
-
|
267 |
-
if ( mode === 'translate' ) {
|
268 |
-
|
269 |
-
// Apply translate
|
270 |
-
this._offset.copy( this.pointEnd ).sub( this.pointStart );
|
271 |
-
|
272 |
-
if ( space === 'local' && axis !== 'XYZ' ) {
|
273 |
-
|
274 |
-
this._offset.applyQuaternion( this._worldQuaternionInv );
|
275 |
-
|
276 |
-
}
|
277 |
-
|
278 |
-
if ( axis.indexOf( 'X' ) === - 1 ) this._offset.x = 0;
|
279 |
-
if ( axis.indexOf( 'Y' ) === - 1 ) this._offset.y = 0;
|
280 |
-
if ( axis.indexOf( 'Z' ) === - 1 ) this._offset.z = 0;
|
281 |
-
|
282 |
-
if ( space === 'local' && axis !== 'XYZ' ) {
|
283 |
-
|
284 |
-
this._offset.applyQuaternion( this._quaternionStart ).divide( this._parentScale );
|
285 |
-
|
286 |
-
} else {
|
287 |
-
|
288 |
-
this._offset.applyQuaternion( this._parentQuaternionInv ).divide( this._parentScale );
|
289 |
-
|
290 |
-
}
|
291 |
-
|
292 |
-
object.position.copy( this._offset ).add( this._positionStart ); // Apply translation snap
|
293 |
-
|
294 |
-
if ( this.translationSnap ) {
|
295 |
-
|
296 |
-
if ( space === 'local' ) {
|
297 |
-
|
298 |
-
object.position.applyQuaternion( _tempQuaternion.copy( this._quaternionStart ).invert() );
|
299 |
-
|
300 |
-
if ( axis.search( 'X' ) !== - 1 ) {
|
301 |
-
|
302 |
-
object.position.x = Math.round( object.position.x / this.translationSnap ) * this.translationSnap;
|
303 |
-
|
304 |
-
}
|
305 |
-
|
306 |
-
if ( axis.search( 'Y' ) !== - 1 ) {
|
307 |
-
|
308 |
-
object.position.y = Math.round( object.position.y / this.translationSnap ) * this.translationSnap;
|
309 |
-
|
310 |
-
}
|
311 |
-
|
312 |
-
if ( axis.search( 'Z' ) !== - 1 ) {
|
313 |
-
|
314 |
-
object.position.z = Math.round( object.position.z / this.translationSnap ) * this.translationSnap;
|
315 |
-
|
316 |
-
}
|
317 |
-
|
318 |
-
object.position.applyQuaternion( this._quaternionStart );
|
319 |
-
|
320 |
-
}
|
321 |
-
|
322 |
-
if ( space === 'world' ) {
|
323 |
-
|
324 |
-
if ( object.parent ) {
|
325 |
-
|
326 |
-
object.position.add( _tempVector.setFromMatrixPosition( object.parent.matrixWorld ) );
|
327 |
-
|
328 |
-
}
|
329 |
-
|
330 |
-
if ( axis.search( 'X' ) !== - 1 ) {
|
331 |
-
|
332 |
-
object.position.x = Math.round( object.position.x / this.translationSnap ) * this.translationSnap;
|
333 |
-
|
334 |
-
}
|
335 |
-
|
336 |
-
if ( axis.search( 'Y' ) !== - 1 ) {
|
337 |
-
|
338 |
-
object.position.y = Math.round( object.position.y / this.translationSnap ) * this.translationSnap;
|
339 |
-
|
340 |
-
}
|
341 |
-
|
342 |
-
if ( axis.search( 'Z' ) !== - 1 ) {
|
343 |
-
|
344 |
-
object.position.z = Math.round( object.position.z / this.translationSnap ) * this.translationSnap;
|
345 |
-
|
346 |
-
}
|
347 |
-
|
348 |
-
if ( object.parent ) {
|
349 |
-
|
350 |
-
object.position.sub( _tempVector.setFromMatrixPosition( object.parent.matrixWorld ) );
|
351 |
-
|
352 |
-
}
|
353 |
-
|
354 |
-
}
|
355 |
-
|
356 |
-
}
|
357 |
-
|
358 |
-
} else if ( mode === 'scale' ) {
|
359 |
-
|
360 |
-
if ( axis.search( 'XYZ' ) !== - 1 ) {
|
361 |
-
|
362 |
-
let d = this.pointEnd.length() / this.pointStart.length();
|
363 |
-
if ( this.pointEnd.dot( this.pointStart ) < 0 ) d *= - 1;
|
364 |
-
|
365 |
-
_tempVector2.set( d, d, d );
|
366 |
-
|
367 |
-
} else {
|
368 |
-
|
369 |
-
_tempVector.copy( this.pointStart );
|
370 |
-
|
371 |
-
_tempVector2.copy( this.pointEnd );
|
372 |
-
|
373 |
-
_tempVector.applyQuaternion( this._worldQuaternionInv );
|
374 |
-
|
375 |
-
_tempVector2.applyQuaternion( this._worldQuaternionInv );
|
376 |
-
|
377 |
-
_tempVector2.divide( _tempVector );
|
378 |
-
|
379 |
-
if ( axis.search( 'X' ) === - 1 ) {
|
380 |
-
|
381 |
-
_tempVector2.x = 1;
|
382 |
-
|
383 |
-
}
|
384 |
-
|
385 |
-
if ( axis.search( 'Y' ) === - 1 ) {
|
386 |
-
|
387 |
-
_tempVector2.y = 1;
|
388 |
-
|
389 |
-
}
|
390 |
-
|
391 |
-
if ( axis.search( 'Z' ) === - 1 ) {
|
392 |
-
|
393 |
-
_tempVector2.z = 1;
|
394 |
-
|
395 |
-
}
|
396 |
-
|
397 |
-
} // Apply scale
|
398 |
-
|
399 |
-
|
400 |
-
object.scale.copy( this._scaleStart ).multiply( _tempVector2 );
|
401 |
-
|
402 |
-
if ( this.scaleSnap ) {
|
403 |
-
|
404 |
-
if ( axis.search( 'X' ) !== - 1 ) {
|
405 |
-
|
406 |
-
object.scale.x = Math.round( object.scale.x / this.scaleSnap ) * this.scaleSnap || this.scaleSnap;
|
407 |
-
|
408 |
-
}
|
409 |
-
|
410 |
-
if ( axis.search( 'Y' ) !== - 1 ) {
|
411 |
-
|
412 |
-
object.scale.y = Math.round( object.scale.y / this.scaleSnap ) * this.scaleSnap || this.scaleSnap;
|
413 |
-
|
414 |
-
}
|
415 |
-
|
416 |
-
if ( axis.search( 'Z' ) !== - 1 ) {
|
417 |
-
|
418 |
-
object.scale.z = Math.round( object.scale.z / this.scaleSnap ) * this.scaleSnap || this.scaleSnap;
|
419 |
-
|
420 |
-
}
|
421 |
-
|
422 |
-
}
|
423 |
-
|
424 |
-
} else if ( mode === 'rotate' ) {
|
425 |
-
|
426 |
-
this._offset.copy( this.pointEnd ).sub( this.pointStart );
|
427 |
-
|
428 |
-
const ROTATION_SPEED = 20 / this.worldPosition.distanceTo( _tempVector.setFromMatrixPosition( this.camera.matrixWorld ) );
|
429 |
-
|
430 |
-
if ( axis === 'E' ) {
|
431 |
-
|
432 |
-
this.rotationAxis.copy( this.eye );
|
433 |
-
this.rotationAngle = this.pointEnd.angleTo( this.pointStart );
|
434 |
-
|
435 |
-
this._startNorm.copy( this.pointStart ).normalize();
|
436 |
-
|
437 |
-
this._endNorm.copy( this.pointEnd ).normalize();
|
438 |
-
|
439 |
-
this.rotationAngle *= this._endNorm.cross( this._startNorm ).dot( this.eye ) < 0 ? 1 : - 1;
|
440 |
-
|
441 |
-
} else if ( axis === 'XYZE' ) {
|
442 |
-
|
443 |
-
this.rotationAxis.copy( this._offset ).cross( this.eye ).normalize();
|
444 |
-
this.rotationAngle = this._offset.dot( _tempVector.copy( this.rotationAxis ).cross( this.eye ) ) * ROTATION_SPEED;
|
445 |
-
|
446 |
-
} else if ( axis === 'X' || axis === 'Y' || axis === 'Z' ) {
|
447 |
-
|
448 |
-
this.rotationAxis.copy( _unit[ axis ] );
|
449 |
-
|
450 |
-
_tempVector.copy( _unit[ axis ] );
|
451 |
-
|
452 |
-
if ( space === 'local' ) {
|
453 |
-
|
454 |
-
_tempVector.applyQuaternion( this.worldQuaternion );
|
455 |
-
|
456 |
-
}
|
457 |
-
|
458 |
-
this.rotationAngle = this._offset.dot( _tempVector.cross( this.eye ).normalize() ) * ROTATION_SPEED;
|
459 |
-
|
460 |
-
} // Apply rotation snap
|
461 |
-
|
462 |
-
|
463 |
-
if ( this.rotationSnap ) this.rotationAngle = Math.round( this.rotationAngle / this.rotationSnap ) * this.rotationSnap; // Apply rotate
|
464 |
-
|
465 |
-
if ( space === 'local' && axis !== 'E' && axis !== 'XYZE' ) {
|
466 |
-
|
467 |
-
object.quaternion.copy( this._quaternionStart );
|
468 |
-
object.quaternion.multiply( _tempQuaternion.setFromAxisAngle( this.rotationAxis, this.rotationAngle ) ).normalize();
|
469 |
-
|
470 |
-
} else {
|
471 |
-
|
472 |
-
this.rotationAxis.applyQuaternion( this._parentQuaternionInv );
|
473 |
-
object.quaternion.copy( _tempQuaternion.setFromAxisAngle( this.rotationAxis, this.rotationAngle ) );
|
474 |
-
object.quaternion.multiply( this._quaternionStart ).normalize();
|
475 |
-
|
476 |
-
}
|
477 |
-
|
478 |
-
}
|
479 |
-
|
480 |
-
this.dispatchEvent( _changeEvent );
|
481 |
-
this.dispatchEvent( _objectChangeEvent );
|
482 |
-
|
483 |
-
}
|
484 |
-
|
485 |
-
pointerUp( pointer ) {
|
486 |
-
|
487 |
-
if ( pointer.button !== 0 ) return;
|
488 |
-
|
489 |
-
if ( this.dragging && this.axis !== null ) {
|
490 |
-
|
491 |
-
_mouseUpEvent.mode = this.mode;
|
492 |
-
this.dispatchEvent( _mouseUpEvent );
|
493 |
-
|
494 |
-
}
|
495 |
-
|
496 |
-
this.dragging = false;
|
497 |
-
this.axis = null;
|
498 |
-
|
499 |
-
}
|
500 |
-
|
501 |
-
dispose() {
|
502 |
-
|
503 |
-
this.domElement.removeEventListener( 'pointerdown', this._onPointerDown );
|
504 |
-
this.domElement.removeEventListener( 'pointermove', this._onPointerHover );
|
505 |
-
this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
|
506 |
-
this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
|
507 |
-
this.traverse( function ( child ) {
|
508 |
-
|
509 |
-
if ( child.geometry ) child.geometry.dispose();
|
510 |
-
if ( child.material ) child.material.dispose();
|
511 |
-
|
512 |
-
} );
|
513 |
-
|
514 |
-
} // Set current object
|
515 |
-
|
516 |
-
|
517 |
-
attach( object ) {
|
518 |
-
|
519 |
-
this.object = object;
|
520 |
-
this.visible = true;
|
521 |
-
return this;
|
522 |
-
|
523 |
-
} // Detatch from object
|
524 |
-
|
525 |
-
|
526 |
-
detach() {
|
527 |
-
|
528 |
-
this.object = undefined;
|
529 |
-
this.visible = false;
|
530 |
-
this.axis = null;
|
531 |
-
return this;
|
532 |
-
|
533 |
-
}
|
534 |
-
|
535 |
-
reset() {
|
536 |
-
|
537 |
-
if ( ! this.enabled ) return;
|
538 |
-
|
539 |
-
if ( this.dragging ) {
|
540 |
-
|
541 |
-
this.object.position.copy( this._positionStart );
|
542 |
-
this.object.quaternion.copy( this._quaternionStart );
|
543 |
-
this.object.scale.copy( this._scaleStart );
|
544 |
-
this.dispatchEvent( _changeEvent );
|
545 |
-
this.dispatchEvent( _objectChangeEvent );
|
546 |
-
this.pointStart.copy( this.pointEnd );
|
547 |
-
|
548 |
-
}
|
549 |
-
|
550 |
-
}
|
551 |
-
|
552 |
-
getRaycaster() {
|
553 |
-
|
554 |
-
return _raycaster;
|
555 |
-
|
556 |
-
} // TODO: deprecate
|
557 |
-
|
558 |
-
|
559 |
-
getMode() {
|
560 |
-
|
561 |
-
return this.mode;
|
562 |
-
|
563 |
-
}
|
564 |
-
|
565 |
-
setMode( mode ) {
|
566 |
-
|
567 |
-
this.mode = mode;
|
568 |
-
|
569 |
-
}
|
570 |
-
|
571 |
-
setTranslationSnap( translationSnap ) {
|
572 |
-
|
573 |
-
this.translationSnap = translationSnap;
|
574 |
-
|
575 |
-
}
|
576 |
-
|
577 |
-
setRotationSnap( rotationSnap ) {
|
578 |
-
|
579 |
-
this.rotationSnap = rotationSnap;
|
580 |
-
|
581 |
-
}
|
582 |
-
|
583 |
-
setScaleSnap( scaleSnap ) {
|
584 |
-
|
585 |
-
this.scaleSnap = scaleSnap;
|
586 |
-
|
587 |
-
}
|
588 |
-
|
589 |
-
setSize( size ) {
|
590 |
-
|
591 |
-
this.size = size;
|
592 |
-
|
593 |
-
}
|
594 |
-
|
595 |
-
setSpace( space ) {
|
596 |
-
|
597 |
-
this.space = space;
|
598 |
-
|
599 |
-
}
|
600 |
-
|
601 |
-
update() {
|
602 |
-
|
603 |
-
console.warn( 'THREE.TransformControls: update function has no more functionality and therefore has been deprecated.' );
|
604 |
-
|
605 |
-
}
|
606 |
-
|
607 |
-
}
|
608 |
-
|
609 |
-
TransformControls.prototype.isTransformControls = true; // mouse / touch event handlers
|
610 |
-
|
611 |
-
function getPointer( event ) {
|
612 |
-
|
613 |
-
if ( this.domElement.ownerDocument.pointerLockElement ) {
|
614 |
-
|
615 |
-
return {
|
616 |
-
x: 0,
|
617 |
-
y: 0,
|
618 |
-
button: event.button
|
619 |
-
};
|
620 |
-
|
621 |
-
} else {
|
622 |
-
|
623 |
-
const rect = this.domElement.getBoundingClientRect();
|
624 |
-
return {
|
625 |
-
x: ( event.clientX - rect.left ) / rect.width * 2 - 1,
|
626 |
-
y: - ( event.clientY - rect.top ) / rect.height * 2 + 1,
|
627 |
-
button: event.button
|
628 |
-
};
|
629 |
-
|
630 |
-
}
|
631 |
-
|
632 |
-
}
|
633 |
-
|
634 |
-
function onPointerHover( event ) {
|
635 |
-
|
636 |
-
if ( ! this.enabled ) return;
|
637 |
-
|
638 |
-
switch ( event.pointerType ) {
|
639 |
-
|
640 |
-
case 'mouse':
|
641 |
-
case 'pen':
|
642 |
-
this.pointerHover( this._getPointer( event ) );
|
643 |
-
break;
|
644 |
-
|
645 |
-
}
|
646 |
-
|
647 |
-
}
|
648 |
-
|
649 |
-
function onPointerDown( event ) {
|
650 |
-
|
651 |
-
if ( ! this.enabled ) return;
|
652 |
-
|
653 |
-
if ( ! document.pointerLockElement ) {
|
654 |
-
|
655 |
-
this.domElement.setPointerCapture( event.pointerId );
|
656 |
-
|
657 |
-
}
|
658 |
-
|
659 |
-
this.domElement.addEventListener( 'pointermove', this._onPointerMove );
|
660 |
-
this.pointerHover( this._getPointer( event ) );
|
661 |
-
this.pointerDown( this._getPointer( event ) );
|
662 |
-
|
663 |
-
}
|
664 |
-
|
665 |
-
function onPointerMove( event ) {
|
666 |
-
|
667 |
-
if ( ! this.enabled ) return;
|
668 |
-
this.pointerMove( this._getPointer( event ) );
|
669 |
-
|
670 |
-
}
|
671 |
-
|
672 |
-
function onPointerUp( event ) {
|
673 |
-
|
674 |
-
if ( ! this.enabled ) return;
|
675 |
-
this.domElement.releasePointerCapture( event.pointerId );
|
676 |
-
this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
|
677 |
-
this.pointerUp( this._getPointer( event ) );
|
678 |
-
|
679 |
-
}
|
680 |
-
|
681 |
-
function intersectObjectWithRay( object, raycaster, includeInvisible ) {
|
682 |
-
|
683 |
-
const allIntersections = raycaster.intersectObject( object, true );
|
684 |
-
|
685 |
-
for ( let i = 0; i < allIntersections.length; i ++ ) {
|
686 |
-
|
687 |
-
if ( allIntersections[ i ].object.visible || includeInvisible ) {
|
688 |
-
|
689 |
-
return allIntersections[ i ];
|
690 |
-
|
691 |
-
}
|
692 |
-
|
693 |
-
}
|
694 |
-
|
695 |
-
return false;
|
696 |
-
|
697 |
-
} //
|
698 |
-
// Reusable utility variables
|
699 |
-
|
700 |
-
|
701 |
-
const _tempEuler = new THREE.Euler();
|
702 |
-
|
703 |
-
const _alignVector = new THREE.Vector3( 0, 1, 0 );
|
704 |
-
|
705 |
-
const _zeroVector = new THREE.Vector3( 0, 0, 0 );
|
706 |
-
|
707 |
-
const _lookAtMatrix = new THREE.Matrix4();
|
708 |
-
|
709 |
-
const _tempQuaternion2 = new THREE.Quaternion();
|
710 |
-
|
711 |
-
const _identityQuaternion = new THREE.Quaternion();
|
712 |
-
|
713 |
-
const _dirVector = new THREE.Vector3();
|
714 |
-
|
715 |
-
const _tempMatrix = new THREE.Matrix4();
|
716 |
-
|
717 |
-
const _unitX = new THREE.Vector3( 1, 0, 0 );
|
718 |
-
|
719 |
-
const _unitY = new THREE.Vector3( 0, 1, 0 );
|
720 |
-
|
721 |
-
const _unitZ = new THREE.Vector3( 0, 0, 1 );
|
722 |
-
|
723 |
-
const _v1 = new THREE.Vector3();
|
724 |
-
|
725 |
-
const _v2 = new THREE.Vector3();
|
726 |
-
|
727 |
-
const _v3 = new THREE.Vector3();
|
728 |
-
|
729 |
-
class TransformControlsGizmo extends THREE.Object3D {
|
730 |
-
|
731 |
-
constructor() {
|
732 |
-
|
733 |
-
super();
|
734 |
-
this.type = 'TransformControlsGizmo'; // shared materials
|
735 |
-
|
736 |
-
const gizmoMaterial = new THREE.MeshBasicMaterial( {
|
737 |
-
depthTest: false,
|
738 |
-
depthWrite: false,
|
739 |
-
fog: false,
|
740 |
-
toneMapped: false,
|
741 |
-
transparent: true
|
742 |
-
} );
|
743 |
-
const gizmoLineMaterial = new THREE.LineBasicMaterial( {
|
744 |
-
depthTest: false,
|
745 |
-
depthWrite: false,
|
746 |
-
fog: false,
|
747 |
-
toneMapped: false,
|
748 |
-
transparent: true
|
749 |
-
} ); // Make unique material for each axis/color
|
750 |
-
|
751 |
-
const matInvisible = gizmoMaterial.clone();
|
752 |
-
matInvisible.opacity = 0.15;
|
753 |
-
const matHelper = gizmoLineMaterial.clone();
|
754 |
-
matHelper.opacity = 0.5;
|
755 |
-
const matRed = gizmoMaterial.clone();
|
756 |
-
matRed.color.setHex( 0xff0000 );
|
757 |
-
const matGreen = gizmoMaterial.clone();
|
758 |
-
matGreen.color.setHex( 0x00ff00 );
|
759 |
-
const matBlue = gizmoMaterial.clone();
|
760 |
-
matBlue.color.setHex( 0x0000ff );
|
761 |
-
const matRedTransparent = gizmoMaterial.clone();
|
762 |
-
matRedTransparent.color.setHex( 0xff0000 );
|
763 |
-
matRedTransparent.opacity = 0.5;
|
764 |
-
const matGreenTransparent = gizmoMaterial.clone();
|
765 |
-
matGreenTransparent.color.setHex( 0x00ff00 );
|
766 |
-
matGreenTransparent.opacity = 0.5;
|
767 |
-
const matBlueTransparent = gizmoMaterial.clone();
|
768 |
-
matBlueTransparent.color.setHex( 0x0000ff );
|
769 |
-
matBlueTransparent.opacity = 0.5;
|
770 |
-
const matWhiteTransparent = gizmoMaterial.clone();
|
771 |
-
matWhiteTransparent.opacity = 0.25;
|
772 |
-
const matYellowTransparent = gizmoMaterial.clone();
|
773 |
-
matYellowTransparent.color.setHex( 0xffff00 );
|
774 |
-
matYellowTransparent.opacity = 0.25;
|
775 |
-
const matYellow = gizmoMaterial.clone();
|
776 |
-
matYellow.color.setHex( 0xffff00 );
|
777 |
-
const matGray = gizmoMaterial.clone();
|
778 |
-
matGray.color.setHex( 0x787878 ); // reusable geometry
|
779 |
-
|
780 |
-
const arrowGeometry = new THREE.CylinderGeometry( 0, 0.04, 0.1, 12 );
|
781 |
-
arrowGeometry.translate( 0, 0.05, 0 );
|
782 |
-
const scaleHandleGeometry = new THREE.BoxGeometry( 0.08, 0.08, 0.08 );
|
783 |
-
scaleHandleGeometry.translate( 0, 0.04, 0 );
|
784 |
-
const lineGeometry = new THREE.BufferGeometry();
|
785 |
-
lineGeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 1, 0, 0 ], 3 ) );
|
786 |
-
const lineGeometry2 = new THREE.CylinderGeometry( 0.0075, 0.0075, 0.5, 3 );
|
787 |
-
lineGeometry2.translate( 0, 0.25, 0 );
|
788 |
-
|
789 |
-
function CircleGeometry( radius, arc ) {
|
790 |
-
|
791 |
-
const geometry = new THREE.TorusGeometry( radius, 0.0075, 3, 64, arc * Math.PI * 2 );
|
792 |
-
geometry.rotateY( Math.PI / 2 );
|
793 |
-
geometry.rotateX( Math.PI / 2 );
|
794 |
-
return geometry;
|
795 |
-
|
796 |
-
} // Special geometry for transform helper. If scaled with position vector it spans from [0,0,0] to position
|
797 |
-
|
798 |
-
|
799 |
-
function TranslateHelperGeometry() {
|
800 |
-
|
801 |
-
const geometry = new THREE.BufferGeometry();
|
802 |
-
geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 1, 1, 1 ], 3 ) );
|
803 |
-
return geometry;
|
804 |
-
|
805 |
-
} // Gizmo definitions - custom hierarchy definitions for setupGizmo() function
|
806 |
-
|
807 |
-
|
808 |
-
const gizmoTranslate = {
|
809 |
-
X: [[ new THREE.Mesh( arrowGeometry, matRed ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], [ new THREE.Mesh( arrowGeometry, matRed ), [ - 0.5, 0, 0 ], [ 0, 0, Math.PI / 2 ]], [ new THREE.Mesh( lineGeometry2, matRed ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]],
|
810 |
-
Y: [[ new THREE.Mesh( arrowGeometry, matGreen ), [ 0, 0.5, 0 ]], [ new THREE.Mesh( arrowGeometry, matGreen ), [ 0, - 0.5, 0 ], [ Math.PI, 0, 0 ]], [ new THREE.Mesh( lineGeometry2, matGreen ) ]],
|
811 |
-
Z: [[ new THREE.Mesh( arrowGeometry, matBlue ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]], [ new THREE.Mesh( arrowGeometry, matBlue ), [ 0, 0, - 0.5 ], [ - Math.PI / 2, 0, 0 ]], [ new THREE.Mesh( lineGeometry2, matBlue ), null, [ Math.PI / 2, 0, 0 ]]],
|
812 |
-
XYZ: [[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.1, 0 ), matWhiteTransparent.clone() ), [ 0, 0, 0 ]]],
|
813 |
-
XY: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.15, 0.15, 0.01 ), matBlueTransparent.clone() ), [ 0.15, 0.15, 0 ]]],
|
814 |
-
YZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.15, 0.15, 0.01 ), matRedTransparent.clone() ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]]],
|
815 |
-
XZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.15, 0.15, 0.01 ), matGreenTransparent.clone() ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]]]
|
816 |
-
};
|
817 |
-
const pickerTranslate = {
|
818 |
-
X: [[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0.3, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], [ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ - 0.3, 0, 0 ], [ 0, 0, Math.PI / 2 ]]],
|
819 |
-
Y: [[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0.3, 0 ]], [ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, - 0.3, 0 ], [ 0, 0, Math.PI ]]],
|
820 |
-
Z: [[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0, 0.3 ], [ Math.PI / 2, 0, 0 ]], [ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0, - 0.3 ], [ - Math.PI / 2, 0, 0 ]]],
|
821 |
-
XYZ: [[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.2, 0 ), matInvisible ) ]],
|
822 |
-
XY: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0.15, 0.15, 0 ]]],
|
823 |
-
YZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]]],
|
824 |
-
XZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]]]
|
825 |
-
};
|
826 |
-
const helperTranslate = {
|
827 |
-
START: [[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]],
|
828 |
-
END: [[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]],
|
829 |
-
DELTA: [[ new THREE.Line( TranslateHelperGeometry(), matHelper ), null, null, null, 'helper' ]],
|
830 |
-
X: [[ new THREE.Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]],
|
831 |
-
Y: [[ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, - 1e3, 0 ], [ 0, 0, Math.PI / 2 ], [ 1e6, 1, 1 ], 'helper' ]],
|
832 |
-
Z: [[ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, 0, - 1e3 ], [ 0, - Math.PI / 2, 0 ], [ 1e6, 1, 1 ], 'helper' ]]
|
833 |
-
};
|
834 |
-
const gizmoRotate = {
|
835 |
-
XYZE: [[ new THREE.Mesh( CircleGeometry( 0.5, 1 ), matGray ), null, [ 0, Math.PI / 2, 0 ]]],
|
836 |
-
X: [[ new THREE.Mesh( CircleGeometry( 0.5, 0.5 ), matRed ) ]],
|
837 |
-
Y: [[ new THREE.Mesh( CircleGeometry( 0.5, 0.5 ), matGreen ), null, [ 0, 0, - Math.PI / 2 ]]],
|
838 |
-
Z: [[ new THREE.Mesh( CircleGeometry( 0.5, 0.5 ), matBlue ), null, [ 0, Math.PI / 2, 0 ]]],
|
839 |
-
E: [[ new THREE.Mesh( CircleGeometry( 0.75, 1 ), matYellowTransparent ), null, [ 0, Math.PI / 2, 0 ]]]
|
840 |
-
};
|
841 |
-
const helperRotate = {
|
842 |
-
AXIS: [[ new THREE.Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]]
|
843 |
-
};
|
844 |
-
const pickerRotate = {
|
845 |
-
XYZE: [[ new THREE.Mesh( new THREE.SphereGeometry( 0.25, 10, 8 ), matInvisible ) ]],
|
846 |
-
X: [[ new THREE.Mesh( new THREE.TorusGeometry( 0.5, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, - Math.PI / 2, - Math.PI / 2 ]]],
|
847 |
-
Y: [[ new THREE.Mesh( new THREE.TorusGeometry( 0.5, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]]],
|
848 |
-
Z: [[ new THREE.Mesh( new THREE.TorusGeometry( 0.5, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]],
|
849 |
-
E: [[ new THREE.Mesh( new THREE.TorusGeometry( 0.75, 0.1, 2, 24 ), matInvisible ) ]]
|
850 |
-
};
|
851 |
-
const gizmoScale = {
|
852 |
-
X: [[ new THREE.Mesh( scaleHandleGeometry, matRed ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], [ new THREE.Mesh( lineGeometry2, matRed ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], [ new THREE.Mesh( scaleHandleGeometry, matRed ), [ - 0.5, 0, 0 ], [ 0, 0, Math.PI / 2 ]]],
|
853 |
-
Y: [[ new THREE.Mesh( scaleHandleGeometry, matGreen ), [ 0, 0.5, 0 ]], [ new THREE.Mesh( lineGeometry2, matGreen ) ], [ new THREE.Mesh( scaleHandleGeometry, matGreen ), [ 0, - 0.5, 0 ], [ 0, 0, Math.PI ]]],
|
854 |
-
Z: [[ new THREE.Mesh( scaleHandleGeometry, matBlue ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]], [ new THREE.Mesh( lineGeometry2, matBlue ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]], [ new THREE.Mesh( scaleHandleGeometry, matBlue ), [ 0, 0, - 0.5 ], [ - Math.PI / 2, 0, 0 ]]],
|
855 |
-
XY: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.15, 0.15, 0.01 ), matBlueTransparent ), [ 0.15, 0.15, 0 ]]],
|
856 |
-
YZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.15, 0.15, 0.01 ), matRedTransparent ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]]],
|
857 |
-
XZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.15, 0.15, 0.01 ), matGreenTransparent ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]]],
|
858 |
-
XYZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.1, 0.1, 0.1 ), matWhiteTransparent.clone() ) ]]
|
859 |
-
};
|
860 |
-
const pickerScale = {
|
861 |
-
X: [[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0.3, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], [ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ - 0.3, 0, 0 ], [ 0, 0, Math.PI / 2 ]]],
|
862 |
-
Y: [[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0.3, 0 ]], [ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, - 0.3, 0 ], [ 0, 0, Math.PI ]]],
|
863 |
-
Z: [[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0, 0.3 ], [ Math.PI / 2, 0, 0 ]], [ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0, - 0.3 ], [ - Math.PI / 2, 0, 0 ]]],
|
864 |
-
XY: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0.15, 0.15, 0 ]]],
|
865 |
-
YZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]]],
|
866 |
-
XZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]]],
|
867 |
-
XYZ: [[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 0, 0 ]]]
|
868 |
-
};
|
869 |
-
const helperScale = {
|
870 |
-
X: [[ new THREE.Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]],
|
871 |
-
Y: [[ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, - 1e3, 0 ], [ 0, 0, Math.PI / 2 ], [ 1e6, 1, 1 ], 'helper' ]],
|
872 |
-
Z: [[ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, 0, - 1e3 ], [ 0, - Math.PI / 2, 0 ], [ 1e6, 1, 1 ], 'helper' ]]
|
873 |
-
}; // Creates an THREE.Object3D with gizmos described in custom hierarchy definition.
|
874 |
-
|
875 |
-
function setupGizmo( gizmoMap ) {
|
876 |
-
|
877 |
-
const gizmo = new THREE.Object3D();
|
878 |
-
|
879 |
-
for ( const name in gizmoMap ) {
|
880 |
-
|
881 |
-
for ( let i = gizmoMap[ name ].length; i --; ) {
|
882 |
-
|
883 |
-
const object = gizmoMap[ name ][ i ][ 0 ].clone();
|
884 |
-
const position = gizmoMap[ name ][ i ][ 1 ];
|
885 |
-
const rotation = gizmoMap[ name ][ i ][ 2 ];
|
886 |
-
const scale = gizmoMap[ name ][ i ][ 3 ];
|
887 |
-
const tag = gizmoMap[ name ][ i ][ 4 ]; // name and tag properties are essential for picking and updating logic.
|
888 |
-
|
889 |
-
object.name = name;
|
890 |
-
object.tag = tag;
|
891 |
-
|
892 |
-
if ( position ) {
|
893 |
-
|
894 |
-
object.position.set( position[ 0 ], position[ 1 ], position[ 2 ] );
|
895 |
-
|
896 |
-
}
|
897 |
-
|
898 |
-
if ( rotation ) {
|
899 |
-
|
900 |
-
object.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ] );
|
901 |
-
|
902 |
-
}
|
903 |
-
|
904 |
-
if ( scale ) {
|
905 |
-
|
906 |
-
object.scale.set( scale[ 0 ], scale[ 1 ], scale[ 2 ] );
|
907 |
-
|
908 |
-
}
|
909 |
-
|
910 |
-
object.updateMatrix();
|
911 |
-
const tempGeometry = object.geometry.clone();
|
912 |
-
tempGeometry.applyMatrix4( object.matrix );
|
913 |
-
object.geometry = tempGeometry;
|
914 |
-
object.renderOrder = Infinity;
|
915 |
-
object.position.set( 0, 0, 0 );
|
916 |
-
object.rotation.set( 0, 0, 0 );
|
917 |
-
object.scale.set( 1, 1, 1 );
|
918 |
-
gizmo.add( object );
|
919 |
-
|
920 |
-
}
|
921 |
-
|
922 |
-
}
|
923 |
-
|
924 |
-
return gizmo;
|
925 |
-
|
926 |
-
} // Gizmo creation
|
927 |
-
|
928 |
-
|
929 |
-
this.gizmo = {};
|
930 |
-
this.picker = {};
|
931 |
-
this.helper = {};
|
932 |
-
this.add( this.gizmo[ 'translate' ] = setupGizmo( gizmoTranslate ) );
|
933 |
-
this.add( this.gizmo[ 'rotate' ] = setupGizmo( gizmoRotate ) );
|
934 |
-
this.add( this.gizmo[ 'scale' ] = setupGizmo( gizmoScale ) );
|
935 |
-
this.add( this.picker[ 'translate' ] = setupGizmo( pickerTranslate ) );
|
936 |
-
this.add( this.picker[ 'rotate' ] = setupGizmo( pickerRotate ) );
|
937 |
-
this.add( this.picker[ 'scale' ] = setupGizmo( pickerScale ) );
|
938 |
-
this.add( this.helper[ 'translate' ] = setupGizmo( helperTranslate ) );
|
939 |
-
this.add( this.helper[ 'rotate' ] = setupGizmo( helperRotate ) );
|
940 |
-
this.add( this.helper[ 'scale' ] = setupGizmo( helperScale ) ); // Pickers should be hidden always
|
941 |
-
|
942 |
-
this.picker[ 'translate' ].visible = false;
|
943 |
-
this.picker[ 'rotate' ].visible = false;
|
944 |
-
this.picker[ 'scale' ].visible = false;
|
945 |
-
|
946 |
-
} // updateMatrixWorld will update transformations and appearance of individual handles
|
947 |
-
|
948 |
-
|
949 |
-
updateMatrixWorld( force ) {
|
950 |
-
|
951 |
-
const space = this.mode === 'scale' ? 'local' : this.space; // scale always oriented to local rotation
|
952 |
-
|
953 |
-
const quaternion = space === 'local' ? this.worldQuaternion : _identityQuaternion; // Show only gizmos for current transform mode
|
954 |
-
|
955 |
-
this.gizmo[ 'translate' ].visible = this.mode === 'translate';
|
956 |
-
this.gizmo[ 'rotate' ].visible = this.mode === 'rotate';
|
957 |
-
this.gizmo[ 'scale' ].visible = this.mode === 'scale';
|
958 |
-
this.helper[ 'translate' ].visible = this.mode === 'translate';
|
959 |
-
this.helper[ 'rotate' ].visible = this.mode === 'rotate';
|
960 |
-
this.helper[ 'scale' ].visible = this.mode === 'scale';
|
961 |
-
let handles = [];
|
962 |
-
handles = handles.concat( this.picker[ this.mode ].children );
|
963 |
-
handles = handles.concat( this.gizmo[ this.mode ].children );
|
964 |
-
handles = handles.concat( this.helper[ this.mode ].children );
|
965 |
-
|
966 |
-
for ( let i = 0; i < handles.length; i ++ ) {
|
967 |
-
|
968 |
-
const handle = handles[ i ]; // hide aligned to camera
|
969 |
-
|
970 |
-
handle.visible = true;
|
971 |
-
handle.rotation.set( 0, 0, 0 );
|
972 |
-
handle.position.copy( this.worldPosition );
|
973 |
-
let factor;
|
974 |
-
|
975 |
-
if ( this.camera.isOrthographicCamera ) {
|
976 |
-
|
977 |
-
factor = ( this.camera.top - this.camera.bottom ) / this.camera.zoom;
|
978 |
-
|
979 |
-
} else {
|
980 |
-
|
981 |
-
factor = this.worldPosition.distanceTo( this.cameraPosition ) * Math.min( 1.9 * Math.tan( Math.PI * this.camera.fov / 360 ) / this.camera.zoom, 7 );
|
982 |
-
|
983 |
-
}
|
984 |
-
|
985 |
-
handle.scale.set( 1, 1, 1 ).multiplyScalar( factor * this.size / 4 ); // TODO: simplify helpers and consider decoupling from gizmo
|
986 |
-
|
987 |
-
if ( handle.tag === 'helper' ) {
|
988 |
-
|
989 |
-
handle.visible = false;
|
990 |
-
|
991 |
-
if ( handle.name === 'AXIS' ) {
|
992 |
-
|
993 |
-
handle.position.copy( this.worldPositionStart );
|
994 |
-
handle.visible = !! this.axis;
|
995 |
-
|
996 |
-
if ( this.axis === 'X' ) {
|
997 |
-
|
998 |
-
_tempQuaternion.setFromEuler( _tempEuler.set( 0, 0, 0 ) );
|
999 |
-
|
1000 |
-
handle.quaternion.copy( quaternion ).multiply( _tempQuaternion );
|
1001 |
-
|
1002 |
-
if ( Math.abs( _alignVector.copy( _unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) {
|
1003 |
-
|
1004 |
-
handle.visible = false;
|
1005 |
-
|
1006 |
-
}
|
1007 |
-
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
if ( this.axis === 'Y' ) {
|
1011 |
-
|
1012 |
-
_tempQuaternion.setFromEuler( _tempEuler.set( 0, 0, Math.PI / 2 ) );
|
1013 |
-
|
1014 |
-
handle.quaternion.copy( quaternion ).multiply( _tempQuaternion );
|
1015 |
-
|
1016 |
-
if ( Math.abs( _alignVector.copy( _unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) {
|
1017 |
-
|
1018 |
-
handle.visible = false;
|
1019 |
-
|
1020 |
-
}
|
1021 |
-
|
1022 |
-
}
|
1023 |
-
|
1024 |
-
if ( this.axis === 'Z' ) {
|
1025 |
-
|
1026 |
-
_tempQuaternion.setFromEuler( _tempEuler.set( 0, Math.PI / 2, 0 ) );
|
1027 |
-
|
1028 |
-
handle.quaternion.copy( quaternion ).multiply( _tempQuaternion );
|
1029 |
-
|
1030 |
-
if ( Math.abs( _alignVector.copy( _unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) {
|
1031 |
-
|
1032 |
-
handle.visible = false;
|
1033 |
-
|
1034 |
-
}
|
1035 |
-
|
1036 |
-
}
|
1037 |
-
|
1038 |
-
if ( this.axis === 'XYZE' ) {
|
1039 |
-
|
1040 |
-
_tempQuaternion.setFromEuler( _tempEuler.set( 0, Math.PI / 2, 0 ) );
|
1041 |
-
|
1042 |
-
_alignVector.copy( this.rotationAxis );
|
1043 |
-
|
1044 |
-
handle.quaternion.setFromRotationMatrix( _lookAtMatrix.lookAt( _zeroVector, _alignVector, _unitY ) );
|
1045 |
-
handle.quaternion.multiply( _tempQuaternion );
|
1046 |
-
handle.visible = this.dragging;
|
1047 |
-
|
1048 |
-
}
|
1049 |
-
|
1050 |
-
if ( this.axis === 'E' ) {
|
1051 |
-
|
1052 |
-
handle.visible = false;
|
1053 |
-
|
1054 |
-
}
|
1055 |
-
|
1056 |
-
} else if ( handle.name === 'START' ) {
|
1057 |
-
|
1058 |
-
handle.position.copy( this.worldPositionStart );
|
1059 |
-
handle.visible = this.dragging;
|
1060 |
-
|
1061 |
-
} else if ( handle.name === 'END' ) {
|
1062 |
-
|
1063 |
-
handle.position.copy( this.worldPosition );
|
1064 |
-
handle.visible = this.dragging;
|
1065 |
-
|
1066 |
-
} else if ( handle.name === 'DELTA' ) {
|
1067 |
-
|
1068 |
-
handle.position.copy( this.worldPositionStart );
|
1069 |
-
handle.quaternion.copy( this.worldQuaternionStart );
|
1070 |
-
|
1071 |
-
_tempVector.set( 1e-10, 1e-10, 1e-10 ).add( this.worldPositionStart ).sub( this.worldPosition ).multiplyScalar( - 1 );
|
1072 |
-
|
1073 |
-
_tempVector.applyQuaternion( this.worldQuaternionStart.clone().invert() );
|
1074 |
-
|
1075 |
-
handle.scale.copy( _tempVector );
|
1076 |
-
handle.visible = this.dragging;
|
1077 |
-
|
1078 |
-
} else {
|
1079 |
-
|
1080 |
-
handle.quaternion.copy( quaternion );
|
1081 |
-
|
1082 |
-
if ( this.dragging ) {
|
1083 |
-
|
1084 |
-
handle.position.copy( this.worldPositionStart );
|
1085 |
-
|
1086 |
-
} else {
|
1087 |
-
|
1088 |
-
handle.position.copy( this.worldPosition );
|
1089 |
-
|
1090 |
-
}
|
1091 |
-
|
1092 |
-
if ( this.axis ) {
|
1093 |
-
|
1094 |
-
handle.visible = this.axis.search( handle.name ) !== - 1;
|
1095 |
-
|
1096 |
-
}
|
1097 |
-
|
1098 |
-
} // If updating helper, skip rest of the loop
|
1099 |
-
|
1100 |
-
|
1101 |
-
continue;
|
1102 |
-
|
1103 |
-
} // Align handles to current local or world rotation
|
1104 |
-
|
1105 |
-
|
1106 |
-
handle.quaternion.copy( quaternion );
|
1107 |
-
|
1108 |
-
if ( this.mode === 'translate' || this.mode === 'scale' ) {
|
1109 |
-
|
1110 |
-
// Hide translate and scale axis facing the camera
|
1111 |
-
const AXIS_HIDE_TRESHOLD = 0.99;
|
1112 |
-
const PLANE_HIDE_TRESHOLD = 0.2;
|
1113 |
-
|
1114 |
-
if ( handle.name === 'X' ) {
|
1115 |
-
|
1116 |
-
if ( Math.abs( _alignVector.copy( _unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
|
1117 |
-
|
1118 |
-
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
1119 |
-
handle.visible = false;
|
1120 |
-
|
1121 |
-
}
|
1122 |
-
|
1123 |
-
}
|
1124 |
-
|
1125 |
-
if ( handle.name === 'Y' ) {
|
1126 |
-
|
1127 |
-
if ( Math.abs( _alignVector.copy( _unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
|
1128 |
-
|
1129 |
-
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
1130 |
-
handle.visible = false;
|
1131 |
-
|
1132 |
-
}
|
1133 |
-
|
1134 |
-
}
|
1135 |
-
|
1136 |
-
if ( handle.name === 'Z' ) {
|
1137 |
-
|
1138 |
-
if ( Math.abs( _alignVector.copy( _unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
|
1139 |
-
|
1140 |
-
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
1141 |
-
handle.visible = false;
|
1142 |
-
|
1143 |
-
}
|
1144 |
-
|
1145 |
-
}
|
1146 |
-
|
1147 |
-
if ( handle.name === 'XY' ) {
|
1148 |
-
|
1149 |
-
if ( Math.abs( _alignVector.copy( _unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
|
1150 |
-
|
1151 |
-
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
1152 |
-
handle.visible = false;
|
1153 |
-
|
1154 |
-
}
|
1155 |
-
|
1156 |
-
}
|
1157 |
-
|
1158 |
-
if ( handle.name === 'YZ' ) {
|
1159 |
-
|
1160 |
-
if ( Math.abs( _alignVector.copy( _unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
|
1161 |
-
|
1162 |
-
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
1163 |
-
handle.visible = false;
|
1164 |
-
|
1165 |
-
}
|
1166 |
-
|
1167 |
-
}
|
1168 |
-
|
1169 |
-
if ( handle.name === 'XZ' ) {
|
1170 |
-
|
1171 |
-
if ( Math.abs( _alignVector.copy( _unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
|
1172 |
-
|
1173 |
-
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
1174 |
-
handle.visible = false;
|
1175 |
-
|
1176 |
-
}
|
1177 |
-
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
} else if ( this.mode === 'rotate' ) {
|
1181 |
-
|
1182 |
-
// Align handles to current local or world rotation
|
1183 |
-
_tempQuaternion2.copy( quaternion );
|
1184 |
-
|
1185 |
-
_alignVector.copy( this.eye ).applyQuaternion( _tempQuaternion.copy( quaternion ).invert() );
|
1186 |
-
|
1187 |
-
if ( handle.name.search( 'E' ) !== - 1 ) {
|
1188 |
-
|
1189 |
-
handle.quaternion.setFromRotationMatrix( _lookAtMatrix.lookAt( this.eye, _zeroVector, _unitY ) );
|
1190 |
-
|
1191 |
-
}
|
1192 |
-
|
1193 |
-
if ( handle.name === 'X' ) {
|
1194 |
-
|
1195 |
-
_tempQuaternion.setFromAxisAngle( _unitX, Math.atan2( - _alignVector.y, _alignVector.z ) );
|
1196 |
-
|
1197 |
-
_tempQuaternion.multiplyQuaternions( _tempQuaternion2, _tempQuaternion );
|
1198 |
-
|
1199 |
-
handle.quaternion.copy( _tempQuaternion );
|
1200 |
-
|
1201 |
-
}
|
1202 |
-
|
1203 |
-
if ( handle.name === 'Y' ) {
|
1204 |
-
|
1205 |
-
_tempQuaternion.setFromAxisAngle( _unitY, Math.atan2( _alignVector.x, _alignVector.z ) );
|
1206 |
-
|
1207 |
-
_tempQuaternion.multiplyQuaternions( _tempQuaternion2, _tempQuaternion );
|
1208 |
-
|
1209 |
-
handle.quaternion.copy( _tempQuaternion );
|
1210 |
-
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
if ( handle.name === 'Z' ) {
|
1214 |
-
|
1215 |
-
_tempQuaternion.setFromAxisAngle( _unitZ, Math.atan2( _alignVector.y, _alignVector.x ) );
|
1216 |
-
|
1217 |
-
_tempQuaternion.multiplyQuaternions( _tempQuaternion2, _tempQuaternion );
|
1218 |
-
|
1219 |
-
handle.quaternion.copy( _tempQuaternion );
|
1220 |
-
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
} // Hide disabled axes
|
1224 |
-
|
1225 |
-
|
1226 |
-
handle.visible = handle.visible && ( handle.name.indexOf( 'X' ) === - 1 || this.showX );
|
1227 |
-
handle.visible = handle.visible && ( handle.name.indexOf( 'Y' ) === - 1 || this.showY );
|
1228 |
-
handle.visible = handle.visible && ( handle.name.indexOf( 'Z' ) === - 1 || this.showZ );
|
1229 |
-
handle.visible = handle.visible && ( handle.name.indexOf( 'E' ) === - 1 || this.showX && this.showY && this.showZ ); // highlight selected axis
|
1230 |
-
|
1231 |
-
handle.material._color = handle.material._color || handle.material.color.clone();
|
1232 |
-
handle.material._opacity = handle.material._opacity || handle.material.opacity;
|
1233 |
-
handle.material.color.copy( handle.material._color );
|
1234 |
-
handle.material.opacity = handle.material._opacity;
|
1235 |
-
|
1236 |
-
if ( this.enabled && this.axis ) {
|
1237 |
-
|
1238 |
-
if ( handle.name === this.axis ) {
|
1239 |
-
|
1240 |
-
handle.material.color.setHex( 0xffff00 );
|
1241 |
-
handle.material.opacity = 1.0;
|
1242 |
-
|
1243 |
-
} else if ( this.axis.split( '' ).some( function ( a ) {
|
1244 |
-
|
1245 |
-
return handle.name === a;
|
1246 |
-
|
1247 |
-
} ) ) {
|
1248 |
-
|
1249 |
-
handle.material.color.setHex( 0xffff00 );
|
1250 |
-
handle.material.opacity = 1.0;
|
1251 |
-
|
1252 |
-
}
|
1253 |
-
|
1254 |
-
}
|
1255 |
-
|
1256 |
-
}
|
1257 |
-
|
1258 |
-
super.updateMatrixWorld( force );
|
1259 |
-
|
1260 |
-
}
|
1261 |
-
|
1262 |
-
}
|
1263 |
-
|
1264 |
-
TransformControlsGizmo.prototype.isTransformControlsGizmo = true; //
|
1265 |
-
|
1266 |
-
class TransformControlsPlane extends THREE.Mesh {
|
1267 |
-
|
1268 |
-
constructor() {
|
1269 |
-
|
1270 |
-
super( new THREE.PlaneGeometry( 100000, 100000, 2, 2 ), new THREE.MeshBasicMaterial( {
|
1271 |
-
visible: false,
|
1272 |
-
wireframe: true,
|
1273 |
-
side: THREE.DoubleSide,
|
1274 |
-
transparent: true,
|
1275 |
-
opacity: 0.1,
|
1276 |
-
toneMapped: false
|
1277 |
-
} ) );
|
1278 |
-
this.type = 'TransformControlsPlane';
|
1279 |
-
|
1280 |
-
}
|
1281 |
-
|
1282 |
-
updateMatrixWorld( force ) {
|
1283 |
-
|
1284 |
-
let space = this.space;
|
1285 |
-
this.position.copy( this.worldPosition );
|
1286 |
-
if ( this.mode === 'scale' ) space = 'local'; // scale always oriented to local rotation
|
1287 |
-
|
1288 |
-
_v1.copy( _unitX ).applyQuaternion( space === 'local' ? this.worldQuaternion : _identityQuaternion );
|
1289 |
-
|
1290 |
-
_v2.copy( _unitY ).applyQuaternion( space === 'local' ? this.worldQuaternion : _identityQuaternion );
|
1291 |
-
|
1292 |
-
_v3.copy( _unitZ ).applyQuaternion( space === 'local' ? this.worldQuaternion : _identityQuaternion ); // Align the plane for current transform mode, axis and space.
|
1293 |
-
|
1294 |
-
|
1295 |
-
_alignVector.copy( _v2 );
|
1296 |
-
|
1297 |
-
switch ( this.mode ) {
|
1298 |
-
|
1299 |
-
case 'translate':
|
1300 |
-
case 'scale':
|
1301 |
-
switch ( this.axis ) {
|
1302 |
-
|
1303 |
-
case 'X':
|
1304 |
-
_alignVector.copy( this.eye ).cross( _v1 );
|
1305 |
-
|
1306 |
-
_dirVector.copy( _v1 ).cross( _alignVector );
|
1307 |
-
|
1308 |
-
break;
|
1309 |
-
|
1310 |
-
case 'Y':
|
1311 |
-
_alignVector.copy( this.eye ).cross( _v2 );
|
1312 |
-
|
1313 |
-
_dirVector.copy( _v2 ).cross( _alignVector );
|
1314 |
-
|
1315 |
-
break;
|
1316 |
-
|
1317 |
-
case 'Z':
|
1318 |
-
_alignVector.copy( this.eye ).cross( _v3 );
|
1319 |
-
|
1320 |
-
_dirVector.copy( _v3 ).cross( _alignVector );
|
1321 |
-
|
1322 |
-
break;
|
1323 |
-
|
1324 |
-
case 'XY':
|
1325 |
-
_dirVector.copy( _v3 );
|
1326 |
-
|
1327 |
-
break;
|
1328 |
-
|
1329 |
-
case 'YZ':
|
1330 |
-
_dirVector.copy( _v1 );
|
1331 |
-
|
1332 |
-
break;
|
1333 |
-
|
1334 |
-
case 'XZ':
|
1335 |
-
_alignVector.copy( _v3 );
|
1336 |
-
|
1337 |
-
_dirVector.copy( _v2 );
|
1338 |
-
|
1339 |
-
break;
|
1340 |
-
|
1341 |
-
case 'XYZ':
|
1342 |
-
case 'E':
|
1343 |
-
_dirVector.set( 0, 0, 0 );
|
1344 |
-
|
1345 |
-
break;
|
1346 |
-
|
1347 |
-
}
|
1348 |
-
|
1349 |
-
break;
|
1350 |
-
|
1351 |
-
case 'rotate':
|
1352 |
-
default:
|
1353 |
-
// special case for rotate
|
1354 |
-
_dirVector.set( 0, 0, 0 );
|
1355 |
-
|
1356 |
-
}
|
1357 |
-
|
1358 |
-
if ( _dirVector.length() === 0 ) {
|
1359 |
-
|
1360 |
-
// If in rotate mode, make the plane parallel to camera
|
1361 |
-
this.quaternion.copy( this.cameraQuaternion );
|
1362 |
-
|
1363 |
-
} else {
|
1364 |
-
|
1365 |
-
_tempMatrix.lookAt( _tempVector.set( 0, 0, 0 ), _dirVector, _alignVector );
|
1366 |
-
|
1367 |
-
this.quaternion.setFromRotationMatrix( _tempMatrix );
|
1368 |
-
|
1369 |
-
}
|
1370 |
-
|
1371 |
-
super.updateMatrixWorld( force );
|
1372 |
-
|
1373 |
-
}
|
1374 |
-
|
1375 |
-
}
|
1376 |
-
|
1377 |
-
TransformControlsPlane.prototype.isTransformControlsPlane = true;
|
1378 |
-
|
1379 |
-
THREE.TransformControls = TransformControls;
|
1380 |
-
THREE.TransformControlsGizmo = TransformControlsGizmo;
|
1381 |
-
THREE.TransformControlsPlane = TransformControlsPlane;
|
1382 |
-
|
1383 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/postprocessing/EffectComposer.js
DELETED
@@ -1,284 +0,0 @@
|
|
1 |
-
( function () {
|
2 |
-
|
3 |
-
class EffectComposer {
|
4 |
-
|
5 |
-
constructor( renderer, renderTarget ) {
|
6 |
-
|
7 |
-
this.renderer = renderer;
|
8 |
-
|
9 |
-
if ( renderTarget === undefined ) {
|
10 |
-
|
11 |
-
const parameters = {
|
12 |
-
minFilter: THREE.LinearFilter,
|
13 |
-
magFilter: THREE.LinearFilter,
|
14 |
-
format: THREE.RGBAFormat
|
15 |
-
};
|
16 |
-
const size = renderer.getSize( new THREE.Vector2() );
|
17 |
-
this._pixelRatio = renderer.getPixelRatio();
|
18 |
-
this._width = size.width;
|
19 |
-
this._height = size.height;
|
20 |
-
renderTarget = new THREE.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, parameters );
|
21 |
-
renderTarget.texture.name = 'EffectComposer.rt1';
|
22 |
-
|
23 |
-
} else {
|
24 |
-
|
25 |
-
this._pixelRatio = 1;
|
26 |
-
this._width = renderTarget.width;
|
27 |
-
this._height = renderTarget.height;
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
this.renderTarget1 = renderTarget;
|
32 |
-
this.renderTarget2 = renderTarget.clone();
|
33 |
-
this.renderTarget2.texture.name = 'EffectComposer.rt2';
|
34 |
-
this.writeBuffer = this.renderTarget1;
|
35 |
-
this.readBuffer = this.renderTarget2;
|
36 |
-
this.renderToScreen = true;
|
37 |
-
this.passes = []; // dependencies
|
38 |
-
|
39 |
-
if ( THREE.CopyShader === undefined ) {
|
40 |
-
|
41 |
-
console.error( 'THREE.EffectComposer relies on THREE.CopyShader' );
|
42 |
-
|
43 |
-
}
|
44 |
-
|
45 |
-
if ( THREE.ShaderPass === undefined ) {
|
46 |
-
|
47 |
-
console.error( 'THREE.EffectComposer relies on THREE.ShaderPass' );
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
this.copyPass = new THREE.ShaderPass( THREE.CopyShader );
|
52 |
-
this.clock = new THREE.Clock();
|
53 |
-
|
54 |
-
}
|
55 |
-
|
56 |
-
swapBuffers() {
|
57 |
-
|
58 |
-
const tmp = this.readBuffer;
|
59 |
-
this.readBuffer = this.writeBuffer;
|
60 |
-
this.writeBuffer = tmp;
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
addPass( pass ) {
|
65 |
-
|
66 |
-
this.passes.push( pass );
|
67 |
-
pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
|
68 |
-
|
69 |
-
}
|
70 |
-
|
71 |
-
insertPass( pass, index ) {
|
72 |
-
|
73 |
-
this.passes.splice( index, 0, pass );
|
74 |
-
pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
|
75 |
-
|
76 |
-
}
|
77 |
-
|
78 |
-
removePass( pass ) {
|
79 |
-
|
80 |
-
const index = this.passes.indexOf( pass );
|
81 |
-
|
82 |
-
if ( index !== - 1 ) {
|
83 |
-
|
84 |
-
this.passes.splice( index, 1 );
|
85 |
-
|
86 |
-
}
|
87 |
-
|
88 |
-
}
|
89 |
-
|
90 |
-
isLastEnabledPass( passIndex ) {
|
91 |
-
|
92 |
-
for ( let i = passIndex + 1; i < this.passes.length; i ++ ) {
|
93 |
-
|
94 |
-
if ( this.passes[ i ].enabled ) {
|
95 |
-
|
96 |
-
return false;
|
97 |
-
|
98 |
-
}
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
return true;
|
103 |
-
|
104 |
-
}
|
105 |
-
|
106 |
-
render( deltaTime ) {
|
107 |
-
|
108 |
-
// deltaTime value is in seconds
|
109 |
-
if ( deltaTime === undefined ) {
|
110 |
-
|
111 |
-
deltaTime = this.clock.getDelta();
|
112 |
-
|
113 |
-
}
|
114 |
-
|
115 |
-
const currentRenderTarget = this.renderer.getRenderTarget();
|
116 |
-
let maskActive = false;
|
117 |
-
|
118 |
-
for ( let i = 0, il = this.passes.length; i < il; i ++ ) {
|
119 |
-
|
120 |
-
const pass = this.passes[ i ];
|
121 |
-
if ( pass.enabled === false ) continue;
|
122 |
-
pass.renderToScreen = this.renderToScreen && this.isLastEnabledPass( i );
|
123 |
-
pass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive );
|
124 |
-
|
125 |
-
if ( pass.needsSwap ) {
|
126 |
-
|
127 |
-
if ( maskActive ) {
|
128 |
-
|
129 |
-
const context = this.renderer.getContext();
|
130 |
-
const stencil = this.renderer.state.buffers.stencil; //context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff );
|
131 |
-
|
132 |
-
stencil.setFunc( context.NOTEQUAL, 1, 0xffffffff );
|
133 |
-
this.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime ); //context.stencilFunc( context.EQUAL, 1, 0xffffffff );
|
134 |
-
|
135 |
-
stencil.setFunc( context.EQUAL, 1, 0xffffffff );
|
136 |
-
|
137 |
-
}
|
138 |
-
|
139 |
-
this.swapBuffers();
|
140 |
-
|
141 |
-
}
|
142 |
-
|
143 |
-
if ( THREE.MaskPass !== undefined ) {
|
144 |
-
|
145 |
-
if ( pass instanceof THREE.MaskPass ) {
|
146 |
-
|
147 |
-
maskActive = true;
|
148 |
-
|
149 |
-
} else if ( pass instanceof THREE.ClearMaskPass ) {
|
150 |
-
|
151 |
-
maskActive = false;
|
152 |
-
|
153 |
-
}
|
154 |
-
|
155 |
-
}
|
156 |
-
|
157 |
-
}
|
158 |
-
|
159 |
-
this.renderer.setRenderTarget( currentRenderTarget );
|
160 |
-
|
161 |
-
}
|
162 |
-
|
163 |
-
reset( renderTarget ) {
|
164 |
-
|
165 |
-
if ( renderTarget === undefined ) {
|
166 |
-
|
167 |
-
const size = this.renderer.getSize( new THREE.Vector2() );
|
168 |
-
this._pixelRatio = this.renderer.getPixelRatio();
|
169 |
-
this._width = size.width;
|
170 |
-
this._height = size.height;
|
171 |
-
renderTarget = this.renderTarget1.clone();
|
172 |
-
renderTarget.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
|
173 |
-
|
174 |
-
}
|
175 |
-
|
176 |
-
this.renderTarget1.dispose();
|
177 |
-
this.renderTarget2.dispose();
|
178 |
-
this.renderTarget1 = renderTarget;
|
179 |
-
this.renderTarget2 = renderTarget.clone();
|
180 |
-
this.writeBuffer = this.renderTarget1;
|
181 |
-
this.readBuffer = this.renderTarget2;
|
182 |
-
|
183 |
-
}
|
184 |
-
|
185 |
-
setSize( width, height ) {
|
186 |
-
|
187 |
-
this._width = width;
|
188 |
-
this._height = height;
|
189 |
-
const effectiveWidth = this._width * this._pixelRatio;
|
190 |
-
const effectiveHeight = this._height * this._pixelRatio;
|
191 |
-
this.renderTarget1.setSize( effectiveWidth, effectiveHeight );
|
192 |
-
this.renderTarget2.setSize( effectiveWidth, effectiveHeight );
|
193 |
-
|
194 |
-
for ( let i = 0; i < this.passes.length; i ++ ) {
|
195 |
-
|
196 |
-
this.passes[ i ].setSize( effectiveWidth, effectiveHeight );
|
197 |
-
|
198 |
-
}
|
199 |
-
|
200 |
-
}
|
201 |
-
|
202 |
-
setPixelRatio( pixelRatio ) {
|
203 |
-
|
204 |
-
this._pixelRatio = pixelRatio;
|
205 |
-
this.setSize( this._width, this._height );
|
206 |
-
|
207 |
-
}
|
208 |
-
|
209 |
-
}
|
210 |
-
|
211 |
-
class Pass {
|
212 |
-
|
213 |
-
constructor() {
|
214 |
-
|
215 |
-
// if set to true, the pass is processed by the composer
|
216 |
-
this.enabled = true; // if set to true, the pass indicates to swap read and write buffer after rendering
|
217 |
-
|
218 |
-
this.needsSwap = true; // if set to true, the pass clears its buffer before rendering
|
219 |
-
|
220 |
-
this.clear = false; // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.
|
221 |
-
|
222 |
-
this.renderToScreen = false;
|
223 |
-
|
224 |
-
}
|
225 |
-
|
226 |
-
setSize() {}
|
227 |
-
|
228 |
-
render() {
|
229 |
-
|
230 |
-
console.error( 'THREE.Pass: .render() must be implemented in derived pass.' );
|
231 |
-
|
232 |
-
}
|
233 |
-
|
234 |
-
} // Helper for passes that need to fill the viewport with a single quad.
|
235 |
-
|
236 |
-
|
237 |
-
const _camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); // https://github.com/mrdoob/three.js/pull/21358
|
238 |
-
|
239 |
-
|
240 |
-
const _geometry = new THREE.BufferGeometry();
|
241 |
-
|
242 |
-
_geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );
|
243 |
-
|
244 |
-
_geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );
|
245 |
-
|
246 |
-
class FullScreenQuad {
|
247 |
-
|
248 |
-
constructor( material ) {
|
249 |
-
|
250 |
-
this._mesh = new THREE.Mesh( _geometry, material );
|
251 |
-
|
252 |
-
}
|
253 |
-
|
254 |
-
dispose() {
|
255 |
-
|
256 |
-
this._mesh.geometry.dispose();
|
257 |
-
|
258 |
-
}
|
259 |
-
|
260 |
-
render( renderer ) {
|
261 |
-
|
262 |
-
renderer.render( this._mesh, _camera );
|
263 |
-
|
264 |
-
}
|
265 |
-
|
266 |
-
get material() {
|
267 |
-
|
268 |
-
return this._mesh.material;
|
269 |
-
|
270 |
-
}
|
271 |
-
|
272 |
-
set material( value ) {
|
273 |
-
|
274 |
-
this._mesh.material = value;
|
275 |
-
|
276 |
-
}
|
277 |
-
|
278 |
-
}
|
279 |
-
|
280 |
-
THREE.EffectComposer = EffectComposer;
|
281 |
-
THREE.FullScreenQuad = FullScreenQuad;
|
282 |
-
THREE.Pass = Pass;
|
283 |
-
|
284 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/postprocessing/OutlinePass.js
DELETED
@@ -1,596 +0,0 @@
|
|
1 |
-
( function () {
|
2 |
-
|
3 |
-
class OutlinePass extends THREE.Pass {
|
4 |
-
|
5 |
-
constructor( resolution, scene, camera, selectedObjects ) {
|
6 |
-
|
7 |
-
super();
|
8 |
-
this.renderScene = scene;
|
9 |
-
this.renderCamera = camera;
|
10 |
-
this.selectedObjects = selectedObjects !== undefined ? selectedObjects : [];
|
11 |
-
this.visibleEdgeColor = new THREE.Color( 1, 1, 1 );
|
12 |
-
this.hiddenEdgeColor = new THREE.Color( 0.1, 0.04, 0.02 );
|
13 |
-
this.edgeGlow = 0.0;
|
14 |
-
this.usePatternTexture = false;
|
15 |
-
this.edgeThickness = 1.0;
|
16 |
-
this.edgeStrength = 3.0;
|
17 |
-
this.downSampleRatio = 2;
|
18 |
-
this.pulsePeriod = 0;
|
19 |
-
this._visibilityCache = new Map();
|
20 |
-
this.resolution = resolution !== undefined ? new THREE.Vector2( resolution.x, resolution.y ) : new THREE.Vector2( 256, 256 );
|
21 |
-
const pars = {
|
22 |
-
minFilter: THREE.LinearFilter,
|
23 |
-
magFilter: THREE.LinearFilter,
|
24 |
-
format: THREE.RGBAFormat
|
25 |
-
};
|
26 |
-
const resx = Math.round( this.resolution.x / this.downSampleRatio );
|
27 |
-
const resy = Math.round( this.resolution.y / this.downSampleRatio );
|
28 |
-
this.maskBufferMaterial = new THREE.MeshBasicMaterial( {
|
29 |
-
color: 0xffffff
|
30 |
-
} );
|
31 |
-
this.maskBufferMaterial.side = THREE.DoubleSide;
|
32 |
-
this.renderTargetMaskBuffer = new THREE.WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
|
33 |
-
this.renderTargetMaskBuffer.texture.name = 'OutlinePass.mask';
|
34 |
-
this.renderTargetMaskBuffer.texture.generateMipmaps = false;
|
35 |
-
this.depthMaterial = new THREE.MeshDepthMaterial();
|
36 |
-
this.depthMaterial.side = THREE.DoubleSide;
|
37 |
-
this.depthMaterial.depthPacking = THREE.RGBADepthPacking;
|
38 |
-
this.depthMaterial.blending = THREE.NoBlending;
|
39 |
-
this.prepareMaskMaterial = this.getPrepareMaskMaterial();
|
40 |
-
this.prepareMaskMaterial.side = THREE.DoubleSide;
|
41 |
-
this.prepareMaskMaterial.fragmentShader = replaceDepthToViewZ( this.prepareMaskMaterial.fragmentShader, this.renderCamera );
|
42 |
-
this.renderTargetDepthBuffer = new THREE.WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
|
43 |
-
this.renderTargetDepthBuffer.texture.name = 'OutlinePass.depth';
|
44 |
-
this.renderTargetDepthBuffer.texture.generateMipmaps = false;
|
45 |
-
this.renderTargetMaskDownSampleBuffer = new THREE.WebGLRenderTarget( resx, resy, pars );
|
46 |
-
this.renderTargetMaskDownSampleBuffer.texture.name = 'OutlinePass.depthDownSample';
|
47 |
-
this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = false;
|
48 |
-
this.renderTargetBlurBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars );
|
49 |
-
this.renderTargetBlurBuffer1.texture.name = 'OutlinePass.blur1';
|
50 |
-
this.renderTargetBlurBuffer1.texture.generateMipmaps = false;
|
51 |
-
this.renderTargetBlurBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), pars );
|
52 |
-
this.renderTargetBlurBuffer2.texture.name = 'OutlinePass.blur2';
|
53 |
-
this.renderTargetBlurBuffer2.texture.generateMipmaps = false;
|
54 |
-
this.edgeDetectionMaterial = this.getEdgeDetectionMaterial();
|
55 |
-
this.renderTargetEdgeBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars );
|
56 |
-
this.renderTargetEdgeBuffer1.texture.name = 'OutlinePass.edge1';
|
57 |
-
this.renderTargetEdgeBuffer1.texture.generateMipmaps = false;
|
58 |
-
this.renderTargetEdgeBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), pars );
|
59 |
-
this.renderTargetEdgeBuffer2.texture.name = 'OutlinePass.edge2';
|
60 |
-
this.renderTargetEdgeBuffer2.texture.generateMipmaps = false;
|
61 |
-
const MAX_EDGE_THICKNESS = 4;
|
62 |
-
const MAX_EDGE_GLOW = 4;
|
63 |
-
this.separableBlurMaterial1 = this.getSeperableBlurMaterial( MAX_EDGE_THICKNESS );
|
64 |
-
this.separableBlurMaterial1.uniforms[ 'texSize' ].value.set( resx, resy );
|
65 |
-
this.separableBlurMaterial1.uniforms[ 'kernelRadius' ].value = 1;
|
66 |
-
this.separableBlurMaterial2 = this.getSeperableBlurMaterial( MAX_EDGE_GLOW );
|
67 |
-
this.separableBlurMaterial2.uniforms[ 'texSize' ].value.set( Math.round( resx / 2 ), Math.round( resy / 2 ) );
|
68 |
-
this.separableBlurMaterial2.uniforms[ 'kernelRadius' ].value = MAX_EDGE_GLOW; // Overlay material
|
69 |
-
|
70 |
-
this.overlayMaterial = this.getOverlayMaterial(); // copy material
|
71 |
-
|
72 |
-
if ( THREE.CopyShader === undefined ) console.error( 'THREE.OutlinePass relies on THREE.CopyShader' );
|
73 |
-
const copyShader = THREE.CopyShader;
|
74 |
-
this.copyUniforms = THREE.UniformsUtils.clone( copyShader.uniforms );
|
75 |
-
this.copyUniforms[ 'opacity' ].value = 1.0;
|
76 |
-
this.materialCopy = new THREE.ShaderMaterial( {
|
77 |
-
uniforms: this.copyUniforms,
|
78 |
-
vertexShader: copyShader.vertexShader,
|
79 |
-
fragmentShader: copyShader.fragmentShader,
|
80 |
-
blending: THREE.NoBlending,
|
81 |
-
depthTest: false,
|
82 |
-
depthWrite: false,
|
83 |
-
transparent: true
|
84 |
-
} );
|
85 |
-
this.enabled = true;
|
86 |
-
this.needsSwap = false;
|
87 |
-
this._oldClearColor = new THREE.Color();
|
88 |
-
this.oldClearAlpha = 1;
|
89 |
-
this.fsQuad = new THREE.FullScreenQuad( null );
|
90 |
-
this.tempPulseColor1 = new THREE.Color();
|
91 |
-
this.tempPulseColor2 = new THREE.Color();
|
92 |
-
this.textureMatrix = new THREE.Matrix4();
|
93 |
-
|
94 |
-
function replaceDepthToViewZ( string, camera ) {
|
95 |
-
|
96 |
-
var type = camera.isPerspectiveCamera ? 'perspective' : 'orthographic';
|
97 |
-
return string.replace( /DEPTH_TO_VIEW_Z/g, type + 'DepthToViewZ' );
|
98 |
-
|
99 |
-
}
|
100 |
-
|
101 |
-
}
|
102 |
-
|
103 |
-
dispose() {
|
104 |
-
|
105 |
-
this.renderTargetMaskBuffer.dispose();
|
106 |
-
this.renderTargetDepthBuffer.dispose();
|
107 |
-
this.renderTargetMaskDownSampleBuffer.dispose();
|
108 |
-
this.renderTargetBlurBuffer1.dispose();
|
109 |
-
this.renderTargetBlurBuffer2.dispose();
|
110 |
-
this.renderTargetEdgeBuffer1.dispose();
|
111 |
-
this.renderTargetEdgeBuffer2.dispose();
|
112 |
-
|
113 |
-
}
|
114 |
-
|
115 |
-
setSize( width, height ) {
|
116 |
-
|
117 |
-
this.renderTargetMaskBuffer.setSize( width, height );
|
118 |
-
this.renderTargetDepthBuffer.setSize( width, height );
|
119 |
-
let resx = Math.round( width / this.downSampleRatio );
|
120 |
-
let resy = Math.round( height / this.downSampleRatio );
|
121 |
-
this.renderTargetMaskDownSampleBuffer.setSize( resx, resy );
|
122 |
-
this.renderTargetBlurBuffer1.setSize( resx, resy );
|
123 |
-
this.renderTargetEdgeBuffer1.setSize( resx, resy );
|
124 |
-
this.separableBlurMaterial1.uniforms[ 'texSize' ].value.set( resx, resy );
|
125 |
-
resx = Math.round( resx / 2 );
|
126 |
-
resy = Math.round( resy / 2 );
|
127 |
-
this.renderTargetBlurBuffer2.setSize( resx, resy );
|
128 |
-
this.renderTargetEdgeBuffer2.setSize( resx, resy );
|
129 |
-
this.separableBlurMaterial2.uniforms[ 'texSize' ].value.set( resx, resy );
|
130 |
-
|
131 |
-
}
|
132 |
-
|
133 |
-
changeVisibilityOfSelectedObjects( bVisible ) {
|
134 |
-
|
135 |
-
const cache = this._visibilityCache;
|
136 |
-
|
137 |
-
function gatherSelectedMeshesCallBack( object ) {
|
138 |
-
|
139 |
-
if ( object.isMesh ) {
|
140 |
-
|
141 |
-
if ( bVisible === true ) {
|
142 |
-
|
143 |
-
object.visible = cache.get( object );
|
144 |
-
|
145 |
-
} else {
|
146 |
-
|
147 |
-
cache.set( object, object.visible );
|
148 |
-
object.visible = bVisible;
|
149 |
-
|
150 |
-
}
|
151 |
-
|
152 |
-
}
|
153 |
-
|
154 |
-
}
|
155 |
-
|
156 |
-
for ( let i = 0; i < this.selectedObjects.length; i ++ ) {
|
157 |
-
|
158 |
-
const selectedObject = this.selectedObjects[ i ];
|
159 |
-
selectedObject.traverse( gatherSelectedMeshesCallBack );
|
160 |
-
|
161 |
-
}
|
162 |
-
|
163 |
-
}
|
164 |
-
|
165 |
-
changeVisibilityOfNonSelectedObjects( bVisible ) {
|
166 |
-
|
167 |
-
const cache = this._visibilityCache;
|
168 |
-
const selectedMeshes = [];
|
169 |
-
|
170 |
-
function gatherSelectedMeshesCallBack( object ) {
|
171 |
-
|
172 |
-
if ( object.isMesh ) selectedMeshes.push( object );
|
173 |
-
|
174 |
-
}
|
175 |
-
|
176 |
-
for ( let i = 0; i < this.selectedObjects.length; i ++ ) {
|
177 |
-
|
178 |
-
const selectedObject = this.selectedObjects[ i ];
|
179 |
-
selectedObject.traverse( gatherSelectedMeshesCallBack );
|
180 |
-
|
181 |
-
}
|
182 |
-
|
183 |
-
function VisibilityChangeCallBack( object ) {
|
184 |
-
|
185 |
-
if ( object.isMesh || object.isSprite ) {
|
186 |
-
|
187 |
-
// only meshes and sprites are supported by OutlinePass
|
188 |
-
let bFound = false;
|
189 |
-
|
190 |
-
for ( let i = 0; i < selectedMeshes.length; i ++ ) {
|
191 |
-
|
192 |
-
const selectedObjectId = selectedMeshes[ i ].id;
|
193 |
-
|
194 |
-
if ( selectedObjectId === object.id ) {
|
195 |
-
|
196 |
-
bFound = true;
|
197 |
-
break;
|
198 |
-
|
199 |
-
}
|
200 |
-
|
201 |
-
}
|
202 |
-
|
203 |
-
if ( bFound === false ) {
|
204 |
-
|
205 |
-
const visibility = object.visible;
|
206 |
-
|
207 |
-
if ( bVisible === false || cache.get( object ) === true ) {
|
208 |
-
|
209 |
-
object.visible = bVisible;
|
210 |
-
|
211 |
-
}
|
212 |
-
|
213 |
-
cache.set( object, visibility );
|
214 |
-
|
215 |
-
}
|
216 |
-
|
217 |
-
} else if ( object.isPoints || object.isLine ) {
|
218 |
-
|
219 |
-
// the visibilty of points and lines is always set to false in order to
|
220 |
-
// not affect the outline computation
|
221 |
-
if ( bVisible === true ) {
|
222 |
-
|
223 |
-
object.visible = cache.get( object ); // restore
|
224 |
-
|
225 |
-
} else {
|
226 |
-
|
227 |
-
cache.set( object, object.visible );
|
228 |
-
object.visible = bVisible;
|
229 |
-
|
230 |
-
}
|
231 |
-
|
232 |
-
}
|
233 |
-
|
234 |
-
}
|
235 |
-
|
236 |
-
this.renderScene.traverse( VisibilityChangeCallBack );
|
237 |
-
|
238 |
-
}
|
239 |
-
|
240 |
-
updateTextureMatrix() {
|
241 |
-
|
242 |
-
this.textureMatrix.set( 0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0 );
|
243 |
-
this.textureMatrix.multiply( this.renderCamera.projectionMatrix );
|
244 |
-
this.textureMatrix.multiply( this.renderCamera.matrixWorldInverse );
|
245 |
-
|
246 |
-
}
|
247 |
-
|
248 |
-
render( renderer, writeBuffer, readBuffer, deltaTime, maskActive ) {
|
249 |
-
|
250 |
-
if ( this.selectedObjects.length > 0 ) {
|
251 |
-
|
252 |
-
renderer.getClearColor( this._oldClearColor );
|
253 |
-
this.oldClearAlpha = renderer.getClearAlpha();
|
254 |
-
const oldAutoClear = renderer.autoClear;
|
255 |
-
renderer.autoClear = false;
|
256 |
-
if ( maskActive ) renderer.state.buffers.stencil.setTest( false );
|
257 |
-
renderer.setClearColor( 0xffffff, 1 ); // Make selected objects invisible
|
258 |
-
|
259 |
-
this.changeVisibilityOfSelectedObjects( false );
|
260 |
-
const currentBackground = this.renderScene.background;
|
261 |
-
this.renderScene.background = null; // 1. Draw Non Selected objects in the depth buffer
|
262 |
-
|
263 |
-
this.renderScene.overrideMaterial = this.depthMaterial;
|
264 |
-
renderer.setRenderTarget( this.renderTargetDepthBuffer );
|
265 |
-
renderer.clear();
|
266 |
-
renderer.render( this.renderScene, this.renderCamera ); // Make selected objects visible
|
267 |
-
|
268 |
-
this.changeVisibilityOfSelectedObjects( true );
|
269 |
-
|
270 |
-
this._visibilityCache.clear(); // Update Texture Matrix for Depth compare
|
271 |
-
|
272 |
-
|
273 |
-
this.updateTextureMatrix(); // Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects
|
274 |
-
|
275 |
-
this.changeVisibilityOfNonSelectedObjects( false );
|
276 |
-
this.renderScene.overrideMaterial = this.prepareMaskMaterial;
|
277 |
-
this.prepareMaskMaterial.uniforms[ 'cameraNearFar' ].value.set( this.renderCamera.near, this.renderCamera.far );
|
278 |
-
this.prepareMaskMaterial.uniforms[ 'depthTexture' ].value = this.renderTargetDepthBuffer.texture;
|
279 |
-
this.prepareMaskMaterial.uniforms[ 'textureMatrix' ].value = this.textureMatrix;
|
280 |
-
renderer.setRenderTarget( this.renderTargetMaskBuffer );
|
281 |
-
renderer.clear();
|
282 |
-
renderer.render( this.renderScene, this.renderCamera );
|
283 |
-
this.renderScene.overrideMaterial = null;
|
284 |
-
this.changeVisibilityOfNonSelectedObjects( true );
|
285 |
-
|
286 |
-
this._visibilityCache.clear();
|
287 |
-
|
288 |
-
this.renderScene.background = currentBackground; // 2. Downsample to Half resolution
|
289 |
-
|
290 |
-
this.fsQuad.material = this.materialCopy;
|
291 |
-
this.copyUniforms[ 'tDiffuse' ].value = this.renderTargetMaskBuffer.texture;
|
292 |
-
renderer.setRenderTarget( this.renderTargetMaskDownSampleBuffer );
|
293 |
-
renderer.clear();
|
294 |
-
this.fsQuad.render( renderer );
|
295 |
-
this.tempPulseColor1.copy( this.visibleEdgeColor );
|
296 |
-
this.tempPulseColor2.copy( this.hiddenEdgeColor );
|
297 |
-
|
298 |
-
if ( this.pulsePeriod > 0 ) {
|
299 |
-
|
300 |
-
const scalar = ( 1 + 0.25 ) / 2 + Math.cos( performance.now() * 0.01 / this.pulsePeriod ) * ( 1.0 - 0.25 ) / 2;
|
301 |
-
this.tempPulseColor1.multiplyScalar( scalar );
|
302 |
-
this.tempPulseColor2.multiplyScalar( scalar );
|
303 |
-
|
304 |
-
} // 3. Apply Edge Detection THREE.Pass
|
305 |
-
|
306 |
-
|
307 |
-
this.fsQuad.material = this.edgeDetectionMaterial;
|
308 |
-
this.edgeDetectionMaterial.uniforms[ 'maskTexture' ].value = this.renderTargetMaskDownSampleBuffer.texture;
|
309 |
-
this.edgeDetectionMaterial.uniforms[ 'texSize' ].value.set( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height );
|
310 |
-
this.edgeDetectionMaterial.uniforms[ 'visibleEdgeColor' ].value = this.tempPulseColor1;
|
311 |
-
this.edgeDetectionMaterial.uniforms[ 'hiddenEdgeColor' ].value = this.tempPulseColor2;
|
312 |
-
renderer.setRenderTarget( this.renderTargetEdgeBuffer1 );
|
313 |
-
renderer.clear();
|
314 |
-
this.fsQuad.render( renderer ); // 4. Apply Blur on Half res
|
315 |
-
|
316 |
-
this.fsQuad.material = this.separableBlurMaterial1;
|
317 |
-
this.separableBlurMaterial1.uniforms[ 'colorTexture' ].value = this.renderTargetEdgeBuffer1.texture;
|
318 |
-
this.separableBlurMaterial1.uniforms[ 'direction' ].value = OutlinePass.BlurDirectionX;
|
319 |
-
this.separableBlurMaterial1.uniforms[ 'kernelRadius' ].value = this.edgeThickness;
|
320 |
-
renderer.setRenderTarget( this.renderTargetBlurBuffer1 );
|
321 |
-
renderer.clear();
|
322 |
-
this.fsQuad.render( renderer );
|
323 |
-
this.separableBlurMaterial1.uniforms[ 'colorTexture' ].value = this.renderTargetBlurBuffer1.texture;
|
324 |
-
this.separableBlurMaterial1.uniforms[ 'direction' ].value = OutlinePass.BlurDirectionY;
|
325 |
-
renderer.setRenderTarget( this.renderTargetEdgeBuffer1 );
|
326 |
-
renderer.clear();
|
327 |
-
this.fsQuad.render( renderer ); // Apply Blur on quarter res
|
328 |
-
|
329 |
-
this.fsQuad.material = this.separableBlurMaterial2;
|
330 |
-
this.separableBlurMaterial2.uniforms[ 'colorTexture' ].value = this.renderTargetEdgeBuffer1.texture;
|
331 |
-
this.separableBlurMaterial2.uniforms[ 'direction' ].value = OutlinePass.BlurDirectionX;
|
332 |
-
renderer.setRenderTarget( this.renderTargetBlurBuffer2 );
|
333 |
-
renderer.clear();
|
334 |
-
this.fsQuad.render( renderer );
|
335 |
-
this.separableBlurMaterial2.uniforms[ 'colorTexture' ].value = this.renderTargetBlurBuffer2.texture;
|
336 |
-
this.separableBlurMaterial2.uniforms[ 'direction' ].value = OutlinePass.BlurDirectionY;
|
337 |
-
renderer.setRenderTarget( this.renderTargetEdgeBuffer2 );
|
338 |
-
renderer.clear();
|
339 |
-
this.fsQuad.render( renderer ); // Blend it additively over the input texture
|
340 |
-
|
341 |
-
this.fsQuad.material = this.overlayMaterial;
|
342 |
-
this.overlayMaterial.uniforms[ 'maskTexture' ].value = this.renderTargetMaskBuffer.texture;
|
343 |
-
this.overlayMaterial.uniforms[ 'edgeTexture1' ].value = this.renderTargetEdgeBuffer1.texture;
|
344 |
-
this.overlayMaterial.uniforms[ 'edgeTexture2' ].value = this.renderTargetEdgeBuffer2.texture;
|
345 |
-
this.overlayMaterial.uniforms[ 'patternTexture' ].value = this.patternTexture;
|
346 |
-
this.overlayMaterial.uniforms[ 'edgeStrength' ].value = this.edgeStrength;
|
347 |
-
this.overlayMaterial.uniforms[ 'edgeGlow' ].value = this.edgeGlow;
|
348 |
-
this.overlayMaterial.uniforms[ 'usePatternTexture' ].value = this.usePatternTexture;
|
349 |
-
if ( maskActive ) renderer.state.buffers.stencil.setTest( true );
|
350 |
-
renderer.setRenderTarget( readBuffer );
|
351 |
-
this.fsQuad.render( renderer );
|
352 |
-
renderer.setClearColor( this._oldClearColor, this.oldClearAlpha );
|
353 |
-
renderer.autoClear = oldAutoClear;
|
354 |
-
|
355 |
-
}
|
356 |
-
|
357 |
-
if ( this.renderToScreen ) {
|
358 |
-
|
359 |
-
this.fsQuad.material = this.materialCopy;
|
360 |
-
this.copyUniforms[ 'tDiffuse' ].value = readBuffer.texture;
|
361 |
-
renderer.setRenderTarget( null );
|
362 |
-
this.fsQuad.render( renderer );
|
363 |
-
|
364 |
-
}
|
365 |
-
|
366 |
-
}
|
367 |
-
|
368 |
-
getPrepareMaskMaterial() {
|
369 |
-
|
370 |
-
return new THREE.ShaderMaterial( {
|
371 |
-
uniforms: {
|
372 |
-
'depthTexture': {
|
373 |
-
value: null
|
374 |
-
},
|
375 |
-
'cameraNearFar': {
|
376 |
-
value: new THREE.Vector2( 0.5, 0.5 )
|
377 |
-
},
|
378 |
-
'textureMatrix': {
|
379 |
-
value: null
|
380 |
-
}
|
381 |
-
},
|
382 |
-
vertexShader: `#include <morphtarget_pars_vertex>
|
383 |
-
#include <skinning_pars_vertex>
|
384 |
-
|
385 |
-
varying vec4 projTexCoord;
|
386 |
-
varying vec4 vPosition;
|
387 |
-
uniform mat4 textureMatrix;
|
388 |
-
|
389 |
-
void main() {
|
390 |
-
|
391 |
-
#include <skinbase_vertex>
|
392 |
-
#include <begin_vertex>
|
393 |
-
#include <morphtarget_vertex>
|
394 |
-
#include <skinning_vertex>
|
395 |
-
#include <project_vertex>
|
396 |
-
|
397 |
-
vPosition = mvPosition;
|
398 |
-
vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
|
399 |
-
projTexCoord = textureMatrix * worldPosition;
|
400 |
-
|
401 |
-
}`,
|
402 |
-
fragmentShader: `#include <packing>
|
403 |
-
varying vec4 vPosition;
|
404 |
-
varying vec4 projTexCoord;
|
405 |
-
uniform sampler2D depthTexture;
|
406 |
-
uniform vec2 cameraNearFar;
|
407 |
-
|
408 |
-
void main() {
|
409 |
-
|
410 |
-
float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));
|
411 |
-
float viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );
|
412 |
-
float depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;
|
413 |
-
gl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);
|
414 |
-
|
415 |
-
}`
|
416 |
-
} );
|
417 |
-
|
418 |
-
}
|
419 |
-
|
420 |
-
getEdgeDetectionMaterial() {
|
421 |
-
|
422 |
-
return new THREE.ShaderMaterial( {
|
423 |
-
uniforms: {
|
424 |
-
'maskTexture': {
|
425 |
-
value: null
|
426 |
-
},
|
427 |
-
'texSize': {
|
428 |
-
value: new THREE.Vector2( 0.5, 0.5 )
|
429 |
-
},
|
430 |
-
'visibleEdgeColor': {
|
431 |
-
value: new THREE.Vector3( 1.0, 1.0, 1.0 )
|
432 |
-
},
|
433 |
-
'hiddenEdgeColor': {
|
434 |
-
value: new THREE.Vector3( 1.0, 1.0, 1.0 )
|
435 |
-
}
|
436 |
-
},
|
437 |
-
vertexShader: `varying vec2 vUv;
|
438 |
-
|
439 |
-
void main() {
|
440 |
-
vUv = uv;
|
441 |
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
442 |
-
}`,
|
443 |
-
fragmentShader: `varying vec2 vUv;
|
444 |
-
|
445 |
-
uniform sampler2D maskTexture;
|
446 |
-
uniform vec2 texSize;
|
447 |
-
uniform vec3 visibleEdgeColor;
|
448 |
-
uniform vec3 hiddenEdgeColor;
|
449 |
-
|
450 |
-
void main() {
|
451 |
-
vec2 invSize = 1.0 / texSize;
|
452 |
-
vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);
|
453 |
-
vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);
|
454 |
-
vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);
|
455 |
-
vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);
|
456 |
-
vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);
|
457 |
-
float diff1 = (c1.r - c2.r)*0.5;
|
458 |
-
float diff2 = (c3.r - c4.r)*0.5;
|
459 |
-
float d = length( vec2(diff1, diff2) );
|
460 |
-
float a1 = min(c1.g, c2.g);
|
461 |
-
float a2 = min(c3.g, c4.g);
|
462 |
-
float visibilityFactor = min(a1, a2);
|
463 |
-
vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;
|
464 |
-
gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);
|
465 |
-
}`
|
466 |
-
} );
|
467 |
-
|
468 |
-
}
|
469 |
-
|
470 |
-
getSeperableBlurMaterial( maxRadius ) {
|
471 |
-
|
472 |
-
return new THREE.ShaderMaterial( {
|
473 |
-
defines: {
|
474 |
-
'MAX_RADIUS': maxRadius
|
475 |
-
},
|
476 |
-
uniforms: {
|
477 |
-
'colorTexture': {
|
478 |
-
value: null
|
479 |
-
},
|
480 |
-
'texSize': {
|
481 |
-
value: new THREE.Vector2( 0.5, 0.5 )
|
482 |
-
},
|
483 |
-
'direction': {
|
484 |
-
value: new THREE.Vector2( 0.5, 0.5 )
|
485 |
-
},
|
486 |
-
'kernelRadius': {
|
487 |
-
value: 1.0
|
488 |
-
}
|
489 |
-
},
|
490 |
-
vertexShader: `varying vec2 vUv;
|
491 |
-
|
492 |
-
void main() {
|
493 |
-
vUv = uv;
|
494 |
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
495 |
-
}`,
|
496 |
-
fragmentShader: `#include <common>
|
497 |
-
varying vec2 vUv;
|
498 |
-
uniform sampler2D colorTexture;
|
499 |
-
uniform vec2 texSize;
|
500 |
-
uniform vec2 direction;
|
501 |
-
uniform float kernelRadius;
|
502 |
-
|
503 |
-
float gaussianPdf(in float x, in float sigma) {
|
504 |
-
return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
|
505 |
-
}
|
506 |
-
|
507 |
-
void main() {
|
508 |
-
vec2 invSize = 1.0 / texSize;
|
509 |
-
float weightSum = gaussianPdf(0.0, kernelRadius);
|
510 |
-
vec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;
|
511 |
-
vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);
|
512 |
-
vec2 uvOffset = delta;
|
513 |
-
for( int i = 1; i <= MAX_RADIUS; i ++ ) {
|
514 |
-
float w = gaussianPdf(uvOffset.x, kernelRadius);
|
515 |
-
vec4 sample1 = texture2D( colorTexture, vUv + uvOffset);
|
516 |
-
vec4 sample2 = texture2D( colorTexture, vUv - uvOffset);
|
517 |
-
diffuseSum += ((sample1 + sample2) * w);
|
518 |
-
weightSum += (2.0 * w);
|
519 |
-
uvOffset += delta;
|
520 |
-
}
|
521 |
-
gl_FragColor = diffuseSum/weightSum;
|
522 |
-
}`
|
523 |
-
} );
|
524 |
-
|
525 |
-
}
|
526 |
-
|
527 |
-
getOverlayMaterial() {
|
528 |
-
|
529 |
-
return new THREE.ShaderMaterial( {
|
530 |
-
uniforms: {
|
531 |
-
'maskTexture': {
|
532 |
-
value: null
|
533 |
-
},
|
534 |
-
'edgeTexture1': {
|
535 |
-
value: null
|
536 |
-
},
|
537 |
-
'edgeTexture2': {
|
538 |
-
value: null
|
539 |
-
},
|
540 |
-
'patternTexture': {
|
541 |
-
value: null
|
542 |
-
},
|
543 |
-
'edgeStrength': {
|
544 |
-
value: 1.0
|
545 |
-
},
|
546 |
-
'edgeGlow': {
|
547 |
-
value: 1.0
|
548 |
-
},
|
549 |
-
'usePatternTexture': {
|
550 |
-
value: 0.0
|
551 |
-
}
|
552 |
-
},
|
553 |
-
vertexShader: `varying vec2 vUv;
|
554 |
-
|
555 |
-
void main() {
|
556 |
-
vUv = uv;
|
557 |
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
558 |
-
}`,
|
559 |
-
fragmentShader: `varying vec2 vUv;
|
560 |
-
|
561 |
-
uniform sampler2D maskTexture;
|
562 |
-
uniform sampler2D edgeTexture1;
|
563 |
-
uniform sampler2D edgeTexture2;
|
564 |
-
uniform sampler2D patternTexture;
|
565 |
-
uniform float edgeStrength;
|
566 |
-
uniform float edgeGlow;
|
567 |
-
uniform bool usePatternTexture;
|
568 |
-
|
569 |
-
void main() {
|
570 |
-
vec4 edgeValue1 = texture2D(edgeTexture1, vUv);
|
571 |
-
vec4 edgeValue2 = texture2D(edgeTexture2, vUv);
|
572 |
-
vec4 maskColor = texture2D(maskTexture, vUv);
|
573 |
-
vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);
|
574 |
-
float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;
|
575 |
-
vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;
|
576 |
-
vec4 finalColor = edgeStrength * maskColor.r * edgeValue;
|
577 |
-
if(usePatternTexture)
|
578 |
-
finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);
|
579 |
-
gl_FragColor = finalColor;
|
580 |
-
}`,
|
581 |
-
blending: THREE.AdditiveBlending,
|
582 |
-
depthTest: false,
|
583 |
-
depthWrite: false,
|
584 |
-
transparent: true
|
585 |
-
} );
|
586 |
-
|
587 |
-
}
|
588 |
-
|
589 |
-
}
|
590 |
-
|
591 |
-
OutlinePass.BlurDirectionX = new THREE.Vector2( 1.0, 0.0 );
|
592 |
-
OutlinePass.BlurDirectionY = new THREE.Vector2( 0.0, 1.0 );
|
593 |
-
|
594 |
-
THREE.OutlinePass = OutlinePass;
|
595 |
-
|
596 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/postprocessing/RenderPass.js
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
( function () {
|
2 |
-
|
3 |
-
class RenderPass extends THREE.Pass {
|
4 |
-
|
5 |
-
constructor( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
|
6 |
-
|
7 |
-
super();
|
8 |
-
this.scene = scene;
|
9 |
-
this.camera = camera;
|
10 |
-
this.overrideMaterial = overrideMaterial;
|
11 |
-
this.clearColor = clearColor;
|
12 |
-
this.clearAlpha = clearAlpha !== undefined ? clearAlpha : 0;
|
13 |
-
this.clear = true;
|
14 |
-
this.clearDepth = false;
|
15 |
-
this.needsSwap = false;
|
16 |
-
this._oldClearColor = new THREE.Color();
|
17 |
-
|
18 |
-
}
|
19 |
-
|
20 |
-
render( renderer, writeBuffer, readBuffer
|
21 |
-
/*, deltaTime, maskActive */
|
22 |
-
) {
|
23 |
-
|
24 |
-
const oldAutoClear = renderer.autoClear;
|
25 |
-
renderer.autoClear = false;
|
26 |
-
let oldClearAlpha, oldOverrideMaterial;
|
27 |
-
|
28 |
-
if ( this.overrideMaterial !== undefined ) {
|
29 |
-
|
30 |
-
oldOverrideMaterial = this.scene.overrideMaterial;
|
31 |
-
this.scene.overrideMaterial = this.overrideMaterial;
|
32 |
-
|
33 |
-
}
|
34 |
-
|
35 |
-
if ( this.clearColor ) {
|
36 |
-
|
37 |
-
renderer.getClearColor( this._oldClearColor );
|
38 |
-
oldClearAlpha = renderer.getClearAlpha();
|
39 |
-
renderer.setClearColor( this.clearColor, this.clearAlpha );
|
40 |
-
|
41 |
-
}
|
42 |
-
|
43 |
-
if ( this.clearDepth ) {
|
44 |
-
|
45 |
-
renderer.clearDepth();
|
46 |
-
|
47 |
-
}
|
48 |
-
|
49 |
-
renderer.setRenderTarget( this.renderToScreen ? null : readBuffer ); // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
|
50 |
-
|
51 |
-
if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
|
52 |
-
renderer.render( this.scene, this.camera );
|
53 |
-
|
54 |
-
if ( this.clearColor ) {
|
55 |
-
|
56 |
-
renderer.setClearColor( this._oldClearColor, oldClearAlpha );
|
57 |
-
|
58 |
-
}
|
59 |
-
|
60 |
-
if ( this.overrideMaterial !== undefined ) {
|
61 |
-
|
62 |
-
this.scene.overrideMaterial = oldOverrideMaterial;
|
63 |
-
|
64 |
-
}
|
65 |
-
|
66 |
-
renderer.autoClear = oldAutoClear;
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
}
|
71 |
-
|
72 |
-
THREE.RenderPass = RenderPass;
|
73 |
-
|
74 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/postprocessing/ShaderPass.js
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
( function () {
|
2 |
-
|
3 |
-
class ShaderPass extends THREE.Pass {
|
4 |
-
|
5 |
-
constructor( shader, textureID ) {
|
6 |
-
|
7 |
-
super();
|
8 |
-
this.textureID = textureID !== undefined ? textureID : 'tDiffuse';
|
9 |
-
|
10 |
-
if ( shader instanceof THREE.ShaderMaterial ) {
|
11 |
-
|
12 |
-
this.uniforms = shader.uniforms;
|
13 |
-
this.material = shader;
|
14 |
-
|
15 |
-
} else if ( shader ) {
|
16 |
-
|
17 |
-
this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
|
18 |
-
this.material = new THREE.ShaderMaterial( {
|
19 |
-
defines: Object.assign( {}, shader.defines ),
|
20 |
-
uniforms: this.uniforms,
|
21 |
-
vertexShader: shader.vertexShader,
|
22 |
-
fragmentShader: shader.fragmentShader
|
23 |
-
} );
|
24 |
-
|
25 |
-
}
|
26 |
-
|
27 |
-
this.fsQuad = new THREE.FullScreenQuad( this.material );
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
render( renderer, writeBuffer, readBuffer
|
32 |
-
/*, deltaTime, maskActive */
|
33 |
-
) {
|
34 |
-
|
35 |
-
if ( this.uniforms[ this.textureID ] ) {
|
36 |
-
|
37 |
-
this.uniforms[ this.textureID ].value = readBuffer.texture;
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
this.fsQuad.material = this.material;
|
42 |
-
|
43 |
-
if ( this.renderToScreen ) {
|
44 |
-
|
45 |
-
renderer.setRenderTarget( null );
|
46 |
-
this.fsQuad.render( renderer );
|
47 |
-
|
48 |
-
} else {
|
49 |
-
|
50 |
-
renderer.setRenderTarget( writeBuffer ); // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
|
51 |
-
|
52 |
-
if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
|
53 |
-
this.fsQuad.render( renderer );
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
}
|
58 |
-
|
59 |
-
}
|
60 |
-
|
61 |
-
THREE.ShaderPass = ShaderPass;
|
62 |
-
|
63 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/shaders/CopyShader.js
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
( function () {
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Full-screen textured quad shader
|
5 |
-
*/
|
6 |
-
var CopyShader = {
|
7 |
-
uniforms: {
|
8 |
-
'tDiffuse': {
|
9 |
-
value: null
|
10 |
-
},
|
11 |
-
'opacity': {
|
12 |
-
value: 1.0
|
13 |
-
}
|
14 |
-
},
|
15 |
-
vertexShader:
|
16 |
-
/* glsl */
|
17 |
-
`
|
18 |
-
|
19 |
-
varying vec2 vUv;
|
20 |
-
|
21 |
-
void main() {
|
22 |
-
|
23 |
-
vUv = uv;
|
24 |
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
25 |
-
|
26 |
-
}`,
|
27 |
-
fragmentShader:
|
28 |
-
/* glsl */
|
29 |
-
`
|
30 |
-
|
31 |
-
uniform float opacity;
|
32 |
-
|
33 |
-
uniform sampler2D tDiffuse;
|
34 |
-
|
35 |
-
varying vec2 vUv;
|
36 |
-
|
37 |
-
void main() {
|
38 |
-
|
39 |
-
vec4 texel = texture2D( tDiffuse, vUv );
|
40 |
-
gl_FragColor = opacity * texel;
|
41 |
-
|
42 |
-
}`
|
43 |
-
};
|
44 |
-
|
45 |
-
THREE.CopyShader = CopyShader;
|
46 |
-
|
47 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/three.js
DELETED
The diff for this file is too large to render.
See raw diff
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/3rdparty/three-js/utils/SceneUtils.js
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
( function () {
|
2 |
-
|
3 |
-
function createMeshesFromInstancedMesh( instancedMesh ) {
|
4 |
-
|
5 |
-
const group = new THREE.Group();
|
6 |
-
const count = instancedMesh.count;
|
7 |
-
const geometry = instancedMesh.geometry;
|
8 |
-
const material = instancedMesh.material;
|
9 |
-
|
10 |
-
for ( let i = 0; i < count; i ++ ) {
|
11 |
-
|
12 |
-
const mesh = new THREE.Mesh( geometry, material );
|
13 |
-
instancedMesh.getMatrixAt( i, mesh.matrix );
|
14 |
-
mesh.matrix.decompose( mesh.position, mesh.quaternion, mesh.scale );
|
15 |
-
group.add( mesh );
|
16 |
-
|
17 |
-
}
|
18 |
-
|
19 |
-
group.copy( instancedMesh );
|
20 |
-
group.updateMatrixWorld(); // ensure correct world matrices of meshes
|
21 |
-
|
22 |
-
return group;
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
function createMultiMaterialObject( geometry, materials ) {
|
27 |
-
|
28 |
-
const group = new THREE.Group();
|
29 |
-
|
30 |
-
for ( let i = 0, l = materials.length; i < l; i ++ ) {
|
31 |
-
|
32 |
-
group.add( new THREE.Mesh( geometry, materials[ i ] ) );
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
return group;
|
37 |
-
|
38 |
-
}
|
39 |
-
|
40 |
-
function detach( child, parent, scene ) {
|
41 |
-
|
42 |
-
console.warn( 'THREE.SceneUtils: detach() has been deprecated. Use scene.attach( child ) instead.' );
|
43 |
-
scene.attach( child );
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
function attach( child, scene, parent ) {
|
48 |
-
|
49 |
-
console.warn( 'THREE.SceneUtils: attach() has been deprecated. Use parent.attach( child ) instead.' );
|
50 |
-
parent.attach( child );
|
51 |
-
|
52 |
-
}
|
53 |
-
|
54 |
-
THREE.SceneUtils = {};
|
55 |
-
THREE.SceneUtils.attach = attach;
|
56 |
-
THREE.SceneUtils.createMeshesFromInstancedMesh = createMeshesFromInstancedMesh;
|
57 |
-
THREE.SceneUtils.createMultiMaterialObject = createMultiMaterialObject;
|
58 |
-
THREE.SceneUtils.detach = detach;
|
59 |
-
|
60 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/OpenMeshCore.dll
DELETED
Binary file (483 kB)
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/OpenMeshTools.dll
DELETED
Binary file (45.6 kB)
|
|
learning_machines_robobo/examples/full_project_setup/CoppeliaSim/Qt53DCore.dll
DELETED
Binary file (415 kB)
|
|