@openglobus/og 0.11.2 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/package.json +13 -13
  2. package/src/og/Clock.js +10 -10
  3. package/src/og/Events.js +8 -6
  4. package/src/og/Extent.js +82 -41
  5. package/src/og/Globe.js +25 -13
  6. package/src/og/ImageCanvas.js +22 -16
  7. package/src/og/LonLat.js +16 -13
  8. package/src/og/Popup.js +21 -14
  9. package/src/og/QueueArray.js +6 -2
  10. package/src/og/Rectangle.js +11 -6
  11. package/src/og/Stack.js +5 -2
  12. package/src/og/ajax.js +21 -33
  13. package/src/og/astro/astro.js +5 -5
  14. package/src/og/astro/earth.js +22 -16
  15. package/src/og/astro/jd.js +23 -18
  16. package/src/og/astro/orbit.js +13 -11
  17. package/src/og/astro/rotation.js +17 -8
  18. package/src/og/bv/Box.js +7 -3
  19. package/src/og/bv/Sphere.js +14 -11
  20. package/src/og/camera/Camera.js +51 -54
  21. package/src/og/camera/Frustum.js +29 -18
  22. package/src/og/camera/PlanetCamera.js +32 -23
  23. package/src/og/control/CompassButton.js +5 -1
  24. package/src/og/control/Control.js +12 -10
  25. package/src/og/control/DebugInfo.js +4 -1
  26. package/src/og/control/EarthCoordinates.js +54 -33
  27. package/src/og/control/KeyboardNavigation.js +10 -10
  28. package/src/og/control/LayerSwitcher.js +22 -21
  29. package/src/og/control/Lighting.js +34 -3
  30. package/src/og/control/MouseNavigation.js +1 -1
  31. package/src/og/control/ScaleControl.js +1 -1
  32. package/src/og/control/SegmentBoundVisualization.js +6 -7
  33. package/src/og/control/ShowFps.js +13 -8
  34. package/src/og/control/SimpleNavigation.js +6 -8
  35. package/src/og/control/Sun.js +25 -15
  36. package/src/og/control/ToggleWireframe.js +4 -4
  37. package/src/og/control/TouchNavigation.js +44 -33
  38. package/src/og/control/ZoomControl.js +41 -25
  39. package/src/og/ellipsoid/Ellipsoid.js +162 -66
  40. package/src/og/ellipsoid/wgs84.js +4 -4
  41. package/src/og/entity/BaseBillboard.js +100 -56
  42. package/src/og/entity/Billboard.js +14 -10
  43. package/src/og/entity/BillboardHandler.js +317 -60
  44. package/src/og/entity/Entity.js +100 -68
  45. package/src/og/entity/EntityCollection.js +70 -47
  46. package/src/og/entity/GeoObject.js +228 -0
  47. package/src/og/entity/GeoObjectHandler.js +910 -0
  48. package/src/og/entity/Geometry.js +27 -24
  49. package/src/og/entity/GeometryHandler.js +596 -124
  50. package/src/og/entity/Label.js +80 -49
  51. package/src/og/entity/LabelHandler.js +45 -244
  52. package/src/og/entity/LabelWorker.js +218 -0
  53. package/src/og/entity/Object3d.js +504 -0
  54. package/src/og/entity/PointCloud.js +80 -32
  55. package/src/og/entity/PointCloudHandler.js +8 -8
  56. package/src/og/entity/Polyline.js +16 -16
  57. package/src/og/entity/Ray.js +60 -27
  58. package/src/og/entity/Strip.js +77 -48
  59. package/src/og/entity/StripHandler.js +26 -26
  60. package/src/og/entity/index.js +8 -16
  61. package/src/og/layer/BaseGeoImage.js +54 -23
  62. package/src/og/layer/CanvasTiles.js +24 -24
  63. package/src/og/layer/GeoImage.js +9 -9
  64. package/src/og/layer/GeoVideo.js +3 -3
  65. package/src/og/layer/KML.js +63 -37
  66. package/src/og/layer/Layer.js +44 -21
  67. package/src/og/layer/Material.js +23 -20
  68. package/src/og/layer/Vector.js +114 -68
  69. package/src/og/layer/WMS.js +34 -17
  70. package/src/og/layer/XYZ.js +48 -46
  71. package/src/og/light/LightSource.js +46 -39
  72. package/src/og/math/Mat3.js +34 -22
  73. package/src/og/math/Mat4.js +603 -459
  74. package/src/og/math/Plane.js +21 -20
  75. package/src/og/math/Quat.js +182 -139
  76. package/src/og/math/Ray.js +38 -33
  77. package/src/og/math/Vec2.js +85 -75
  78. package/src/og/math/Vec3.js +142 -112
  79. package/src/og/math/Vec4.js +27 -31
  80. package/src/og/math/coder.js +10 -10
  81. package/src/og/math.js +12 -12
  82. package/src/og/proj/EPSG3857.js +4 -4
  83. package/src/og/proj/EPSG4326.js +4 -4
  84. package/src/og/proj/Proj.js +4 -6
  85. package/src/og/quadTree/Node.js +8 -8
  86. package/src/og/renderer/Renderer.js +59 -52
  87. package/src/og/renderer/RendererEvents.js +50 -27
  88. package/src/og/scene/BaseNode.js +7 -8
  89. package/src/og/scene/Planet.js +102 -103
  90. package/src/og/scene/RenderNode.js +28 -21
  91. package/src/og/segment/Segment.js +26 -21
  92. package/src/og/segment/SegmentLonLat.js +5 -5
  93. package/src/og/shaders/drawnode.js +135 -142
  94. package/src/og/shaders/geoObject.js +211 -0
  95. package/src/og/shaders/pointCloud.js +41 -41
  96. package/src/og/shaders/shape.js +12 -18
  97. package/src/og/shaders/skybox.js +36 -36
  98. package/src/og/shaders/toneMapping.js +1 -0
  99. package/src/og/shapes/BaseShape.js +126 -54
  100. package/src/og/shapes/Icosphere.js +29 -14
  101. package/src/og/shapes/Sphere.js +12 -15
  102. package/src/og/terrain/BilTerrain.js +1 -0
  103. package/src/og/terrain/EmptyTerrain.js +2 -2
  104. package/src/og/terrain/GlobusTerrain.js +9 -9
  105. package/src/og/utils/FontAtlas.js +6 -2
  106. package/src/og/utils/TextureAtlas.js +22 -24
  107. package/src/og/utils/VectorTileCreator.js +1 -3
  108. package/src/og/utils/shared.js +16 -16
  109. package/src/og/webgl/Framebuffer.js +88 -40
  110. package/src/og/webgl/Handler.js +243 -169
  111. package/src/og/webgl/Multisample.js +47 -19
  112. package/src/og/webgl/Program.js +79 -34
  113. package/src/og/webgl/ProgramController.js +17 -13
  114. package/src/og/webgl/callbacks.js +8 -8
  115. package/src/og/inherits.js +0 -8
  116. package/src/og/utils/polylabel.js +0 -176
  117. package/types/Clock.d.ts +0 -90
  118. package/types/Deferred.d.ts +0 -6
  119. package/types/Events.d.ts +0 -73
  120. package/types/Extent.d.ts +0 -166
  121. package/types/Globe.d.ts +0 -75
  122. package/types/ImageCanvas.d.ts +0 -121
  123. package/types/Lock.d.ts +0 -12
  124. package/types/LonLat.d.ts +0 -108
  125. package/types/Popup.d.ts +0 -38
  126. package/types/QueueArray.d.ts +0 -15
  127. package/types/Rectangle.d.ts +0 -74
  128. package/types/Stack.d.ts +0 -15
  129. package/types/ajax.d.ts +0 -24
  130. package/types/arial.d.ts +0 -48
  131. package/types/astro/astro.d.ts +0 -38
  132. package/types/astro/earth.d.ts +0 -6
  133. package/types/astro/jd.d.ts +0 -254
  134. package/types/bv/Box.d.ts +0 -25
  135. package/types/bv/Sphere.d.ts +0 -38
  136. package/types/bv/index.d.ts +0 -3
  137. package/types/camera/Camera.d.ts +0 -303
  138. package/types/camera/Frustum.d.ts +0 -129
  139. package/types/camera/PlanetCamera.d.ts +0 -223
  140. package/types/camera/index.d.ts +0 -3
  141. package/types/cons.d.ts +0 -40
  142. package/types/control/CompassButton.d.ts +0 -18
  143. package/types/control/Control.d.ts +0 -101
  144. package/types/control/DebugInfo.d.ts +0 -16
  145. package/types/control/EarthCoordinates.d.ts +0 -47
  146. package/types/control/EarthNavigation.d.ts +0 -42
  147. package/types/control/GeoImageDragControl.d.ts +0 -6
  148. package/types/control/KeyboardNavigation.d.ts +0 -22
  149. package/types/control/LayerSwitcher.d.ts +0 -23
  150. package/types/control/Lighting.d.ts +0 -16
  151. package/types/control/MouseNavigation.d.ts +0 -51
  152. package/types/control/ScaleControl.d.ts +0 -22
  153. package/types/control/ShowFps.d.ts +0 -12
  154. package/types/control/SimpleNavigation.d.ts +0 -28
  155. package/types/control/Sun.d.ts +0 -52
  156. package/types/control/ToggleWireframe.d.ts +0 -12
  157. package/types/control/TouchNavigation.d.ts +0 -50
  158. package/types/control/ZoomControl.d.ts +0 -28
  159. package/types/control/index.d.ts +0 -17
  160. package/types/ellipsoid/Ellipsoid.d.ts +0 -142
  161. package/types/ellipsoid/index.d.ts +0 -3
  162. package/types/ellipsoid/wgs84.d.ts +0 -5
  163. package/types/entity/BaseBillboard.d.ts +0 -208
  164. package/types/entity/Billboard.d.ts +0 -94
  165. package/types/entity/BillboardHandler.d.ts +0 -74
  166. package/types/entity/Entity.d.ts +0 -331
  167. package/types/entity/EntityCollection.d.ts +0 -303
  168. package/types/entity/Geometry.d.ts +0 -73
  169. package/types/entity/GeometryHandler.d.ts +0 -76
  170. package/types/entity/Label.d.ts +0 -194
  171. package/types/entity/LabelHandler.d.ts +0 -24
  172. package/types/entity/PointCloud.d.ts +0 -174
  173. package/types/entity/PointCloudHandler.d.ts +0 -38
  174. package/types/entity/Polyline.d.ts +0 -304
  175. package/types/entity/PolylineHandler.d.ts +0 -18
  176. package/types/entity/Ray.d.ts +0 -123
  177. package/types/entity/RayHandler.d.ts +0 -67
  178. package/types/entity/ShapeHandler.d.ts +0 -22
  179. package/types/entity/Strip.d.ts +0 -118
  180. package/types/entity/StripHandler.d.ts +0 -38
  181. package/types/entity/index.d.ts +0 -8
  182. package/types/index.core.d.ts +0 -65
  183. package/types/index.d.ts +0 -45
  184. package/types/index.webgl.d.ts +0 -7
  185. package/types/inherits.d.ts +0 -4
  186. package/types/input/KeyboardHandler.d.ts +0 -10
  187. package/types/input/MouseHandler.d.ts +0 -5
  188. package/types/input/TouchHandler.d.ts +0 -5
  189. package/types/input/input.d.ts +0 -34
  190. package/types/layer/BaseGeoImage.d.ts +0 -107
  191. package/types/layer/CanvasTiles.d.ts +0 -75
  192. package/types/layer/GeoImage.d.ts +0 -65
  193. package/types/layer/GeoTexture2d.d.ts +0 -8
  194. package/types/layer/GeoVideo.d.ts +0 -80
  195. package/types/layer/KML.d.ts +0 -58
  196. package/types/layer/Layer.d.ts +0 -321
  197. package/types/layer/Material.d.ts +0 -48
  198. package/types/layer/Vector.d.ts +0 -228
  199. package/types/layer/WMS.d.ts +0 -66
  200. package/types/layer/XYZ.d.ts +0 -130
  201. package/types/layer/index.d.ts +0 -10
  202. package/types/light/LightSource.d.ts +0 -177
  203. package/types/math/Line2.d.ts +0 -11
  204. package/types/math/Line3.d.ts +0 -10
  205. package/types/math/Mat3.d.ts +0 -63
  206. package/types/math/Mat4.d.ts +0 -173
  207. package/types/math/Plane.d.ts +0 -17
  208. package/types/math/Quat.d.ts +0 -376
  209. package/types/math/Ray.d.ts +0 -81
  210. package/types/math/Vec2.d.ts +0 -308
  211. package/types/math/Vec3.d.ts +0 -459
  212. package/types/math/Vec4.d.ts +0 -161
  213. package/types/math/coder.d.ts +0 -42
  214. package/types/math/index.d.ts +0 -11
  215. package/types/math.d.ts +0 -261
  216. package/types/mercator.d.ts +0 -92
  217. package/types/proj/EPSG3857.d.ts +0 -5
  218. package/types/proj/EPSG4326.d.ts +0 -5
  219. package/types/proj/Proj.d.ts +0 -42
  220. package/types/quadTree/EntityCollectionNode.d.ts +0 -34
  221. package/types/quadTree/Node.d.ts +0 -61
  222. package/types/quadTree/quadTree.d.ts +0 -40
  223. package/types/renderer/Renderer.d.ts +0 -296
  224. package/types/renderer/RendererEvents.d.ts +0 -230
  225. package/types/res/images.d.ts +0 -3
  226. package/types/scene/Axes.d.ts +0 -11
  227. package/types/scene/BaseNode.d.ts +0 -60
  228. package/types/scene/Planet.d.ts +0 -574
  229. package/types/scene/RenderNode.d.ts +0 -143
  230. package/types/scene/SkyBox.d.ts +0 -10
  231. package/types/scene/index.d.ts +0 -4
  232. package/types/segment/Segment.d.ts +0 -271
  233. package/types/segment/SegmentLonLat.d.ts +0 -62
  234. package/types/segment/segmentHelper.d.ts +0 -13
  235. package/types/shaders/billboard.d.ts +0 -3
  236. package/types/shaders/depth.d.ts +0 -2
  237. package/types/shaders/drawnode.d.ts +0 -7
  238. package/types/shaders/label.d.ts +0 -4
  239. package/types/shaders/pointCloud.d.ts +0 -2
  240. package/types/shaders/polyline.d.ts +0 -3
  241. package/types/shaders/ray.d.ts +0 -2
  242. package/types/shaders/screenFrame.d.ts +0 -2
  243. package/types/shaders/shape.d.ts +0 -4
  244. package/types/shaders/skybox.d.ts +0 -2
  245. package/types/shaders/toneMapping.d.ts +0 -2
  246. package/types/shapes/BaseShape.d.ts +0 -247
  247. package/types/shapes/Sphere.d.ts +0 -41
  248. package/types/terrain/BilTerrain.d.ts +0 -8
  249. package/types/terrain/EmptyTerrain.d.ts +0 -72
  250. package/types/terrain/Geoid.d.ts +0 -26
  251. package/types/terrain/GlobusTerrain.d.ts +0 -153
  252. package/types/terrain/MapboxTerrain.d.ts +0 -8
  253. package/types/terrain/index.d.ts +0 -5
  254. package/types/utils/FontAtlas.d.ts +0 -14
  255. package/types/utils/GeoImageCreator.d.ts +0 -30
  256. package/types/utils/ImagesCacheManager.d.ts +0 -10
  257. package/types/utils/Loader.d.ts +0 -25
  258. package/types/utils/NormalMapCreator.d.ts +0 -39
  259. package/types/utils/PlainSegmentWorker.d.ts +0 -10
  260. package/types/utils/TerrainWorker.d.ts +0 -9
  261. package/types/utils/TextureAtlas.d.ts +0 -111
  262. package/types/utils/VectorTileCreator.d.ts +0 -16
  263. package/types/utils/colorTable.d.ts +0 -143
  264. package/types/utils/earcut.d.ts +0 -6
  265. package/types/utils/shared.d.ts +0 -230
  266. package/types/webgl/Framebuffer.d.ts +0 -135
  267. package/types/webgl/Handler.d.ts +0 -372
  268. package/types/webgl/Multisample.d.ts +0 -89
  269. package/types/webgl/Program.d.ts +0 -155
  270. package/types/webgl/ProgramController.d.ts +0 -84
  271. package/types/webgl/callbacks.d.ts +0 -1
  272. package/types/webgl/index.d.ts +0 -6
  273. package/types/webgl/types.d.ts +0 -2
@@ -1,9 +1,9 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- import * as math from '../math.js';
4
- import { Mat3 } from './Mat3.js';
5
- import { Mat4 } from './Mat4.js';
6
- import { Vec3 } from './Vec3.js';
3
+ import * as math from "../math.js";
4
+ import { Mat3 } from "./Mat3.js";
5
+ import { Mat4 } from "./Mat4.js";
6
+ import { Vec3 } from "./Vec3.js";
7
7
 
8
8
  /**
9
9
  * A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
@@ -14,7 +14,6 @@ import { Vec3 } from './Vec3.js';
14
14
  * @param {Number} [w=0.0] The W component.
15
15
  */
16
16
  export class Quat {
17
-
18
17
  /**
19
18
  * @param {Number} [x=0.0] The X component.
20
19
  * @param {Number} [y=0.0] The Y component.
@@ -58,7 +57,7 @@ export class Quat {
58
57
  /**
59
58
  * Identity Quat.
60
59
  * @const
61
- * @type {og.Quat}
60
+ * @type {Quat}
62
61
  */
63
62
  static get IDENTITY() {
64
63
  return new Quat(0.0, 0.0, 0.0, 1.0);
@@ -68,7 +67,7 @@ export class Quat {
68
67
  * Returns a Quat represents rotation around X axis.
69
68
  * @static
70
69
  * @param {number} a - The angle in radians to rotate around the axis.
71
- * @returns {og.Quat} -
70
+ * @returns {Quat} -
72
71
  */
73
72
  static xRotation(a) {
74
73
  a *= 0.5;
@@ -79,7 +78,7 @@ export class Quat {
79
78
  * Returns a Quat represents rotation around Y axis.
80
79
  * @static
81
80
  * @param {number} a - The angle in radians to rotate around the axis.
82
- * @returns {og.Quat} -
81
+ * @returns {Quat} -
83
82
  */
84
83
  static yRotation(a) {
85
84
  a *= 0.5;
@@ -90,7 +89,7 @@ export class Quat {
90
89
  * Returns a Quat represents rotation around Z axis.
91
90
  * @static
92
91
  * @param {number} a - The angle in radians to rotate around the axis.
93
- * @returns {og.Quat} -
92
+ * @returns {Quat} -
94
93
  */
95
94
  static zRotation(a) {
96
95
  a *= 0.5;
@@ -100,90 +99,65 @@ export class Quat {
100
99
  /**
101
100
  * Computes a Quat representing a rotation around an axis.
102
101
  * @static
103
- * @param {og.Vec3} axis - The axis of rotation.
102
+ * @param {Vec3} axis - The axis of rotation.
104
103
  * @param {number} [angle=0.0] The angle in radians to rotate around the axis.
105
- * @returns {og.Quat} -
104
+ * @returns {Quat} -
106
105
  */
107
106
  static axisAngleToQuat(axis, angle) {
108
107
  angle = angle || 0.0;
109
108
  var v = axis.normal();
110
109
  var half_angle = angle * 0.5;
111
110
  var sin_a = Math.sin(half_angle);
112
- return new Quat(
113
- v.x * sin_a,
114
- v.y * sin_a,
115
- v.z * sin_a,
116
- Math.cos(half_angle));
111
+ return new Quat(v.x * sin_a, v.y * sin_a, v.z * sin_a, Math.cos(half_angle));
117
112
  }
118
113
 
119
114
  /**
120
115
  * Computes a rotation from the given heading and up vector.
121
116
  * @static
122
- * @param {og.Vec3} forward - Heading target coordinates.
123
- * @param {og.Vec3} up - Up vector.
124
- * @returns {og.Quat} -
117
+ * @param {Vec3} forward - Heading target coordinates.
118
+ * @param {Vec3} up - Up vector.
119
+ * @returns {Quat} -
125
120
  */
126
121
  static getLookRotation(forward, up) {
127
-
128
122
  var f = forward.normal().negate();
129
- var s = (up.cross(f)).normalize();
123
+ var s = up.cross(f).normalize();
130
124
  var u = f.cross(s);
131
125
 
132
126
  var z = 1.0 + s.x + u.y + f.z;
133
127
 
134
128
  if (z > 0.000001) {
135
129
  let fd = 1.0 / (2.0 * Math.sqrt(z));
136
- return new Quat(
137
- (f.y - u.z) * fd,
138
- (s.z - f.x) * fd,
139
- (u.x - s.y) * fd,
140
- 0.25 / fd
141
- );
130
+ return new Quat((f.y - u.z) * fd, (s.z - f.x) * fd, (u.x - s.y) * fd, 0.25 / fd);
142
131
  }
143
132
 
144
133
  if (s.x > u.y && s.x > f.z) {
145
134
  let fd = 1.0 / (2.0 * Math.sqrt(1.0 + s.x - u.y - f.z));
146
- return new Quat(
147
- 0.25 / fd,
148
- (u.x + s.y) * fd,
149
- (s.z + f.x) * fd,
150
- (f.y - u.z) * fd
151
- );
135
+ return new Quat(0.25 / fd, (u.x + s.y) * fd, (s.z + f.x) * fd, (f.y - u.z) * fd);
152
136
  }
153
137
 
154
138
  if (u.y > f.z) {
155
139
  let fd = 1.0 / (2.0 * Math.sqrt(1.0 + u.y - s.x - f.z));
156
- return new Quat(
157
- (u.x + s.y) * fd,
158
- 0.25 / fd,
159
- (f.y + u.z) * fd,
160
- (s.z - f.x) * fd
161
- );
140
+ return new Quat((u.x + s.y) * fd, 0.25 / fd, (f.y + u.z) * fd, (s.z - f.x) * fd);
162
141
  }
163
142
 
164
143
  let fd = 1.0 / (2.0 * Math.sqrt(1.0 + f.z - s.x - u.y));
165
- return new Quat(
166
- (s.z + f.x) * fd,
167
- (f.y + u.z) * fd,
168
- 0.25 / fd,
169
- (u.x - s.y) * fd
170
- );
144
+ return new Quat((s.z + f.x) * fd, (f.y + u.z) * fd, 0.25 / fd, (u.x - s.y) * fd);
171
145
  }
172
146
 
173
147
  /**
174
148
  * Computes a Quat from from source point heading to the destination point.
175
149
  * @static
176
- * @param {og.Vec3} sourcePoint - Source coordinate.
177
- * @param {og.Vec3} destPoint - Destination coordinate.
178
- * @returns {og.Quat} -
150
+ * @param {Vec3} sourcePoint - Source coordinate.
151
+ * @param {Vec3} destPoint - Destination coordinate.
152
+ * @returns {Quat} -
179
153
  */
180
154
  static getLookAtSourceDest(sourcePoint, destPoint) {
181
155
  var forwardVector = destPoint.subA(sourcePoint).normalize();
182
156
  var dot = Vec3.FORWARD.dot(forwardVector);
183
- if (Math.abs(dot - (-1.0)) < 0.000001) {
157
+ if (Math.abs(dot - -1.0) < 0.000001) {
184
158
  return Quat.axisAngleToQuat(Vec3.UP, Math.PI);
185
159
  }
186
- if (Math.abs(dot - (1.0)) < 0.000001) {
160
+ if (Math.abs(dot - 1.0) < 0.000001) {
187
161
  return new Quat(0.0, 0.0, 0.0, 1.0);
188
162
  }
189
163
  var rotAngle = Math.acos(dot);
@@ -194,9 +168,9 @@ export class Quat {
194
168
  /**
195
169
  * Compute rotation between two vectors.
196
170
  * @static
197
- * @param {og.Vec3} u - First vector.
198
- * @param {og.Vec3} v - Second vector.
199
- * @returns {og.Quat} -
171
+ * @param {Vec3} u - First vector.
172
+ * @param {Vec3} v - Second vector.
173
+ * @returns {Quat} -
200
174
  */
201
175
  static getRotationBetweenVectors(u, v) {
202
176
  var w = u.cross(v);
@@ -207,10 +181,10 @@ export class Quat {
207
181
  /**
208
182
  * Compute rotation between two vectors.
209
183
  * @static
210
- * @param {og.Vec3} u - First vector.
211
- * @param {og.Vec3} v - Second vector.
184
+ * @param {Vec3} u - First vector.
185
+ * @param {Vec3} v - Second vector.
212
186
  * @param {Quat} res
213
- * @returns {og.Quat} -
187
+ * @returns {Quat} -
214
188
  */
215
189
  static getRotationBetweenVectorsRes(u, v, res) {
216
190
  var w = u.cross(v);
@@ -219,19 +193,19 @@ export class Quat {
219
193
  }
220
194
 
221
195
  /**
222
- * Compute rotation between two vectors with around vector up
196
+ * Compute rotation between two vectors with around vector up
223
197
  * for exactly opposite vectors. If vectors exaclty in the same
224
198
  * direction than returns identity Quat.
225
199
  * @static
226
- * @param {og.Vec3} source - First vector.
227
- * @param {og.Vec3} dest - Second vector.
228
- * @param {og.Vec3} up - Up vector.
229
- * @returns {og.Quat} -
200
+ * @param {Vec3} source - First vector.
201
+ * @param {Vec3} dest - Second vector.
202
+ * @param {Vec3} up - Up vector.
203
+ * @returns {Quat} -
230
204
  */
231
205
  static getRotationBetweenVectorsUp(source, dest, up) {
232
206
  var dot = source.dot(dest);
233
207
  if (Math.abs(dot + 1.0) < 0.000001) {
234
- // vector source and dest point exactly in the opposite direction,
208
+ // vector source and dest point exactly in the opposite direction,
235
209
  // so it is a 180 degrees turn around the up-axis
236
210
  return Quat.axisAngleToQuat(up, Math.PI);
237
211
  }
@@ -244,12 +218,12 @@ export class Quat {
244
218
  var rotAxis = source.cross(dest).normalize();
245
219
  return Quat.axisAngleToQuat(rotAxis, rotAngle);
246
220
  }
247
-
221
+
248
222
  /**
249
223
  * Returns true if the components are zero.
250
224
  * @public
251
- * @param {og.Quat} q - Quat to subtract.
252
- * @returns {og.Quat} -
225
+ * @param {Quat} q - Quat to subtract.
226
+ * @returns {Quat} -
253
227
  */
254
228
  isZero() {
255
229
  return this.x === 0.0 && this.y === 0.0 && this.z === 0.0 && this.w === 0.0;
@@ -258,7 +232,7 @@ export class Quat {
258
232
  /**
259
233
  * Clear Quat. Sets zeroes.
260
234
  * @public
261
- * @returns {og.Quat} -
235
+ * @returns {Quat} -
262
236
  */
263
237
  clear() {
264
238
  this.x = this.y = this.z = this.w = 0;
@@ -272,7 +246,7 @@ export class Quat {
272
246
  * @param {Number} [y=0.0] The Y component.
273
247
  * @param {Number} [z=0.0] The Z component.
274
248
  * @param {Number} [w=0.0] The W component.
275
- * @returns {og.Quat} -
249
+ * @returns {Quat} -
276
250
  */
277
251
  set(x, y, z, w) {
278
252
  this.x = x;
@@ -285,8 +259,8 @@ export class Quat {
285
259
  /**
286
260
  * Copy Quat values.
287
261
  * @public
288
- * @param {og.Quat} q - Copy Quat.
289
- * @returns {og.Quat} -
262
+ * @param {Quat} q - Copy Quat.
263
+ * @returns {Quat} -
290
264
  */
291
265
  copy(q) {
292
266
  this.x = q.x;
@@ -299,7 +273,7 @@ export class Quat {
299
273
  /**
300
274
  * Set current Quat instance to identity Quat.
301
275
  * @public
302
- * @returns {og.Quat} -
276
+ * @returns {Quat} -
303
277
  */
304
278
  setIdentity() {
305
279
  this.x = 0.0;
@@ -312,7 +286,7 @@ export class Quat {
312
286
  /**
313
287
  * Duplicates a Quat instance.
314
288
  * @public
315
- * @returns {og.Quat} -
289
+ * @returns {Quat} -
316
290
  */
317
291
  clone() {
318
292
  return new Quat(this.x, this.y, this.z, this.w);
@@ -321,8 +295,8 @@ export class Quat {
321
295
  /**
322
296
  * Computes the componentwise sum of two Quats.
323
297
  * @public
324
- * @param {og.Quat} q - Quat to add.
325
- * @returns {og.Quat} -
298
+ * @param {Quat} q - Quat to add.
299
+ * @returns {Quat} -
326
300
  */
327
301
  add(q) {
328
302
  return new Quat(this.x + q.x, this.y + q.y, this.z + q.z, this.w + q.w);
@@ -331,8 +305,8 @@ export class Quat {
331
305
  /**
332
306
  * Computes the componentwise difference of two Quats.
333
307
  * @public
334
- * @param {og.Quat} q - Quat to subtract.
335
- * @returns {og.Quat} -
308
+ * @param {Quat} q - Quat to subtract.
309
+ * @returns {Quat} -
336
310
  */
337
311
  sub(q) {
338
312
  return new Quat(this.x - q.x, this.y - q.y, this.z - q.z, this.w - q.w);
@@ -342,7 +316,7 @@ export class Quat {
342
316
  * Multiplies the provided Quat componentwise by the provided scalar.
343
317
  * @public
344
318
  * @param {Number} scale - The scalar to multiply with.
345
- * @returns {og.Quat} -
319
+ * @returns {Quat} -
346
320
  */
347
321
  scaleTo(scale) {
348
322
  return new Quat(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
@@ -352,10 +326,13 @@ export class Quat {
352
326
  * Multiplies the provided Quat componentwise.
353
327
  * @public
354
328
  * @param {Number} scale - The scalar to multiply with.
355
- * @returns {og.Quat} -
329
+ * @returns {Quat} -
356
330
  */
357
331
  scale(scale) {
358
- this.x *= scale; this.y *= scale; this.z *= scale; this.w *= scale;
332
+ this.x *= scale;
333
+ this.y *= scale;
334
+ this.z *= scale;
335
+ this.w *= scale;
359
336
  return this;
360
337
  }
361
338
 
@@ -374,7 +351,7 @@ export class Quat {
374
351
  * @param {number} lat - Latitude.
375
352
  * @param {number} lon - Longitude.
376
353
  * @param {number} angle - Angle in radians.
377
- * @returns {og.Quat} -
354
+ * @returns {Quat} -
378
355
  */
379
356
  setFromSphericalCoords(lat, lon, angle) {
380
357
  var sin_a = Math.sin(angle / 2);
@@ -393,14 +370,13 @@ export class Quat {
393
370
  /**
394
371
  * Sets rotation with the given heading and up vectors.
395
372
  * @static
396
- * @param {og.Vec3} forward - Heading target coordinates.
397
- * @param {og.Vec3} up - Up vector.
398
- * @returns {og.Quat} -
373
+ * @param {Vec3} forward - Heading target coordinates.
374
+ * @param {Vec3} up - Up vector.
375
+ * @returns {Quat} -
399
376
  */
400
377
  setLookRotation(forward, up) {
401
-
402
378
  var f = forward.normal().negate();
403
- var s = (up.cross(f)).normalize();
379
+ var s = up.cross(f).normalize();
404
380
  var u = f.cross(s);
405
381
 
406
382
  var z = 1.0 + s.x + u.y + f.z;
@@ -437,7 +413,7 @@ export class Quat {
437
413
  /**
438
414
  * Gets spherical coordinates.
439
415
  * @public
440
- * @returns {Object} Returns object with latitude, longitude and alpha.
416
+ * @returns {Object} Returns object with latitude, longitude and alpha.
441
417
  */
442
418
  toSphericalCoords() {
443
419
  var cos_a = this.w;
@@ -450,7 +426,8 @@ export class Quat {
450
426
  var ty = this.y / sin_a;
451
427
  var tz = this.z / sin_a;
452
428
 
453
- var lon, lat = -Math.asin(ty);
429
+ var lon,
430
+ lat = -Math.asin(ty);
454
431
  if (tx * tx + tz * tz < 0.0005) {
455
432
  lon = 0;
456
433
  } else {
@@ -466,9 +443,9 @@ export class Quat {
466
443
  /**
467
444
  * Sets current Quat representing a rotation around an axis.
468
445
  * @public
469
- * @param {og.Vec3} axis - The axis of rotation.
446
+ * @param {Vec3} axis - The axis of rotation.
470
447
  * @param {number} angle The angle in radians to rotate around the axis.
471
- * @returns {og.Quat} -
448
+ * @returns {Quat} -
472
449
  */
473
450
  setFromAxisAngle(axis, angle) {
474
451
  var v = axis.normal();
@@ -484,15 +461,19 @@ export class Quat {
484
461
  * @returns {Object} -
485
462
  */
486
463
  getAxisAngle() {
487
- var vl = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
464
+ let x = this.x,
465
+ y = this.y,
466
+ z = this.z,
467
+ w = this.w;
468
+ var vl = Math.sqrt(x * x + y * y + z * z);
488
469
  var axis, angle;
489
470
  if (vl > 0.0000001) {
490
471
  var ivl = 1.0 / vl;
491
472
  axis = new Vec3(x * ivl, y * ivl, z * ivl);
492
- if (this.w < 0) {
493
- angle = 2.0 * Math.atan2(-vl, -w); // -PI,0
473
+ if (w < 0) {
474
+ angle = 2.0 * Math.atan2(-vl, -w); // -PI,0
494
475
  } else {
495
- angle = 2.0 * Math.atan2(vl, w); // 0,PI
476
+ angle = 2.0 * Math.atan2(vl, w); // 0,PI
496
477
  }
497
478
  } else {
498
479
  axis = new Vec3(0, 0, 0);
@@ -507,7 +488,7 @@ export class Quat {
507
488
  * @param {number} pitch - Pitch angle in degrees.
508
489
  * @param {number} yaw - Yaw angle in degrees.
509
490
  * @param {number} roll - Roll angle in degrees.
510
- * @returns {og.Quat} -
491
+ * @returns {Quat} -
511
492
  */
512
493
  setFromEulerAngles(pitch, yaw, roll) {
513
494
  var ex = pitch * math.RADIANS_HALF,
@@ -539,8 +520,10 @@ export class Quat {
539
520
  * @returns {Object} -
540
521
  */
541
522
  getEulerAngles() {
542
-
543
- let x = this.x, y = this.y, z = this.z, w = this.w;
523
+ let x = this.x,
524
+ y = this.y,
525
+ z = this.z,
526
+ w = this.w;
544
527
 
545
528
  let sqy = y * y;
546
529
 
@@ -563,11 +546,13 @@ export class Quat {
563
546
  /**
564
547
  * Computes a Quat from the provided 4x4 matrix instance.
565
548
  * @public
566
- * @param {og.Mat4} m - The rotation matrix.
567
- * @returns {og.Quat} -
549
+ * @param {Mat4} m - The rotation matrix.
550
+ * @returns {Quat} -
568
551
  */
569
552
  setFromMatrix4(m) {
570
- var tr, s, q = [];
553
+ var tr,
554
+ s,
555
+ q = [];
571
556
  var i, j, k;
572
557
  m = m._m;
573
558
 
@@ -589,7 +574,7 @@ export class Quat {
589
574
  j = nxt[i];
590
575
  k = nxt[j];
591
576
 
592
- s = Math.sqrt((m[i * 5] - (m[j * 5] + m[k * 5])) + 1.0);
577
+ s = Math.sqrt(m[i * 5] - (m[j * 5] + m[k * 5]) + 1.0);
593
578
 
594
579
  q[i] = s * 0.5;
595
580
 
@@ -610,7 +595,7 @@ export class Quat {
610
595
  /**
611
596
  * Converts current Quat to the rotation 4x4 matrix.
612
597
  * @public
613
- * @returns {og.Mat4} -
598
+ * @returns {Mat4} -
614
599
  */
615
600
  getMat4(out) {
616
601
  var xs = this.x + this.x;
@@ -626,13 +611,30 @@ export class Quat {
626
611
  var yz = this.y * zs;
627
612
  var zz = this.z * zs;
628
613
  var m = out || new Mat4();
629
- return m.set([1 - (yy + zz), xy - wz, xz + wy, 0, xy + wz, 1 - (xx + zz), yz - wx, 0, xz - wy, yz + wx, 1 - (xx + yy), 0, 0, 0, 0, 1]);
614
+ return m.set([
615
+ 1 - (yy + zz),
616
+ xy - wz,
617
+ xz + wy,
618
+ 0,
619
+ xy + wz,
620
+ 1 - (xx + zz),
621
+ yz - wx,
622
+ 0,
623
+ xz - wy,
624
+ yz + wx,
625
+ 1 - (xx + yy),
626
+ 0,
627
+ 0,
628
+ 0,
629
+ 0,
630
+ 1
631
+ ]);
630
632
  }
631
633
 
632
634
  /**
633
635
  * Converts current Quat to the rotation 3x3 matrix.
634
636
  * @public
635
- * @returns {og.Mat3} -
637
+ * @returns {Mat3} -
636
638
  * @todo NOT TESTED
637
639
  */
638
640
  getMat3() {
@@ -658,9 +660,15 @@ export class Quat {
658
660
  h = g * h;
659
661
  g = g * i;
660
662
 
661
- mx[0] = 1 - (l + e); mx[1] = k - g; mx[2] = c + h;
662
- mx[3] = k + g; mx[4] = 1 - (j + e); mx[5] = d - f;
663
- mx[6] = c - h; mx[7] = d + f; mx[8] = 1 - (j + l);
663
+ mx[0] = 1 - (l + e);
664
+ mx[1] = k - g;
665
+ mx[2] = c + h;
666
+ mx[3] = k + g;
667
+ mx[4] = 1 - (j + e);
668
+ mx[5] = d - f;
669
+ mx[6] = c - h;
670
+ mx[7] = d + f;
671
+ mx[8] = 1 - (j + l);
664
672
 
665
673
  return m;
666
674
  }
@@ -668,11 +676,10 @@ export class Quat {
668
676
  /**
669
677
  * Returns quatrenion and vector production.
670
678
  * @public
671
- * @param {og.Vec3} v - 3d Vector.
672
- * @returns {og.Vec3} -
679
+ * @param {Vec3} v - 3d Vector.
680
+ * @returns {Vec3} -
673
681
  */
674
682
  mulVec3(v) {
675
-
676
683
  // t = 2 * cross(q.xyz, v)
677
684
  // v' = v + q.w * t + cross(q.xyz, t)
678
685
 
@@ -694,34 +701,48 @@ export class Quat {
694
701
  return new Vec3(
695
702
  i * a + d * -b + j * -h - k * -f,
696
703
  j * a + d * -f + k * -b - i * -h,
697
- k * a + d * -h + i * -f - j * -b);
704
+ k * a + d * -h + i * -f - j * -b
705
+ );
698
706
  }
699
707
 
700
708
  /**
701
709
  * Computes the product of two Quats.
702
710
  * @public
703
- * @param {og.Quat} q - Quat to multiply.
704
- * @returns {og.Quat} -
711
+ * @param {Quat} q - Quat to multiply.
712
+ * @returns {Quat} -
705
713
  */
706
714
  mul(q) {
707
- var d = this.x, e = this.y, g = this.z, a = this.w;
708
- var f = q.x, h = q.y, i = q.z, b = q.w;
715
+ var d = this.x,
716
+ e = this.y,
717
+ g = this.z,
718
+ a = this.w;
719
+ var f = q.x,
720
+ h = q.y,
721
+ i = q.z,
722
+ b = q.w;
709
723
  return new Quat(
710
724
  d * b + a * f + e * i - g * h,
711
725
  e * b + a * h + g * f - d * i,
712
726
  g * b + a * i + d * h - e * f,
713
- a * b - d * f - e * h - g * i);
727
+ a * b - d * f - e * h - g * i
728
+ );
714
729
  }
715
730
 
716
731
  /**
717
732
  * Computes the product of two Quats.
718
733
  * @public
719
- * @param {og.Quat} q - Quat to multiply.
720
- * @returns {og.Quat} -
734
+ * @param {Quat} q - Quat to multiply.
735
+ * @returns {Quat} -
721
736
  */
722
737
  mulA(q) {
723
- var d = this.x, e = this.y, g = this.z, a = this.w;
724
- var f = q.x, h = q.y, i = q.z, b = q.w;
738
+ var d = this.x,
739
+ e = this.y,
740
+ g = this.z,
741
+ a = this.w;
742
+ var f = q.x,
743
+ h = q.y,
744
+ i = q.z,
745
+ b = q.w;
725
746
  this.x = d * b + a * f + e * i - g * h;
726
747
  this.y = e * b + a * h + g * f - d * i;
727
748
  this.z = g * b + a * i + d * h - e * f;
@@ -732,16 +753,16 @@ export class Quat {
732
753
  /**
733
754
  * Gets the conjugate of the Quat.
734
755
  * @public
735
- * @returns {og.Quat} -
756
+ * @returns {Quat} -
736
757
  */
737
758
  conjugate() {
738
759
  return new Quat(-this.x, -this.y, -this.z, this.w);
739
760
  }
740
761
 
741
- /**
762
+ /**
742
763
  * Computes the inverse of the Quat.
743
764
  * @public
744
- * @returns {og.Quat} -
765
+ * @returns {Quat} -
745
766
  */
746
767
  inverse() {
747
768
  var n = 1 / this.magnitude2();
@@ -754,7 +775,10 @@ export class Quat {
754
775
  * @returns {number} -
755
776
  */
756
777
  magnitude() {
757
- var b = this.x, c = this.y, d = this.z, a = this.w;
778
+ var b = this.x,
779
+ c = this.y,
780
+ d = this.z,
781
+ a = this.w;
758
782
  return Math.sqrt(b * b + c * c + d * d + a * a);
759
783
  }
760
784
 
@@ -764,14 +788,17 @@ export class Quat {
764
788
  * @returns {number} -
765
789
  */
766
790
  magnitude2() {
767
- var b = this.x, c = this.y, d = this.z, a = this.w;
791
+ var b = this.x,
792
+ c = this.y,
793
+ d = this.z,
794
+ a = this.w;
768
795
  return b * b + c * c + d * d + a * a;
769
796
  }
770
797
 
771
798
  /**
772
799
  * Computes the dot (scalar) product of two Quats.
773
800
  * @public
774
- * @param {og.Quat} q - Second quatrnion.
801
+ * @param {Quat} q - Second quatrnion.
775
802
  * @returns {number} -
776
803
  */
777
804
  dot(q) {
@@ -781,10 +808,13 @@ export class Quat {
781
808
  /**
782
809
  * Current Quat normalization.
783
810
  * @public
784
- * @returns {og.Quat} -
811
+ * @returns {Quat} -
785
812
  */
786
813
  normalize() {
787
- var c = this.x, d = this.y, e = this.z, g = this.w,
814
+ var c = this.x,
815
+ d = this.y,
816
+ e = this.z,
817
+ g = this.w,
788
818
  f = Math.sqrt(c * c + d * d + e * e + g * g);
789
819
  if (f === 0.0) {
790
820
  this.x = 0;
@@ -804,7 +834,7 @@ export class Quat {
804
834
  /**
805
835
  * Compares two Quats.
806
836
  * @public
807
- * @param {og.Quat} q - Second quatrnion.
837
+ * @param {Quat} q - Second quatrnion.
808
838
  * @returns {Boolean} -
809
839
  */
810
840
  isEqual(q) {
@@ -818,14 +848,19 @@ export class Quat {
818
848
  /**
819
849
  * Performs a spherical linear interpolation between two Quats.
820
850
  * @public
821
- * @param {og.Quat} b - The end rotation Quat.
851
+ * @param {Quat} b - The end rotation Quat.
822
852
  * @param {number} t - interpolation amount between the two Quats.
823
- * @returns {og.Quat} -
853
+ * @returns {Quat} -
824
854
  */
825
855
  slerp(b, t) {
826
-
827
- var ax = this.x, ay = this.y, az = this.z, aw = this.w,
828
- bx = b.x, by = b.y, bz = b.z, bw = b.w;
856
+ var ax = this.x,
857
+ ay = this.y,
858
+ az = this.z,
859
+ aw = this.w,
860
+ bx = b.x,
861
+ by = b.y,
862
+ bz = b.z,
863
+ bw = b.w;
829
864
 
830
865
  var omega, cosom, sinom, scale0, scale1;
831
866
 
@@ -839,7 +874,7 @@ export class Quat {
839
874
  bw = -bw;
840
875
  }
841
876
 
842
- if ((1.0 - cosom) > 0.000001) {
877
+ if (1.0 - cosom > 0.000001) {
843
878
  omega = Math.acos(cosom);
844
879
  sinom = Math.sin(omega);
845
880
  scale0 = Math.sin((1.0 - t) * omega) / sinom;
@@ -864,7 +899,10 @@ export class Quat {
864
899
  * @returns {Number} -
865
900
  */
866
901
  getRoll(reprojectAxis) {
867
- var x = this.x, y = this.y, z = this.z, w = this.w;
902
+ var x = this.x,
903
+ y = this.y,
904
+ z = this.z,
905
+ w = this.w;
868
906
  if (reprojectAxis) {
869
907
  var fTy = 2.0 * y;
870
908
  var fTz = 2.0 * z;
@@ -885,7 +923,10 @@ export class Quat {
885
923
  * @returns {number} -
886
924
  */
887
925
  getPitch(reprojectAxis) {
888
- var x = this.x, y = this.y, z = this.z, w = this.w;
926
+ var x = this.x,
927
+ y = this.y,
928
+ z = this.z,
929
+ w = this.w;
889
930
  if (reprojectAxis) {
890
931
  var fTx = 2.0 * x;
891
932
  var fTz = 2.0 * z;
@@ -906,7 +947,10 @@ export class Quat {
906
947
  * @returns {number} -
907
948
  */
908
949
  getYaw(reprojectAxis) {
909
- var x = this.x, y = this.y, z = this.z, w = this.w;
950
+ var x = this.x,
951
+ y = this.y,
952
+ z = this.z,
953
+ w = this.w;
910
954
  if (reprojectAxis) {
911
955
  var fTx = 2.0 * x;
912
956
  var fTy = 2.0 * y;
@@ -929,9 +973,8 @@ export class Quat {
929
973
  * @param {Number} [y=0.0] The Y component.
930
974
  * @param {Number} [z=0.0] The Z component.
931
975
  * @param {Number} [w=0.0] The W component.
932
- * @returns {og.Quat} -
976
+ * @returns {Quat} -
933
977
  */
934
978
  export function quat(x, y, z, w) {
935
979
  return new Quat(x, y, z, w);
936
980
  }
937
-