package wip
This commit is contained in:
23
math/SUMMARY.md
Normal file
23
math/SUMMARY.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# math
|
||||
Library that contains math utilities.
|
||||
|
||||
## General
|
||||
- [math_Modulus](docs/modulus.md)
|
||||
- [math_Min](docs/min.md)
|
||||
- [math_Max](docs/max.md)
|
||||
- [math_Clamp](docs/clamp.md)
|
||||
- [math_Sqrt](docs/sqrt.md)
|
||||
- [math_Pow](docs/pow.md)
|
||||
|
||||
## Trig Functions
|
||||
- [math_Sin](docs/trig/sin.md)
|
||||
- [math_Cos](docs/trig/cos.md)
|
||||
- [math_Tan](docs/trig/tan.md)
|
||||
- [math_RadiansToDegrees](docs/trig/rad_to_deg.md)
|
||||
- [math_DegreesToRadians](docs/trig/deg_to_rad.md)
|
||||
|
||||
## Random
|
||||
- [math_Random](docs/random/random.md)
|
||||
- [math_RandomDouble](docs/random/random_double.md)
|
||||
- [math_RandomSetSeed](docs/random/random_set_seed.md)
|
||||
|
||||
16
math/docs/clamp.md
Normal file
16
math/docs/clamp.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# math_Clamp
|
||||
Clamps a number between a minimum and maximum value.
|
||||
|
||||
## Arguments
|
||||
- number (double): The number to be clamped
|
||||
- min (double): Minimum value
|
||||
- max (double): Maximum value
|
||||
|
||||
## Returns
|
||||
result (double): The number after being clamped
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Clamp 1.5 0.0 1.0 &result
|
||||
println $result # 1.0
|
||||
```
|
||||
15
math/docs/max.md
Normal file
15
math/docs/max.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# math_Max
|
||||
Choose the largest number out of the two arguments.
|
||||
|
||||
## Arguments
|
||||
- number1 (double): First number
|
||||
- number2 (double): Second number
|
||||
|
||||
## Returns
|
||||
result (double): The largest number out of the two provided
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Max 1.2 0.7 &result
|
||||
println $result # 1.2
|
||||
```
|
||||
15
math/docs/min.md
Normal file
15
math/docs/min.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# math_Min
|
||||
Choose the smallest number out of the two arguments.
|
||||
|
||||
## Arguments
|
||||
- number1 (double): First number
|
||||
- number2 (double): Second number
|
||||
|
||||
## Returns
|
||||
result (double): The smallest number out of the two provided
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Min 0.5 1.5 &result
|
||||
println $result # 0.5
|
||||
```
|
||||
15
math/docs/modulus.md
Normal file
15
math/docs/modulus.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# math_Modulus
|
||||
Gets the remainder of dividing the two numbers.
|
||||
|
||||
## Arguments
|
||||
- number1 (double): First number
|
||||
- number2 (double): Second number
|
||||
|
||||
## Returns
|
||||
remainder (double): The remainder.
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Modulus 4 3 &remainder
|
||||
println $remainder # 1
|
||||
```
|
||||
14
math/docs/pow.md
Normal file
14
math/docs/pow.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# math_Pow
|
||||
Gets the
|
||||
|
||||
## Arguments
|
||||
- number (double): The number to get the square root of
|
||||
|
||||
## Returns
|
||||
result (double): The square root of the number
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Sqrt 16 &result
|
||||
println $result # 4
|
||||
```
|
||||
22
math/docs/random/random.md
Normal file
22
math/docs/random/random.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# math_Random
|
||||
Generate a random integer in the range provided.
|
||||
**IMPORTANT:** math_Random is **NOT** cryptographically secure! Use the `cryptography` library instead!
|
||||
If you want to generate a random double, use `math_RandomDouble`.
|
||||
|
||||
## Arguments
|
||||
- min (int): Smallest possible number
|
||||
- max (int): Largest possible number
|
||||
|
||||
## Returns
|
||||
randomNumber (int): A random number in the range provided
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Random 1 6 &dice
|
||||
println $dice # 3
|
||||
call !math_Random 1 6 &dice
|
||||
println $dice # 2
|
||||
call !math_Random 1 6 &dice
|
||||
println $dice # 6
|
||||
...
|
||||
```
|
||||
22
math/docs/random/random_double.md
Normal file
22
math/docs/random/random_double.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# math_RandomDouble
|
||||
Generate a random double in the range provided.
|
||||
**IMPORTANT:** math_RandomDouble is **NOT** cryptographically secure! Use the `cryptography` library instead!
|
||||
If you want to generate a random integer, use `math_Random`.
|
||||
|
||||
## Arguments
|
||||
- min (double): Smallest possible number
|
||||
- max (double): Largest possible number
|
||||
|
||||
## Returns
|
||||
randomNumber (double): A random number in the range provided
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_RandomDouble 0.0 10.0 &randomNumber
|
||||
println $randomNumber # 5.24...
|
||||
call !math_RandomDouble 0.0 10.0 &randomNumber
|
||||
println $randomNumber # 6.58...
|
||||
call !math_RandomDouble 0.0 10.0 &randomNumber
|
||||
println $randomNumber # 9.22...
|
||||
...
|
||||
```
|
||||
20
math/docs/random/random_set_seed.md
Normal file
20
math/docs/random/random_set_seed.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# math_RandomSetSeed
|
||||
Seed the pseudo random number generator.
|
||||
Seeding the random number generator the same number will always yield the same random number.
|
||||
|
||||
## Arguments
|
||||
- seed (int): Seed
|
||||
|
||||
## Returns
|
||||
math_RandomSetSeed does not return anything.
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_RandomSetSeed 123 &
|
||||
call !math_Random 1 6 &dice
|
||||
println $dice # some number
|
||||
call !math_RandomSetSeed 123 &
|
||||
call !math_Random 1 6 &dice
|
||||
println $dice # the same number
|
||||
# (i cant test this cause libraries are broken as am i writing docs lmao)
|
||||
```
|
||||
14
math/docs/sqrt.md
Normal file
14
math/docs/sqrt.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# math_Sqrt
|
||||
Gets the square root of a number.
|
||||
|
||||
## Arguments
|
||||
- number (double): The number to get the square root of
|
||||
|
||||
## Returns
|
||||
result (double): The square root of the number
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Sqrt 16 &result
|
||||
println $result # 4
|
||||
```
|
||||
14
math/docs/trig/cos.md
Normal file
14
math/docs/trig/cos.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# math_Cos
|
||||
Get the cosine of a certain amount of radians.
|
||||
|
||||
## Arguments
|
||||
- x (double): Number (in radians)
|
||||
|
||||
## Returns
|
||||
result (double): The cosine of the number in radians
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Cos 3.14159 &result
|
||||
println $result # -1
|
||||
```
|
||||
14
math/docs/trig/deg_to_rad.md
Normal file
14
math/docs/trig/deg_to_rad.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# math_DegreesToRadians
|
||||
Convert degrees to radians.
|
||||
|
||||
## Arguments
|
||||
- x (double): Number of degrees
|
||||
|
||||
## Returns
|
||||
result (double): x degrees in radians
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_DegreesToRadians 180.0 &result
|
||||
println $result # 3.14159
|
||||
```
|
||||
14
math/docs/trig/rad_to_deg.md
Normal file
14
math/docs/trig/rad_to_deg.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# math_RadiansToDegrees
|
||||
Convert radians to degrees.
|
||||
|
||||
## Arguments
|
||||
- x (double): Number of radians
|
||||
|
||||
## Returns
|
||||
result (double): x radians in degrees
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_RadiansToDegrees 3.14159 &result
|
||||
println $result # 180.0
|
||||
```
|
||||
14
math/docs/trig/sin.md
Normal file
14
math/docs/trig/sin.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# math_Sin
|
||||
Get the sine of a certain amount of radians.
|
||||
|
||||
## Arguments
|
||||
- x (double): Number (in radians)
|
||||
|
||||
## Returns
|
||||
result (double): The sine of the number in radians
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Sin 3.14159 &result
|
||||
println $result # 0
|
||||
```
|
||||
14
math/docs/trig/tan.md
Normal file
14
math/docs/trig/tan.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# math_Tan
|
||||
Get the tangent of a certain amount of radians.
|
||||
|
||||
## Arguments
|
||||
- x (double): Number (in radians)
|
||||
|
||||
## Returns
|
||||
result (double): The tangent of the number in radians
|
||||
|
||||
## Example
|
||||
```python
|
||||
call !math_Tan 3.14159 &result
|
||||
println $result # 0
|
||||
```
|
||||
7
math/mineral.ini
Normal file
7
math/mineral.ini
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
description = Library that contains math utilities.
|
||||
version = 1.2.5
|
||||
config_version = 1
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[package]
|
||||
description = Standard library for Ground.
|
||||
version = 1.2.0
|
||||
version = 1.2.5
|
||||
config_version = 1
|
||||
|
||||
[dependencies]
|
||||
math=1.2.0
|
||||
request=1.2.0
|
||||
fileio=1.2.0
|
||||
math=1.2.5
|
||||
request=1.2.5
|
||||
fileio=1.2.5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user