Skip to content

Instantly share code, notes, and snippets.

View ninovanhooff's full-sized avatar

Nino van Hooff ninovanhooff

View GitHub Profile
@ninovanhooff
ninovanhooff / Thick Line to Polygon JS
Created April 15, 2024 18:57 — forked from kekscom/Thick Line to Polygon JS
A JavaScript method to turn thick lines into polygons
/**
* @author Jan Marsch (@kekscom)
* @example see http://jsfiddle.net/osmbuildings/2e5KX/5/
* @example thickLineToPolygon([{x:50,y:155}, {x:75,y:150}, {x:100,y:100}, {x:50,y:100}], 20)
* @param polyline {array} a list of point objects in format {x:75,y:150}
* @param thickness {int} line thickness
*/
var thickLineToPolygon = (function () {
function getOffsets(a, b, thickness) {