-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,014 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
|
||
<!-- markdownlint-disable --> | ||
|
||
# fmath library | ||
|
||
`fmath` contains a set of mathematical functions that work with FixedPoint numbers and integers. `fmath` replaces Lua's `math` library in game scripts (you can use Lua's `math` library outside of game scripts). | ||
|
||
[//]: # "This file is automatically generated." | ||
[//]: # "Manual edits will be overwritten." | ||
|
||
## Functions | ||
### `max_fixedpoint()` | ||
```tsx | ||
fmath.max_fixedpoint(): FixedPoint | ||
``` | ||
Returns the maximum value a fixedpoint integer can take. | ||
|
||
|
||
--- | ||
### `random_fixedpoint()` | ||
```tsx | ||
fmath.random_fixedpoint( | ||
min: FixedPoint, | ||
max: FixedPoint | ||
): FixedPoint | ||
``` | ||
Returns a random fixedpoint value in the range [`min`, `max`]. `max` must be greater or equal to `min`. | ||
|
||
|
||
--- | ||
### `random_int()` | ||
```tsx | ||
fmath.random_int( | ||
min: int, | ||
max: int | ||
): int | ||
``` | ||
Returns an integer in the range [`min`, `max`]. `max` must be greater or equal to `min`. | ||
|
||
|
||
--- | ||
### `sqrt()` | ||
```tsx | ||
fmath.sqrt(x: FixedPoint): FixedPoint | ||
``` | ||
Returns the square root of `x`. `x` must be greater or equal to 0. | ||
|
||
|
||
--- | ||
### `from_fraction()` | ||
```tsx | ||
fmath.from_fraction( | ||
numerator: int, | ||
denominator: int | ||
): FixedPoint | ||
``` | ||
Returns the fixedpoint value representing the fraction `numerator`/`denominator`. `denominator` must not be equal to zero. | ||
|
||
|
||
--- | ||
### `to_int()` | ||
```tsx | ||
fmath.to_int(value: FixedPoint): int | ||
``` | ||
Returns the integral part of the `value`. | ||
|
||
|
||
--- | ||
### `abs_fixedpoint()` | ||
```tsx | ||
fmath.abs_fixedpoint(value: FixedPoint): FixedPoint | ||
``` | ||
Returns the absolute value. | ||
|
||
|
||
--- | ||
### `to_fixedpoint()` | ||
```tsx | ||
fmath.to_fixedpoint(value: int): FixedPoint | ||
``` | ||
Returns a fixedpoint value with the integral part of `value`, and no fractional part. | ||
|
||
|
||
--- | ||
### `sincos()` | ||
```tsx | ||
fmath.sincos(angle: FixedPoint): FixedPoint, FixedPoint | ||
``` | ||
Returns the sinus and cosinus of `angle`. `angle` is in radian. | ||
|
||
|
||
--- | ||
### `atan2()` | ||
```tsx | ||
fmath.atan2( | ||
y: FixedPoint, | ||
x: FixedPoint | ||
): FixedPoint | ||
``` | ||
Returns the principal value of the arc tangent of y/x. Returns a value in the range [0, 2π[. | ||
|
||
|
||
--- | ||
### `tau()` | ||
```tsx | ||
fmath.tau(): FixedPoint | ||
``` | ||
Returns τ (aka 2π). | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,7 @@ | ||
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; | ||
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; | ||
|
||
/** | ||
* Creating a sidebar enables you to: | ||
- create an ordered group of docs | ||
- render a sidebar for each doc of that group | ||
- provide next/previous navigation | ||
The sidebars can be generated from the filesystem, or explicitly defined here. | ||
Create as many sidebars as you want. | ||
*/ | ||
const sidebars: SidebarsConfig = { | ||
// By default, Docusaurus generates a sidebar from the docs folder structure | ||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], | ||
|
||
// But you can create a sidebar manually | ||
/* | ||
tutorialSidebar: [ | ||
'intro', | ||
'hello', | ||
{ | ||
type: 'category', | ||
label: 'Tutorial', | ||
items: ['tutorial-basics/create-a-document'], | ||
}, | ||
], | ||
*/ | ||
tutorialSidebar: [{ type: "autogenerated", dirName: "." }], | ||
}; | ||
|
||
export default sidebars; |
Oops, something went wrong.