cljs-polys-etc.polys
- Functions for working with polygons in SVG.
arc-len-degrees
- Returns the length of an arc with given theta (degrees) and radius.arc-len-radians
- Returns the length of an arc with given theta (radians) and radius.degrees-to-radians
- Converts degrees to radians.difference
- Returns a vector of polys that is the difference of two polys.equilateral-height
- Returns height of an equilateral triangle with given side length.equilateral-inradius
- Returns the inner radius of an equilateral triangle with given side length.equilateral-sidelen
- Returns the side length of an equilateral triangle with given height.intersection
- Returns a vector of polys that is the intersection of two polys.polar-to-cartesian
- Converts a point in polar space to cartesian space.poly2path
- Converts a poly into a string suitable for using in an SVG :polygon
's :point
attribute.rotate-point
- Rotates a point around [0,0] by given degrees.rotate-poly
- Rotates all points in poly around [0,0] by given degrees.sqrt3
translate-point
- Translates a point by xd
, yd
.translate-poly
- Translates all points in a poly by xd
, yd
.translate-polys
- Translates all polys in a vector of polys.union
- Returns a vector of polys that is the union of two polys.Functions for working with polygons in SVG. This library requires polybooljs
to work.
The notion of a polygon here is just a vector of points in cartesian space, e.g.
(def a-square [[0 0] [10 0] [10 10] [0 10]])
The polybooljs library has a more complex idea of what a polygon is [<https://sean.cm/a/polygon-clipping-pt2],
which means a vector of with multiple regions and an inverted?
flag. Cljs-polys-etc is not
that complex (yet). The inverted?
tag remains unimplemented.
arc-len-degrees
(arc-len-degrees theta radius)
Returns the length of an arc with given theta (degrees) and radius.
arc-len-radians
(arc-len-radians theta radius)
Returns the length of an arc with given theta (radians) and radius.
degrees-to-radians
(degrees-to-radians degrees)
Converts degrees to radians. 0 radians usually 'point right' and the resulting degrees will also have 0 'pointing right.'
difference
(difference poly1 poly2)
Returns a vector of polys that is the difference of two polys.
equilateral-height
(equilateral-height sidelen)
Returns height of an equilateral triangle with given side length.
equilateral-inradius
(equilateral-inradius sidelen)
Returns the inner radius of an equilateral triangle with given side length.
equilateral-sidelen
(equilateral-sidelen height)
Returns the side length of an equilateral triangle with given height.
intersection
(intersection poly1 poly2)
Returns a vector of polys that is the intersection of two polys.
polar-to-cartesian
(polar-to-cartesian cx cy radius degrees)
Converts a point in polar space to cartesian space.
poly2path
(poly2path poly)
Converts a poly into a string suitable for using in an SVG :polygon
's :point
attribute.
rotate-point
(rotate-point [x y] degrees)
Rotates a point around [0,0] by given degrees.
rotate-poly
(rotate-poly poly degrees)
Rotates all points in poly around [0,0] by given degrees.
sqrt3
translate-point
(translate-point [x y] xd yd)
Translates a point by xd
, yd
.
translate-poly
(translate-poly poly xd yd)
Translates all points in a poly by xd
, yd
.
translate-polys
(translate-polys polys x y)
Translates all polys in a vector of polys.
union
(union poly1 poly2)
Returns a vector of polys that is the union of two polys.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close