1.0.0 • Published 6 years ago

apl-easy-2d v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Easy 2D

Various helper functions to perform mathematical and geometry operations in two dimensions

Included functions


Geometry functions

rotate, rotateAround, windingOrder, triangulatePolygons


Glyph-related functions

splitCurve, convertGlyphToPolygons


Rasterisation functions

dda, rasterizeTriangle, ddaOptions


2D intersection functions

boxLineIntersection, boxRayIntersection, pointInBox, pointInTriangle, pointInCurve, barycentricCoords


2D vector math functions

scale, multiply, divide, add, adds, sub, floor, abs, sign, dot, equal, length, normalize, avg, inRange

Using in node

Install via npm install apl-easy-2d, then import via ES6 Modules:

import { windingOrder } from 'apl-easy-2d';

Using in the browser

Add the script tag below or download it an bundle it with your own scripts.

<script src="http://unpkg.com/apl-easy-2d/lib/apl-easy-2d.min.js"></script>

TODO

  • Add unit tests to all functions

Licence

All code is licenced under MIT.

1.0.0

6 years ago