Welcome to GitHub Pages.
This is a small set of geometry tools I had written around a years ago for a small project, as well as a basic html5 renderer. I opened this repo in case I am back in the mood. As it turns out, there is plently of mood, but not adequate time. Nevertheless I do spend a few hours per week on this.
Personally I am especially proud of the removeDangles function in the topology.js file, that, for those that are not familiar with the term, it trims any line, in a line collection that does not participate in any potential line to polygon conversion.
Usage Examples
-display polygons- I converted the code so that functions would no longer be global. Instead everything is packed in 4 closure functions primitives geometrical rendering topology
- Read Polygon Coordinates as a xy Array
Geometries[i] ={ type : "polygon", geometry : primitives.CreatePolygon(xyArray)};
- Calculate the Bounding Box
var BBox = geometrical.getBoundingBox(Geometries);
- Transform Polygon Coordinate to the Local Canvas System
var tr = geometrical.transform(Geometries, BBox, Canvas_width, Canvas_height);
- Draw the Polygons on the Canvas Element
rendering.drawing(tr (transformed geometries), fill (true/false), '243011'(hex color without #), canvas (the canvas object));
rendering.drawing(tr, false, '243011', canvas);
Example Page
Draw/Fill/Area/Centroids/Nodes Examples
Authors and Contributors
elasticrash
Support or Contact
You are welcome to post any comments or ideas