line2offset
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

lineoffset.js GitHub release (latest by date) npm GitHub file size in bytes GitHub

⚙A tool that takes a line and returns a line at offset by the specified offset.

Installation

npm install --save line2offset
//or
yarn add --save line2offset
<script src="lineoffset.min.js"></script>

Getting Started

import lineOffset from "line2offset";

/**
 * Takes a line and returns a line at offset by the specified offset.
 * @name lineOffset
 * @param {[number,number][]} coords input coords
 * @param {number} offset the line
 * @returns {[number,number][]} Line offset from the input line
 * @example
 * const line = [[-83, 30], [-84, 36], [-78, 41]];
 * const offsetLine = lineOffset(line, 2);
 */
const lineString = lineOffset([
    [100, 180],
    [200, 180],
    [300, 180],	
 ], 10);

console.log(lineString) // => [[100, 185],[200, 185],[300, 185],[300, 175],[200, 175],[100, 175]]

License

MIT License

Copyright (c) 2021 varon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Readme

Keywords

Package Sidebar

Install

npm i line2offset

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

7.24 kB

Total Files

5

Last publish

Collaborators

  • cangshudada