apl-easy-2d
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i apl-easy-2d

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

77.7 kB

Total Files

32

Last publish

Collaborators

  • andrewlowndes