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