0.0.0 • Published 11 years ago

line-offset v0.0.0

Weekly downloads
3
License
BSD
Repository
github
Last release
11 years ago

line-offset

Intelligently offset lines. Useful for a variety of problems, mainly map symbology, label placement, and drawing.

example

var line = [
    { x: 0, y: 10 },
    { x: 0, y: 20 },
    { x: 10, y: 20 },
    { x: 10, y: 27 }
];

var offsetLine = offset.offset(line, 10);

API

offset.offset(line, offset)

Offset a line by a certain distance. By default, expects points on the line to be in { x: 0, y: 0 } form. Offset is a required parameter and must be numeric.

Cheers

Mostly a port of includes/mapnik/offset_converter.hpp from the Mapnik project, though unlike it, a sync interface rather than a stream.