@openglobus/og 0.18.0 → 0.18.1
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.
- package/README.md +8 -8
- package/lib/@openglobus/og.esm.js +2 -0
- package/lib/@openglobus/og.esm.js.map +1 -0
- package/lib/@openglobus/og.umd.js +2 -0
- package/lib/@openglobus/og.umd.js.map +1 -0
- package/lib/js/Clock.d.ts +106 -0
- package/{src/Clock.ts → lib/js/Clock.js} +31 -126
- package/lib/js/Deferred.d.ts +6 -0
- package/lib/js/Deferred.js +13 -0
- package/lib/js/Events.d.ts +90 -0
- package/{src/Events.ts → lib/js/Events.js} +29 -84
- package/lib/js/Extent.d.ts +145 -0
- package/{src/Extent.ts → lib/js/Extent.js} +74 -120
- package/lib/js/Globe.d.ts +132 -0
- package/{src/Globe.ts → lib/js/Globe.js} +61 -159
- package/lib/js/ImageCanvas.d.ts +128 -0
- package/{src/ImageCanvas.ts → lib/js/ImageCanvas.js} +24 -65
- package/lib/js/Lock.d.ts +15 -0
- package/{src/Lock.ts → lib/js/Lock.js} +7 -21
- package/lib/js/LonLat.d.ts +128 -0
- package/{src/LonLat.ts → lib/js/LonLat.js} +44 -75
- package/lib/js/Object3d.d.ts +49 -0
- package/{src/Object3d.ts → lib/js/Object3d.js} +64 -184
- package/lib/js/Popup.d.ts +46 -0
- package/{src/Popup.ts → lib/js/Popup.js} +42 -110
- package/lib/js/QueueArray.d.ts +16 -0
- package/{src/QueueArray.ts → lib/js/QueueArray.js} +12 -25
- package/lib/js/Rectangle.d.ts +76 -0
- package/{src/Rectangle.ts → lib/js/Rectangle.js} +12 -50
- package/lib/js/Stack.d.ts +20 -0
- package/{src/Stack.ts → lib/js/Stack.js} +13 -29
- package/lib/js/astro/astro.d.ts +39 -0
- package/{src/astro/astro.ts → lib/js/astro/astro.js} +2 -8
- package/lib/js/astro/earth.d.ts +8 -0
- package/{src/astro/earth.ts → lib/js/astro/earth.js} +3 -39
- package/lib/js/astro/jd.d.ts +234 -0
- package/{src/astro/jd.ts → lib/js/astro/jd.js} +55 -134
- package/lib/js/astro/orbit.d.ts +5 -0
- package/{src/astro/orbit.ts → lib/js/astro/orbit.js} +26 -39
- package/lib/js/astro/rotation.d.ts +2 -0
- package/{src/astro/rotation.ts → lib/js/astro/rotation.js} +2 -11
- package/lib/js/bv/Box.d.ts +32 -0
- package/{src/bv/Box.ts → lib/js/bv/Box.js} +7 -35
- package/lib/js/bv/Sphere.d.ts +37 -0
- package/{src/bv/Sphere.ts → lib/js/bv/Sphere.js} +6 -34
- package/{src/bv/index.ts → lib/js/bv/index.d.ts} +0 -1
- package/lib/js/bv/index.js +3 -0
- package/lib/js/camera/Camera.d.ts +314 -0
- package/{src/camera/Camera.ts → lib/js/camera/Camera.js} +77 -326
- package/lib/js/camera/Frustum.d.ts +139 -0
- package/{src/camera/Frustum.ts → lib/js/camera/Frustum.js} +66 -185
- package/lib/js/camera/PlanetCamera.d.ts +234 -0
- package/{src/camera/PlanetCamera.ts → lib/js/camera/PlanetCamera.js} +65 -338
- package/{src/camera/index.ts → lib/js/camera/index.d.ts} +0 -1
- package/lib/js/camera/index.js +3 -0
- package/lib/js/cons.d.ts +40 -0
- package/{src/cons.ts → lib/js/cons.js} +10 -22
- package/lib/js/control/Atmosphere.d.ts +16 -0
- package/{src/control/Atmosphere.ts → lib/js/control/Atmosphere.js} +33 -86
- package/lib/js/control/CompassButton.d.ts +16 -0
- package/{src/control/CompassButton.ts → lib/js/control/CompassButton.js} +18 -43
- package/lib/js/control/Control.d.ts +100 -0
- package/{src/control/Control.ts → lib/js/control/Control.js} +22 -89
- package/lib/js/control/DebugInfo.d.ts +25 -0
- package/{src/control/DebugInfo.ts → lib/js/control/DebugInfo.js} +38 -84
- package/lib/js/control/DrawingSwitcher.d.ts +13 -0
- package/{src/control/DrawingSwitcher.ts → lib/js/control/DrawingSwitcher.js} +13 -30
- package/lib/js/control/EarthCoordinates.d.ts +41 -0
- package/{src/control/EarthCoordinates.ts → lib/js/control/EarthCoordinates.js} +58 -119
- package/lib/js/control/EarthNavigation.d.ts +50 -0
- package/{src/control/EarthNavigation.ts → lib/js/control/EarthNavigation.js} +70 -161
- package/lib/js/control/GeoImageDragControl.d.ts +22 -0
- package/{src/control/GeoImageDragControl.ts → lib/js/control/GeoImageDragControl.js} +26 -49
- package/lib/js/control/KeyboardNavigation.d.ts +28 -0
- package/{src/control/KeyboardNavigation.ts → lib/js/control/KeyboardNavigation.js} +67 -92
- package/lib/js/control/LayerAnimation.d.ts +71 -0
- package/{src/control/LayerAnimation.ts → lib/js/control/LayerAnimation.js} +82 -162
- package/lib/js/control/LayerSwitcher.d.ts +21 -0
- package/{src/control/LayerSwitcher.ts → lib/js/control/LayerSwitcher.js} +16 -41
- package/lib/js/control/Lighting.d.ts +49 -0
- package/{src/control/Lighting.ts → lib/js/control/Lighting.js} +106 -219
- package/lib/js/control/MouseNavigation.d.ts +62 -0
- package/{src/control/MouseNavigation.ts → lib/js/control/MouseNavigation.js} +105 -211
- package/lib/js/control/MouseWheelZoomControl.d.ts +44 -0
- package/lib/js/control/MouseWheelZoomControl.js +181 -0
- package/lib/js/control/RulerSwitcher.d.ts +17 -0
- package/{src/control/RulerSwitcher.ts → lib/js/control/RulerSwitcher.js} +13 -28
- package/lib/js/control/ScaleControl.d.ts +24 -0
- package/lib/js/control/ScaleControl.js +91 -0
- package/lib/js/control/SegmentBoundVisualization.d.ts +12 -0
- package/lib/js/control/SegmentBoundVisualization.js +37 -0
- package/lib/js/control/ShowFps.d.ts +9 -0
- package/lib/js/control/ShowFps.js +20 -0
- package/lib/js/control/SimpleNavigation.d.ts +25 -0
- package/{src/control/SimpleNavigation.ts → lib/js/control/SimpleNavigation.js} +29 -51
- package/lib/js/control/SimpleSkyBackground.d.ts +15 -0
- package/{src/control/SimpleSkyBackground.ts → lib/js/control/SimpleSkyBackground.js} +21 -48
- package/lib/js/control/Sun.d.ts +33 -0
- package/{src/control/Sun.ts → lib/js/control/Sun.js} +34 -85
- package/lib/js/control/ToggleWireframe.d.ts +14 -0
- package/lib/js/control/ToggleWireframe.js +28 -0
- package/lib/js/control/TouchNavigation.d.ts +52 -0
- package/{src/control/TouchNavigation.ts → lib/js/control/TouchNavigation.js} +88 -193
- package/lib/js/control/ZoomControl.d.ts +27 -0
- package/{src/control/ZoomControl.ts → lib/js/control/ZoomControl.js} +25 -50
- package/lib/js/control/drawing/DrawingControl.d.ts +12 -0
- package/{src/control/drawing/DrawingControl.ts → lib/js/control/drawing/DrawingControl.js} +10 -20
- package/lib/js/control/drawing/LineStringDrawingScene.d.ts +15 -0
- package/{src/control/drawing/LineStringDrawingScene.ts → lib/js/control/drawing/LineStringDrawingScene.js} +28 -85
- package/lib/js/control/drawing/PolygonDrawingScene.d.ts +98 -0
- package/{src/control/drawing/PolygonDrawingScene.ts → lib/js/control/drawing/PolygonDrawingScene.js} +190 -388
- package/lib/js/control/elevationProfile/ElevationProfile.d.ts +61 -0
- package/{src/control/elevationProfile/ElevationProfile.ts → lib/js/control/elevationProfile/ElevationProfile.js} +56 -148
- package/lib/js/control/heightRuler/HeightRuler.d.ts +7 -0
- package/{src/control/heightRuler/HeightRuler.ts → lib/js/control/heightRuler/HeightRuler.js} +4 -9
- package/lib/js/control/heightRuler/HeightRulerScene.d.ts +35 -0
- package/{src/control/heightRuler/HeightRulerScene.ts → lib/js/control/heightRuler/HeightRulerScene.js} +47 -99
- package/lib/js/control/heightRuler/HeightRulerSwitcher.d.ts +6 -0
- package/{src/control/heightRuler/HeightRulerSwitcher.ts → lib/js/control/heightRuler/HeightRulerSwitcher.js} +2 -4
- package/{src/control/index.ts → lib/js/control/index.d.ts} +1 -18
- package/lib/js/control/index.js +28 -0
- package/lib/js/control/ruler/Ruler.d.ts +13 -0
- package/lib/js/control/ruler/Ruler.js +23 -0
- package/lib/js/control/ruler/RulerScene.d.ts +88 -0
- package/lib/js/control/ruler/RulerScene.js +324 -0
- package/lib/js/control/selection/Selection.d.ts +55 -0
- package/{src/control/selection/Selection.ts → lib/js/control/selection/Selection.js} +15 -34
- package/lib/js/control/selection/SelectionScene.d.ts +44 -0
- package/{src/control/selection/SelectionScene.ts → lib/js/control/selection/SelectionScene.js} +26 -113
- package/lib/js/control/timeline/TimelineControl.d.ts +18 -0
- package/{src/control/timeline/TimelineControl.ts → lib/js/control/timeline/TimelineControl.js} +13 -43
- package/lib/js/control/timeline/TimelineModel.d.ts +41 -0
- package/{src/control/timeline/TimelineModel.ts → lib/js/control/timeline/TimelineModel.js} +26 -74
- package/lib/js/control/timeline/TimelineView.d.ts +85 -0
- package/{src/control/timeline/TimelineView.ts → lib/js/control/timeline/TimelineView.js} +133 -281
- package/lib/js/control/timeline/timelineUtils.d.ts +12 -0
- package/lib/js/control/timeline/timelineUtils.js +112 -0
- package/lib/js/control/visibleExtent/Segment.d.ts +277 -0
- package/{src → lib/js}/control/visibleExtent/Segment.js +145 -698
- package/lib/js/control/visibleExtent/VisibleExtent.d.ts +5 -0
- package/{src → lib/js}/control/visibleExtent/VisibleExtent.js +1 -18
- package/lib/js/control/visibleExtent/drawnode.d.ts +7 -0
- package/{src/control/visibleExtent/drawnode.ts → lib/js/control/visibleExtent/drawnode.js} +1 -28
- package/lib/js/ellipsoid/Ellipsoid.d.ts +187 -0
- package/{src/ellipsoid/Ellipsoid.ts → lib/js/ellipsoid/Ellipsoid.js} +82 -267
- package/lib/js/ellipsoid/index.d.ts +3 -0
- package/lib/js/ellipsoid/index.js +3 -0
- package/lib/js/ellipsoid/wgs84.d.ts +6 -0
- package/{src/ellipsoid/wgs84.ts → lib/js/ellipsoid/wgs84.js} +1 -2
- package/lib/js/entity/BaseBillboard.d.ts +222 -0
- package/{src/entity/BaseBillboard.ts → lib/js/entity/BaseBillboard.js} +48 -165
- package/lib/js/entity/BaseBillboardHandler.d.ts +81 -0
- package/{src/entity/BaseBillboardHandler.ts → lib/js/entity/BaseBillboardHandler.js} +139 -365
- package/lib/js/entity/Billboard.d.ts +113 -0
- package/{src/entity/Billboard.ts → lib/js/entity/Billboard.js} +19 -83
- package/lib/js/entity/BillboardHandler.d.ts +15 -0
- package/{src/entity/BillboardHandler.ts → lib/js/entity/BillboardHandler.js} +27 -59
- package/lib/js/entity/Entity.d.ts +354 -0
- package/{src/entity/Entity.ts → lib/js/entity/Entity.js} +101 -373
- package/lib/js/entity/EntityCollection.d.ts +364 -0
- package/{src/entity/EntityCollection.ts → lib/js/entity/EntityCollection.js} +51 -353
- package/lib/js/entity/GeoObject.d.ts +138 -0
- package/{src/entity/GeoObject.ts → lib/js/entity/GeoObject.js} +41 -146
- package/lib/js/entity/GeoObjectHandler.d.ts +99 -0
- package/{src/entity/GeoObjectHandler.ts → lib/js/entity/GeoObjectHandler.js} +162 -423
- package/lib/js/entity/Geometry.d.ts +111 -0
- package/lib/js/entity/Geometry.js +283 -0
- package/lib/js/entity/GeometryHandler.d.ts +84 -0
- package/{src/entity/GeometryHandler.ts → lib/js/entity/GeometryHandler.js} +162 -657
- package/lib/js/entity/Label.d.ts +207 -0
- package/{src/entity/Label.ts → lib/js/entity/Label.js} +62 -164
- package/lib/js/entity/LabelHandler.d.ts +65 -0
- package/{src/entity/LabelHandler.ts → lib/js/entity/LabelHandler.js} +175 -408
- package/lib/js/entity/LabelWorker.d.ts +15 -0
- package/{src/entity/LabelWorker.ts → lib/js/entity/LabelWorker.js} +24 -45
- package/lib/js/entity/PointCloud.d.ts +179 -0
- package/{src/entity/PointCloud.ts → lib/js/entity/PointCloud.js} +65 -265
- package/lib/js/entity/PointCloudHandler.d.ts +42 -0
- package/{src/entity/PointCloudHandler.ts → lib/js/entity/PointCloudHandler.js} +19 -62
- package/lib/js/entity/Polyline.d.ts +337 -0
- package/{src/entity/Polyline.ts → lib/js/entity/Polyline.js} +289 -924
- package/lib/js/entity/PolylineHandler.d.ts +22 -0
- package/{src/entity/PolylineHandler.ts → lib/js/entity/PolylineHandler.js} +12 -37
- package/lib/js/entity/Ray.d.ts +133 -0
- package/{src/entity/Ray.ts → lib/js/entity/Ray.js} +26 -146
- package/lib/js/entity/RayHandler.d.ts +70 -0
- package/{src/entity/RayHandler.ts → lib/js/entity/RayHandler.js} +102 -342
- package/lib/js/entity/Strip.d.ts +127 -0
- package/{src/entity/Strip.ts → lib/js/entity/Strip.js} +102 -372
- package/lib/js/entity/StripHandler.d.ts +42 -0
- package/{src/entity/StripHandler.ts → lib/js/entity/StripHandler.js} +22 -74
- package/{src/entity/index.ts → lib/js/entity/index.d.ts} +1 -2
- package/lib/js/entity/index.js +11 -0
- package/lib/js/index.d.ts +33 -0
- package/lib/js/index.js +33 -0
- package/lib/js/input/KeyboardHandler.d.ts +33 -0
- package/{src/input/KeyboardHandler.ts → lib/js/input/KeyboardHandler.js} +45 -84
- package/lib/js/input/MouseHandler.d.ts +16 -0
- package/{src/input/MouseHandler.ts → lib/js/input/MouseHandler.js} +12 -36
- package/lib/js/input/TouchHandler.d.ts +11 -0
- package/{src/input/TouchHandler.ts → lib/js/input/TouchHandler.js} +11 -23
- package/lib/js/input/input.d.ts +3 -0
- package/{src/input/input.ts → lib/js/input/input.js} +1 -1
- package/lib/js/layer/BaseGeoImage.d.ts +145 -0
- package/{src/layer/BaseGeoImage.ts → lib/js/layer/BaseGeoImage.js} +70 -235
- package/lib/js/layer/CanvasTiles.d.ts +103 -0
- package/{src/layer/CanvasTiles.ts → lib/js/layer/CanvasTiles.js} +54 -146
- package/lib/js/layer/GeoImage.d.ts +61 -0
- package/{src/layer/GeoImage.ts → lib/js/layer/GeoImage.js} +24 -54
- package/lib/js/layer/GeoTexture2d.d.ts +17 -0
- package/lib/js/layer/GeoTexture2d.js +37 -0
- package/lib/js/layer/GeoVideo.d.ts +68 -0
- package/{src/layer/GeoVideo.ts → lib/js/layer/GeoVideo.js} +31 -61
- package/lib/js/layer/KML.d.ts +72 -0
- package/{src/layer/KML.ts → lib/js/layer/KML.js} +94 -138
- package/lib/js/layer/Layer.d.ts +401 -0
- package/{src/layer/Layer.ts → lib/js/layer/Layer.js} +92 -443
- package/lib/js/layer/Material.d.ts +34 -0
- package/{src/layer/Material.ts → lib/js/layer/Material.js} +9 -43
- package/lib/js/layer/Vector.d.ts +244 -0
- package/{src/layer/Vector.ts → lib/js/layer/Vector.js} +147 -418
- package/lib/js/layer/WMS.d.ts +75 -0
- package/{src/layer/WMS.ts → lib/js/layer/WMS.js} +18 -100
- package/lib/js/layer/XYZ.d.ts +149 -0
- package/{src/layer/XYZ.ts → lib/js/layer/XYZ.js} +71 -171
- package/lib/js/layer/index.d.ts +11 -0
- package/lib/js/layer/index.js +11 -0
- package/lib/js/light/LightSource.d.ts +174 -0
- package/{src/light/LightSource.ts → lib/js/light/LightSource.js} +22 -131
- package/lib/js/math/Line2.d.ts +11 -0
- package/{src/math/Line2.ts → lib/js/math/Line2.js} +5 -15
- package/lib/js/math/Line3.d.ts +28 -0
- package/lib/js/math/Line3.js +85 -0
- package/lib/js/math/Mat3.d.ts +77 -0
- package/{src/math/Mat3.ts → lib/js/math/Mat3.js} +22 -51
- package/lib/js/math/Mat4.d.ts +195 -0
- package/{src/math/Mat4.ts → lib/js/math/Mat4.js} +53 -219
- package/lib/js/math/Plane.d.ts +20 -0
- package/{src/math/Plane.ts → lib/js/math/Plane.js} +26 -40
- package/lib/js/math/Quat.d.ts +373 -0
- package/{src/math/Quat.ts → lib/js/math/Quat.js} +106 -319
- package/lib/js/math/Ray.d.ts +76 -0
- package/{src/math/Ray.ts → lib/js/math/Ray.js} +21 -66
- package/lib/js/math/Vec2.d.ts +310 -0
- package/{src/math/Vec2.ts → lib/js/math/Vec2.js} +55 -121
- package/lib/js/math/Vec3.d.ts +472 -0
- package/{src/math/Vec3.ts → lib/js/math/Vec3.js} +103 -236
- package/lib/js/math/Vec4.d.ts +163 -0
- package/{src/math/Vec4.ts → lib/js/math/Vec4.js} +23 -79
- package/lib/js/math/coder.d.ts +51 -0
- package/{src/math/coder.ts → lib/js/math/coder.js} +14 -20
- package/lib/js/math/index.d.ts +11 -0
- package/lib/js/math/index.js +11 -0
- package/lib/js/math.d.ts +266 -0
- package/{src/math.ts → lib/js/math.js} +37 -85
- package/lib/js/mercator.d.ts +92 -0
- package/{src/mercator.ts → lib/js/mercator.js} +13 -37
- package/lib/js/proj/EPSG3857.d.ts +9 -0
- package/{src/proj/EPSG3857.ts → lib/js/proj/EPSG3857.js} +0 -2
- package/lib/js/proj/EPSG4326.d.ts +9 -0
- package/{src/proj/EPSG4326.ts → lib/js/proj/EPSG4326.js} +0 -2
- package/lib/js/proj/Proj.d.ts +43 -0
- package/{src/proj/Proj.ts → lib/js/proj/Proj.js} +4 -29
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +17 -0
- package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/EarthQuadTreeStrategy.js +19 -0
- package/lib/js/quadTree/EntityCollectionNode.d.ts +54 -0
- package/{src/quadTree/EntityCollectionNode.ts → lib/js/quadTree/EntityCollectionNode.js} +83 -150
- package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/MarsQuadTreeStrategy.js +17 -0
- package/lib/js/quadTree/Node.d.ts +61 -0
- package/{src/quadTree/Node.ts → lib/js/quadTree/Node.js} +140 -357
- package/lib/js/quadTree/QuadTreeStrategy.d.ts +25 -0
- package/{src/quadTree/QuadTreeStrategy.ts → lib/js/quadTree/QuadTreeStrategy.js} +13 -44
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +15 -0
- package/lib/js/quadTree/index.d.ts +12 -0
- package/lib/js/quadTree/index.js +12 -0
- package/lib/js/quadTree/quadTree.d.ts +40 -0
- package/{src/quadTree/quadTree.ts → lib/js/quadTree/quadTree.js} +0 -9
- package/lib/js/renderer/Renderer.d.ts +311 -0
- package/{src/renderer/Renderer.ts → lib/js/renderer/Renderer.js} +169 -611
- package/lib/js/renderer/RendererEvents.d.ts +237 -0
- package/{src/renderer/RendererEvents.ts → lib/js/renderer/RendererEvents.js} +134 -471
- package/lib/js/scene/Axes.d.ts +12 -0
- package/lib/js/scene/Axes.js +59 -0
- package/lib/js/scene/BaseNode.d.ts +61 -0
- package/{src/scene/BaseNode.ts → lib/js/scene/BaseNode.js} +11 -57
- package/lib/js/scene/Planet.d.ts +623 -0
- package/{src/scene/Planet.ts → lib/js/scene/Planet.js} +251 -935
- package/lib/js/scene/RenderNode.d.ts +150 -0
- package/{src/scene/RenderNode.ts → lib/js/scene/RenderNode.js} +33 -138
- package/lib/js/scene/SkyBox.d.ts +13 -0
- package/{src/scene/SkyBox.ts → lib/js/scene/SkyBox.js} +16 -37
- package/{src/scene/index.ts → lib/js/scene/index.d.ts} +0 -1
- package/lib/js/scene/index.js +5 -0
- package/lib/js/segment/Segment.d.ts +278 -0
- package/{src/segment/Segment.ts → lib/js/segment/Segment.js} +242 -913
- package/lib/js/segment/SegmentLonLat.d.ts +48 -0
- package/{src/segment/SegmentLonLat.ts → lib/js/segment/SegmentLonLat.js} +58 -132
- package/lib/js/segment/SegmentLonLatWgs84.d.ts +10 -0
- package/lib/js/segment/SegmentLonLatWgs84.js +23 -0
- package/lib/js/segment/Slice.d.ts +13 -0
- package/{src/segment/Slice.ts → lib/js/segment/Slice.js} +4 -22
- package/lib/js/segment/segmentHelper.d.ts +18 -0
- package/{src/segment/segmentHelper.ts → lib/js/segment/segmentHelper.js} +30 -88
- package/lib/js/shaders/atmos.d.ts +4 -0
- package/{src/shaders/atmos.ts → lib/js/shaders/atmos.js} +8 -26
- package/lib/js/shaders/billboard.d.ts +3 -0
- package/{src/shaders/billboard.ts → lib/js/shaders/billboard.js} +9 -18
- package/lib/js/shaders/bloom.d.ts +2 -0
- package/{src/shaders/bloom.ts → lib/js/shaders/bloom.js} +5 -8
- package/lib/js/shaders/blur.d.ts +3 -0
- package/{src/shaders/blur.ts → lib/js/shaders/blur.js} +11 -19
- package/lib/js/shaders/depth.d.ts +2 -0
- package/{src/shaders/depth.ts → lib/js/shaders/depth.js} +3 -6
- package/lib/js/shaders/drawnode.d.ts +8 -0
- package/{src/shaders/drawnode.ts → lib/js/shaders/drawnode.js} +23 -75
- package/lib/js/shaders/geoObject.d.ts +3 -0
- package/{src/shaders/geoObject.ts → lib/js/shaders/geoObject.js} +51 -63
- package/lib/js/shaders/label.d.ts +4 -0
- package/{src/shaders/label.ts → lib/js/shaders/label.js} +12 -25
- package/lib/js/shaders/lumFilter.d.ts +2 -0
- package/{src/shaders/lumFilter.ts → lib/js/shaders/lumFilter.js} +4 -7
- package/lib/js/shaders/pickingMask.d.ts +2 -0
- package/{src/shaders/pickingMask.ts → lib/js/shaders/pickingMask.js} +5 -8
- package/lib/js/shaders/pointCloud.d.ts +2 -0
- package/{src/shaders/pointCloud.ts → lib/js/shaders/pointCloud.js} +4 -7
- package/lib/js/shaders/polyline.d.ts +3 -0
- package/{src/shaders/polyline.ts → lib/js/shaders/polyline.js} +7 -22
- package/lib/js/shaders/ray.d.ts +2 -0
- package/{src/shaders/ray.ts → lib/js/shaders/ray.js} +4 -7
- package/lib/js/shaders/screenFrame.d.ts +2 -0
- package/{src/shaders/screenFrame.ts → lib/js/shaders/screenFrame.js} +5 -8
- package/lib/js/shaders/skybox.d.ts +2 -0
- package/{src/shaders/skybox.ts → lib/js/shaders/skybox.js} +10 -13
- package/lib/js/shaders/toneMapping.d.ts +2 -0
- package/{src/shaders/toneMapping.ts → lib/js/shaders/toneMapping.js} +5 -8
- package/lib/js/shaders/utils.d.ts +1 -0
- package/{src/shaders/utils.ts → lib/js/shaders/utils.js} +1 -1
- package/lib/js/terrain/BilTerrain.d.ts +18 -0
- package/{src/terrain/BilTerrain.ts → lib/js/terrain/BilTerrain.js} +21 -118
- package/lib/js/terrain/EmptyTerrain.d.ts +106 -0
- package/{src/terrain/EmptyTerrain.ts → lib/js/terrain/EmptyTerrain.js} +20 -144
- package/lib/js/terrain/Geoid.d.ts +33 -0
- package/lib/js/terrain/Geoid.js +191 -0
- package/lib/js/terrain/GlobusTerrain.d.ts +134 -0
- package/{src/terrain/GlobusTerrain.ts → lib/js/terrain/GlobusTerrain.js} +82 -239
- package/lib/js/terrain/MapboxTerrain.d.ts +21 -0
- package/{src/terrain/MapboxTerrain.ts → lib/js/terrain/MapboxTerrain.js} +46 -215
- package/{src/terrain/index.ts → lib/js/terrain/index.d.ts} +0 -1
- package/lib/js/terrain/index.js +5 -0
- package/lib/js/ui/Button.d.ts +32 -0
- package/lib/js/ui/Button.js +78 -0
- package/lib/js/ui/ButtonGroup.d.ts +16 -0
- package/lib/js/ui/ButtonGroup.js +41 -0
- package/lib/js/ui/Dialog.d.ts +55 -0
- package/lib/js/ui/Dialog.js +173 -0
- package/lib/js/ui/Slider.d.ts +38 -0
- package/lib/js/ui/Slider.js +129 -0
- package/lib/js/ui/ToggleButton.d.ts +20 -0
- package/lib/js/ui/ToggleButton.js +42 -0
- package/lib/js/ui/View.d.ts +37 -0
- package/{src/ui/View.ts → lib/js/ui/View.js} +31 -77
- package/lib/js/ui/icons.d.ts +1 -0
- package/{src/ui/icons.ts → lib/js/ui/icons.js} +1 -1
- package/lib/js/utils/BaseWorker.d.ts +14 -0
- package/{src/utils/BaseWorker.ts → lib/js/utils/BaseWorker.js} +15 -28
- package/lib/js/utils/FontAtlas.d.ts +82 -0
- package/{src/utils/FontAtlas.ts → lib/js/utils/FontAtlas.js} +45 -181
- package/lib/js/utils/GeoImageCreator.d.ts +34 -0
- package/{src/utils/GeoImageCreator.ts → lib/js/utils/GeoImageCreator.js} +34 -91
- package/lib/js/utils/ImagesCacheManager.d.ts +22 -0
- package/{src/utils/ImagesCacheManager.ts → lib/js/utils/ImagesCacheManager.js} +16 -38
- package/lib/js/utils/Loader.d.ts +63 -0
- package/lib/js/utils/Loader.js +156 -0
- package/lib/js/utils/NormalMapCreator.d.ts +52 -0
- package/{src/utils/NormalMapCreator.ts → lib/js/utils/NormalMapCreator.js} +64 -195
- package/lib/js/utils/PlainSegmentWorker.d.ts +24 -0
- package/{src/utils/PlainSegmentWorker.ts → lib/js/utils/PlainSegmentWorker.js} +24 -56
- package/lib/js/utils/TerrainWorker.d.ts +28 -0
- package/{src/utils/TerrainWorker.ts → lib/js/utils/TerrainWorker.js} +19 -56
- package/lib/js/utils/TextureAtlas.d.ts +113 -0
- package/{src/utils/TextureAtlas.ts → lib/js/utils/TextureAtlas.js} +40 -131
- package/lib/js/utils/VectorTileCreator.d.ts +18 -0
- package/{src/utils/VectorTileCreator.ts → lib/js/utils/VectorTileCreator.js} +61 -147
- package/lib/js/utils/colorTable.d.ts +3 -0
- package/{src/utils/colorTable.ts → lib/js/utils/colorTable.js} +2 -2
- package/lib/js/utils/earcut.d.ts +7 -0
- package/{src/utils/earcut.ts → lib/js/utils/earcut.js} +95 -223
- package/lib/js/utils/objParser.d.ts +24 -0
- package/{src/utils/objParser.ts → lib/js/utils/objParser.js} +38 -93
- package/lib/js/utils/shared.d.ts +267 -0
- package/{src/utils/shared.ts → lib/js/utils/shared.js} +184 -341
- package/lib/js/utils/units.d.ts +16 -0
- package/lib/js/utils/units.js +61 -0
- package/lib/js/webgl/BaseFramebuffer.d.ts +53 -0
- package/{src/webgl/BaseFramebuffer.ts → lib/js/webgl/BaseFramebuffer.js} +22 -59
- package/lib/js/webgl/Framebuffer.d.ts +69 -0
- package/{src/webgl/Framebuffer.ts → lib/js/webgl/Framebuffer.js} +30 -87
- package/lib/js/webgl/Handler.d.ts +473 -0
- package/{src/webgl/Handler.ts → lib/js/webgl/Handler.js} +175 -586
- package/lib/js/webgl/Multisample.d.ts +27 -0
- package/lib/js/webgl/Multisample.js +77 -0
- package/lib/js/webgl/Program.d.ts +159 -0
- package/{src/webgl/Program.ts → lib/js/webgl/Program.js} +73 -210
- package/lib/js/webgl/ProgramController.d.ts +86 -0
- package/{src/webgl/ProgramController.ts → lib/js/webgl/ProgramController.js} +11 -45
- package/{src/webgl/index.ts → lib/js/webgl/index.d.ts} +1 -8
- package/lib/js/webgl/index.js +6 -0
- package/lib/js/webgl/types.d.ts +9 -0
- package/{src/webgl/types.ts → lib/js/webgl/types.js} +5 -8
- package/lib/js/webgl/variableHandlers.d.ts +22 -0
- package/lib/js/webgl/variableHandlers.js +78 -0
- package/package.json +23 -34
- package/dist/@openglobus/og.esm.js +0 -2
- package/dist/@openglobus/og.esm.js.map +0 -1
- package/dist/@openglobus/og.umd.js +0 -2
- package/dist/@openglobus/og.umd.js.map +0 -1
- package/src/Deferred.ts +0 -17
- package/src/control/MouseWheelZoomControl.ts +0 -269
- package/src/control/ScaleControl.ts +0 -131
- package/src/control/SegmentBoundVisualization.ts +0 -50
- package/src/control/ShowFps.ts +0 -28
- package/src/control/ToggleWireframe.ts +0 -35
- package/src/control/ruler/Ruler.ts +0 -35
- package/src/control/ruler/RulerScene.ts +0 -437
- package/src/control/timeline/timelineUtils.ts +0 -133
- package/src/ellipsoid/index.ts +0 -4
- package/src/entity/Geometry.ts +0 -486
- package/src/index.ts +0 -173
- package/src/layer/GeoTexture2d.ts +0 -56
- package/src/layer/index.ts +0 -12
- package/src/math/Line3.ts +0 -162
- package/src/math/index.ts +0 -26
- package/src/quadTree/EPSG4326QuadTreeStrategy.ts +0 -24
- package/src/quadTree/EarthQuadTreeStrategy.ts +0 -28
- package/src/quadTree/MarsQuadTreeStrategy.ts +0 -25
- package/src/quadTree/Wgs84QuadTreeStrategy.ts +0 -22
- package/src/quadTree/index.ts +0 -14
- package/src/scene/Axes.ts +0 -78
- package/src/segment/SegmentLonLatWgs84.ts +0 -33
- package/src/terrain/Geoid.ts +0 -273
- package/src/ui/Button.ts +0 -121
- package/src/ui/ButtonGroup.ts +0 -63
- package/src/ui/Dialog.ts +0 -244
- package/src/ui/Slider.ts +0 -188
- package/src/ui/ToggleButton.ts +0 -68
- package/src/utils/Loader.ts +0 -247
- package/src/utils/units.ts +0 -78
- package/src/webgl/Multisample.ts +0 -153
- package/src/webgl/variableHandlers.ts +0 -114
- /package/{dist → lib}/@openglobus/og.css +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.js +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/night-4326.png +0 -0
- /package/{dist → lib}/@openglobus/res/night.png +0 -0
- /package/{dist → lib}/@openglobus/res/spec.png +0 -0
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import {LonLat} from "../LonLat";
|
|
2
|
-
import {Quat} from "../math/Quat";
|
|
3
|
-
import {Vec3} from "../math/Vec3";
|
|
4
|
-
import {DEGREES, EPS1, EPS12, EPS15, RADIANS, zeroTwoPI} from "../math";
|
|
5
|
-
|
|
6
|
-
export interface IInverseResult {
|
|
7
|
-
distance: number;
|
|
8
|
-
initialAzimuth: number;
|
|
9
|
-
finalAzimuth: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface IDirectResult {
|
|
13
|
-
destination: LonLat;
|
|
14
|
-
finalAzimuth: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
1
|
+
import { LonLat } from "../LonLat";
|
|
2
|
+
import { Quat } from "../math/Quat";
|
|
3
|
+
import { Vec3 } from "../math/Vec3";
|
|
4
|
+
import { DEGREES, EPS1, EPS12, EPS15, RADIANS, zeroTwoPI } from "../math";
|
|
17
5
|
/**
|
|
18
6
|
* Class represents a plant ellipsoid.
|
|
19
7
|
* @class
|
|
@@ -21,76 +9,42 @@ export interface IDirectResult {
|
|
|
21
9
|
* @param {number} polarSize - Polar ellipsoid size.
|
|
22
10
|
*/
|
|
23
11
|
class Ellipsoid {
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Equatorial size
|
|
27
|
-
* @type {number}
|
|
28
|
-
* @protected
|
|
29
|
-
*/
|
|
30
|
-
protected _a: number;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Polar size
|
|
34
|
-
* @type {number}
|
|
35
|
-
* @protected
|
|
36
|
-
*/
|
|
37
|
-
protected _b: number;
|
|
38
|
-
protected _flattening: number;
|
|
39
|
-
protected _f: number;
|
|
40
|
-
protected _a2: number;
|
|
41
|
-
protected _b2: number;
|
|
42
|
-
protected _e: number;
|
|
43
|
-
protected _e2: number;
|
|
44
|
-
protected _e22: number;
|
|
45
|
-
protected _k: number;
|
|
46
|
-
protected _k2: number;
|
|
47
|
-
protected _radii: Vec3;
|
|
48
|
-
protected _radii2: Vec3;
|
|
49
|
-
protected _invRadii: Vec3;
|
|
50
|
-
public _invRadii2: Vec3;
|
|
51
|
-
|
|
52
|
-
constructor(equatorialSize: number = 1, polarSize: number = 1) {
|
|
12
|
+
constructor(equatorialSize = 1, polarSize = 1) {
|
|
53
13
|
this._a = equatorialSize;
|
|
54
14
|
this._b = polarSize;
|
|
55
15
|
this._flattening = (equatorialSize - polarSize) / equatorialSize;
|
|
56
16
|
this._f = 1 / this._flattening;
|
|
57
|
-
|
|
58
17
|
this._a2 = equatorialSize * equatorialSize;
|
|
59
18
|
this._b2 = polarSize * polarSize;
|
|
60
|
-
|
|
61
19
|
const qa2b2 = Math.sqrt(this._a2 - this._b2);
|
|
62
|
-
|
|
63
20
|
this._e = qa2b2 / equatorialSize;
|
|
64
21
|
this._e2 = this._e * this._e;
|
|
65
22
|
this._e22 = this._e2 * this._e2;
|
|
66
|
-
|
|
67
23
|
this._k = qa2b2 / polarSize;
|
|
68
24
|
this._k2 = this._k * this._k;
|
|
69
|
-
|
|
70
25
|
this._radii = new Vec3(equatorialSize, equatorialSize, polarSize);
|
|
71
26
|
this._radii2 = new Vec3(this._a2, this._a2, this._b2);
|
|
72
27
|
this._invRadii = new Vec3(1.0 / equatorialSize, 1.0 / equatorialSize, 1.0 / polarSize);
|
|
73
28
|
this._invRadii2 = new Vec3(1.0 / this._a2, 1.0 / this._a2, 1.0 / this._b2);
|
|
74
29
|
}
|
|
75
|
-
|
|
76
30
|
/**
|
|
77
31
|
* Returns the distance travelling from ‘this’ point to destination point along a rhumb line.
|
|
78
32
|
* @param {LonLat} startLonLat coordinates.
|
|
79
33
|
* @param {LonLat} endLonLat coordinates
|
|
80
34
|
* @returns {number} Distance in m between this point and destination point (same units as radius).
|
|
81
35
|
*/
|
|
82
|
-
|
|
36
|
+
rhumbDistanceTo(startLonLat, endLonLat) {
|
|
83
37
|
const f1 = startLonLat.lat * RADIANS;
|
|
84
38
|
const f2 = endLonLat.lat * RADIANS;
|
|
85
39
|
const df = f2 - f1;
|
|
86
40
|
let d = Math.abs(endLonLat.lon - startLonLat.lon) * RADIANS;
|
|
87
|
-
if (Math.abs(d) > Math.PI)
|
|
41
|
+
if (Math.abs(d) > Math.PI)
|
|
42
|
+
d = d > 0 ? -(2 * Math.PI - d) : (2 * Math.PI + d);
|
|
88
43
|
const dd = Math.log(Math.tan(f2 / 2 + Math.PI / 4) / Math.tan(f1 / 2 + Math.PI / 4));
|
|
89
44
|
const q = Math.abs(dd) > 10e-12 ? df / dd : Math.cos(f1);
|
|
90
45
|
const t = Math.sqrt(df * df + q * q * d * d); // angular distance in radians
|
|
91
46
|
return t * this._a;
|
|
92
47
|
}
|
|
93
|
-
|
|
94
48
|
/**
|
|
95
49
|
* Returns the point at given fraction between two points on the great circle.
|
|
96
50
|
* @param {LonLat} lonLat1 - Longitude/Latitude of source point.
|
|
@@ -98,79 +52,69 @@ class Ellipsoid {
|
|
|
98
52
|
* @param {number} fraction - Fraction between the two points (0 = source point, 1 = destination point).
|
|
99
53
|
* @returns {LonLat} Intermediate point between points.
|
|
100
54
|
*/
|
|
101
|
-
|
|
102
|
-
if (fraction == 0)
|
|
103
|
-
|
|
55
|
+
getIntermediatePointOnGreatCircle(lonLat1, lonLat2, fraction) {
|
|
56
|
+
if (fraction == 0)
|
|
57
|
+
return lonLat1.clone();
|
|
58
|
+
if (fraction == 1)
|
|
59
|
+
return lonLat2.clone();
|
|
104
60
|
const inverse = this.inverse(lonLat1, lonLat2);
|
|
105
61
|
const dist = inverse.distance;
|
|
106
62
|
const azimuth = inverse.initialAzimuth;
|
|
107
63
|
return isNaN(azimuth) ? lonLat1 : this.getGreatCircleDestination(lonLat1, azimuth, dist * fraction);
|
|
108
64
|
}
|
|
109
|
-
|
|
110
65
|
/**
|
|
111
66
|
* REMOVE ASAP after
|
|
112
67
|
* @param lonLat1
|
|
113
68
|
* @param lonLat2
|
|
114
69
|
* @returns {number}
|
|
115
70
|
*/
|
|
116
|
-
static getBearing(lonLat1
|
|
117
|
-
let f1 = lonLat1.lat * RADIANS,
|
|
118
|
-
|
|
119
|
-
let f2 = lonLat2.lat * RADIANS,
|
|
120
|
-
l2 = lonLat2.lon * RADIANS;
|
|
71
|
+
static getBearing(lonLat1, lonLat2) {
|
|
72
|
+
let f1 = lonLat1.lat * RADIANS, l1 = lonLat1.lon * RADIANS;
|
|
73
|
+
let f2 = lonLat2.lat * RADIANS, l2 = lonLat2.lon * RADIANS;
|
|
121
74
|
let y = Math.sin(l2 - l1) * Math.cos(f2);
|
|
122
75
|
let x = Math.cos(f1) * Math.sin(f2) - Math.sin(f1) * Math.cos(f2) * Math.cos(l2 - l1);
|
|
123
76
|
return Math.atan2(y, x) * DEGREES;
|
|
124
77
|
}
|
|
125
|
-
|
|
126
|
-
public getFlattening(): number {
|
|
78
|
+
getFlattening() {
|
|
127
79
|
return this._flattening;
|
|
128
80
|
}
|
|
129
|
-
|
|
130
81
|
/**
|
|
131
82
|
* Gets ellipsoid equatorial size.
|
|
132
83
|
* @public
|
|
133
84
|
* @returns {number} -
|
|
134
85
|
*/
|
|
135
|
-
|
|
86
|
+
getEquatorialSize() {
|
|
136
87
|
return this._a;
|
|
137
88
|
}
|
|
138
|
-
|
|
139
|
-
public get equatorialSize(): number {
|
|
89
|
+
get equatorialSize() {
|
|
140
90
|
return this._a;
|
|
141
91
|
}
|
|
142
|
-
|
|
143
|
-
public get equatorialSizeSqr(): number {
|
|
92
|
+
get equatorialSizeSqr() {
|
|
144
93
|
return this._a2;
|
|
145
94
|
}
|
|
146
|
-
|
|
147
95
|
/**
|
|
148
96
|
* Gets ellipsoid polar size.
|
|
149
97
|
* @public
|
|
150
98
|
* @returns {number} -
|
|
151
99
|
*/
|
|
152
|
-
|
|
100
|
+
getPolarSize() {
|
|
153
101
|
return this._b;
|
|
154
102
|
}
|
|
155
|
-
|
|
156
|
-
public get polarSize(): number {
|
|
103
|
+
get polarSize() {
|
|
157
104
|
return this._b;
|
|
158
105
|
}
|
|
159
|
-
|
|
160
|
-
public get polarSizeSqr(): number {
|
|
106
|
+
get polarSizeSqr() {
|
|
161
107
|
return this._b2;
|
|
162
108
|
}
|
|
163
|
-
|
|
164
109
|
/**
|
|
165
110
|
* Calculate cartesian coordinates by its ECEF geodetic coordinates.
|
|
166
111
|
* @public
|
|
167
112
|
* @param {LonLat} lonlat - Geodetic coordinates.
|
|
168
113
|
* @returns {Vec3} -
|
|
169
114
|
*/
|
|
170
|
-
|
|
115
|
+
lonLatToCartesian(lonlat) {
|
|
171
116
|
return this.geodeticToCartesian(lonlat.lon, lonlat.lat, lonlat.height);
|
|
172
117
|
}
|
|
173
|
-
|
|
174
118
|
/**
|
|
175
119
|
* Calculate cartesian coordinates by its ECEF geodetic coordinates.
|
|
176
120
|
* @public
|
|
@@ -178,10 +122,9 @@ class Ellipsoid {
|
|
|
178
122
|
* @param {Vec3} res - Output variable reference.
|
|
179
123
|
* @returns {Vec3} -
|
|
180
124
|
*/
|
|
181
|
-
|
|
125
|
+
lonLatToCartesianRes(lonlat, res) {
|
|
182
126
|
return this.geodeticToCartesian(lonlat.lon, lonlat.lat, lonlat.height, res);
|
|
183
127
|
}
|
|
184
|
-
|
|
185
128
|
/**
|
|
186
129
|
* Gets cartesian ECEF from Wgs84 geodetic coordinates.
|
|
187
130
|
* @public
|
|
@@ -191,128 +134,86 @@ class Ellipsoid {
|
|
|
191
134
|
* @param {Vec3} res - Output result variable.
|
|
192
135
|
* @returns {Vec3} -
|
|
193
136
|
*/
|
|
194
|
-
|
|
195
|
-
let latrad = RADIANS * lat,
|
|
196
|
-
lonrad = RADIANS * lon;
|
|
197
|
-
|
|
137
|
+
geodeticToCartesian(lon, lat, height = 0, res = new Vec3()) {
|
|
138
|
+
let latrad = RADIANS * lat, lonrad = RADIANS * lon;
|
|
198
139
|
let slt = Math.sin(latrad);
|
|
199
|
-
|
|
200
140
|
let N = this._a / Math.sqrt(1 - this._e2 * slt * slt);
|
|
201
141
|
let nc = (N + height) * Math.cos(latrad);
|
|
202
|
-
|
|
203
142
|
res.x = nc * Math.cos(lonrad);
|
|
204
143
|
res.y = nc * Math.sin(lonrad);
|
|
205
144
|
res.z = (N * (1 - this._e2) + height) * slt;
|
|
206
|
-
|
|
207
145
|
return res;
|
|
208
146
|
}
|
|
209
|
-
|
|
210
147
|
/**
|
|
211
148
|
* Gets Wgs84 geodetic coordinates from cartesian ECEF.
|
|
212
149
|
* @public
|
|
213
150
|
* @param {Vec3} p - Cartesian coordinates.
|
|
214
151
|
* @returns {LonLat} -
|
|
215
152
|
*/
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
let pX = p.x || 0.0,
|
|
219
|
-
pY = p.y || 0.0,
|
|
220
|
-
pZ = p.z || 0.0;
|
|
221
|
-
|
|
153
|
+
projToSurface(p) {
|
|
154
|
+
let pX = p.x || 0.0, pY = p.y || 0.0, pZ = p.z || 0.0;
|
|
222
155
|
let length = Math.sqrt(pX * pX + pY * pY + pZ * pZ);
|
|
223
|
-
|
|
224
|
-
let invRadii2X =
|
|
225
|
-
invRadii2Y = this._invRadii2.y,
|
|
226
|
-
invRadii2Z = this._invRadii2.z;
|
|
227
|
-
|
|
228
|
-
let x2 = pX * pX * invRadii2X,
|
|
229
|
-
y2 = pY * pY * invRadii2Y,
|
|
230
|
-
z2 = pZ * pZ * invRadii2Z;
|
|
231
|
-
|
|
156
|
+
let invRadii2X = this._invRadii2.x, invRadii2Y = this._invRadii2.y, invRadii2Z = this._invRadii2.z;
|
|
157
|
+
let x2 = pX * pX * invRadii2X, y2 = pY * pY * invRadii2Y, z2 = pZ * pZ * invRadii2Z;
|
|
232
158
|
let norm = x2 + y2 + z2;
|
|
233
159
|
let ratio = Math.sqrt(1.0 / norm);
|
|
234
160
|
let first = p.scaleTo(ratio);
|
|
235
|
-
|
|
236
161
|
if (norm < EPS1) {
|
|
237
|
-
return !Number.isFinite(ratio) ? new Vec3() : first
|
|
162
|
+
return !Number.isFinite(ratio) ? new Vec3() : first;
|
|
238
163
|
}
|
|
239
|
-
|
|
240
164
|
let lambda = ((1.0 - ratio) * length) / first.mulA(this._invRadii2).length();
|
|
241
|
-
|
|
242
165
|
let m_X = 0.0, m_Y = 0.0, m_Z = 0.0;
|
|
243
|
-
|
|
244
166
|
do {
|
|
245
167
|
m_X = 1.0 / (1.0 + lambda * invRadii2X);
|
|
246
168
|
m_Y = 1.0 / (1.0 + lambda * invRadii2Y);
|
|
247
169
|
m_Z = 1.0 / (1.0 + lambda * invRadii2Z);
|
|
248
|
-
|
|
249
|
-
let m_X2 = m_X * m_X,
|
|
250
|
-
m_Y2 = m_Y * m_Y,
|
|
251
|
-
m_Z2 = m_Z * m_Z;
|
|
252
|
-
|
|
170
|
+
let m_X2 = m_X * m_X, m_Y2 = m_Y * m_Y, m_Z2 = m_Z * m_Z;
|
|
253
171
|
let func = x2 * m_X2 + y2 * m_Y2 + z2 * m_Z2 - 1.0;
|
|
254
|
-
|
|
255
172
|
if (Math.abs(func) < EPS12) {
|
|
256
173
|
break;
|
|
257
174
|
}
|
|
258
|
-
|
|
259
|
-
let m_X3 = m_X2 * m_X,
|
|
260
|
-
m_Y3 = m_Y2 * m_Y,
|
|
261
|
-
m_Z3 = m_Z2 * m_Z;
|
|
262
|
-
|
|
175
|
+
let m_X3 = m_X2 * m_X, m_Y3 = m_Y2 * m_Y, m_Z3 = m_Z2 * m_Z;
|
|
263
176
|
lambda += 0.5 * func / (x2 * m_X3 * invRadii2X + y2 * m_Y3 * invRadii2Y + z2 * m_Z3 * invRadii2Z);
|
|
264
|
-
|
|
265
177
|
} while (true); // eslint-disable-line
|
|
266
|
-
|
|
267
178
|
return new Vec3(pX * m_X, pY * m_Y, pZ * m_Z);
|
|
268
179
|
}
|
|
269
|
-
|
|
270
180
|
/**
|
|
271
181
|
* Converts 3d cartesian coordinates to geodetic
|
|
272
182
|
* @param {Vec3} cart - Cartesian coordinates
|
|
273
183
|
* @returns {LonLat} - Geodetic coordinates
|
|
274
184
|
*/
|
|
275
|
-
|
|
185
|
+
cartesianToLonLat(cart) {
|
|
276
186
|
return this.cartesianToLonLatRes(cart);
|
|
277
187
|
}
|
|
278
|
-
|
|
279
188
|
/**
|
|
280
189
|
* Converts 3d cartesian coordinates to geodetic
|
|
281
190
|
* @param {Vec3} cart - Cartesian coordinates
|
|
282
191
|
* @param {LonLat} res - Link geodetic coordinates variable
|
|
283
192
|
* @returns {LonLat} - Geodetic coordinates
|
|
284
193
|
*/
|
|
285
|
-
|
|
194
|
+
cartesianToLonLatRes(cart, res = new LonLat()) {
|
|
286
195
|
let p = this.projToSurface(cart);
|
|
287
|
-
let n = this.getSurfaceNormal3v(p),
|
|
288
|
-
h = cart.sub(p);
|
|
289
|
-
|
|
196
|
+
let n = this.getSurfaceNormal3v(p), h = cart.sub(p);
|
|
290
197
|
res.lon = Math.atan2(n.y, n.x) * DEGREES;
|
|
291
198
|
res.lat = Math.asin(n.z) * DEGREES;
|
|
292
199
|
res.height = Math.sign(h.dot(cart)) * h.length();
|
|
293
|
-
|
|
294
200
|
return res;
|
|
295
201
|
}
|
|
296
|
-
|
|
297
202
|
/**
|
|
298
203
|
* Gets ellipsoid surface normal.
|
|
299
204
|
* @public
|
|
300
205
|
* @param {Vec3} coord - Spatial coordinates.
|
|
301
206
|
* @return {Vec3} -
|
|
302
207
|
*/
|
|
303
|
-
|
|
208
|
+
getSurfaceNormal3v(coord) {
|
|
304
209
|
let r2 = this._invRadii2;
|
|
305
|
-
let nx = coord.x * r2.x,
|
|
306
|
-
ny = coord.y * r2.y,
|
|
307
|
-
nz = coord.z * r2.z;
|
|
210
|
+
let nx = coord.x * r2.x, ny = coord.y * r2.y, nz = coord.z * r2.z;
|
|
308
211
|
let l = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
309
212
|
return new Vec3(nx * l, ny * l, nz * l);
|
|
310
213
|
}
|
|
311
|
-
|
|
312
|
-
public getGreatCircleDistance(lonLat1: LonLat, lonLat2: LonLat): number {
|
|
214
|
+
getGreatCircleDistance(lonLat1, lonLat2) {
|
|
313
215
|
return this.inverse(lonLat1, lonLat2).distance;
|
|
314
216
|
}
|
|
315
|
-
|
|
316
217
|
/**
|
|
317
218
|
* Calculates the destination point given start point lat / lon, azimuth(deg) and distance (m).
|
|
318
219
|
* Source: http://movable-type.co.uk/scripts/latlong-vincenty-direct.html and optimized / cleaned up by Mathias Bynens <http://mathiasbynens.be/>
|
|
@@ -322,34 +223,28 @@ class Ellipsoid {
|
|
|
322
223
|
* @param {number} dist - Distance to the destination point coordinates in meters
|
|
323
224
|
* @returns {LonLat} - Destination point coordinates
|
|
324
225
|
*/
|
|
325
|
-
|
|
226
|
+
getGreatCircleDestination(lonLat, azimuth, dist) {
|
|
326
227
|
return this.direct(lonLat, azimuth, dist).destination;
|
|
327
228
|
}
|
|
328
|
-
|
|
329
|
-
public inverse(lonLat1: LonLat, lonLat2: LonLat): IInverseResult {
|
|
330
|
-
|
|
229
|
+
inverse(lonLat1, lonLat2) {
|
|
331
230
|
let a = this._a, b = this._b, f = this._flattening;
|
|
332
|
-
|
|
333
231
|
const fi1 = lonLat1.lat * RADIANS, lambda1 = lonLat1.lon * RADIANS;
|
|
334
232
|
const fi2 = lonLat2.lat * RADIANS, lambda2 = lonLat2.lon * RADIANS;
|
|
335
|
-
|
|
336
233
|
const L = lambda2 - lambda1; // L = difference in longitude, U = reduced latitude, defined by tan U = (1-f)·tanφ.
|
|
337
234
|
const tanU1 = (1 - f) * Math.tan(fi1), cosU1 = 1 / Math.sqrt((1 + tanU1 * tanU1)), sinU1 = tanU1 * cosU1;
|
|
338
235
|
const tanU2 = (1 - f) * Math.tan(fi2), cosU2 = 1 / Math.sqrt((1 + tanU2 * tanU2)), sinU2 = tanU2 * cosU2;
|
|
339
|
-
|
|
340
236
|
const antipodal = Math.abs(L) > Math.PI / 2 || Math.abs(fi2 - fi1) > Math.PI / 2;
|
|
341
|
-
|
|
342
237
|
let lmb = L, sinLmb = null, cosLmb = null; // lmb - difference in longitude on an auxiliary sphere
|
|
343
238
|
let s = antipodal ? Math.PI : 0, sin_s = 0, cos_s = antipodal ? -1 : 1, sinSqs = null; // s - angular distance lonLat1 lonLat2 on the sphere
|
|
344
|
-
let cos2sm = 1;
|
|
345
|
-
let cosSqa = 1;
|
|
346
|
-
|
|
239
|
+
let cos2sm = 1; // sm - angular distance on the sphere from the equator to the midpoint of the line
|
|
240
|
+
let cosSqa = 1; // a - azimuth of the geodesic at the equator
|
|
347
241
|
let lmb_ = null, iterations = 0;
|
|
348
242
|
do {
|
|
349
243
|
sinLmb = Math.sin(lmb);
|
|
350
244
|
cosLmb = Math.cos(lmb);
|
|
351
245
|
sinSqs = (cosU2 * sinLmb) ** 2 + (cosU1 * sinU2 - sinU1 * cosU2 * cosLmb) ** 2;
|
|
352
|
-
if (Math.abs(sinSqs) < 1e-24)
|
|
246
|
+
if (Math.abs(sinSqs) < 1e-24)
|
|
247
|
+
break; // co-incident/antipodal points (σ < ≈0.006mm)
|
|
353
248
|
sin_s = Math.sqrt(sinSqs);
|
|
354
249
|
cos_s = sinU1 * sinU2 + cosU1 * cosU2 * cosLmb;
|
|
355
250
|
s = Math.atan2(sin_s, cos_s);
|
|
@@ -360,28 +255,23 @@ class Ellipsoid {
|
|
|
360
255
|
lmb_ = lmb;
|
|
361
256
|
lmb = L + (1 - C) * f * sin_a * (s + C * sin_s * (cos2sm + C * cos_s * (-1 + 2 * cos2sm * cos2sm)));
|
|
362
257
|
} while (Math.abs(lmb - lmb_) > EPS12 && ++iterations < 1000);
|
|
363
|
-
|
|
364
258
|
const uSq = cosSqa * (a * a - b * b) / (b * b);
|
|
365
259
|
const A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
|
|
366
260
|
const B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
|
|
367
261
|
const ds = B * sin_s * (cos2sm + B / 4 * (cos_s * (-1 + 2 * cos2sm * cos2sm) - B / 6 * cos2sm * (-3 + 4 * sin_s * sin_s) * (-3 + 4 * cos2sm * cos2sm)));
|
|
368
|
-
|
|
369
262
|
const dist = b * A * (s - ds); // s = length of the geodesic
|
|
370
|
-
|
|
371
263
|
// note special handling of exactly antipodal points where sin²σ = 0 (due to discontinuity
|
|
372
264
|
// atan2(0, 0) = 0 but atan2(ε, 0) = π/2 / 90°) - in which case bearing is always meridional,
|
|
373
265
|
// due north (or due south!)
|
|
374
266
|
// α = azimuths of the geodesic; α2 the direction P₁ P₂ produced
|
|
375
267
|
const a1 = Math.abs(sinSqs) < Number.EPSILON ? 0 : Math.atan2(cosU2 * sinLmb, cosU1 * sinU2 - sinU1 * cosU2 * cosLmb);
|
|
376
268
|
const a2 = Math.abs(sinSqs) < Number.EPSILON ? Math.PI : Math.atan2(cosU1 * sinLmb, -sinU1 * cosU2 + cosU1 * sinU2 * cosLmb);
|
|
377
|
-
|
|
378
269
|
return {
|
|
379
270
|
distance: dist,
|
|
380
271
|
initialAzimuth: Math.abs(dist) < Number.EPSILON ? NaN : zeroTwoPI(a1) * DEGREES,
|
|
381
272
|
finalAzimuth: Math.abs(dist) < Number.EPSILON ? NaN : zeroTwoPI(a2) * DEGREES
|
|
382
273
|
};
|
|
383
274
|
}
|
|
384
|
-
|
|
385
275
|
/**
|
|
386
276
|
* Calculates the destination point given start point lat / lon, azimuth(deg) and distance (m).
|
|
387
277
|
* Source: http://movable-type.co.uk/scripts/latlong-vincenty-direct.html and optimized / cleaned up by Mathias Bynens <http://mathiasbynens.be/>
|
|
@@ -391,69 +281,27 @@ class Ellipsoid {
|
|
|
391
281
|
* @param {number} dist - Distance to the destination point coordinates in meters
|
|
392
282
|
* @returns {LonLat} - Destination point coordinates
|
|
393
283
|
*/
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
let
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
let a = this._a,
|
|
400
|
-
b = this._b,
|
|
401
|
-
f = this._flattening,
|
|
402
|
-
s = dist,
|
|
403
|
-
alpha1 = azimuth * RADIANS,
|
|
404
|
-
sinAlpha1 = Math.sin(alpha1),
|
|
405
|
-
cosAlpha1 = Math.cos(alpha1),
|
|
406
|
-
tanU1 = (1 - f) * Math.tan(lat1 * RADIANS),
|
|
407
|
-
cosU1 = 1 / Math.sqrt(1 + tanU1 * tanU1),
|
|
408
|
-
sinU1 = tanU1 * cosU1,
|
|
409
|
-
sigma1 = Math.atan2(tanU1, cosAlpha1),
|
|
410
|
-
sinAlpha = cosU1 * sinAlpha1,
|
|
411
|
-
cosSqAlpha = 1 - sinAlpha * sinAlpha,
|
|
412
|
-
uSq = (cosSqAlpha * (a * a - b * b)) / (b * b),
|
|
413
|
-
A = 1 + (uSq / 16384) * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq))),
|
|
414
|
-
B = (uSq / 1024) * (256 + uSq * (-128 + uSq * (74 - 47 * uSq))),
|
|
415
|
-
sigma = s / (b * A),
|
|
416
|
-
sigmaP = 2 * Math.PI;
|
|
417
|
-
|
|
418
|
-
let cos2SigmaM = 0,
|
|
419
|
-
sinSigma = 0,
|
|
420
|
-
cosSigma = 0,
|
|
421
|
-
deltaSigma = 0;
|
|
422
|
-
|
|
284
|
+
direct(lonLat, azimuth, dist) {
|
|
285
|
+
let lon1 = lonLat.lon, lat1 = lonLat.lat;
|
|
286
|
+
let a = this._a, b = this._b, f = this._flattening, s = dist, alpha1 = azimuth * RADIANS, sinAlpha1 = Math.sin(alpha1), cosAlpha1 = Math.cos(alpha1), tanU1 = (1 - f) * Math.tan(lat1 * RADIANS), cosU1 = 1 / Math.sqrt(1 + tanU1 * tanU1), sinU1 = tanU1 * cosU1, sigma1 = Math.atan2(tanU1, cosAlpha1), sinAlpha = cosU1 * sinAlpha1, cosSqAlpha = 1 - sinAlpha * sinAlpha, uSq = (cosSqAlpha * (a * a - b * b)) / (b * b), A = 1 + (uSq / 16384) * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq))), B = (uSq / 1024) * (256 + uSq * (-128 + uSq * (74 - 47 * uSq))), sigma = s / (b * A), sigmaP = 2 * Math.PI;
|
|
287
|
+
let cos2SigmaM = 0, sinSigma = 0, cosSigma = 0, deltaSigma = 0;
|
|
423
288
|
while (Math.abs(sigma - sigmaP) > 1e-12) {
|
|
424
289
|
cos2SigmaM = Math.cos(2 * sigma1 + sigma);
|
|
425
290
|
sinSigma = Math.sin(sigma);
|
|
426
291
|
cosSigma = Math.cos(sigma);
|
|
427
292
|
deltaSigma = B * sinSigma *
|
|
428
293
|
(cos2SigmaM + (B / 4) *
|
|
429
|
-
(
|
|
430
|
-
|
|
431
|
-
(B / 6) * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)
|
|
432
|
-
));
|
|
294
|
+
(cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) -
|
|
295
|
+
(B / 6) * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
|
|
433
296
|
sigmaP = sigma;
|
|
434
297
|
sigma = s / (b * A) + deltaSigma;
|
|
435
298
|
}
|
|
436
|
-
|
|
437
|
-
let tmp = sinU1 * sinSigma - cosU1 * cosSigma * cosAlpha1,
|
|
438
|
-
lat2 = Math.atan2(
|
|
439
|
-
sinU1 * cosSigma + cosU1 * sinSigma * cosAlpha1,
|
|
440
|
-
(1 - f) * Math.sqrt(sinAlpha * sinAlpha + tmp * tmp)
|
|
441
|
-
),
|
|
442
|
-
lambda = Math.atan2(
|
|
443
|
-
sinSigma * sinAlpha1,
|
|
444
|
-
cosU1 * cosSigma - sinU1 * sinSigma * cosAlpha1
|
|
445
|
-
),
|
|
446
|
-
C = (f / 16.0) * cosSqAlpha * (4.0 + f * (4.0 - 3.0 * cosSqAlpha)),
|
|
447
|
-
L = lambda - (1.0 - C) * f * sinAlpha * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1.0 + 2.0 * cos2SigmaM * cos2SigmaM))),
|
|
448
|
-
revAz = Math.atan2(sinAlpha, -tmp);
|
|
449
|
-
|
|
299
|
+
let tmp = sinU1 * sinSigma - cosU1 * cosSigma * cosAlpha1, lat2 = Math.atan2(sinU1 * cosSigma + cosU1 * sinSigma * cosAlpha1, (1 - f) * Math.sqrt(sinAlpha * sinAlpha + tmp * tmp)), lambda = Math.atan2(sinSigma * sinAlpha1, cosU1 * cosSigma - sinU1 * sinSigma * cosAlpha1), C = (f / 16.0) * cosSqAlpha * (4.0 + f * (4.0 - 3.0 * cosSqAlpha)), L = lambda - (1.0 - C) * f * sinAlpha * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1.0 + 2.0 * cos2SigmaM * cos2SigmaM))), revAz = Math.atan2(sinAlpha, -tmp);
|
|
450
300
|
return {
|
|
451
301
|
destination: new LonLat(lon1 + L * DEGREES, lat2 * DEGREES),
|
|
452
302
|
finalAzimuth: revAz * DEGREES
|
|
453
303
|
};
|
|
454
304
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
305
|
/**
|
|
458
306
|
* Returns cartesian coordinates of the intersection of a ray and an ellipsoid.
|
|
459
307
|
* If the ray doesn't hit ellipsoid returns null.
|
|
@@ -462,34 +310,29 @@ class Ellipsoid {
|
|
|
462
310
|
* @param {Vec3} direction - Ray direction.
|
|
463
311
|
* @returns {Vec3} -
|
|
464
312
|
*/
|
|
465
|
-
|
|
313
|
+
hitRay(origin, direction) {
|
|
466
314
|
let q = this._invRadii.mul(origin);
|
|
467
315
|
let w = this._invRadii.mul(direction);
|
|
468
|
-
|
|
469
316
|
let q2 = q.dot(q);
|
|
470
317
|
let qw = q.dot(w);
|
|
471
|
-
|
|
472
318
|
let difference, w2, product, discriminant, temp;
|
|
473
|
-
|
|
474
319
|
if (q2 > 1.0) {
|
|
475
320
|
// Outside ellipsoid.
|
|
476
321
|
if (qw >= 0.0) {
|
|
477
322
|
// Looking outward or tangent (0 intersections).
|
|
478
323
|
return undefined;
|
|
479
324
|
}
|
|
480
|
-
|
|
481
325
|
// qw < 0.0.
|
|
482
326
|
var qw2 = qw * qw;
|
|
483
327
|
difference = q2 - 1.0; // Positively valued.
|
|
484
328
|
w2 = w.dot(w);
|
|
485
329
|
product = w2 * difference;
|
|
486
|
-
|
|
487
330
|
let eps = Math.abs(qw2 - product);
|
|
488
|
-
|
|
489
331
|
if (eps > EPS15 && qw2 < product) {
|
|
490
332
|
// Imaginary roots (0 intersections).
|
|
491
333
|
return undefined;
|
|
492
|
-
}
|
|
334
|
+
}
|
|
335
|
+
else if (qw2 > product) {
|
|
493
336
|
// Distinct roots (2 intersections).
|
|
494
337
|
discriminant = qw * qw - product;
|
|
495
338
|
temp = -qw + Math.sqrt(discriminant); // Avoid cancellation.
|
|
@@ -499,12 +342,14 @@ class Ellipsoid {
|
|
|
499
342
|
return origin.add(direction.scaleTo(root0));
|
|
500
343
|
}
|
|
501
344
|
return origin.add(direction.scaleTo(root1));
|
|
502
|
-
}
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
503
347
|
// qw2 == product. Repeated roots (2 intersections).
|
|
504
348
|
var root = Math.sqrt(difference / w2);
|
|
505
349
|
return origin.add(direction.scaleTo(root));
|
|
506
350
|
}
|
|
507
|
-
}
|
|
351
|
+
}
|
|
352
|
+
else if (q2 < 1.0) {
|
|
508
353
|
// Inside ellipsoid (2 intersections).
|
|
509
354
|
difference = q2 - 1.0; // Negatively valued.
|
|
510
355
|
w2 = w.dot(w);
|
|
@@ -512,7 +357,8 @@ class Ellipsoid {
|
|
|
512
357
|
discriminant = qw * qw - product;
|
|
513
358
|
temp = -qw + Math.sqrt(discriminant); // Positively valued.
|
|
514
359
|
return origin.add(direction.scaleTo(temp / w2));
|
|
515
|
-
}
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
516
362
|
// q2 == 1.0. On ellipsoid.
|
|
517
363
|
if (qw < 0.0) {
|
|
518
364
|
// Looking inward.
|
|
@@ -523,13 +369,11 @@ class Ellipsoid {
|
|
|
523
369
|
// return undefined
|
|
524
370
|
}
|
|
525
371
|
}
|
|
526
|
-
|
|
527
|
-
public getNorthFrameRotation(cartesian: Vec3): Quat {
|
|
372
|
+
getNorthFrameRotation(cartesian) {
|
|
528
373
|
let n = this.getSurfaceNormal3v(cartesian);
|
|
529
374
|
let t = Vec3.proj_b_to_plane(Vec3.NORTH, n);
|
|
530
375
|
return Quat.getLookRotation(t, n);
|
|
531
376
|
}
|
|
532
|
-
|
|
533
377
|
/**
|
|
534
378
|
* @todo this is not precise function, needs to be replaced or removed
|
|
535
379
|
* @param lonLat1
|
|
@@ -537,26 +381,16 @@ class Ellipsoid {
|
|
|
537
381
|
* @param distance
|
|
538
382
|
* @returns {LonLat}
|
|
539
383
|
*/
|
|
540
|
-
|
|
384
|
+
getBearingDestination(lonLat1, bearing = 0.0, distance = 0) {
|
|
541
385
|
bearing = bearing * RADIANS;
|
|
542
386
|
var nlon = ((lonLat1.lon + 540) % 360) - 180;
|
|
543
|
-
var f1 = lonLat1.lat * RADIANS,
|
|
544
|
-
l1 = nlon * RADIANS;
|
|
387
|
+
var f1 = lonLat1.lat * RADIANS, l1 = nlon * RADIANS;
|
|
545
388
|
var dR = distance / this._a;
|
|
546
|
-
var f2 = Math.asin(
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
(l1 +
|
|
551
|
-
Math.atan2(
|
|
552
|
-
Math.sin(bearing) * Math.sin(dR) * Math.cos(f1),
|
|
553
|
-
Math.cos(dR) - Math.sin(f1) * Math.sin(f2)
|
|
554
|
-
)) *
|
|
555
|
-
DEGREES,
|
|
556
|
-
f2 * DEGREES
|
|
557
|
-
);
|
|
389
|
+
var f2 = Math.asin(Math.sin(f1) * Math.cos(dR) + Math.cos(f1) * Math.sin(dR) * Math.cos(bearing));
|
|
390
|
+
return new LonLat((l1 +
|
|
391
|
+
Math.atan2(Math.sin(bearing) * Math.sin(dR) * Math.cos(f1), Math.cos(dR) - Math.sin(f1) * Math.sin(f2))) *
|
|
392
|
+
DEGREES, f2 * DEGREES);
|
|
558
393
|
}
|
|
559
|
-
|
|
560
394
|
/**
|
|
561
395
|
* Returns the point at given fraction between two points on the great circle.
|
|
562
396
|
* @param {LonLat} lonLat1 - Longitude/Latitude of source point.
|
|
@@ -564,56 +398,37 @@ class Ellipsoid {
|
|
|
564
398
|
* @param {number} fraction - Fraction between the two points (0 = source point, 1 = destination point).
|
|
565
399
|
* @returns {LonLat} Intermediate point between points.
|
|
566
400
|
*/
|
|
567
|
-
static getIntermediatePointOnGreatCircle(lonLat1
|
|
568
|
-
var f1 = lonLat1.lat * RADIANS,
|
|
569
|
-
|
|
570
|
-
var
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
var
|
|
574
|
-
cosf1 = Math.cos(f1),
|
|
575
|
-
sinl1 = Math.sin(l1),
|
|
576
|
-
cosl1 = Math.cos(l1);
|
|
577
|
-
var sinf2 = Math.sin(f2),
|
|
578
|
-
cosf2 = Math.cos(f2),
|
|
579
|
-
sinl2 = Math.sin(l2),
|
|
580
|
-
cosl2 = Math.cos(l2);
|
|
581
|
-
|
|
582
|
-
var df = f2 - f1,
|
|
583
|
-
dl = l2 - l1;
|
|
584
|
-
var a =
|
|
585
|
-
Math.sin(df / 2) * Math.sin(df / 2) +
|
|
401
|
+
static getIntermediatePointOnGreatCircle(lonLat1, lonLat2, fraction) {
|
|
402
|
+
var f1 = lonLat1.lat * RADIANS, l1 = lonLat1.lon * RADIANS;
|
|
403
|
+
var f2 = lonLat2.lat * RADIANS, l2 = lonLat2.lon * RADIANS;
|
|
404
|
+
var sinf1 = Math.sin(f1), cosf1 = Math.cos(f1), sinl1 = Math.sin(l1), cosl1 = Math.cos(l1);
|
|
405
|
+
var sinf2 = Math.sin(f2), cosf2 = Math.cos(f2), sinl2 = Math.sin(l2), cosl2 = Math.cos(l2);
|
|
406
|
+
var df = f2 - f1, dl = l2 - l1;
|
|
407
|
+
var a = Math.sin(df / 2) * Math.sin(df / 2) +
|
|
586
408
|
Math.cos(f1) * Math.cos(f2) * Math.sin(dl / 2) * Math.sin(dl / 2);
|
|
587
409
|
var d = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
588
|
-
|
|
589
410
|
var A = Math.sin((1 - fraction) * d) / Math.sin(d);
|
|
590
411
|
var B = Math.sin(fraction * d) / Math.sin(d);
|
|
591
|
-
|
|
592
412
|
var x = A * cosf1 * cosl1 + B * cosf2 * cosl2;
|
|
593
413
|
var y = A * cosf1 * sinl1 + B * cosf2 * sinl2;
|
|
594
414
|
var z = A * sinf1 + B * sinf2;
|
|
595
|
-
|
|
596
415
|
var f3 = Math.atan2(z, Math.sqrt(x * x + y * y));
|
|
597
416
|
var l3 = Math.atan2(y, x);
|
|
598
|
-
|
|
599
417
|
return new LonLat(((l3 * DEGREES + 540) % 360) - 180, f3 * DEGREES);
|
|
600
418
|
}
|
|
601
|
-
|
|
602
|
-
static getRhumbBearing(lonLat1: LonLat, lonLat2: LonLat): number {
|
|
419
|
+
static getRhumbBearing(lonLat1, lonLat2) {
|
|
603
420
|
var dLon = (lonLat2.lon - lonLat1.lon) * RADIANS;
|
|
604
|
-
var dPhi = Math.log(
|
|
605
|
-
Math.tan((
|
|
606
|
-
Math.tan((lonLat1.lat * RADIANS) / 2 + Math.PI / 4)
|
|
607
|
-
);
|
|
421
|
+
var dPhi = Math.log(Math.tan((lonLat2.lat * RADIANS) / 2 + Math.PI / 4) /
|
|
422
|
+
Math.tan((lonLat1.lat * RADIANS) / 2 + Math.PI / 4));
|
|
608
423
|
if (Math.abs(dLon) > Math.PI) {
|
|
609
424
|
if (dLon > 0) {
|
|
610
425
|
dLon = (2 * Math.PI - dLon) * -1;
|
|
611
|
-
}
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
612
428
|
dLon = 2 * Math.PI + dLon;
|
|
613
429
|
}
|
|
614
430
|
}
|
|
615
431
|
return (Math.atan2(dLon, dPhi) * DEGREES + 360) % 360;
|
|
616
432
|
}
|
|
617
433
|
}
|
|
618
|
-
|
|
619
|
-
export {Ellipsoid};
|
|
434
|
+
export { Ellipsoid };
|