Math library in Typescript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test added matrix inverse Feb 16, 2019
.editorconfig
.gitignore
LICENSE
README.md
package.json 1.0.3 Feb 16, 2019
tsconfig.json basic project setup Jan 12, 2019
tslint.json

README.md

daign-math

NPM package

Math library in Typescript

Inspired by the math classes from three.js. But here the focus is on 2D graphics. Additionally every class implements an observable pattern.

Installation

npm install @daign/math --save

Usage

import {Line2} from '@daign/math';
import {Vector2} from '@daign/math';

// Create a point
const point = new Vector2( 1, 5 );

// Create a line
const line = new Line2( new Vector2(), new Vector2( 6, 4 ) );

// Calculate result of projecting the point on the line
const projected = point.projectOnLine( line );
console.log( projected.x, projected.y );

// Calculate distance between point and projection
console.log( point.distanceTo( projected ) );

Scripts

Build

npm run build

Run lint analysis

npm run lint

Run unit tests with code coverage

npm run test