@openglobus/og 0.16.3 → 0.17.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 +1 -1
- package/css/og.css +24 -2
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Clock.js +1 -5
- package/src/og/Events.js +2 -6
- package/src/og/Extent.js +5 -9
- package/src/og/Globe.js +93 -56
- package/src/og/ImageCanvas.js +13 -6
- package/src/og/Lock.js +44 -48
- package/src/og/LonLat.js +1 -5
- package/src/og/Object3d.js +2 -2
- package/src/og/QueueArray.js +1 -1
- package/src/og/Stack.js +49 -53
- package/src/og/astro/earth.js +112 -116
- package/src/og/astro/jd.js +514 -518
- package/src/og/astro/orbit.js +119 -123
- package/src/og/astro/rotation.js +36 -40
- package/src/og/bv/Box.js +77 -81
- package/src/og/bv/Sphere.js +57 -61
- package/src/og/camera/Camera.js +20 -7
- package/src/og/camera/Frustum.js +4 -4
- package/src/og/camera/PlanetCamera.js +15 -22
- package/src/og/cons.js +1 -1
- package/src/og/control/Atmosphere.js +0 -4
- package/src/og/control/Control.js +9 -8
- package/src/og/control/DebugInfo.js +3 -7
- package/src/og/control/DrawingSwitcher.js +117 -0
- package/src/og/control/EarthCoordinates.js +214 -214
- package/src/og/control/EarthNavigation.js +6 -13
- package/src/og/control/GeoImageDragControl.js +0 -4
- package/src/og/control/KeyboardNavigation.js +0 -4
- package/src/og/control/LayerAnimation.js +0 -4
- package/src/og/control/LayerSwitcher.js +2 -4
- package/src/og/control/Lighting.js +12 -16
- package/src/og/control/MouseNavigation.js +1 -5
- package/src/og/control/MouseWheelZoomControl.js +0 -4
- package/src/og/control/RulerSwitcher.js +0 -4
- package/src/og/control/ScaleControl.js +2 -6
- package/src/og/control/ShowFps.js +40 -44
- package/src/og/control/SimpleNavigation.js +10 -10
- package/src/og/control/SimpleSkyBackground.js +0 -4
- package/src/og/control/Sun.js +0 -4
- package/src/og/control/ToggleWireframe.js +35 -39
- package/src/og/control/ZoomControl.js +0 -4
- package/src/og/control/drawing/DrawingControl.js +51 -0
- package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
- package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
- package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
- package/src/og/control/index.js +5 -1
- package/src/og/control/ruler/Ruler.js +0 -4
- package/src/og/control/ruler/RulerScene.js +3 -2
- package/src/og/control/selection/Selection.js +0 -4
- package/src/og/control/selection/SelectionScene.js +2 -4
- package/src/og/control/timeline/TimelineControl.js +4 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +1 -0
- package/src/og/control/visibleExtent/Segment.js +7 -7
- package/src/og/control/visibleExtent/drawnode.js +0 -4
- package/src/og/ellipsoid/Ellipsoid.js +236 -325
- package/src/og/ellipsoid/wgs84.js +0 -4
- package/src/og/entity/BaseBillboard.js +375 -379
- package/src/og/entity/Billboard.js +0 -4
- package/src/og/entity/BillboardHandler.js +3 -7
- package/src/og/entity/Entity.js +22 -22
- package/src/og/entity/EntityCollection.js +14 -18
- package/src/og/entity/GeoObject.js +6 -8
- package/src/og/entity/GeoObjectHandler.js +30 -24
- package/src/og/entity/Geometry.js +5 -4
- package/src/og/entity/GeometryHandler.js +18 -19
- package/src/og/entity/Label.js +0 -4
- package/src/og/entity/LabelHandler.js +10 -14
- package/src/og/entity/LabelWorker.js +1 -1
- package/src/og/entity/PointCloud.js +2 -6
- package/src/og/entity/PointCloudHandler.js +122 -126
- package/src/og/entity/Polyline.js +15 -17
- package/src/og/entity/PolylineHandler.js +104 -108
- package/src/og/entity/Ray.js +29 -29
- package/src/og/entity/RayHandler.js +2 -2
- package/src/og/entity/Strip.js +1 -1
- package/src/og/entity/StripHandler.js +2 -2
- package/src/og/index.js +3 -1
- package/src/og/input/KeyboardHandler.js +128 -132
- package/src/og/input/MouseHandler.js +94 -98
- package/src/og/input/TouchHandler.js +59 -63
- package/src/og/input/input.js +44 -48
- package/src/og/layer/BaseGeoImage.js +6 -9
- package/src/og/layer/CanvasTiles.js +1 -5
- package/src/og/layer/GeoImage.js +0 -4
- package/src/og/layer/GeoTexture2d.js +0 -4
- package/src/og/layer/GeoVideo.js +0 -4
- package/src/og/layer/KML.js +1 -0
- package/src/og/layer/Layer.js +22 -26
- package/src/og/layer/Material.js +0 -4
- package/src/og/layer/Vector.js +25 -22
- package/src/og/layer/WMS.js +182 -186
- package/src/og/layer/XYZ.js +0 -4
- package/src/og/light/LightSource.js +0 -4
- package/src/og/math/Line2.js +28 -32
- package/src/og/math/Mat3.js +152 -156
- package/src/og/math/Ray.js +0 -4
- package/src/og/math/Vec2.js +0 -4
- package/src/og/math/Vec3.js +5 -4
- package/src/og/math/Vec4.js +0 -4
- package/src/og/math/coder.js +104 -104
- package/src/og/math.js +42 -10
- package/src/og/mercator.js +1 -1
- package/src/og/proj/EPSG3857.js +13 -13
- package/src/og/proj/Proj.js +59 -63
- package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EntityCollectionNode.js +12 -16
- package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Node.js +15 -14
- package/src/og/quadTree/QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
- package/src/og/renderer/Renderer.js +114 -27
- package/src/og/renderer/RendererEvents.js +0 -4
- package/src/og/scene/Axes.js +74 -78
- package/src/og/scene/BaseNode.js +1 -5
- package/src/og/scene/Planet.js +127 -130
- package/src/og/scene/RenderNode.js +20 -12
- package/src/og/scene/SkyBox.js +104 -108
- package/src/og/segment/Segment.js +10 -6
- package/src/og/segment/SegmentLonLat.js +3 -7
- package/src/og/segment/segmentHelper.js +229 -225
- package/src/og/shaders/atmos.js +1 -1
- package/src/og/shaders/billboard.js +0 -4
- package/src/og/shaders/drawnode.js +5 -9
- package/src/og/shaders/geoObject.js +0 -4
- package/src/og/shaders/label.js +0 -4
- package/src/og/shaders/pickingMask.js +0 -4
- package/src/og/shaders/pointCloud.js +0 -4
- package/src/og/shaders/polyline.js +0 -4
- package/src/og/shaders/ray.js +0 -4
- package/src/og/shaders/skybox.js +0 -4
- package/src/og/terrain/EmptyTerrain.js +0 -4
- package/src/og/utils/FontAtlas.js +0 -4
- package/src/og/utils/GeoImageCreator.js +2 -3
- package/src/og/utils/NormalMapCreator.js +11 -12
- package/src/og/utils/PlainSegmentWorker.js +9 -9
- package/src/og/utils/TerrainWorker.js +2 -2
- package/src/og/utils/TextureAtlas.js +1 -1
- package/src/og/utils/VectorTileCreator.js +3 -9
- package/src/og/utils/earcut.js +8 -8
- package/src/og/utils/shared.js +30 -11
- package/src/og/webgl/Framebuffer.js +2 -6
- package/src/og/webgl/Handler.js +46 -20
- package/src/og/webgl/Multisample.js +2 -6
- package/src/og/webgl/Program.js +4 -8
- package/src/og/webgl/ProgramController.js +2 -2
- package/types/Clock.d.ts +1 -1
- package/types/Extent.d.ts +5 -5
- package/types/Globe.d.ts +15 -1
- package/types/ImageCanvas.d.ts +5 -0
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +3 -3
- package/types/camera/Camera.d.ts +3 -2
- package/types/camera/PlanetCamera.d.ts +4 -4
- package/types/control/DrawingSwitcher.d.ts +13 -0
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Lighting.d.ts +8 -8
- package/types/control/drawing/DrawingControl.d.ts +14 -0
- package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
- package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
- package/types/control/index.d.ts +3 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/SelectionScene.d.ts +0 -1
- package/types/ellipsoid/Ellipsoid.d.ts +53 -64
- package/types/entity/Entity.d.ts +3 -2
- package/types/entity/GeoObject.d.ts +1 -2
- package/types/entity/Geometry.d.ts +5 -0
- package/types/entity/Polyline.d.ts +1 -1
- package/types/entity/Ray.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/layer/BaseGeoImage.d.ts +1 -1
- package/types/layer/CanvasTiles.d.ts +1 -1
- package/types/layer/Layer.d.ts +1 -1
- package/types/layer/Vector.d.ts +1 -0
- package/types/math/Vec3.d.ts +2 -0
- package/types/math.d.ts +7 -0
- package/types/renderer/Renderer.d.ts +7 -1
- package/types/scene/Axes.d.ts +0 -1
- package/types/scene/Planet.d.ts +27 -26
- package/types/scene/RenderNode.d.ts +2 -0
- package/types/scene/SkyBox.d.ts +0 -1
- package/types/segment/Segment.d.ts +3 -2
- package/types/segment/SegmentLonLat.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +1 -1
- package/types/utils/NormalMapCreator.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +2 -2
- package/types/utils/shared.d.ts +2 -0
- package/types/webgl/Handler.d.ts +6 -4
package/src/og/astro/earth.js
CHANGED
|
@@ -1,116 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import * as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//
|
|
21
|
-
// e
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
var E
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
// Convert to RA and Decl
|
|
114
|
-
// var RA = Math.atan2(yequat, xequat) * math.DEGREES;
|
|
115
|
-
// var Decl = Math.atan2(zequat, Math.sqrt(xequat * xequat + yequat * yequat)) * math.DEGREES;
|
|
116
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as math from "../math.js";
|
|
4
|
+
import { Quat } from "../math/Quat.js";
|
|
5
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
6
|
+
import * as astro from "./astro.js";
|
|
7
|
+
import * as jd from "./jd.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns Sun position in the geocentric coordinate system by the time.
|
|
11
|
+
* @param {Number} jDate - Julian date time.
|
|
12
|
+
* @returns {Vec3} - Sun geocentric coordinates.
|
|
13
|
+
*/
|
|
14
|
+
export function getSunPosition(jDate) {
|
|
15
|
+
// http://stjarnhimlen.se/comp/tutorial.html
|
|
16
|
+
// a Mean distance, or semi-major axis
|
|
17
|
+
// e Eccentricity
|
|
18
|
+
// T Time at perihelion
|
|
19
|
+
|
|
20
|
+
// q Perihelion distance = a * (1 - e)
|
|
21
|
+
// Q Aphelion distance = a * (1 + e)
|
|
22
|
+
|
|
23
|
+
// i Inclination, i.e. the "tilt" of the orbit relative to the
|
|
24
|
+
// ecliptic. The inclination varies from 0 to 180 degrees. If
|
|
25
|
+
// the inclination is larger than 90 degrees, the planet is in
|
|
26
|
+
// a retrogade orbit, i.e. it moves "backwards". The most
|
|
27
|
+
// well-known celestial body with retrogade motion is Comet Halley.
|
|
28
|
+
|
|
29
|
+
// N (usually written as "Capital Omega") Longitude of Ascending
|
|
30
|
+
// Node. This is the angle, along the ecliptic, from the Vernal
|
|
31
|
+
// Point to the Ascending Node, which is the intersection between
|
|
32
|
+
// the orbit and the ecliptic, where the planet moves from south
|
|
33
|
+
// of to north of the ecliptic, i.e. from negative to positive
|
|
34
|
+
// latitudes.
|
|
35
|
+
|
|
36
|
+
// w (usually written as "small Omega") The angle from the Ascending
|
|
37
|
+
// node to the Perihelion, along the orbit.
|
|
38
|
+
|
|
39
|
+
// P Orbital period = 365.256898326 * a**1.5/sqrt(1+m) days,
|
|
40
|
+
// where m = the mass of the planet in solar masses (0 for
|
|
41
|
+
// comets and asteroids). sqrt() is the square root function.
|
|
42
|
+
|
|
43
|
+
// n Daily motion = 360_deg / P degrees/day
|
|
44
|
+
|
|
45
|
+
// t Some epoch as a day count, e.g. Julian Day Number. The Time
|
|
46
|
+
// at Perihelion, T, should then be expressed as the same day count.
|
|
47
|
+
|
|
48
|
+
// t - T Time since Perihelion, usually in days
|
|
49
|
+
|
|
50
|
+
// M Mean Anomaly = n * (t - T) = (t - T) * 360_deg / P
|
|
51
|
+
// Mean Anomaly is 0 at perihelion and 180 degrees at aphelion
|
|
52
|
+
|
|
53
|
+
// L Mean Longitude = M + w + N
|
|
54
|
+
|
|
55
|
+
// E Eccentric anomaly, defined by Kepler's equation: M = E - e * sin(E)
|
|
56
|
+
// An auxiliary angle to compute the position in an elliptic orbit
|
|
57
|
+
|
|
58
|
+
// v True anomaly: the angle from perihelion to the planet, as seen
|
|
59
|
+
// from the Sun
|
|
60
|
+
|
|
61
|
+
// r Heliocentric distance: the planet's distance from the Sun.
|
|
62
|
+
|
|
63
|
+
// x,y,z Rectangular coordinates. Used e.g. when a heliocentric
|
|
64
|
+
// position (seen from the Sun) should be converted to a
|
|
65
|
+
// corresponding geocentric position (seen from the Earth).
|
|
66
|
+
|
|
67
|
+
var d = jDate - jd.J2000;
|
|
68
|
+
|
|
69
|
+
var w = 282.9404 + 4.70935e-5 * d; // longitude of perihelion
|
|
70
|
+
// var a = 1.000000; // mean distance, a.u.
|
|
71
|
+
var e = 0.016709 - 1.151e-9 * d; // eccentricity
|
|
72
|
+
var M = math.rev(356.047 + 0.9856002585 * d); // mean anomaly
|
|
73
|
+
|
|
74
|
+
var oblecl = astro.J2000_OBLIQUITY - 3.563e-7 * d; // obliquity of the ecliptic
|
|
75
|
+
|
|
76
|
+
// var L = math.rev(w + M); // Sun's mean longitude
|
|
77
|
+
|
|
78
|
+
var E =
|
|
79
|
+
M + math.DEGREES * e * Math.sin(M * math.RADIANS) * (1 + e * Math.cos(M * math.RADIANS)); // eccentric anomaly
|
|
80
|
+
|
|
81
|
+
// Sun rectangular coordinates, where the X axis points towards the perihelion
|
|
82
|
+
var x = Math.cos(E * math.RADIANS) - e;
|
|
83
|
+
var y = Math.sin(E * math.RADIANS) * Math.sqrt(1 - e * e);
|
|
84
|
+
|
|
85
|
+
var r = Math.sqrt(x * x + y * y); // distance
|
|
86
|
+
var v = Math.atan2(y, x) * math.DEGREES; // true anomaly
|
|
87
|
+
|
|
88
|
+
var lon = math.rev(v + w); // longitude of the Sun
|
|
89
|
+
|
|
90
|
+
// the Sun's ecliptic rectangular coordinates
|
|
91
|
+
x = r * Math.cos(lon * math.RADIANS);
|
|
92
|
+
y = r * Math.sin(lon * math.RADIANS);
|
|
93
|
+
|
|
94
|
+
// We use oblecl, and rotate these coordinates
|
|
95
|
+
var xequat = x;
|
|
96
|
+
var yequat = y * Math.cos(oblecl * math.RADIANS);
|
|
97
|
+
var zequat = y * Math.sin(oblecl * math.RADIANS);
|
|
98
|
+
|
|
99
|
+
var theta = math.TWO_PI * ((d * 24.0) / 23.9344694 - 259.853 / 360.0); // Siderial spin time
|
|
100
|
+
|
|
101
|
+
return Quat.zRotation(-theta).mulVec3(
|
|
102
|
+
new Vec3(
|
|
103
|
+
-xequat * astro.AU_TO_METERS,
|
|
104
|
+
-yequat * astro.AU_TO_METERS,
|
|
105
|
+
zequat * astro.AU_TO_METERS
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// Convert to RA and Decl
|
|
110
|
+
// var RA = Math.atan2(yequat, xequat) * math.DEGREES;
|
|
111
|
+
// var Decl = Math.atan2(zequat, Math.sqrt(xequat * xequat + yequat * yequat)) * math.DEGREES;
|
|
112
|
+
}
|