@quenty/vector3utils 5.0.0 → 5.1.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 +11 -0
- package/package.json +2 -2
- package/src/Shared/RandomVector3Utils.lua +19 -0
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
|
+
# [5.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/vector3utils@5.0.0...@quenty/vector3utils@5.1.0) (2022-07-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add RandomVector3Utils.gaussianRandom() ([e131c4b](https://github.com/Quenty/NevermoreEngine/commit/e131c4b1a657163dc81f871f3ad1c85148d7434c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [5.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/vector3utils@4.2.0...@quenty/vector3utils@5.0.0) (2022-05-21)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/vector3utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Utilities involving Vector3 objects in Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "e31b3a35aa475bb5699a24898a8639e107165b36"
|
|
35
35
|
}
|
|
@@ -19,6 +19,25 @@ function RandomVector3Utils.getRandomUnitVector(): Vector3
|
|
|
19
19
|
return Vector3.new(rx, ry, rz)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
local function gaussianRandom()
|
|
23
|
+
return math.sqrt(-2*math.log(1 - math.random()))*math.cos(2*math.pi*math.random())
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
--[=[
|
|
27
|
+
Computes a gaussian random vector3.
|
|
28
|
+
|
|
29
|
+
@param mean Vector3 -- center
|
|
30
|
+
@param spread Vector3 -- std deviation
|
|
31
|
+
@return Vector3
|
|
32
|
+
]=]
|
|
33
|
+
function RandomVector3Utils.gaussianRandom(mean: Vector3, spread: Vector3): Vector3
|
|
34
|
+
return mean + spread*Vector3.new(
|
|
35
|
+
gaussianRandom(),
|
|
36
|
+
gaussianRandom(),
|
|
37
|
+
gaussianRandom()
|
|
38
|
+
)/math.sqrt(3)
|
|
39
|
+
end
|
|
40
|
+
|
|
22
41
|
--[=[
|
|
23
42
|
Gets a uniformally distributed random unit vector3 in the direction
|
|
24
43
|
specified.
|