Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

Math library in Typescript

Resources

License

Packages

No packages published