Liking cljdoc? Tell your friends :D

cljs-polys-etc

Mostly this is for working with polybooljs in ClojureScript. Also provided are some extra functions that I found useful while creating SVGs.

maturity warning

This was written for another project I’m working on. Though it handles the task well, at some point I will come back to expand this to handle multi-region polygons better and include the inversion flag from polybooljs. That might result in changes to the interface.

coordinates

First:

npm install polybooljs

lein / shadow-cljs:

[net.nundrum/cljs-polys-etc "0.0.1"]

deps.edn:

{:deps {net.nundrum/clls-polys-etc {:mvn/version "0.0.1"}}
 ...}

polybooljs

The polybooljs library handles boolean operations on polygons. It has a conception of a polygon as regions combined with an inversion flag. Which makes sense in the case of taking the difference of polygons - the result might be two or more unconnected polygons.

usage suggestion

Generally, the approach is:

  • Create a polygon

  • Rotate as needed

  • Translate into position

  • Encode as a string for the :points of an SVG polygon

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close