A port of RobloxianDemo's Math module.
npm install @rbxts/mathMath is a highly lightweight utility, served as an addition to Roblox's traditional Math library.
```
npm i @rbxts/math
``
yarn add @rbxts/math
``
pnpm add @rbxts/math
`ts`
function Map
number: number,
minimumA: number,
maximumA: number,
minimumB: number,
maximumB: number,
): T;
Map the specified number using two ranges.
`ts`
function Lerp
Interpolate between two specified numbers with a given alpha number.
`ts`
function LerpClamp
Interpolate between two specified numbers with a given alpha number, which is clamped.
`ts`
function InverseClamp
Inverse lerp between two specified numbers to return its alpha number.
`ts`
function LawOfCosines
Solve for the opposite angle from numberC.
`ts`
function Round
Round the specified number relative to the given precision factor, utilizing math.round.
`ts`
function RoundUp
Round the specified number relative to the given precision factor, utilizing math.ceil.
`ts`
function RoundDown
Round the specified number relative to the given precision factor, utilizing math.floor.
`ts`
function EulersNumber
Return eulers number.
`ts`
function EulersConstant
Return eulers constant.
`ts`
function GammaCoefficient
Return the gamma coefficient.
`ts`
function GammaQuad
Return the gamma quad.
`ts`
function GammaSet
Return the gamma set.
`ts`
function E
Return E.
`ts`
function Tau
Return tau.
`ts`
function AperysConstant
Return apery's constant.
`ts`
function BelphegorsPrimeNumber
Return belphegor's prime number.
`ts
// Services
import { Workspace } from "@rbxts/services";
// Modules
import { LerpClamp } from "@rbxts/math";
// Functions
const Part = new Instance("Part");
Part.Name = "Part";
Part.Position = new Vector3(0, 5, 0);
Part.Size = new Vector3(5, 1, 5);
Part.Parent = Workspace;
const partPositionClamped = LerpClamp(Part.Position.X + 1, Part.Position.Y + 1, Part.Position.Z + 1);
print(partPositionClamped);
``