clipper.polygon([n]) -> poly |
create a polygon object of size n (default 0) |
poly:size() -> n |
number of vertices |
poly:add(x, y) |
add a vertex to the polygon |
poly:get(i).x -> n poly:get(i).y -> n |
get vertex coordinates |
poly:get(i).x = n poly:get(i).y = n |
set vertex coordinates |
poly:simplify([rule]) -> polys |
simplify a polygon (rule can be ‘even_odd’, ‘non_zero’, ‘positive’, ‘negative’) |
poly:clean([distance]) -> polys |
clean a polygon |
poly:reverse() |
reverse the order (and hence orientation) of vertices |
poly:orientation() -> true | false |
polygon orientation (true = clockwise) |
poly:area() -> n |
polygon area |
Polygon lists |
|
clipper.polygons([n | poly1, poly2, ...]) -> polys |
create a polygon list |
polys:size() -> n |
list size |
polys:add(poly) |
add a polygon to the end of the list |
polys:get(i) -> poly |
get a polygon from the list |
polys:set(i, poly) |
set a polygon in the list |
polys:simplify([rule]) -> polys |
simplify polygons (default rule is 'even_odd' ) |
polys:clean([distance]) -> polys |
clean polygons (default distance is ~= sqrt(2) ) |
polys:reverse() |
reverse the order (and hence orientation) of vertices |
polys:offset(delta, [join_type], [limit]) -> polys |
offset polygons (join type can be ‘square’ (default), ‘round’, ‘miter’; default limit is 0) |
Clipping |
|
clipper.new() -> cl |
create a clipper object |
cl:add_subject(poly | polys) |
add polygons to be clipped |
cl:add_clip(poly | polys) |
add polygons to be clipped against |
cl:get_bounds() -> x1, y1, x2, y2 |
bounding box of all the polygons in the clipper |