@quenty/sunpositionutils 2.3.0 → 2.3.1-canary.545.2374fb2.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.3.1-canary.545.2374fb2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sunpositionutils@2.3.0...@quenty/sunpositionutils@2.3.1-canary.545.2374fb2.0) (2025-04-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sunpositionutils@2.2.1...@quenty/sunpositionutils@2.3.0) (2024-05-09)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/sunpositionutils",
3
- "version": "2.3.0",
3
+ "version": "2.3.1-canary.545.2374fb2.0",
4
4
  "description": "Utility to position the sun and to retrieve sun information specific to Roblox.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "3fd5cdca3128bf34c8d9dfae1e92d62533b6e6f5"
30
+ "gitHead": "2374fb2b043cfbe0e9b507b3316eec46a4e353a0"
31
31
  }
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  Utility to position the sun and to retrieve sun information specific to Roblox.
3
4
 
@@ -19,9 +20,11 @@ local ZAXIS = Vector3.new(0, 0, 1)
19
20
  @param direction Vector3
20
21
  @return number
21
22
  ]=]
22
- function SunPositionUtils.getGeographicalLatitudeFromDirection(direction: Vector3)
23
- local angle = math.atan2(direction.z, math.sqrt(direction.x^2 + direction.y^2))
24
- return angle/(math.pi*2)*360+EARTH_TILT
23
+ function SunPositionUtils.getGeographicalLatitudeFromDirection(direction: Vector3): number
24
+ local x = direction.X
25
+ local y = direction.Y
26
+ local angle = math.atan2(direction.Z, math.sqrt(x * x + y * y))
27
+ return angle / (math.pi * 2) * 360 + EARTH_TILT
25
28
  end
26
29
 
27
30
  SunPositionUtils.getGeographicalLatitudeFromMoonDirection = SunPositionUtils.getGeographicalLatitudeFromDirection
@@ -32,10 +35,10 @@ SunPositionUtils.getGeographicalLatitudeFromMoonDirection = SunPositionUtils.get
32
35
  @param direction Vector3
33
36
  @return number
34
37
  ]=]
35
- function SunPositionUtils.getClockTimeFromDirection(direction: Vector3)
36
- local altitude = math.atan2(-direction.y, -direction.x)
38
+ function SunPositionUtils.getClockTimeFromDirection(direction: Vector3): number
39
+ local altitude = math.atan2(-direction.Y, -direction.X)
37
40
 
38
- return (altitude/(math.pi*2)*24-6) % 24
41
+ return (altitude / (math.pi * 2) * 24 - 6) % 24
39
42
  end
40
43
 
41
44
  --[=[
@@ -44,10 +47,10 @@ end
44
47
  @param direction Vector3
45
48
  @return number
46
49
  ]=]
47
- function SunPositionUtils.getClockTimeFromMoonDirection(direction: Vector3)
48
- local altitude = math.atan2(direction.y, direction.x)
50
+ function SunPositionUtils.getClockTimeFromMoonDirection(direction: Vector3): number
51
+ local altitude = math.atan2(direction.Y, direction.X)
49
52
 
50
- return (altitude/(math.pi*2)*24-6) % 24
53
+ return (altitude / (math.pi * 2) * 24 - 6) % 24
51
54
  end
52
55
 
53
56
  --[=[
@@ -58,9 +61,9 @@ end
58
61
  @param north Vector3?
59
62
  @return number
60
63
  ]=]
61
- function SunPositionUtils.getDirection(azimuthRad: number, altitudeRad: number, north: Vector3)
62
- local cframe = (CFrame.Angles(0, azimuthRad, 0) * CFrame.Angles(altitudeRad, 0, 0))
63
- return cframe:vectorToWorldSpace(north or NORTH)
64
+ function SunPositionUtils.getDirection(azimuthRad: number, altitudeRad: number, north: Vector3): Vector3
65
+ local cframe: CFrame = (CFrame.Angles(0, azimuthRad, 0) * CFrame.Angles(altitudeRad, 0, 0))
66
+ return cframe:VectorToWorldSpace(north or NORTH)
64
67
  end
65
68
 
66
69
  --[=[
@@ -71,7 +74,7 @@ end
71
74
  @return Vector3 -- Sun position
72
75
  @return Vector3 -- Moon position
73
76
  ]=]
74
- function SunPositionUtils.getSunPosition(clockTime: number, geoLatitude: number)
77
+ function SunPositionUtils.getSunPosition(clockTime: number, geoLatitude: number): (Vector3, Vector3)
75
78
  local seconds = clockTime*60*60
76
79
  local DAY = 24 * 60 * 60
77
80
  local YEAR = 365.2564 * DAY