@openglobus/og 0.18.0 → 0.18.2

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 (476) hide show
  1. package/README.md +8 -8
  2. package/lib/@openglobus/og.esm.js +2 -0
  3. package/lib/@openglobus/og.esm.js.map +1 -0
  4. package/lib/@openglobus/og.umd.js +2 -0
  5. package/lib/@openglobus/og.umd.js.map +1 -0
  6. package/lib/js/Clock.d.ts +106 -0
  7. package/{src/Clock.ts → lib/js/Clock.js} +31 -126
  8. package/lib/js/Deferred.d.ts +6 -0
  9. package/lib/js/Deferred.js +13 -0
  10. package/lib/js/Events.d.ts +90 -0
  11. package/{src/Events.ts → lib/js/Events.js} +29 -84
  12. package/lib/js/Extent.d.ts +145 -0
  13. package/{src/Extent.ts → lib/js/Extent.js} +74 -120
  14. package/lib/js/Globe.d.ts +132 -0
  15. package/{src/Globe.ts → lib/js/Globe.js} +61 -159
  16. package/lib/js/ImageCanvas.d.ts +128 -0
  17. package/{src/ImageCanvas.ts → lib/js/ImageCanvas.js} +24 -65
  18. package/lib/js/Lock.d.ts +15 -0
  19. package/{src/Lock.ts → lib/js/Lock.js} +7 -21
  20. package/lib/js/LonLat.d.ts +128 -0
  21. package/{src/LonLat.ts → lib/js/LonLat.js} +44 -75
  22. package/lib/js/Object3d.d.ts +49 -0
  23. package/{src/Object3d.ts → lib/js/Object3d.js} +64 -184
  24. package/lib/js/Popup.d.ts +46 -0
  25. package/{src/Popup.ts → lib/js/Popup.js} +42 -110
  26. package/lib/js/QueueArray.d.ts +16 -0
  27. package/{src/QueueArray.ts → lib/js/QueueArray.js} +12 -25
  28. package/lib/js/Rectangle.d.ts +76 -0
  29. package/{src/Rectangle.ts → lib/js/Rectangle.js} +12 -50
  30. package/lib/js/Stack.d.ts +20 -0
  31. package/{src/Stack.ts → lib/js/Stack.js} +13 -29
  32. package/lib/js/astro/astro.d.ts +39 -0
  33. package/{src/astro/astro.ts → lib/js/astro/astro.js} +2 -8
  34. package/lib/js/astro/earth.d.ts +8 -0
  35. package/{src/astro/earth.ts → lib/js/astro/earth.js} +3 -39
  36. package/lib/js/astro/jd.d.ts +234 -0
  37. package/{src/astro/jd.ts → lib/js/astro/jd.js} +55 -134
  38. package/lib/js/astro/orbit.d.ts +5 -0
  39. package/{src/astro/orbit.ts → lib/js/astro/orbit.js} +26 -39
  40. package/lib/js/astro/rotation.d.ts +2 -0
  41. package/{src/astro/rotation.ts → lib/js/astro/rotation.js} +2 -11
  42. package/lib/js/bv/Box.d.ts +32 -0
  43. package/{src/bv/Box.ts → lib/js/bv/Box.js} +7 -35
  44. package/lib/js/bv/Sphere.d.ts +37 -0
  45. package/{src/bv/Sphere.ts → lib/js/bv/Sphere.js} +6 -34
  46. package/{src/bv/index.ts → lib/js/bv/index.d.ts} +0 -1
  47. package/lib/js/bv/index.js +3 -0
  48. package/lib/js/camera/Camera.d.ts +314 -0
  49. package/{src/camera/Camera.ts → lib/js/camera/Camera.js} +77 -326
  50. package/lib/js/camera/Frustum.d.ts +139 -0
  51. package/{src/camera/Frustum.ts → lib/js/camera/Frustum.js} +66 -185
  52. package/lib/js/camera/PlanetCamera.d.ts +234 -0
  53. package/{src/camera/PlanetCamera.ts → lib/js/camera/PlanetCamera.js} +65 -338
  54. package/{src/camera/index.ts → lib/js/camera/index.d.ts} +0 -1
  55. package/lib/js/camera/index.js +3 -0
  56. package/lib/js/cons.d.ts +40 -0
  57. package/{src/cons.ts → lib/js/cons.js} +10 -22
  58. package/lib/js/control/Atmosphere.d.ts +16 -0
  59. package/{src/control/Atmosphere.ts → lib/js/control/Atmosphere.js} +33 -86
  60. package/lib/js/control/CompassButton.d.ts +16 -0
  61. package/{src/control/CompassButton.ts → lib/js/control/CompassButton.js} +18 -43
  62. package/lib/js/control/Control.d.ts +100 -0
  63. package/{src/control/Control.ts → lib/js/control/Control.js} +22 -89
  64. package/lib/js/control/DebugInfo.d.ts +25 -0
  65. package/{src/control/DebugInfo.ts → lib/js/control/DebugInfo.js} +38 -84
  66. package/lib/js/control/DrawingSwitcher.d.ts +13 -0
  67. package/{src/control/DrawingSwitcher.ts → lib/js/control/DrawingSwitcher.js} +13 -30
  68. package/lib/js/control/EarthCoordinates.d.ts +41 -0
  69. package/{src/control/EarthCoordinates.ts → lib/js/control/EarthCoordinates.js} +58 -119
  70. package/lib/js/control/EarthNavigation.d.ts +50 -0
  71. package/{src/control/EarthNavigation.ts → lib/js/control/EarthNavigation.js} +70 -161
  72. package/lib/js/control/GeoImageDragControl.d.ts +22 -0
  73. package/{src/control/GeoImageDragControl.ts → lib/js/control/GeoImageDragControl.js} +26 -49
  74. package/lib/js/control/KeyboardNavigation.d.ts +28 -0
  75. package/{src/control/KeyboardNavigation.ts → lib/js/control/KeyboardNavigation.js} +67 -92
  76. package/lib/js/control/LayerAnimation.d.ts +71 -0
  77. package/{src/control/LayerAnimation.ts → lib/js/control/LayerAnimation.js} +82 -162
  78. package/lib/js/control/LayerSwitcher.d.ts +21 -0
  79. package/{src/control/LayerSwitcher.ts → lib/js/control/LayerSwitcher.js} +16 -41
  80. package/lib/js/control/Lighting.d.ts +49 -0
  81. package/{src/control/Lighting.ts → lib/js/control/Lighting.js} +106 -219
  82. package/lib/js/control/MouseNavigation.d.ts +62 -0
  83. package/{src/control/MouseNavigation.ts → lib/js/control/MouseNavigation.js} +105 -211
  84. package/lib/js/control/MouseWheelZoomControl.d.ts +44 -0
  85. package/lib/js/control/MouseWheelZoomControl.js +181 -0
  86. package/lib/js/control/RulerSwitcher.d.ts +17 -0
  87. package/{src/control/RulerSwitcher.ts → lib/js/control/RulerSwitcher.js} +13 -28
  88. package/lib/js/control/ScaleControl.d.ts +24 -0
  89. package/lib/js/control/ScaleControl.js +91 -0
  90. package/lib/js/control/SegmentBoundVisualization.d.ts +12 -0
  91. package/lib/js/control/SegmentBoundVisualization.js +37 -0
  92. package/lib/js/control/ShowFps.d.ts +9 -0
  93. package/lib/js/control/ShowFps.js +20 -0
  94. package/lib/js/control/SimpleNavigation.d.ts +25 -0
  95. package/{src/control/SimpleNavigation.ts → lib/js/control/SimpleNavigation.js} +29 -51
  96. package/lib/js/control/SimpleSkyBackground.d.ts +15 -0
  97. package/{src/control/SimpleSkyBackground.ts → lib/js/control/SimpleSkyBackground.js} +21 -48
  98. package/lib/js/control/Sun.d.ts +33 -0
  99. package/{src/control/Sun.ts → lib/js/control/Sun.js} +34 -85
  100. package/lib/js/control/ToggleWireframe.d.ts +14 -0
  101. package/lib/js/control/ToggleWireframe.js +28 -0
  102. package/lib/js/control/TouchNavigation.d.ts +52 -0
  103. package/{src/control/TouchNavigation.ts → lib/js/control/TouchNavigation.js} +88 -193
  104. package/lib/js/control/ZoomControl.d.ts +27 -0
  105. package/{src/control/ZoomControl.ts → lib/js/control/ZoomControl.js} +25 -50
  106. package/lib/js/control/drawing/DrawingControl.d.ts +12 -0
  107. package/{src/control/drawing/DrawingControl.ts → lib/js/control/drawing/DrawingControl.js} +10 -20
  108. package/lib/js/control/drawing/LineStringDrawingScene.d.ts +15 -0
  109. package/{src/control/drawing/LineStringDrawingScene.ts → lib/js/control/drawing/LineStringDrawingScene.js} +28 -85
  110. package/lib/js/control/drawing/PolygonDrawingScene.d.ts +98 -0
  111. package/{src/control/drawing/PolygonDrawingScene.ts → lib/js/control/drawing/PolygonDrawingScene.js} +190 -388
  112. package/lib/js/control/elevationProfile/ElevationProfile.d.ts +61 -0
  113. package/{src/control/elevationProfile/ElevationProfile.ts → lib/js/control/elevationProfile/ElevationProfile.js} +56 -148
  114. package/lib/js/control/heightRuler/HeightRuler.d.ts +7 -0
  115. package/{src/control/heightRuler/HeightRuler.ts → lib/js/control/heightRuler/HeightRuler.js} +4 -9
  116. package/lib/js/control/heightRuler/HeightRulerScene.d.ts +35 -0
  117. package/{src/control/heightRuler/HeightRulerScene.ts → lib/js/control/heightRuler/HeightRulerScene.js} +47 -99
  118. package/lib/js/control/heightRuler/HeightRulerSwitcher.d.ts +6 -0
  119. package/{src/control/heightRuler/HeightRulerSwitcher.ts → lib/js/control/heightRuler/HeightRulerSwitcher.js} +2 -4
  120. package/{src/control/index.ts → lib/js/control/index.d.ts} +1 -18
  121. package/lib/js/control/index.js +28 -0
  122. package/lib/js/control/ruler/Ruler.d.ts +13 -0
  123. package/lib/js/control/ruler/Ruler.js +23 -0
  124. package/lib/js/control/ruler/RulerScene.d.ts +88 -0
  125. package/lib/js/control/ruler/RulerScene.js +324 -0
  126. package/lib/js/control/selection/Selection.d.ts +55 -0
  127. package/{src/control/selection/Selection.ts → lib/js/control/selection/Selection.js} +15 -34
  128. package/lib/js/control/selection/SelectionScene.d.ts +44 -0
  129. package/{src/control/selection/SelectionScene.ts → lib/js/control/selection/SelectionScene.js} +26 -113
  130. package/lib/js/control/timeline/TimelineControl.d.ts +18 -0
  131. package/{src/control/timeline/TimelineControl.ts → lib/js/control/timeline/TimelineControl.js} +13 -43
  132. package/lib/js/control/timeline/TimelineModel.d.ts +41 -0
  133. package/{src/control/timeline/TimelineModel.ts → lib/js/control/timeline/TimelineModel.js} +26 -74
  134. package/lib/js/control/timeline/TimelineView.d.ts +85 -0
  135. package/{src/control/timeline/TimelineView.ts → lib/js/control/timeline/TimelineView.js} +133 -281
  136. package/lib/js/control/timeline/timelineUtils.d.ts +12 -0
  137. package/lib/js/control/timeline/timelineUtils.js +112 -0
  138. package/lib/js/control/visibleExtent/Segment.d.ts +277 -0
  139. package/{src → lib/js}/control/visibleExtent/Segment.js +145 -698
  140. package/lib/js/control/visibleExtent/VisibleExtent.d.ts +5 -0
  141. package/{src → lib/js}/control/visibleExtent/VisibleExtent.js +1 -18
  142. package/lib/js/control/visibleExtent/drawnode.d.ts +7 -0
  143. package/{src/control/visibleExtent/drawnode.ts → lib/js/control/visibleExtent/drawnode.js} +1 -28
  144. package/lib/js/ellipsoid/Ellipsoid.d.ts +187 -0
  145. package/{src/ellipsoid/Ellipsoid.ts → lib/js/ellipsoid/Ellipsoid.js} +85 -267
  146. package/lib/js/ellipsoid/index.d.ts +3 -0
  147. package/lib/js/ellipsoid/index.js +3 -0
  148. package/lib/js/ellipsoid/wgs84.d.ts +6 -0
  149. package/{src/ellipsoid/wgs84.ts → lib/js/ellipsoid/wgs84.js} +1 -2
  150. package/lib/js/entity/BaseBillboard.d.ts +222 -0
  151. package/{src/entity/BaseBillboard.ts → lib/js/entity/BaseBillboard.js} +48 -165
  152. package/lib/js/entity/BaseBillboardHandler.d.ts +81 -0
  153. package/{src/entity/BaseBillboardHandler.ts → lib/js/entity/BaseBillboardHandler.js} +139 -365
  154. package/lib/js/entity/Billboard.d.ts +113 -0
  155. package/{src/entity/Billboard.ts → lib/js/entity/Billboard.js} +19 -83
  156. package/lib/js/entity/BillboardHandler.d.ts +15 -0
  157. package/{src/entity/BillboardHandler.ts → lib/js/entity/BillboardHandler.js} +27 -59
  158. package/lib/js/entity/Entity.d.ts +354 -0
  159. package/{src/entity/Entity.ts → lib/js/entity/Entity.js} +102 -374
  160. package/lib/js/entity/EntityCollection.d.ts +363 -0
  161. package/{src/entity/EntityCollection.ts → lib/js/entity/EntityCollection.js} +57 -359
  162. package/lib/js/entity/GeoObject.d.ts +138 -0
  163. package/{src/entity/GeoObject.ts → lib/js/entity/GeoObject.js} +41 -146
  164. package/lib/js/entity/GeoObjectHandler.d.ts +99 -0
  165. package/{src/entity/GeoObjectHandler.ts → lib/js/entity/GeoObjectHandler.js} +162 -423
  166. package/lib/js/entity/Geometry.d.ts +111 -0
  167. package/lib/js/entity/Geometry.js +283 -0
  168. package/lib/js/entity/GeometryHandler.d.ts +84 -0
  169. package/{src/entity/GeometryHandler.ts → lib/js/entity/GeometryHandler.js} +162 -657
  170. package/lib/js/entity/Label.d.ts +207 -0
  171. package/{src/entity/Label.ts → lib/js/entity/Label.js} +63 -165
  172. package/lib/js/entity/LabelHandler.d.ts +65 -0
  173. package/{src/entity/LabelHandler.ts → lib/js/entity/LabelHandler.js} +175 -408
  174. package/lib/js/entity/LabelWorker.d.ts +15 -0
  175. package/{src/entity/LabelWorker.ts → lib/js/entity/LabelWorker.js} +24 -45
  176. package/lib/js/entity/PointCloud.d.ts +179 -0
  177. package/{src/entity/PointCloud.ts → lib/js/entity/PointCloud.js} +65 -265
  178. package/lib/js/entity/PointCloudHandler.d.ts +42 -0
  179. package/{src/entity/PointCloudHandler.ts → lib/js/entity/PointCloudHandler.js} +19 -62
  180. package/lib/js/entity/Polyline.d.ts +337 -0
  181. package/{src/entity/Polyline.ts → lib/js/entity/Polyline.js} +289 -924
  182. package/lib/js/entity/PolylineHandler.d.ts +22 -0
  183. package/{src/entity/PolylineHandler.ts → lib/js/entity/PolylineHandler.js} +12 -37
  184. package/lib/js/entity/Ray.d.ts +133 -0
  185. package/{src/entity/Ray.ts → lib/js/entity/Ray.js} +26 -146
  186. package/lib/js/entity/RayHandler.d.ts +70 -0
  187. package/{src/entity/RayHandler.ts → lib/js/entity/RayHandler.js} +102 -342
  188. package/lib/js/entity/Strip.d.ts +127 -0
  189. package/{src/entity/Strip.ts → lib/js/entity/Strip.js} +102 -372
  190. package/lib/js/entity/StripHandler.d.ts +42 -0
  191. package/{src/entity/StripHandler.ts → lib/js/entity/StripHandler.js} +22 -74
  192. package/{src/entity/index.ts → lib/js/entity/index.d.ts} +1 -2
  193. package/lib/js/entity/index.js +11 -0
  194. package/lib/js/index.d.ts +33 -0
  195. package/lib/js/index.js +33 -0
  196. package/lib/js/input/KeyboardHandler.d.ts +33 -0
  197. package/{src/input/KeyboardHandler.ts → lib/js/input/KeyboardHandler.js} +45 -84
  198. package/lib/js/input/MouseHandler.d.ts +16 -0
  199. package/{src/input/MouseHandler.ts → lib/js/input/MouseHandler.js} +12 -36
  200. package/lib/js/input/TouchHandler.d.ts +11 -0
  201. package/{src/input/TouchHandler.ts → lib/js/input/TouchHandler.js} +11 -23
  202. package/lib/js/input/input.d.ts +3 -0
  203. package/{src/input/input.ts → lib/js/input/input.js} +1 -1
  204. package/lib/js/layer/BaseGeoImage.d.ts +145 -0
  205. package/{src/layer/BaseGeoImage.ts → lib/js/layer/BaseGeoImage.js} +70 -235
  206. package/lib/js/layer/CanvasTiles.d.ts +103 -0
  207. package/{src/layer/CanvasTiles.ts → lib/js/layer/CanvasTiles.js} +54 -146
  208. package/lib/js/layer/GeoImage.d.ts +61 -0
  209. package/{src/layer/GeoImage.ts → lib/js/layer/GeoImage.js} +24 -54
  210. package/lib/js/layer/GeoTexture2d.d.ts +17 -0
  211. package/lib/js/layer/GeoTexture2d.js +37 -0
  212. package/lib/js/layer/GeoVideo.d.ts +68 -0
  213. package/{src/layer/GeoVideo.ts → lib/js/layer/GeoVideo.js} +31 -61
  214. package/lib/js/layer/KML.d.ts +72 -0
  215. package/{src/layer/KML.ts → lib/js/layer/KML.js} +94 -138
  216. package/lib/js/layer/Layer.d.ts +401 -0
  217. package/{src/layer/Layer.ts → lib/js/layer/Layer.js} +92 -443
  218. package/lib/js/layer/Material.d.ts +34 -0
  219. package/{src/layer/Material.ts → lib/js/layer/Material.js} +9 -43
  220. package/lib/js/layer/Vector.d.ts +243 -0
  221. package/{src/layer/Vector.ts → lib/js/layer/Vector.js} +155 -426
  222. package/lib/js/layer/WMS.d.ts +75 -0
  223. package/{src/layer/WMS.ts → lib/js/layer/WMS.js} +18 -100
  224. package/lib/js/layer/XYZ.d.ts +149 -0
  225. package/{src/layer/XYZ.ts → lib/js/layer/XYZ.js} +71 -171
  226. package/lib/js/layer/index.d.ts +11 -0
  227. package/lib/js/layer/index.js +11 -0
  228. package/lib/js/light/LightSource.d.ts +174 -0
  229. package/{src/light/LightSource.ts → lib/js/light/LightSource.js} +22 -131
  230. package/lib/js/math/Line2.d.ts +11 -0
  231. package/{src/math/Line2.ts → lib/js/math/Line2.js} +5 -15
  232. package/lib/js/math/Line3.d.ts +28 -0
  233. package/lib/js/math/Line3.js +85 -0
  234. package/lib/js/math/Mat3.d.ts +77 -0
  235. package/{src/math/Mat3.ts → lib/js/math/Mat3.js} +22 -51
  236. package/lib/js/math/Mat4.d.ts +195 -0
  237. package/{src/math/Mat4.ts → lib/js/math/Mat4.js} +53 -219
  238. package/lib/js/math/Plane.d.ts +20 -0
  239. package/{src/math/Plane.ts → lib/js/math/Plane.js} +26 -40
  240. package/lib/js/math/Quat.d.ts +373 -0
  241. package/{src/math/Quat.ts → lib/js/math/Quat.js} +106 -319
  242. package/lib/js/math/Ray.d.ts +76 -0
  243. package/{src/math/Ray.ts → lib/js/math/Ray.js} +21 -66
  244. package/lib/js/math/Vec2.d.ts +310 -0
  245. package/{src/math/Vec2.ts → lib/js/math/Vec2.js} +55 -121
  246. package/lib/js/math/Vec3.d.ts +472 -0
  247. package/{src/math/Vec3.ts → lib/js/math/Vec3.js} +103 -236
  248. package/lib/js/math/Vec4.d.ts +163 -0
  249. package/{src/math/Vec4.ts → lib/js/math/Vec4.js} +23 -79
  250. package/lib/js/math/coder.d.ts +51 -0
  251. package/{src/math/coder.ts → lib/js/math/coder.js} +14 -20
  252. package/lib/js/math/index.d.ts +11 -0
  253. package/lib/js/math/index.js +11 -0
  254. package/lib/js/math.d.ts +266 -0
  255. package/{src/math.ts → lib/js/math.js} +37 -85
  256. package/lib/js/mercator.d.ts +92 -0
  257. package/{src/mercator.ts → lib/js/mercator.js} +13 -37
  258. package/lib/js/proj/EPSG3857.d.ts +9 -0
  259. package/{src/proj/EPSG3857.ts → lib/js/proj/EPSG3857.js} +0 -2
  260. package/lib/js/proj/EPSG4326.d.ts +9 -0
  261. package/{src/proj/EPSG4326.ts → lib/js/proj/EPSG4326.js} +0 -2
  262. package/lib/js/proj/Proj.d.ts +43 -0
  263. package/{src/proj/Proj.ts → lib/js/proj/Proj.js} +4 -29
  264. package/lib/js/quadTree/EPSG4326QuadTreeStrategy.d.ts +6 -0
  265. package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +17 -0
  266. package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +6 -0
  267. package/lib/js/quadTree/EarthQuadTreeStrategy.js +19 -0
  268. package/lib/js/quadTree/EntityCollectionNode.d.ts +54 -0
  269. package/{src/quadTree/EntityCollectionNode.ts → lib/js/quadTree/EntityCollectionNode.js} +83 -150
  270. package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +6 -0
  271. package/lib/js/quadTree/MarsQuadTreeStrategy.js +17 -0
  272. package/lib/js/quadTree/Node.d.ts +61 -0
  273. package/{src/quadTree/Node.ts → lib/js/quadTree/Node.js} +140 -357
  274. package/lib/js/quadTree/QuadTreeStrategy.d.ts +25 -0
  275. package/{src/quadTree/QuadTreeStrategy.ts → lib/js/quadTree/QuadTreeStrategy.js} +13 -44
  276. package/lib/js/quadTree/Wgs84QuadTreeStrategy.d.ts +6 -0
  277. package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +15 -0
  278. package/lib/js/quadTree/index.d.ts +12 -0
  279. package/lib/js/quadTree/index.js +12 -0
  280. package/lib/js/quadTree/quadTree.d.ts +40 -0
  281. package/{src/quadTree/quadTree.ts → lib/js/quadTree/quadTree.js} +0 -9
  282. package/lib/js/renderer/Renderer.d.ts +320 -0
  283. package/{src/renderer/Renderer.ts → lib/js/renderer/Renderer.js} +265 -622
  284. package/lib/js/renderer/RendererEvents.d.ts +239 -0
  285. package/{src/renderer/RendererEvents.ts → lib/js/renderer/RendererEvents.js} +158 -472
  286. package/lib/js/scene/Axes.d.ts +12 -0
  287. package/lib/js/scene/Axes.js +59 -0
  288. package/lib/js/scene/BaseNode.d.ts +61 -0
  289. package/{src/scene/BaseNode.ts → lib/js/scene/BaseNode.js} +11 -57
  290. package/lib/js/scene/Planet.d.ts +623 -0
  291. package/{src/scene/Planet.ts → lib/js/scene/Planet.js} +257 -937
  292. package/lib/js/scene/RenderNode.d.ts +150 -0
  293. package/{src/scene/RenderNode.ts → lib/js/scene/RenderNode.js} +33 -138
  294. package/lib/js/scene/SkyBox.d.ts +13 -0
  295. package/{src/scene/SkyBox.ts → lib/js/scene/SkyBox.js} +16 -37
  296. package/{src/scene/index.ts → lib/js/scene/index.d.ts} +0 -1
  297. package/lib/js/scene/index.js +5 -0
  298. package/lib/js/segment/Segment.d.ts +278 -0
  299. package/{src/segment/Segment.ts → lib/js/segment/Segment.js} +242 -913
  300. package/lib/js/segment/SegmentLonLat.d.ts +48 -0
  301. package/{src/segment/SegmentLonLat.ts → lib/js/segment/SegmentLonLat.js} +58 -132
  302. package/lib/js/segment/SegmentLonLatWgs84.d.ts +10 -0
  303. package/lib/js/segment/SegmentLonLatWgs84.js +23 -0
  304. package/lib/js/segment/Slice.d.ts +13 -0
  305. package/{src/segment/Slice.ts → lib/js/segment/Slice.js} +4 -22
  306. package/lib/js/segment/segmentHelper.d.ts +18 -0
  307. package/{src/segment/segmentHelper.ts → lib/js/segment/segmentHelper.js} +30 -88
  308. package/lib/js/shaders/atmos.d.ts +4 -0
  309. package/{src/shaders/atmos.ts → lib/js/shaders/atmos.js} +8 -26
  310. package/lib/js/shaders/billboard.d.ts +3 -0
  311. package/{src/shaders/billboard.ts → lib/js/shaders/billboard.js} +9 -18
  312. package/lib/js/shaders/bloom.d.ts +2 -0
  313. package/{src/shaders/bloom.ts → lib/js/shaders/bloom.js} +5 -8
  314. package/lib/js/shaders/blur.d.ts +3 -0
  315. package/{src/shaders/blur.ts → lib/js/shaders/blur.js} +11 -19
  316. package/lib/js/shaders/depth.d.ts +2 -0
  317. package/{src/shaders/depth.ts → lib/js/shaders/depth.js} +3 -6
  318. package/lib/js/shaders/drawnode.d.ts +8 -0
  319. package/{src/shaders/drawnode.ts → lib/js/shaders/drawnode.js} +23 -75
  320. package/lib/js/shaders/geoObject.d.ts +3 -0
  321. package/{src/shaders/geoObject.ts → lib/js/shaders/geoObject.js} +51 -63
  322. package/lib/js/shaders/label.d.ts +4 -0
  323. package/{src/shaders/label.ts → lib/js/shaders/label.js} +12 -25
  324. package/lib/js/shaders/lumFilter.d.ts +2 -0
  325. package/{src/shaders/lumFilter.ts → lib/js/shaders/lumFilter.js} +4 -7
  326. package/lib/js/shaders/pickingMask.d.ts +2 -0
  327. package/{src/shaders/pickingMask.ts → lib/js/shaders/pickingMask.js} +5 -8
  328. package/lib/js/shaders/pointCloud.d.ts +2 -0
  329. package/{src/shaders/pointCloud.ts → lib/js/shaders/pointCloud.js} +4 -7
  330. package/lib/js/shaders/polyline.d.ts +3 -0
  331. package/{src/shaders/polyline.ts → lib/js/shaders/polyline.js} +7 -22
  332. package/lib/js/shaders/ray.d.ts +2 -0
  333. package/{src/shaders/ray.ts → lib/js/shaders/ray.js} +4 -7
  334. package/lib/js/shaders/screenFrame.d.ts +2 -0
  335. package/{src/shaders/screenFrame.ts → lib/js/shaders/screenFrame.js} +5 -8
  336. package/lib/js/shaders/skybox.d.ts +2 -0
  337. package/{src/shaders/skybox.ts → lib/js/shaders/skybox.js} +10 -13
  338. package/lib/js/shaders/toneMapping.d.ts +2 -0
  339. package/{src/shaders/toneMapping.ts → lib/js/shaders/toneMapping.js} +5 -8
  340. package/lib/js/shaders/utils.d.ts +1 -0
  341. package/{src/shaders/utils.ts → lib/js/shaders/utils.js} +1 -1
  342. package/lib/js/terrain/BilTerrain.d.ts +18 -0
  343. package/{src/terrain/BilTerrain.ts → lib/js/terrain/BilTerrain.js} +21 -118
  344. package/lib/js/terrain/EmptyTerrain.d.ts +106 -0
  345. package/{src/terrain/EmptyTerrain.ts → lib/js/terrain/EmptyTerrain.js} +20 -144
  346. package/lib/js/terrain/Geoid.d.ts +33 -0
  347. package/lib/js/terrain/Geoid.js +191 -0
  348. package/lib/js/terrain/GlobusTerrain.d.ts +134 -0
  349. package/{src/terrain/GlobusTerrain.ts → lib/js/terrain/GlobusTerrain.js} +84 -241
  350. package/lib/js/terrain/MapboxTerrain.d.ts +21 -0
  351. package/{src/terrain/MapboxTerrain.ts → lib/js/terrain/MapboxTerrain.js} +46 -215
  352. package/{src/terrain/index.ts → lib/js/terrain/index.d.ts} +0 -1
  353. package/lib/js/terrain/index.js +5 -0
  354. package/lib/js/ui/Button.d.ts +32 -0
  355. package/lib/js/ui/Button.js +78 -0
  356. package/lib/js/ui/ButtonGroup.d.ts +16 -0
  357. package/lib/js/ui/ButtonGroup.js +41 -0
  358. package/lib/js/ui/Dialog.d.ts +55 -0
  359. package/lib/js/ui/Dialog.js +173 -0
  360. package/lib/js/ui/Slider.d.ts +38 -0
  361. package/lib/js/ui/Slider.js +129 -0
  362. package/lib/js/ui/ToggleButton.d.ts +20 -0
  363. package/lib/js/ui/ToggleButton.js +42 -0
  364. package/lib/js/ui/View.d.ts +37 -0
  365. package/{src/ui/View.ts → lib/js/ui/View.js} +31 -77
  366. package/lib/js/ui/icons.d.ts +1 -0
  367. package/{src/ui/icons.ts → lib/js/ui/icons.js} +1 -1
  368. package/lib/js/utils/BaseWorker.d.ts +14 -0
  369. package/{src/utils/BaseWorker.ts → lib/js/utils/BaseWorker.js} +15 -28
  370. package/lib/js/utils/FontAtlas.d.ts +82 -0
  371. package/{src/utils/FontAtlas.ts → lib/js/utils/FontAtlas.js} +46 -182
  372. package/lib/js/utils/GeoImageCreator.d.ts +34 -0
  373. package/{src/utils/GeoImageCreator.ts → lib/js/utils/GeoImageCreator.js} +34 -91
  374. package/lib/js/utils/ImagesCacheManager.d.ts +22 -0
  375. package/{src/utils/ImagesCacheManager.ts → lib/js/utils/ImagesCacheManager.js} +16 -38
  376. package/lib/js/utils/Loader.d.ts +63 -0
  377. package/lib/js/utils/Loader.js +156 -0
  378. package/lib/js/utils/NormalMapCreator.d.ts +52 -0
  379. package/{src/utils/NormalMapCreator.ts → lib/js/utils/NormalMapCreator.js} +64 -195
  380. package/lib/js/utils/PlainSegmentWorker.d.ts +24 -0
  381. package/{src/utils/PlainSegmentWorker.ts → lib/js/utils/PlainSegmentWorker.js} +24 -56
  382. package/lib/js/utils/TerrainWorker.d.ts +28 -0
  383. package/{src/utils/TerrainWorker.ts → lib/js/utils/TerrainWorker.js} +19 -56
  384. package/lib/js/utils/TextureAtlas.d.ts +113 -0
  385. package/{src/utils/TextureAtlas.ts → lib/js/utils/TextureAtlas.js} +40 -131
  386. package/lib/js/utils/VectorTileCreator.d.ts +18 -0
  387. package/{src/utils/VectorTileCreator.ts → lib/js/utils/VectorTileCreator.js} +61 -147
  388. package/lib/js/utils/colorTable.d.ts +3 -0
  389. package/{src/utils/colorTable.ts → lib/js/utils/colorTable.js} +2 -2
  390. package/lib/js/utils/earcut.d.ts +7 -0
  391. package/{src/utils/earcut.ts → lib/js/utils/earcut.js} +95 -223
  392. package/lib/js/utils/objParser.d.ts +24 -0
  393. package/{src/utils/objParser.ts → lib/js/utils/objParser.js} +38 -93
  394. package/lib/js/utils/shared.d.ts +267 -0
  395. package/{src/utils/shared.ts → lib/js/utils/shared.js} +185 -342
  396. package/lib/js/utils/units.d.ts +16 -0
  397. package/lib/js/utils/units.js +61 -0
  398. package/lib/js/webgl/BaseFramebuffer.d.ts +53 -0
  399. package/{src/webgl/BaseFramebuffer.ts → lib/js/webgl/BaseFramebuffer.js} +22 -59
  400. package/lib/js/webgl/Framebuffer.d.ts +69 -0
  401. package/{src/webgl/Framebuffer.ts → lib/js/webgl/Framebuffer.js} +30 -87
  402. package/lib/js/webgl/Handler.d.ts +473 -0
  403. package/{src/webgl/Handler.ts → lib/js/webgl/Handler.js} +175 -586
  404. package/lib/js/webgl/Multisample.d.ts +27 -0
  405. package/lib/js/webgl/Multisample.js +77 -0
  406. package/lib/js/webgl/Program.d.ts +159 -0
  407. package/{src/webgl/Program.ts → lib/js/webgl/Program.js} +73 -210
  408. package/lib/js/webgl/ProgramController.d.ts +86 -0
  409. package/{src/webgl/ProgramController.ts → lib/js/webgl/ProgramController.js} +11 -45
  410. package/{src/webgl/index.ts → lib/js/webgl/index.d.ts} +1 -8
  411. package/lib/js/webgl/index.js +6 -0
  412. package/lib/js/webgl/types.d.ts +9 -0
  413. package/{src/webgl/types.ts → lib/js/webgl/types.js} +5 -8
  414. package/lib/js/webgl/variableHandlers.d.ts +22 -0
  415. package/lib/js/webgl/variableHandlers.js +78 -0
  416. package/package.json +23 -34
  417. package/dist/@openglobus/og.esm.js +0 -2
  418. package/dist/@openglobus/og.esm.js.map +0 -1
  419. package/dist/@openglobus/og.umd.js +0 -2
  420. package/dist/@openglobus/og.umd.js.map +0 -1
  421. package/src/Deferred.ts +0 -17
  422. package/src/control/MouseWheelZoomControl.ts +0 -269
  423. package/src/control/ScaleControl.ts +0 -131
  424. package/src/control/SegmentBoundVisualization.ts +0 -50
  425. package/src/control/ShowFps.ts +0 -28
  426. package/src/control/ToggleWireframe.ts +0 -35
  427. package/src/control/ruler/Ruler.ts +0 -35
  428. package/src/control/ruler/RulerScene.ts +0 -437
  429. package/src/control/timeline/timelineUtils.ts +0 -133
  430. package/src/ellipsoid/index.ts +0 -4
  431. package/src/entity/Geometry.ts +0 -486
  432. package/src/index.ts +0 -173
  433. package/src/layer/GeoTexture2d.ts +0 -56
  434. package/src/layer/index.ts +0 -12
  435. package/src/math/Line3.ts +0 -162
  436. package/src/math/index.ts +0 -26
  437. package/src/quadTree/EPSG4326QuadTreeStrategy.ts +0 -24
  438. package/src/quadTree/EarthQuadTreeStrategy.ts +0 -28
  439. package/src/quadTree/MarsQuadTreeStrategy.ts +0 -25
  440. package/src/quadTree/Wgs84QuadTreeStrategy.ts +0 -22
  441. package/src/quadTree/index.ts +0 -14
  442. package/src/scene/Axes.ts +0 -78
  443. package/src/segment/SegmentLonLatWgs84.ts +0 -33
  444. package/src/terrain/Geoid.ts +0 -273
  445. package/src/ui/Button.ts +0 -121
  446. package/src/ui/ButtonGroup.ts +0 -63
  447. package/src/ui/Dialog.ts +0 -244
  448. package/src/ui/Slider.ts +0 -188
  449. package/src/ui/ToggleButton.ts +0 -68
  450. package/src/utils/Loader.ts +0 -247
  451. package/src/utils/units.ts +0 -78
  452. package/src/webgl/Multisample.ts +0 -153
  453. package/src/webgl/variableHandlers.ts +0 -114
  454. /package/{dist → lib}/@openglobus/og.css +0 -0
  455. /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.json +0 -0
  456. /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.cfg +0 -0
  457. /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
  458. /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.json +0 -0
  459. /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.cfg +0 -0
  460. /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
  461. /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.json +0 -0
  462. /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.cfg +0 -0
  463. /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
  464. /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.json +0 -0
  465. /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +0 -0
  466. /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
  467. /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.json +0 -0
  468. /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +0 -0
  469. /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
  470. /package/{dist → lib}/@openglobus/res/fonts/arial.js +0 -0
  471. /package/{dist → lib}/@openglobus/res/fonts/arial.json +0 -0
  472. /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.cfg +0 -0
  473. /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.png +0 -0
  474. /package/{dist → lib}/@openglobus/res/night-4326.png +0 -0
  475. /package/{dist → lib}/@openglobus/res/night.png +0 -0
  476. /package/{dist → lib}/@openglobus/res/spec.png +0 -0
@@ -0,0 +1,76 @@
1
+ import { Box } from "../bv/Box";
2
+ import { Sphere } from "../bv/Sphere";
3
+ import { Vec3 } from "./Vec3";
4
+ /**
5
+ * Represents a ray that extends infinitely from the provided origin in the provided direction.
6
+ * @class
7
+ * @param {Vec3} origin - The origin of the ray.
8
+ * @param {Vec3} direction - The direction of the ray.
9
+ */
10
+ export declare class Ray {
11
+ /**
12
+ * The origin of the ray.
13
+ * @public
14
+ * @type {Vec3}
15
+ */
16
+ origin: Vec3;
17
+ /**
18
+ * The direction of the ray.
19
+ * @public
20
+ * @type {Vec3}
21
+ */
22
+ direction: Vec3;
23
+ constructor(origin?: Vec3, direction?: Vec3);
24
+ /** @const */
25
+ static get OUTSIDE(): number;
26
+ /** @const */
27
+ static get INSIDE(): number;
28
+ /** @const */
29
+ static get INPLANE(): number;
30
+ /** @const */
31
+ static get AWAY(): number;
32
+ /**
33
+ * Sets a ray parameters.
34
+ * @public
35
+ * @param {Vec3} origin - The origin of the ray.
36
+ * @param {Vec3} direction - The direction of the ray.
37
+ * @returns {Ray}
38
+ */
39
+ set(origin: Vec3, direction: Vec3): Ray;
40
+ /**
41
+ * Computes the point along the ray on the distance.
42
+ * @public
43
+ * @param {number} distance - Point distance.
44
+ * @returns {Vec3}
45
+ */
46
+ getPoint(distance: number): Vec3;
47
+ /**
48
+ * Returns ray hit a triange result.
49
+ * @public
50
+ * @param {Vec3} v0 - First triangle corner coordinate.
51
+ * @param {Vec3} v1 - Second triangle corner coordinate.
52
+ * @param {Vec3} v2 - Third triangle corner coordinate.
53
+ * @param {Vec3} res - Hit point object pointer that stores hit result.
54
+ * @returns {number} - Hit code, could 0 - og.Ray.OUTSIDE, 1 - og.Ray.INSIDE,
55
+ * 2 - og.Ray.INPLANE and 3 - og.Ray.AWAY(ray goes away from triangle).
56
+ */
57
+ hitTriangle(v0: Vec3, v1: Vec3, v2: Vec3, res: Vec3): number;
58
+ /**
59
+ * Gets a ray hit a plane result. If the ray cross the plane returns 1 - og.Ray.INSIDE otherwise returns 0 - og.Ray.OUTSIDE.
60
+ * @public
61
+ * @param {Vec3} v0 - First plane point.
62
+ * @param {Vec3} v1 - Second plane point.
63
+ * @param {Vec3} v2 - Third plane point.
64
+ * @param {Vec3} res - Hit point object pointer that stores hit result.
65
+ * @returns {number}
66
+ */
67
+ hitPlane(v0: Vec3, v1: Vec3, v2: Vec3, res: Vec3): number;
68
+ /**
69
+ * Returns a ray hit sphere coordiante. If there isn't hit returns null.
70
+ * @public
71
+ * @param {Sphere} sphere - Sphere object.
72
+ * @returns {Vec3}
73
+ */
74
+ hitSphere(sphere: Sphere): Vec3 | null;
75
+ hitBox(box: Box): void;
76
+ }
@@ -1,8 +1,5 @@
1
- import {EPS10} from "../math";
2
- import {Box} from "../bv/Box";
3
- import {Sphere} from "../bv/Sphere";
4
- import {Vec3} from "./Vec3";
5
-
1
+ import { EPS10 } from "../math";
2
+ import { Vec3 } from "./Vec3";
6
3
  /**
7
4
  * Represents a ray that extends infinitely from the provided origin in the provided direction.
8
5
  * @class
@@ -10,47 +7,26 @@ import {Vec3} from "./Vec3";
10
7
  * @param {Vec3} direction - The direction of the ray.
11
8
  */
12
9
  export class Ray {
13
- /**
14
- * The origin of the ray.
15
- * @public
16
- * @type {Vec3}
17
- */
18
- public origin: Vec3;
19
-
20
- /**
21
- * The direction of the ray.
22
- * @public
23
- * @type {Vec3}
24
- */
25
- public direction: Vec3;
26
-
27
- constructor(origin: Vec3 = Vec3.ZERO, direction: Vec3 = Vec3.ZERO) {
28
-
10
+ constructor(origin = Vec3.ZERO, direction = Vec3.ZERO) {
29
11
  this.origin = origin;
30
-
31
12
  this.direction = direction;
32
13
  }
33
-
34
14
  /** @const */
35
15
  static get OUTSIDE() {
36
16
  return 0;
37
17
  }
38
-
39
18
  /** @const */
40
19
  static get INSIDE() {
41
20
  return 1;
42
21
  }
43
-
44
22
  /** @const */
45
23
  static get INPLANE() {
46
24
  return 2;
47
25
  }
48
-
49
26
  /** @const */
50
27
  static get AWAY() {
51
28
  return 3;
52
29
  }
53
-
54
30
  /**
55
31
  * Sets a ray parameters.
56
32
  * @public
@@ -58,22 +34,20 @@ export class Ray {
58
34
  * @param {Vec3} direction - The direction of the ray.
59
35
  * @returns {Ray}
60
36
  */
61
- public set(origin: Vec3, direction: Vec3): Ray {
37
+ set(origin, direction) {
62
38
  this.origin = origin;
63
39
  this.direction = direction;
64
40
  return this;
65
41
  }
66
-
67
42
  /**
68
43
  * Computes the point along the ray on the distance.
69
44
  * @public
70
45
  * @param {number} distance - Point distance.
71
46
  * @returns {Vec3}
72
47
  */
73
- public getPoint(distance: number): Vec3 {
48
+ getPoint(distance) {
74
49
  return Vec3.add(this.origin, this.direction.scaleTo(distance));
75
50
  }
76
-
77
51
  /**
78
52
  * Returns ray hit a triange result.
79
53
  * @public
@@ -84,37 +58,32 @@ export class Ray {
84
58
  * @returns {number} - Hit code, could 0 - og.Ray.OUTSIDE, 1 - og.Ray.INSIDE,
85
59
  * 2 - og.Ray.INPLANE and 3 - og.Ray.AWAY(ray goes away from triangle).
86
60
  */
87
- public hitTriangle(v0: Vec3, v1: Vec3, v2: Vec3, res: Vec3): number {
61
+ hitTriangle(v0, v1, v2, res) {
88
62
  let u = v1.sub(v0);
89
63
  let v = v2.sub(v0);
90
64
  let n = u.cross(v);
91
-
92
65
  let w0 = this.origin.sub(v0);
93
66
  let a = -n.dot(w0);
94
67
  let b = n.dot(this.direction);
95
-
96
68
  // ray is parallel to triangle plane
97
69
  if (Math.abs(b) < EPS10) {
98
70
  if (a === 0) {
99
71
  res.copy(this.origin);
100
72
  // ray lies in triangle plane
101
73
  return Ray.INPLANE;
102
- } else {
74
+ }
75
+ else {
103
76
  // ray disjoint from plane
104
77
  return Ray.OUTSIDE;
105
78
  }
106
79
  }
107
-
108
80
  let r = a / b;
109
-
110
81
  // intersect point of ray and plane
111
82
  res.copy(this.origin.add(this.direction.scaleTo(r)));
112
-
113
83
  // ray goes away from triangle
114
84
  if (r < 0.0) {
115
85
  return Ray.AWAY;
116
86
  }
117
-
118
87
  // is res point inside the triangle?
119
88
  let uu = u.dot(u);
120
89
  let uv = u.dot(v);
@@ -123,20 +92,16 @@ export class Ray {
123
92
  let wu = w.dot(u);
124
93
  let wv = w.dot(v);
125
94
  let D = uv * uv - uu * vv;
126
-
127
95
  let s = (uv * wv - vv * wu) / D;
128
96
  if (s < 0.0 || s > 1.0) {
129
97
  return Ray.OUTSIDE;
130
98
  }
131
-
132
99
  let t = (uv * wu - uu * wv) / D;
133
100
  if (t < 0.0 || s + t > 1.0) {
134
101
  return Ray.OUTSIDE;
135
102
  }
136
-
137
103
  return Ray.INSIDE;
138
104
  }
139
-
140
105
  /**
141
106
  * Gets a ray hit a plane result. If the ray cross the plane returns 1 - og.Ray.INSIDE otherwise returns 0 - og.Ray.OUTSIDE.
142
107
  * @public
@@ -146,57 +111,45 @@ export class Ray {
146
111
  * @param {Vec3} res - Hit point object pointer that stores hit result.
147
112
  * @returns {number}
148
113
  */
149
- public hitPlane(v0: Vec3, v1: Vec3, v2: Vec3, res: Vec3): number {
114
+ hitPlane(v0, v1, v2, res) {
150
115
  let u = Vec3.sub(v1, v0);
151
116
  let v = Vec3.sub(v2, v0);
152
117
  let n = u.cross(v);
153
-
154
118
  let w0 = Vec3.sub(this.origin, v0);
155
119
  let a = -n.dot(w0);
156
120
  let b = n.dot(this.direction);
157
-
158
121
  // ray is parallel to the plane
159
122
  if (Math.abs(b) < EPS10) {
160
123
  if (a === 0) {
161
124
  return Ray.OUTSIDE;
162
125
  }
163
126
  }
164
-
165
127
  let r = a / b;
166
-
167
128
  if (r < 0) {
168
129
  return Ray.OUTSIDE;
169
130
  }
170
-
171
131
  let d = this.direction.scaleTo(r);
172
-
173
132
  // intersect point of ray and plane
174
133
  res.x = this.origin.x + d.x;
175
134
  res.y = this.origin.y + d.y;
176
135
  res.z = this.origin.z + d.z;
177
-
178
136
  return Ray.INSIDE;
179
137
  }
180
-
181
138
  /**
182
139
  * Returns a ray hit sphere coordiante. If there isn't hit returns null.
183
140
  * @public
184
141
  * @param {Sphere} sphere - Sphere object.
185
142
  * @returns {Vec3}
186
143
  */
187
- public hitSphere(sphere: Sphere) {
188
- let r = sphere.radius,
189
- c = sphere.center,
190
- o = this.origin,
191
- d = this.direction;
192
-
144
+ hitSphere(sphere) {
145
+ let r = sphere.radius, c = sphere.center, o = this.origin, d = this.direction;
193
146
  let vpc = Vec3.sub(c, o);
194
-
195
147
  if (vpc.dot(d) < 0) {
196
148
  var l = vpc.length();
197
149
  if (l > r) {
198
150
  return null;
199
- } else if (l === r) {
151
+ }
152
+ else if (l === r) {
200
153
  return o.clone();
201
154
  }
202
155
  let pc = c.projToRay(o, vpc);
@@ -205,18 +158,21 @@ export class Ray {
205
158
  let di1 = dist - Vec3.sub(pc, o).length();
206
159
  let intersection = Vec3.add(o, d.scaleTo(di1));
207
160
  return intersection;
208
- } else {
161
+ }
162
+ else {
209
163
  let pc = c.projToRay(o, d);
210
164
  var cpcl = Vec3.sub(c, pc).length();
211
165
  if (cpcl > sphere.radius) {
212
166
  return null;
213
- } else {
167
+ }
168
+ else {
214
169
  let dist = Math.sqrt(r * r - cpcl * cpcl);
215
170
  let di1;
216
171
  pc.subA(o);
217
172
  if (vpc.length() > r) {
218
173
  di1 = pc.length() - dist;
219
- } else {
174
+ }
175
+ else {
220
176
  di1 = pc.length() + dist;
221
177
  }
222
178
  let intersection = Vec3.add(o, d.scaleTo(di1));
@@ -224,10 +180,9 @@ export class Ray {
224
180
  }
225
181
  }
226
182
  }
227
-
228
- public hitBox(box: Box) {
183
+ hitBox(box) {
229
184
  //
230
185
  // TODO
231
186
  //
232
187
  }
233
- }
188
+ }
@@ -0,0 +1,310 @@
1
+ import { Vec3 } from "./Vec3";
2
+ export type NumberArray2 = [number, number];
3
+ /**
4
+ * Class represents a 3d vector.
5
+ * @class
6
+ * @param {number} [x] - First value.
7
+ * @param {number} [y] - Second value.
8
+ */
9
+ export declare class Vec2 {
10
+ /**
11
+ * @public
12
+ * @type {number}
13
+ */
14
+ x: number;
15
+ /**
16
+ * @public
17
+ * @type {number}
18
+ */
19
+ y: number;
20
+ constructor(x?: number, y?: number);
21
+ /** @const */
22
+ static get UP(): Vec2;
23
+ /** @const */
24
+ static get DOWN(): Vec2;
25
+ /** @const */
26
+ static get RIGHT(): Vec2;
27
+ /** @const */
28
+ static get LEFT(): Vec2;
29
+ /** @const */
30
+ static get ZERO(): Vec2;
31
+ /**
32
+ * Returns summary vector.
33
+ * @static
34
+ * @param {Vec2} a - First vector.
35
+ * @param {Vec2} b - Second vector.
36
+ * @returns {Vec2} - Summary vector.
37
+ */
38
+ static add(a: Vec2, b: Vec2): Vec2;
39
+ /**
40
+ * Returns two vectors subtraction.
41
+ * @static
42
+ * @param {Vec2} a - First vector.
43
+ * @param {Vec2} b - Second vector.
44
+ * @returns {Vec2} - Vectors subtraction.
45
+ */
46
+ static sub(a: Vec2, b: Vec2): Vec2;
47
+ /**
48
+ * Returns scaled vector.
49
+ * @static
50
+ * @param {Vec2} a - Input vector.
51
+ * @param {number} scale - Scale value.
52
+ * @returns {Vec2}
53
+ */
54
+ static scale(a: Vec2, scale: number): Vec2;
55
+ /**
56
+ * Returns two vectors production.
57
+ * @static
58
+ * @param {Vec2} a - First vector.
59
+ * @param {Vec2} b - Second vector.
60
+ * @returns {Vec2}
61
+ */
62
+ static mul(a: Vec2, b: Vec2): Vec2;
63
+ /**
64
+ * Returns vector components division product one to another.
65
+ * @static
66
+ * @param {Vec2} a - First vector.
67
+ * @param {Vec2} b - Second vector.
68
+ * @returns {Vec2}
69
+ */
70
+ static div(a: Vec2, b: Vec2): Vec2;
71
+ /**
72
+ * Get projection of the first vector to the second.
73
+ * @static
74
+ * @param {Vec2} b - First vector.
75
+ * @param {Vec2} a - Second vector.
76
+ * @returns {Vec2}
77
+ */
78
+ static proj_b_to_a(b: Vec2, a: Vec2): Vec2;
79
+ /**
80
+ * Gets angle between two vectors.
81
+ * @static
82
+ * @param {Vec2} a - First vector.
83
+ * @param {Vec2} b - Second vector.
84
+ * @returns {number}
85
+ */
86
+ static angle(a: Vec2, b: Vec2): number;
87
+ /**
88
+ * Makes vectors normalized and orthogonal to each other.
89
+ * @static
90
+ * @param {Vec2} normal - Normal vector.
91
+ * @param {Vec2} tangent - Tangent vector.
92
+ * @returns {Vec2}
93
+ */
94
+ static orthoNormalize(normal: Vec2, tangent: Vec2): Vec2;
95
+ /**
96
+ * Converts to 3d vector, third value is 0.0.
97
+ * @public
98
+ * @returns {Vec3}
99
+ */
100
+ toVector3(): Vec3;
101
+ /**
102
+ * Returns clone vector.
103
+ * @public
104
+ * @returns {Vec2}
105
+ */
106
+ clone(): Vec2;
107
+ /**
108
+ * Compares with vector. Returns true if it equals another.
109
+ * @public
110
+ * @param {Vec2} p - Vector to compare.
111
+ * @returns {boolean}
112
+ */
113
+ equal(p: Vec2): boolean;
114
+ /**
115
+ * Copy input vector's values.
116
+ * @param {Vec2} point2 - Vector to copy.
117
+ * @returns {Vec2}
118
+ */
119
+ copy(point2: Vec2): Vec2;
120
+ /**
121
+ * Gets vector's length.
122
+ * @public
123
+ * @returns {number}
124
+ */
125
+ length(): number;
126
+ /**
127
+ * Returns squared vector's length.
128
+ * @public
129
+ * @returns {number}
130
+ */
131
+ length2(): number;
132
+ /**
133
+ * Adds vector to the current.
134
+ * @public
135
+ * @param {Vec2}
136
+ * @returns {Vec2}
137
+ */
138
+ addA(v: Vec2): Vec2;
139
+ /**
140
+ * Summarize two vectors.
141
+ * @public
142
+ * @param {Vec2}
143
+ * @returns {Vec2}
144
+ */
145
+ add(v: Vec2): Vec2;
146
+ /**
147
+ * Subtract vector from the current where results saved on the current instance.
148
+ * @public
149
+ * @param {Vec2} v - Subtract vector.
150
+ * @returns {Vec2}
151
+ */
152
+ subA(v: Vec2): Vec2;
153
+ /**
154
+ * Subtract vector from the current.
155
+ * @public
156
+ * @param {Vec2} v - Subtract vector.
157
+ * @returns {Vec2}
158
+ */
159
+ sub(v: Vec2): Vec2;
160
+ /**
161
+ * Scale current vector.
162
+ * @public
163
+ * @param {number} scale - Scale value.
164
+ * @returns {Vec2}
165
+ */
166
+ scale(scale: number): Vec2;
167
+ /**
168
+ * Scale current vector to another instance.
169
+ * @public
170
+ * @param {number} scale - Scale value.
171
+ * @returns {Vec2}
172
+ */
173
+ scaleTo(scale: number): Vec2;
174
+ /**
175
+ * Multiply current vector object to another and store result in the current instance.
176
+ * @public
177
+ * @param {Vec2} vec - Multiply vector.
178
+ * @returns {Vec2}
179
+ */
180
+ mulA(vec: Vec2): Vec2;
181
+ /**
182
+ * Multiply current vector object to another and returns new vector instance.
183
+ * @public
184
+ * @param {Vec2} vec - Multiply vector.
185
+ * @returns {Vec2}
186
+ */
187
+ mul(vec: Vec2): Vec2;
188
+ /**
189
+ * Divide current vector's components to another. Results stores in the current vector object.
190
+ * @public
191
+ * @param {Vec2}
192
+ * @returns {Vec2}
193
+ */
194
+ divA(vec: Vec2): Vec2;
195
+ /**
196
+ * Gets vectors dot production.
197
+ * @public
198
+ * @param {Vec2} v - Another vector.
199
+ * @returns {number}
200
+ */
201
+ dot(v: Vec2): number;
202
+ /**
203
+ * Gets vectors dot production.
204
+ * @public
205
+ * @param {Array.<number>} arr - Array vector. (exactly 2 entries)
206
+ * @returns {number}
207
+ */
208
+ dotArr(arr: NumberArray2): number;
209
+ /**
210
+ * Gets vectors cross production.
211
+ * @public
212
+ * @param {Vec2} v - Another vector.
213
+ * @returns {number}
214
+ */
215
+ cross(v: Vec2): number;
216
+ /**
217
+ * Sets vector to zero.
218
+ * @public
219
+ * @returns {Vec2}
220
+ */
221
+ clear(): Vec2;
222
+ /**
223
+ * Returns normalized vector.
224
+ * @public
225
+ * @returns {Vec2}
226
+ */
227
+ normal(): Vec2;
228
+ /**
229
+ * Normalize current vector.
230
+ * @public
231
+ * @returns {Vec2}
232
+ */
233
+ normalize(): Vec2;
234
+ /**
235
+ * Converts vector to a number array.
236
+ * @public
237
+ * @returns {Array.<number>} - (exactly 2 entries)
238
+ */
239
+ toVec(): NumberArray2;
240
+ /**
241
+ * Gets distance to point.
242
+ * @public
243
+ * @param {Vec2} p - Distant point.
244
+ * @returns {number}
245
+ */
246
+ distance(p: Vec2): number;
247
+ /**
248
+ * Sets vector's values.
249
+ * @public
250
+ * @param {number} x - Value X.
251
+ * @param {number} y - Value Y.
252
+ * @returns {Vec2}
253
+ */
254
+ set(x: number, y: number): Vec2;
255
+ /**
256
+ * Negate current vector.
257
+ * @public
258
+ * @returns {Vec2}
259
+ */
260
+ negate(): Vec2;
261
+ /**
262
+ * Negate current vector to another instance.
263
+ * @public
264
+ * @returns {Vec2}
265
+ */
266
+ negateTo(): Vec2;
267
+ /**
268
+ * Gets projected point coordinates of the current vector on the ray.
269
+ * @public
270
+ * @param {Vec2} pos - Ray position.
271
+ * @param {Vec2} direction - Ray direction.
272
+ * @returns {Vec2}
273
+ */
274
+ projToRay(pos: Vec2, direction: Vec2): Vec2;
275
+ /**
276
+ * Gets angle between two vectors.
277
+ * @public
278
+ * @param {Vec2} a - Another vector.
279
+ * @returns {number}
280
+ */
281
+ angle(a: Vec2): number;
282
+ /**
283
+ * Returns two vectors linear interpolation.
284
+ * @public
285
+ * @param {Vec2} v2 - End vector.
286
+ * @param {number} l - Interpolate value.
287
+ * @returns {Vec2}
288
+ */
289
+ lerp(v1: Vec2, v2: Vec2, l: number): Vec2;
290
+ static get LERP_DELTA(): number;
291
+ /**
292
+ * Spherically interpolates between two vectors.
293
+ * Interpolates between current and v2 vector by amount t. The difference between this and linear interpolation (aka, "lerp") is that
294
+ * the vectors are treated as directions rather than points in space. The direction of the returned vector is interpolated
295
+ * by the angle and its magnitude is interpolated between the magnitudes of from and to.
296
+ * @public
297
+ * @param {Vec2} v2
298
+ * @param {number} t - The parameter t is clamped to the range [0, 1].
299
+ * @returns {Vec2}
300
+ */
301
+ slerp(v2: Vec2, t: number): Vec2;
302
+ }
303
+ /**
304
+ * Vector 2d object creator.
305
+ * @function
306
+ * @param {number} [x] - First cvalue.
307
+ * @param {number} [y] - Second value.
308
+ * @returns {Vec2}
309
+ */
310
+ export declare function vec2(x?: number, y?: number): Vec2;