New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

parallel-lines

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parallel-lines

Draw parallel lines a distance from an array of connected lines

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
0
Created
Source

Parallel Lines

This library demonstrates how to draw parallel lines based on a set of given points using JavaScript. The original lines are drawn in blue, and the parallel lines are drawn in red.

Features

  • Draws lines connecting specified points.
  • Calculates and draws parallel lines at a specified offset.

Getting Started

To run this project locally, follow these steps: To use

npm install parallel-lines

or Clone the repository (or download the files):

git clone https://github.com/ronald-wentworth/parallel-lines.git cd parallel-lines

Available functions

getParallels

  • points: an array of connected x, y coordinates (i.e [{x:0, y:10}, {x:5, y:11} ...)
  • distance: a value representing the distance from the above points that new points should be generated

returns a left(l) and right(r) array of points representing the new parallel lines (i.e {l:[{x:0,y:10}...}],r:[...]}

findIntersection

  • line1 an array with 4 elements represeting the from xy coords and the to xy coords for the first line
  • line2 same as 1 except for the second line

returns xy coords where the 2 lines intersect

checkPointPositionDirected

  • x1, y1 point where line starts
  • x2, y2 point where line ends
  • px, py test point

returns which direction the point is relative to the direction of the line 1 left, -1 right, 0 on line

Keywords

graph

FAQs

Package last updated on 01 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts