Catalog npm
Back to packageRELEASE DETAILS

1.1.2

npm

@0x2e757/math-ext

Math extended

extendedgeometrymathtypescript
Published26 Jun 2018
Direct dependencies1
Transitive dependenciesNot calculated

README

Current package documentation

MathExt

Library with useful math functions like clamp and random with parameters and simple geometry classes. Library mostly oriented to be used with any kind of simple graphics. Also class objects support chaining.

TypeScript code transpiled to ES3 JavaScript.

Install

npm i @0x2e757/math-ext

Usage

How to import

import { ... } from "@0x2e757/math-ext";

Interfaces

interface IRange {
    start: number;
    end: number;
}
interface IPoint {
    x: number;
    y: number;
    z: number;
}
interface IRect {
    left: number;
    top: number;
    right: number;
    bottom: number;
}

Math functions

clamp = (value: number, min: number, max: number) => number
clamp = (value: number, range: IRange) => number
round = (value: number, fractionDigits: number) => number
random = (min: number, max: number) => number
random = (min: number, max: number, integer: boolean) => number
random = (range: IRange) => number
random = (range: IRange, integer: boolean) => number

Range methods

new Range(start: number, end: number) => Range
new Range(range: IRange) => Range
shift = (offset: number) => Range
shift = (offsetStart: number, offsetEnd: number) => Range
multiply = (multiplier: number) => Range
multiply = (multiplierStart: number, multiplierEnd: number) => Range
clamp = (min: number, max: number) => Range
clamp = (minStart: number, maxStart: number, minEnd: number, maxEnd: number) => Range
clamp = (range: IRange) => Range
clamp = (rangeStart: IRange, rangeEnd: IRange) => Range
clampStart = (min: number, max: number) => Range
clampStart = (range: IRange) => Range
clampEnd = (min: number, max: number) => Range
clampEnd = (range: IRange) => Range
round = (fractionDigits: number) => Range
round = (fractionDigitsStart: number, fractionDigitsEnd: number) => Range
roundStart = (fractionDigits: number) => Range
roundEnd = (fractionDigits: number) => Range
normalize = () => Range
contains = (value: number) => boolean
contains = (range: IRange) => boolean

Point methods

new Point() => Point
new Point(x: number) => Point
new Point(x: number, y: number) => Point
new Point(x: number, y: number, z: number) => Point
new Point(point: IPoint) => Point
shift = (offsetX: number) => Point
shift = (offsetX: number, offsetY: number) => Point
shift = (offsetX: number, offsetY: number, offsetZ: number) => Point
shift = (point: IPoint) => Point
shiftX = (offset: number) => Point
shiftY = (offset: number) => Point
shiftZ = (offset: number) => Point
multiply = (multiplierX: number) => Point
multiply = (multiplierX: number, multiplierY: number) => Point
multiply = (multiplierX: number, multiplierY: number, multiplierZ: number) => Point
multiplyX = (multiplier: number) => Point
multiplyY = (multiplier: number) => Point
multiplyZ = (multiplier: number) => Point
clamp = (min: number, max: number) => Point
clamp = (minX: number, maxX: number, minY: number, maxY: number, minZ: number, maxZ: number) => Point
clamp = (range: IRange) => Point
clamp = (rangeX: IRange, rangeY: IRange, rangeZ: IRange) => Point
clampX = (min: number, max: number) => Point
clampX = (range: IRange) => Point
clampY = (min: number, max: number) => Point
clampY = (range: IRange) => Point
clampZ = (min: number, max: number) => Point
clampZ = (range: IRange) => Point
round = (fractionDigits: number) => Point
round = (fractionDigitsX: number, fractionDigitsY: number, fractionDigitsZ: number) => Point
roundX = (fractionDigits: number) => Point
roundY = (fractionDigits: number) => Point
roundZ = (fractionDigits: number) => Point
distance = (point: IPoint) => number

Rect methods

new Rect() => Rect
new Rect(left: number, top: number, right: number, bottom: number) => Rect
new Rect(topLeft: IPoint, bottomRight: IPoint) => Rect
new Rect(rect: IRect) => Rect
shift = (offsetHorizontal: number, offsetVertical: number) => Rect
shift = (offsetLeft: number, offsetTop: number, offsetRight: number, offsetBottom: number) => Rect
shift = (offset: IPoint) => Rect
shiftLeft = (offset: number) => Rect
shiftTop = (offset: number) => Rect
shiftRight = (offset: number) => Rect
shiftBottom = (offset: number) => Rect
shiftHorizontal = (offset: number) => Rect
shiftHorizontal = (offsetLeft: number, offsetRight: number) => Rect
shiftVertical = (offset: number) => Rect
shiftVertical = (offsetTop: number, offsetBottom: number) => Rect
shiftTopLeft = (offset: IPoint) => Rect
shiftTopLeft = (offsetLeft: number, offsetTop: number) => Rect
shiftTopRight = (offset: IPoint) => Rect
shiftTopRight = (offsetRight: number, offsetTop: number) => Rect
shiftBottomLeft = (offset: IPoint) => Rect
shiftBottomLeft = (offsetLeft: number, offsetBottom: number) => Rect
shiftBottomRight = (offset: IPoint) => Rect
shiftBottomRight = (offsetRight: number, offsetBottom: number) => Rect
multiply = (multiplier: number) => Rect
multiply = (multiplierHorizontal: number, multiplierVertical: number) => Rect
multiplyHorizontal = (multiplier: number) => Rect
multiplyVertical = (multiplier: number) => Rect
clamp = (min: number, max: number) => Rect
clamp = (minHorizontal: number, maxHorizontal: number, minVertical: number, maxVertical: number) => Rect
clamp = (minLeft: number, maxLeft: number, minTop: number, maxTop: number, minRight: number, maxRight: number, minBottom: number, maxBottom: number) => Rect
clamp = (rect: IRect) => Rect
clamp = (rangeHorizontal: IRange, rangeVertical: IRange) => Rect
clamp = (rangeLeft: IRange, rangeTop: IRange, rangeRight: IRange, rangeBottom: IRange) => Rect
clampLeft = (min: number, max: number) => Rect
clampLeft = (range: IRange) => Rect
clampTop = (min: number, max: number) => Rect
clampTop = (range: IRange) => Rect
clampRight = (min: number, max: number) => Rect
clampRight = (range: IRange) => Rect
clampBottom = (min: number, max: number) => Rect
clampBottom = (range: IRange) => Rect
clampHorizontal = (min: number, max: number) => Rect
clampHorizontal = (range: IRange) => Rect
clampVertical = (min: number, max: number) => Rect
clampVertical = (range: IRange) => Rect
clampTopLeft = (min: number, max: number) => Rect
clampTopLeft = (range: IRange) => Rect
clampTopRight = (min: number, max: number) => Rect
clampTopRight = (range: IRange) => Rect
clampBottomLeft = (min: number, max: number) => Rect
clampBottomLeft = (range: IRange) => Rect
clampBottomRight = (min: number, max: number) => Rect
clampBottomRight = (range: IRange) => Rect
round = (fractionDigits: number) => Rect
round = (fractionDigitsHorizontal: number, fractionDigitsVertical: number) => Rect
roundHorizontal = (fractionDigits: number) => Rect
roundVertical = (fractionDigits: number) => Rect
normalize = () => Rect
topLeft = () => IPoint
topLeft = (left: number, top: number) => Rect
topLeft = (topLeft: IPoint) => Rect
topRight = () => IPoint
topRight = (right: number, top: number) => Rect
topRight = (topRight: IPoint) => Rect
bottomLeft = () => IPoint
bottomLeft = (left: number, bottom: number) => Rect
bottomLeft = (bottomLeft: IPoint) => Rect
bottomRight = () => IPoint
bottomRight = (right: number, bottom: number) => Rect
bottomRight = (bottomRight: IPoint) => Rect
width = () => number
width = (width: number) => Rect
height = () => number
height = (height: number) => Rect
contains = (point: IPoint) => boolean
contains = (rect: IRect) => boolean

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^2.9.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-g6lc5EVIlo7K/nRB0OrOijjeLBBOsyfgaU6Iprd+17y6WAfdaqvRL0hrilFRxYUuOv7aqsgYIUpLoKDI9aPo2Q==",
  "shasum": "9354cf5690817d486e6d21e1db45565225d9713b",
  "tarball": "https://registry.npmjs.org/@0x2e757/math-ext/-/math-ext-1.1.2.tgz",
  "fileCount": 46,
  "unpackedSize": 152428,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbMloFCRA9TVsSAnZWagAACesP/2BxXeGxtUC4ECUxvx++\nrIxAbtVQeVausTtrEfmsLPqAnP2s/cwWJdS0O81tb68+FP2fYLDxa7n55+bF\nK6anv+lvzV9uaQicLmWSDPqnUByXPJhG/9Cv4LVUBzont2En5VPhTkiaR5zZ\nV1PRZR6g19jExR4nx+VhP86s2dbgbqRfUtL/kgQRdFSpEGPEu32d5j9pNyA+\nk67DyobHPmcomfqdwfygsa14WWMG20h18ud7un4yPBFUlhMsJwZ0OF0WsQia\n7EMMlc8o/Thb+rikIo15k821swSjIKD+hLw+OKEjYOUljqzNot94DS8+C1VB\nLp9opwW+6pyE+LnJpljlGoWUdWYI6oMDLeIJks4Cs/79nN4tcjdWv1INgQN3\nfs6qFEgjH6XySDhBQ1zOA9EYnt38rdQ/brKJKABpXIx+gFNXjNUERtrdT0ld\nKyNy2r0oXxOHOYmDCOmpBLSPw2XRC+ZD4BDRVjRKN2WE29k/2x9qRHilbsmX\nYOwSUQb+JpDysYTMGmnwPUDVi5nGoXQeesK5buSfRvVJmKzjtIEUULxd+Z4O\nPoqLryfGcyKoHJwf+LdQwpeZ6ll/LpwNtEDr6JoGsIgx+llqxqok5yNpOAh7\n24dOirNPjoBNWz0Som414dHaIM7u27Y25jUp8QWAjYOI5QHqFHzVCXerT+61\nUrY5\r\n=1ZzJ\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIGv1MS7pT41gJ66SwbjyfJydfa/CAJuw291qWMlbbi5kAiEAoXgxdnqTT2R2kaKrMNumR5fOABd8Uksjz31YtxOX64E="
    }
  ]
}

Repository

PENDING
0x2e757/mathext

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:34 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:0a2ddc44b923794e4a384de389f00652d9a1bda4816dd3c8626cced052d5a8ff

Other collected versions

1.1.125 Jun1.1.025 Jun1.0.024 JunView all collected versions →