TODO: Description goes here
Want to see pretty graphs? Log in now!
npm install geomjs
|4||downloads in the last week|
|16||downloads in the last month|
|Last Published By|
|Version||0.0.5 last updated a year ago|
|Keywords||TODO: Module keywords goes here|
|Dependencies||neat, chancejs, mixinsjs|
GeomJS is a small utility that provides many geometric primitives such
Rectangle; and more complex geometries
Diamond or bezier splines.
GeomJS can be used both on NodeJS and in the browser.
The library is articulated around several interfaces that all geometries
implements, with an exception for the
Surface interface that can't possibly
be implemented by splines.
Below the list of the interfaces and their roles:
Geometry: All geometries provides methods to retrieve an array of points corresponding to their display shape, retrieve their bounds and draw the geometry on a canvas.
Path: All geometries have an outline, and this outline can be used as a path, providing both points and orientation on the path at a given position.
Surface: All geometries, except splines and spiral, provides method to retrieve the surface acreage or to retrieve a random point in the surface.
Triangulable: All surface geometries can return an array containing the triangulated version of the geometry.
Intersections: All geometries can intersect with each other.
Sourcable: All geometries can return the source code of their current state.
Cloneable: All geometries can return a copy of themselves.
Equatable: All geometries provides a
equalsmethod to compare instances of the same class.
Install through npm:
npm install geomjs
Then require it as follow:
geomjs = require 'geomjs' rect = new geomjs.Rectangle 0, 0, 100, 50
Download MixinsJS, ChanceJS and GeomJS packaged version:
Adds it in your html page:
<script src='./mixinsjs.min.js'></script> <script src='./chancejs.min.js'></script> <script src='./geomjs.min.js'></script>
Then use it as follow:
rect = new geomjs.Rectangle 0, 0, 100, 50