Skip to content

daozlv/jspoly

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JSPoly

JSPoly is a Javascript translation of the Boost Polygon Library originally written in C++. It can be used to generate the vornoi diagram and medial axis transform of a polygon with holes.

License : Boost Software License - Version 1.0

screen shot 2017-06-07 at 10 34 03 pm

Sample code

boundary = [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 2}, {x: 4, y: 1}];
segments = JSPoly.construct_medial_axis(boundary, []);

Output

for above example, resultant segments contains following

[{"point0":{"x":3,"y":2,"radius":0},"point1":{"x":2.7928932188134525,"y":1.5,"radius":0.4999999999999998}},{"point0":{"x":1,"y":1,"radius":0},"point1":{"x":2.2071067811865475,"y":1.5,"radius":0.49999999999999994}},{"point0":{"x":2,"y":2,"radius":0},"point1":{"x":2.2071067811865475,"y":1.5,"radius":0.5}},{"point0":{"x":2.2071067811865475,"y":1.5,"radius":0.5},"point1":{"x":2.7928932188134525,"y":1.5,"radius":0.5}},{"point0":{"x":2.7928932188134525,"y":1.5,"radius":0.4999999999999998},"point1":{"x":4,"y":1,"radius":0}}]

screen shot 2017-05-10 at 3 15 26 pm

About

A javascript library to generate the voronoi diagram and the medial axis transform for polygons with holes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%