Skip to content
A node.js wrapper for the Clipper polygon clipper (and helper) library
C++ Other
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
lib
src
.gitignore
README.md
binding.gyp
package.json

README.md

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 ] ]
Something went wrong with that request. Please try again.