Skip to content

snostorm/node-clipper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-clipper

A node.js wrapper for the Clipper polygon clipper (and helper) library

Project State

Please note that this very light wrapper was built for an internal project, so almost no effort has gone on to documentation of 1-to-1 binding of functions we haven't needed.

But we would be interested in expanding it over time and will happily accept pull requests to expand the bindings.

Bindings

Offset

See the clipper documentation for Offset) in order to get an idea of how this is used.

clipper = require('../build/Release/clipper')

/*a
  ## Offset
  * arguments: flattened_coordinate_path, offset
  * where: offset can be positive or negative (negative will go inside the polygon, positive will expand outside)
*/
flattened_coordinate_path = [0, 0, 0, 10, 10, 10, 10, 0]

// A negative offset gets an offset inside our Polygon:
inner_highlight_path = clipper.offset(flattened_coordinate_path, -2)
console.log(inner_highlight_path)
// returns [ [ 2, 2, 8, 2, 8, 8, 2, 8 ] ]

// A positive offset gets an offset outside our Polygon:
outter_highlight_path = clipper.offset(flattened_coordinate_path, 2)
console.log(outter_highlight_path)
// returns [ [ -2, 12, -2, -2, 12, -2, 12, 12 ] ]

About

A node.js wrapper for the Clipper polygon clipper (and helper) library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages