@bothrs/math
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

@bothrs/math

Utility methods for solving common mathematical issues.

Getting started

yarn add @bothrs/math

Contents

Conversion

  • toDegrees: Convert a radian value to degrees.
  • toRadians: Convert a degree value to radians.

Image

  • calculateScaleRatioFit: Calculate the linear scale ratio in which an image fits inside the requested container.

Matrix

  • getScalingMatrix
  • getTranslationMatrix
  • getRotationMatrix
  • getSVGTransformMatrix: Render out a transform matrix as an SVG Transform string.
  • getTransformMatrix: Generate a transform matrix with common edits and defaults.
  • multiplyMatrices

Number

  • getRandomInt: Generate a random integer between 2 values.
  • toFixed: Round a number to a fixed amount of fraction digits.

Readme

Keywords

none

Package Sidebar

Install

npm i @bothrs/math

Weekly Downloads

1

Version

0.2.2

License

MIT

Unpacked Size

25.5 kB

Total Files

8

Last publish

Collaborators

  • bothrsdev
  • bramvanhoutte
  • jaccog