@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.
- 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} +85 -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} +102 -374
- package/lib/js/entity/EntityCollection.d.ts +363 -0
- package/{src/entity/EntityCollection.ts → lib/js/entity/EntityCollection.js} +57 -359
- 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} +63 -165
- 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 +243 -0
- package/{src/layer/Vector.ts → lib/js/layer/Vector.js} +155 -426
- 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 +320 -0
- package/{src/renderer/Renderer.ts → lib/js/renderer/Renderer.js} +265 -622
- package/lib/js/renderer/RendererEvents.d.ts +239 -0
- package/{src/renderer/RendererEvents.ts → lib/js/renderer/RendererEvents.js} +158 -472
- 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} +257 -937
- 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} +84 -241
- 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} +46 -182
- 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} +185 -342
- 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,89 @@ 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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
let x2 = pX * pX * invRadii2X,
|
|
229
|
-
y2 = pY * pY * invRadii2Y,
|
|
230
|
-
z2 = pZ * pZ * invRadii2Z;
|
|
231
|
-
|
|
156
|
+
if (length === 0) {
|
|
157
|
+
return this.lonLatToCartesian(new LonLat());
|
|
158
|
+
}
|
|
159
|
+
let invRadii2X = this._invRadii2.x, invRadii2Y = this._invRadii2.y, invRadii2Z = this._invRadii2.z;
|
|
160
|
+
let x2 = pX * pX * invRadii2X, y2 = pY * pY * invRadii2Y, z2 = pZ * pZ * invRadii2Z;
|
|
232
161
|
let norm = x2 + y2 + z2;
|
|
233
162
|
let ratio = Math.sqrt(1.0 / norm);
|
|
234
163
|
let first = p.scaleTo(ratio);
|
|
235
|
-
|
|
236
164
|
if (norm < EPS1) {
|
|
237
|
-
return !Number.isFinite(ratio) ? new Vec3() : first
|
|
165
|
+
return !Number.isFinite(ratio) ? new Vec3() : first;
|
|
238
166
|
}
|
|
239
|
-
|
|
240
167
|
let lambda = ((1.0 - ratio) * length) / first.mulA(this._invRadii2).length();
|
|
241
|
-
|
|
242
168
|
let m_X = 0.0, m_Y = 0.0, m_Z = 0.0;
|
|
243
|
-
|
|
244
169
|
do {
|
|
245
170
|
m_X = 1.0 / (1.0 + lambda * invRadii2X);
|
|
246
171
|
m_Y = 1.0 / (1.0 + lambda * invRadii2Y);
|
|
247
172
|
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
|
-
|
|
173
|
+
let m_X2 = m_X * m_X, m_Y2 = m_Y * m_Y, m_Z2 = m_Z * m_Z;
|
|
253
174
|
let func = x2 * m_X2 + y2 * m_Y2 + z2 * m_Z2 - 1.0;
|
|
254
|
-
|
|
255
175
|
if (Math.abs(func) < EPS12) {
|
|
256
176
|
break;
|
|
257
177
|
}
|
|
258
|
-
|
|
259
|
-
let m_X3 = m_X2 * m_X,
|
|
260
|
-
m_Y3 = m_Y2 * m_Y,
|
|
261
|
-
m_Z3 = m_Z2 * m_Z;
|
|
262
|
-
|
|
178
|
+
let m_X3 = m_X2 * m_X, m_Y3 = m_Y2 * m_Y, m_Z3 = m_Z2 * m_Z;
|
|
263
179
|
lambda += 0.5 * func / (x2 * m_X3 * invRadii2X + y2 * m_Y3 * invRadii2Y + z2 * m_Z3 * invRadii2Z);
|
|
264
|
-
|
|
265
180
|
} while (true); // eslint-disable-line
|
|
266
|
-
|
|
267
181
|
return new Vec3(pX * m_X, pY * m_Y, pZ * m_Z);
|
|
268
182
|
}
|
|
269
|
-
|
|
270
183
|
/**
|
|
271
184
|
* Converts 3d cartesian coordinates to geodetic
|
|
272
185
|
* @param {Vec3} cart - Cartesian coordinates
|
|
273
186
|
* @returns {LonLat} - Geodetic coordinates
|
|
274
187
|
*/
|
|
275
|
-
|
|
188
|
+
cartesianToLonLat(cart) {
|
|
276
189
|
return this.cartesianToLonLatRes(cart);
|
|
277
190
|
}
|
|
278
|
-
|
|
279
191
|
/**
|
|
280
192
|
* Converts 3d cartesian coordinates to geodetic
|
|
281
193
|
* @param {Vec3} cart - Cartesian coordinates
|
|
282
194
|
* @param {LonLat} res - Link geodetic coordinates variable
|
|
283
195
|
* @returns {LonLat} - Geodetic coordinates
|
|
284
196
|
*/
|
|
285
|
-
|
|
197
|
+
cartesianToLonLatRes(cart, res = new LonLat()) {
|
|
286
198
|
let p = this.projToSurface(cart);
|
|
287
|
-
let n = this.getSurfaceNormal3v(p),
|
|
288
|
-
h = cart.sub(p);
|
|
289
|
-
|
|
199
|
+
let n = this.getSurfaceNormal3v(p), h = cart.sub(p);
|
|
290
200
|
res.lon = Math.atan2(n.y, n.x) * DEGREES;
|
|
291
201
|
res.lat = Math.asin(n.z) * DEGREES;
|
|
292
202
|
res.height = Math.sign(h.dot(cart)) * h.length();
|
|
293
|
-
|
|
294
203
|
return res;
|
|
295
204
|
}
|
|
296
|
-
|
|
297
205
|
/**
|
|
298
206
|
* Gets ellipsoid surface normal.
|
|
299
207
|
* @public
|
|
300
208
|
* @param {Vec3} coord - Spatial coordinates.
|
|
301
209
|
* @return {Vec3} -
|
|
302
210
|
*/
|
|
303
|
-
|
|
211
|
+
getSurfaceNormal3v(coord) {
|
|
304
212
|
let r2 = this._invRadii2;
|
|
305
|
-
let nx = coord.x * r2.x,
|
|
306
|
-
ny = coord.y * r2.y,
|
|
307
|
-
nz = coord.z * r2.z;
|
|
213
|
+
let nx = coord.x * r2.x, ny = coord.y * r2.y, nz = coord.z * r2.z;
|
|
308
214
|
let l = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
309
215
|
return new Vec3(nx * l, ny * l, nz * l);
|
|
310
216
|
}
|
|
311
|
-
|
|
312
|
-
public getGreatCircleDistance(lonLat1: LonLat, lonLat2: LonLat): number {
|
|
217
|
+
getGreatCircleDistance(lonLat1, lonLat2) {
|
|
313
218
|
return this.inverse(lonLat1, lonLat2).distance;
|
|
314
219
|
}
|
|
315
|
-
|
|
316
220
|
/**
|
|
317
221
|
* Calculates the destination point given start point lat / lon, azimuth(deg) and distance (m).
|
|
318
222
|
* Source: http://movable-type.co.uk/scripts/latlong-vincenty-direct.html and optimized / cleaned up by Mathias Bynens <http://mathiasbynens.be/>
|
|
@@ -322,34 +226,28 @@ class Ellipsoid {
|
|
|
322
226
|
* @param {number} dist - Distance to the destination point coordinates in meters
|
|
323
227
|
* @returns {LonLat} - Destination point coordinates
|
|
324
228
|
*/
|
|
325
|
-
|
|
229
|
+
getGreatCircleDestination(lonLat, azimuth, dist) {
|
|
326
230
|
return this.direct(lonLat, azimuth, dist).destination;
|
|
327
231
|
}
|
|
328
|
-
|
|
329
|
-
public inverse(lonLat1: LonLat, lonLat2: LonLat): IInverseResult {
|
|
330
|
-
|
|
232
|
+
inverse(lonLat1, lonLat2) {
|
|
331
233
|
let a = this._a, b = this._b, f = this._flattening;
|
|
332
|
-
|
|
333
234
|
const fi1 = lonLat1.lat * RADIANS, lambda1 = lonLat1.lon * RADIANS;
|
|
334
235
|
const fi2 = lonLat2.lat * RADIANS, lambda2 = lonLat2.lon * RADIANS;
|
|
335
|
-
|
|
336
236
|
const L = lambda2 - lambda1; // L = difference in longitude, U = reduced latitude, defined by tan U = (1-f)·tanφ.
|
|
337
237
|
const tanU1 = (1 - f) * Math.tan(fi1), cosU1 = 1 / Math.sqrt((1 + tanU1 * tanU1)), sinU1 = tanU1 * cosU1;
|
|
338
238
|
const tanU2 = (1 - f) * Math.tan(fi2), cosU2 = 1 / Math.sqrt((1 + tanU2 * tanU2)), sinU2 = tanU2 * cosU2;
|
|
339
|
-
|
|
340
239
|
const antipodal = Math.abs(L) > Math.PI / 2 || Math.abs(fi2 - fi1) > Math.PI / 2;
|
|
341
|
-
|
|
342
240
|
let lmb = L, sinLmb = null, cosLmb = null; // lmb - difference in longitude on an auxiliary sphere
|
|
343
241
|
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
|
-
|
|
242
|
+
let cos2sm = 1; // sm - angular distance on the sphere from the equator to the midpoint of the line
|
|
243
|
+
let cosSqa = 1; // a - azimuth of the geodesic at the equator
|
|
347
244
|
let lmb_ = null, iterations = 0;
|
|
348
245
|
do {
|
|
349
246
|
sinLmb = Math.sin(lmb);
|
|
350
247
|
cosLmb = Math.cos(lmb);
|
|
351
248
|
sinSqs = (cosU2 * sinLmb) ** 2 + (cosU1 * sinU2 - sinU1 * cosU2 * cosLmb) ** 2;
|
|
352
|
-
if (Math.abs(sinSqs) < 1e-24)
|
|
249
|
+
if (Math.abs(sinSqs) < 1e-24)
|
|
250
|
+
break; // co-incident/antipodal points (σ < ≈0.006mm)
|
|
353
251
|
sin_s = Math.sqrt(sinSqs);
|
|
354
252
|
cos_s = sinU1 * sinU2 + cosU1 * cosU2 * cosLmb;
|
|
355
253
|
s = Math.atan2(sin_s, cos_s);
|
|
@@ -360,28 +258,23 @@ class Ellipsoid {
|
|
|
360
258
|
lmb_ = lmb;
|
|
361
259
|
lmb = L + (1 - C) * f * sin_a * (s + C * sin_s * (cos2sm + C * cos_s * (-1 + 2 * cos2sm * cos2sm)));
|
|
362
260
|
} while (Math.abs(lmb - lmb_) > EPS12 && ++iterations < 1000);
|
|
363
|
-
|
|
364
261
|
const uSq = cosSqa * (a * a - b * b) / (b * b);
|
|
365
262
|
const A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
|
|
366
263
|
const B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
|
|
367
264
|
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
265
|
const dist = b * A * (s - ds); // s = length of the geodesic
|
|
370
|
-
|
|
371
266
|
// note special handling of exactly antipodal points where sin²σ = 0 (due to discontinuity
|
|
372
267
|
// atan2(0, 0) = 0 but atan2(ε, 0) = π/2 / 90°) - in which case bearing is always meridional,
|
|
373
268
|
// due north (or due south!)
|
|
374
269
|
// α = azimuths of the geodesic; α2 the direction P₁ P₂ produced
|
|
375
270
|
const a1 = Math.abs(sinSqs) < Number.EPSILON ? 0 : Math.atan2(cosU2 * sinLmb, cosU1 * sinU2 - sinU1 * cosU2 * cosLmb);
|
|
376
271
|
const a2 = Math.abs(sinSqs) < Number.EPSILON ? Math.PI : Math.atan2(cosU1 * sinLmb, -sinU1 * cosU2 + cosU1 * sinU2 * cosLmb);
|
|
377
|
-
|
|
378
272
|
return {
|
|
379
273
|
distance: dist,
|
|
380
274
|
initialAzimuth: Math.abs(dist) < Number.EPSILON ? NaN : zeroTwoPI(a1) * DEGREES,
|
|
381
275
|
finalAzimuth: Math.abs(dist) < Number.EPSILON ? NaN : zeroTwoPI(a2) * DEGREES
|
|
382
276
|
};
|
|
383
277
|
}
|
|
384
|
-
|
|
385
278
|
/**
|
|
386
279
|
* Calculates the destination point given start point lat / lon, azimuth(deg) and distance (m).
|
|
387
280
|
* Source: http://movable-type.co.uk/scripts/latlong-vincenty-direct.html and optimized / cleaned up by Mathias Bynens <http://mathiasbynens.be/>
|
|
@@ -391,69 +284,27 @@ class Ellipsoid {
|
|
|
391
284
|
* @param {number} dist - Distance to the destination point coordinates in meters
|
|
392
285
|
* @returns {LonLat} - Destination point coordinates
|
|
393
286
|
*/
|
|
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
|
-
|
|
287
|
+
direct(lonLat, azimuth, dist) {
|
|
288
|
+
let lon1 = lonLat.lon, lat1 = lonLat.lat;
|
|
289
|
+
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;
|
|
290
|
+
let cos2SigmaM = 0, sinSigma = 0, cosSigma = 0, deltaSigma = 0;
|
|
423
291
|
while (Math.abs(sigma - sigmaP) > 1e-12) {
|
|
424
292
|
cos2SigmaM = Math.cos(2 * sigma1 + sigma);
|
|
425
293
|
sinSigma = Math.sin(sigma);
|
|
426
294
|
cosSigma = Math.cos(sigma);
|
|
427
295
|
deltaSigma = B * sinSigma *
|
|
428
296
|
(cos2SigmaM + (B / 4) *
|
|
429
|
-
(
|
|
430
|
-
|
|
431
|
-
(B / 6) * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)
|
|
432
|
-
));
|
|
297
|
+
(cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) -
|
|
298
|
+
(B / 6) * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
|
|
433
299
|
sigmaP = sigma;
|
|
434
300
|
sigma = s / (b * A) + deltaSigma;
|
|
435
301
|
}
|
|
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
|
-
|
|
302
|
+
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
303
|
return {
|
|
451
304
|
destination: new LonLat(lon1 + L * DEGREES, lat2 * DEGREES),
|
|
452
305
|
finalAzimuth: revAz * DEGREES
|
|
453
306
|
};
|
|
454
307
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
308
|
/**
|
|
458
309
|
* Returns cartesian coordinates of the intersection of a ray and an ellipsoid.
|
|
459
310
|
* If the ray doesn't hit ellipsoid returns null.
|
|
@@ -462,34 +313,29 @@ class Ellipsoid {
|
|
|
462
313
|
* @param {Vec3} direction - Ray direction.
|
|
463
314
|
* @returns {Vec3} -
|
|
464
315
|
*/
|
|
465
|
-
|
|
316
|
+
hitRay(origin, direction) {
|
|
466
317
|
let q = this._invRadii.mul(origin);
|
|
467
318
|
let w = this._invRadii.mul(direction);
|
|
468
|
-
|
|
469
319
|
let q2 = q.dot(q);
|
|
470
320
|
let qw = q.dot(w);
|
|
471
|
-
|
|
472
321
|
let difference, w2, product, discriminant, temp;
|
|
473
|
-
|
|
474
322
|
if (q2 > 1.0) {
|
|
475
323
|
// Outside ellipsoid.
|
|
476
324
|
if (qw >= 0.0) {
|
|
477
325
|
// Looking outward or tangent (0 intersections).
|
|
478
326
|
return undefined;
|
|
479
327
|
}
|
|
480
|
-
|
|
481
328
|
// qw < 0.0.
|
|
482
329
|
var qw2 = qw * qw;
|
|
483
330
|
difference = q2 - 1.0; // Positively valued.
|
|
484
331
|
w2 = w.dot(w);
|
|
485
332
|
product = w2 * difference;
|
|
486
|
-
|
|
487
333
|
let eps = Math.abs(qw2 - product);
|
|
488
|
-
|
|
489
334
|
if (eps > EPS15 && qw2 < product) {
|
|
490
335
|
// Imaginary roots (0 intersections).
|
|
491
336
|
return undefined;
|
|
492
|
-
}
|
|
337
|
+
}
|
|
338
|
+
else if (qw2 > product) {
|
|
493
339
|
// Distinct roots (2 intersections).
|
|
494
340
|
discriminant = qw * qw - product;
|
|
495
341
|
temp = -qw + Math.sqrt(discriminant); // Avoid cancellation.
|
|
@@ -499,12 +345,14 @@ class Ellipsoid {
|
|
|
499
345
|
return origin.add(direction.scaleTo(root0));
|
|
500
346
|
}
|
|
501
347
|
return origin.add(direction.scaleTo(root1));
|
|
502
|
-
}
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
503
350
|
// qw2 == product. Repeated roots (2 intersections).
|
|
504
351
|
var root = Math.sqrt(difference / w2);
|
|
505
352
|
return origin.add(direction.scaleTo(root));
|
|
506
353
|
}
|
|
507
|
-
}
|
|
354
|
+
}
|
|
355
|
+
else if (q2 < 1.0) {
|
|
508
356
|
// Inside ellipsoid (2 intersections).
|
|
509
357
|
difference = q2 - 1.0; // Negatively valued.
|
|
510
358
|
w2 = w.dot(w);
|
|
@@ -512,7 +360,8 @@ class Ellipsoid {
|
|
|
512
360
|
discriminant = qw * qw - product;
|
|
513
361
|
temp = -qw + Math.sqrt(discriminant); // Positively valued.
|
|
514
362
|
return origin.add(direction.scaleTo(temp / w2));
|
|
515
|
-
}
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
516
365
|
// q2 == 1.0. On ellipsoid.
|
|
517
366
|
if (qw < 0.0) {
|
|
518
367
|
// Looking inward.
|
|
@@ -523,13 +372,11 @@ class Ellipsoid {
|
|
|
523
372
|
// return undefined
|
|
524
373
|
}
|
|
525
374
|
}
|
|
526
|
-
|
|
527
|
-
public getNorthFrameRotation(cartesian: Vec3): Quat {
|
|
375
|
+
getNorthFrameRotation(cartesian) {
|
|
528
376
|
let n = this.getSurfaceNormal3v(cartesian);
|
|
529
377
|
let t = Vec3.proj_b_to_plane(Vec3.NORTH, n);
|
|
530
378
|
return Quat.getLookRotation(t, n);
|
|
531
379
|
}
|
|
532
|
-
|
|
533
380
|
/**
|
|
534
381
|
* @todo this is not precise function, needs to be replaced or removed
|
|
535
382
|
* @param lonLat1
|
|
@@ -537,26 +384,16 @@ class Ellipsoid {
|
|
|
537
384
|
* @param distance
|
|
538
385
|
* @returns {LonLat}
|
|
539
386
|
*/
|
|
540
|
-
|
|
387
|
+
getBearingDestination(lonLat1, bearing = 0.0, distance = 0) {
|
|
541
388
|
bearing = bearing * RADIANS;
|
|
542
389
|
var nlon = ((lonLat1.lon + 540) % 360) - 180;
|
|
543
|
-
var f1 = lonLat1.lat * RADIANS,
|
|
544
|
-
l1 = nlon * RADIANS;
|
|
390
|
+
var f1 = lonLat1.lat * RADIANS, l1 = nlon * RADIANS;
|
|
545
391
|
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
|
-
);
|
|
392
|
+
var f2 = Math.asin(Math.sin(f1) * Math.cos(dR) + Math.cos(f1) * Math.sin(dR) * Math.cos(bearing));
|
|
393
|
+
return new LonLat((l1 +
|
|
394
|
+
Math.atan2(Math.sin(bearing) * Math.sin(dR) * Math.cos(f1), Math.cos(dR) - Math.sin(f1) * Math.sin(f2))) *
|
|
395
|
+
DEGREES, f2 * DEGREES);
|
|
558
396
|
}
|
|
559
|
-
|
|
560
397
|
/**
|
|
561
398
|
* Returns the point at given fraction between two points on the great circle.
|
|
562
399
|
* @param {LonLat} lonLat1 - Longitude/Latitude of source point.
|
|
@@ -564,56 +401,37 @@ class Ellipsoid {
|
|
|
564
401
|
* @param {number} fraction - Fraction between the two points (0 = source point, 1 = destination point).
|
|
565
402
|
* @returns {LonLat} Intermediate point between points.
|
|
566
403
|
*/
|
|
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) +
|
|
404
|
+
static getIntermediatePointOnGreatCircle(lonLat1, lonLat2, fraction) {
|
|
405
|
+
var f1 = lonLat1.lat * RADIANS, l1 = lonLat1.lon * RADIANS;
|
|
406
|
+
var f2 = lonLat2.lat * RADIANS, l2 = lonLat2.lon * RADIANS;
|
|
407
|
+
var sinf1 = Math.sin(f1), cosf1 = Math.cos(f1), sinl1 = Math.sin(l1), cosl1 = Math.cos(l1);
|
|
408
|
+
var sinf2 = Math.sin(f2), cosf2 = Math.cos(f2), sinl2 = Math.sin(l2), cosl2 = Math.cos(l2);
|
|
409
|
+
var df = f2 - f1, dl = l2 - l1;
|
|
410
|
+
var a = Math.sin(df / 2) * Math.sin(df / 2) +
|
|
586
411
|
Math.cos(f1) * Math.cos(f2) * Math.sin(dl / 2) * Math.sin(dl / 2);
|
|
587
412
|
var d = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
588
|
-
|
|
589
413
|
var A = Math.sin((1 - fraction) * d) / Math.sin(d);
|
|
590
414
|
var B = Math.sin(fraction * d) / Math.sin(d);
|
|
591
|
-
|
|
592
415
|
var x = A * cosf1 * cosl1 + B * cosf2 * cosl2;
|
|
593
416
|
var y = A * cosf1 * sinl1 + B * cosf2 * sinl2;
|
|
594
417
|
var z = A * sinf1 + B * sinf2;
|
|
595
|
-
|
|
596
418
|
var f3 = Math.atan2(z, Math.sqrt(x * x + y * y));
|
|
597
419
|
var l3 = Math.atan2(y, x);
|
|
598
|
-
|
|
599
420
|
return new LonLat(((l3 * DEGREES + 540) % 360) - 180, f3 * DEGREES);
|
|
600
421
|
}
|
|
601
|
-
|
|
602
|
-
static getRhumbBearing(lonLat1: LonLat, lonLat2: LonLat): number {
|
|
422
|
+
static getRhumbBearing(lonLat1, lonLat2) {
|
|
603
423
|
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
|
-
);
|
|
424
|
+
var dPhi = Math.log(Math.tan((lonLat2.lat * RADIANS) / 2 + Math.PI / 4) /
|
|
425
|
+
Math.tan((lonLat1.lat * RADIANS) / 2 + Math.PI / 4));
|
|
608
426
|
if (Math.abs(dLon) > Math.PI) {
|
|
609
427
|
if (dLon > 0) {
|
|
610
428
|
dLon = (2 * Math.PI - dLon) * -1;
|
|
611
|
-
}
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
612
431
|
dLon = 2 * Math.PI + dLon;
|
|
613
432
|
}
|
|
614
433
|
}
|
|
615
434
|
return (Math.atan2(dLon, dPhi) * DEGREES + 360) % 360;
|
|
616
435
|
}
|
|
617
436
|
}
|
|
618
|
-
|
|
619
|
-
export {Ellipsoid};
|
|
437
|
+
export { Ellipsoid };
|