Explanation
A small JS Library for doing affine transformations and (coming soon) other simple transformations
I need for a bigger project. affine
and polygon
are currently the two exports.
Node Use
npm install -g affine
Browser Use
For your convenience, this project is stitched into one JS file, affine.js
. The stitched file provides a way of requiring components. Here's an in-browser example:
Example Code
Usage (CoffeeScript example)
require 'affine' rot_left = MathPI / 4rot_right = -MathPI / 4go_big = 24go_small = 0.50.25 # rightComposing a transform A with another, A' # desctructively replaces A with A'(A) t = rot_leftcopytrightComposeWith rot_righttrightComposeWith go_bigtrightComposeWith go_smalltrotate 0.234trotate -0.234tscale 12tscale 10.5 square = polygonfactoryunitSquaresquaretransform t # square should be the same, as the 4 affines # cancel each other out. consolelog square
Contributing
All .js
and .json
files are auto-generated. Please edit the appropropriate .coffee
files and run cake build
before committing.