@math.gl/sun 4.2.0-alpha.3 → 4.2.0-alpha.5
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/LICENSE +51 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +0 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -22,6 +22,33 @@ THE SOFTWARE.
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
+
Some primitive tessellation approaches were originally inspired by the TDL WebGL samples under
|
|
26
|
+
the New BSD License:
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2011, Google Inc. All rights reserved.
|
|
29
|
+
|
|
30
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
|
31
|
+
provided that the following conditions are met:
|
|
32
|
+
|
|
33
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions
|
|
34
|
+
and the following disclaimer.
|
|
35
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of
|
|
36
|
+
conditions and the following disclaimer in the documentation and/or other materials provided
|
|
37
|
+
with the distribution.
|
|
38
|
+
3. Neither the name of Google Inc. nor the names of its contributors may be used to endorse or
|
|
39
|
+
promote products derived from this software without specific prior written permission.
|
|
40
|
+
|
|
41
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
|
42
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
44
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
45
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
46
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
|
47
|
+
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
48
|
+
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
25
52
|
math.gl builds on docs and code from "gl-matrix", which is MIT licensed as follows:
|
|
26
53
|
|
|
27
54
|
Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
|
|
@@ -87,3 +114,27 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
87
114
|
See the License for the specific language governing permissions and limitations under the License.
|
|
88
115
|
|
|
89
116
|
Cesium-derived code can be found in the submodule: modules/3d-tiles
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
The @math.gl/geometry primitive tessellators are adapted from luma.gl under the MIT License:
|
|
121
|
+
|
|
122
|
+
Copyright (c) 2020 vis.gl contributors
|
|
123
|
+
|
|
124
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
125
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
126
|
+
in the Software without restriction, including without limitation the rights
|
|
127
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
128
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
129
|
+
furnished to do so, subject to the following conditions:
|
|
130
|
+
|
|
131
|
+
The above copyright notice and this permission notice shall be included in
|
|
132
|
+
all copies or substantial portions of the Software.
|
|
133
|
+
|
|
134
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
135
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
136
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
137
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
138
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
139
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
140
|
+
THE SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -17,12 +17,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
19
|
// dist/index.js
|
|
20
|
-
var
|
|
21
|
-
__export(
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
22
|
getSunDirection: () => getSunDirection,
|
|
23
23
|
getSunPosition: () => getSunPosition
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
|
|
27
27
|
// dist/suncalc.js
|
|
28
28
|
var DEGREES_TO_RADIANS = Math.PI / 180;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/suncalc.ts"],
|
|
4
|
-
"sourcesContent": ["export {getSunPosition, getSunDirection} from './suncalc';\n", "const DEGREES_TO_RADIANS = Math.PI / 180;\n\nconst DAY_IN_MS = 1000 * 60 * 60 * 24;\nconst JD1970 = 2440588; // Julian Day year 1970\nconst JD2000 = 2451545; // Julian Day year 2000\n\n// This angle \u03B5 [epsilon] is called the obliquity of the ecliptic and its value at the beginning of 2000 was 23.4397\u00B0\nconst e = DEGREES_TO_RADIANS * 23.4397; // obliquity of the Earth\n\n// Refer https://www.aa.quae.nl/en/reken/zonpositie.html\n// \"The Mean Anomaly\" section for explanation\nconst M0 = 357.5291; // Earth mean anomaly on start day\nconst M1 = 0.98560028; // Earth angle traverses on average per day seen from the sun\n\nconst THETA0 = 280.147; // The sidereal time (in degrees) at longitude 0\u00B0 at the instant defined by JD2000\nconst THETA1 = 360.9856235; // The rate of change of the sidereal time, in degrees per day.\n\n/**\n * A position in the sky defined by two angles\n * The altitude is 0\u00B0 at the horizon, +90\u00B0 in the zenith (straight over your head), and \u221290\u00B0 in the nadir (straight down).\n * The azimuth is the direction along the horizon, which we measure from south to west.\n * South has azimuth 0\u00B0, west +90\u00B0, north +180\u00B0, and east +270\u00B0 (or \u221290\u00B0, that's the same thing).\n */\nexport type CelestialPosition = {\n azimuth: number;\n altitude: number;\n};\n\n/**\n * Calculate sun position\n * based on https://www.aa.quae.nl/en/reken/zonpositie.html\n * inspired by https://github.com/mourner/suncalc/blob/master/suncalc.js\n */\nexport function getSunPosition(\n timestamp: number | Date,\n latitude: number,\n longitude: number\n): CelestialPosition {\n const longitudeWestInRadians = DEGREES_TO_RADIANS * -longitude;\n const phi = DEGREES_TO_RADIANS * latitude;\n const d = toDays(timestamp);\n\n const c = getSunCoords(d);\n // hour angle\n const H = getSiderealTime(d, longitudeWestInRadians) - c.rightAscension;\n\n return {\n azimuth: getAzimuth(H, phi, c.declination),\n altitude: getAltitude(H, phi, c.declination)\n };\n}\n\nexport function getSunDirection(\n timestamp: number | Date,\n latitude: number,\n longitude: number\n): number[] {\n const {azimuth, altitude} = getSunPosition(timestamp, latitude, longitude);\n\n // solar position to light direction\n return [\n Math.sin(azimuth) * Math.cos(altitude),\n Math.cos(azimuth) * Math.cos(altitude),\n -Math.sin(altitude)\n ];\n}\n\nfunction toJulianDay(timestamp: number | Date): number {\n const ts = typeof timestamp === 'number' ? timestamp : timestamp.getTime();\n return ts / DAY_IN_MS - 0.5 + JD1970;\n}\n\nfunction toDays(timestamp: number | Date): number {\n return toJulianDay(timestamp) - JD2000;\n}\n\nfunction getRightAscension(eclipticLongitude: number, b: number): number {\n const lambda = eclipticLongitude;\n return Math.atan2(Math.sin(lambda) * Math.cos(e) - Math.tan(b) * Math.sin(e), Math.cos(lambda));\n}\n\nfunction getDeclination(eclipticLongitude: number, b: number): number {\n const lambda = eclipticLongitude;\n return Math.asin(Math.sin(b) * Math.cos(e) + Math.cos(b) * Math.sin(e) * Math.sin(lambda));\n}\n\nfunction getAzimuth(hourAngle: number, latitudeInRadians: number, declination: number): number {\n const H = hourAngle;\n const phi = latitudeInRadians;\n const delta = declination;\n return Math.atan2(Math.sin(H), Math.cos(H) * Math.sin(phi) - Math.tan(delta) * Math.cos(phi));\n}\n\nfunction getAltitude(hourAngle: number, latitudeInRadians: number, declination: number): number {\n const H = hourAngle;\n const phi = latitudeInRadians;\n const delta = declination;\n return Math.asin(Math.sin(phi) * Math.sin(delta) + Math.cos(phi) * Math.cos(delta) * Math.cos(H));\n}\n\n// https://www.aa.quae.nl/en/reken/zonpositie.html\n// \"The Observer section\"\nfunction getSiderealTime(dates: number, longitudeWestInRadians: number): number {\n return DEGREES_TO_RADIANS * (THETA0 + THETA1 * dates) - longitudeWestInRadians;\n}\n\nfunction getSolarMeanAnomaly(days: number): number {\n return DEGREES_TO_RADIANS * (M0 + M1 * days);\n}\n\nfunction getEclipticLongitude(meanAnomaly: number): number {\n const M = meanAnomaly;\n // equation of center\n const C =\n DEGREES_TO_RADIANS * (1.9148 * Math.sin(M) + 0.02 * Math.sin(2 * M) + 0.0003 * Math.sin(3 * M));\n // perihelion of the Earth\n const P = DEGREES_TO_RADIANS * 102.9372;\n\n return M + C + P + Math.PI;\n}\n\nfunction getSunCoords(dates: number): {\n declination: number;\n rightAscension: number;\n} {\n const M = getSolarMeanAnomaly(dates);\n const L = getEclipticLongitude(M);\n\n return {\n declination: getDeclination(L, 0),\n rightAscension: getRightAscension(L, 0)\n };\n}\n"],
|
|
5
4
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;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+6,7 @@
|
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"version": "4.2.0-alpha.
|
|
9
|
+
"version": "4.2.0-alpha.5",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"javascript",
|
|
12
12
|
"math",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"dist",
|
|
34
34
|
"src"
|
|
35
35
|
],
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "9c13785761867748e2edb167b5f2749dce803039"
|
|
37
37
|
}
|