Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

polf

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polf

Point on line functions.

  • 0.0.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
439
increased by2.57%
Maintainers
1
Weekly downloads
 
Created
Source

📦 polf

NPM version License NodeJS versions

Find point coordinates inside line functions between a range t from 0 to 1.

Status

Tests Coverage status

Installation

npm install polf

Quickstart

> const { lineXY } = require("polf");
> lineXY([0, 0], [10, 10], .5)
[ 5, 5 ]

Documentation

Point on line functions

Utility functions

Point on line functions

# lineXY(p0, p1, t) ⇒ array

Computes the coordinate of a point in a line parametrized in the range t from 0 to 1.

Algorithm: B(t) = p0 + (p1 - p0) * t , 0 <= t <= 1

  • p0 (array) Start point coordinate.
  • p1 (array) End point coordinate.
  • t (number) Number in the range from 0 to 1 that parametrizes the location on the line.

# cubicBezierXY(p0, p1, p2, p3, t) ⇒ array

Computes the coordinate of a point in a cubic Bézier curve parametrized in the range t from 0 to 1.

Algorithm: B(t) = (1-t)^3 * p0 + 3*(1-t)^2 * t * p1 + 3*(1-t)^2 * p2 + t^3 * p3 , 0 <= t <= 1

  • p0 (array) Start point coordinate.
  • p1 (array) First control point coordinate.
  • p2 (array) Second control point coordinate.
  • p3 (array) End point coordinate.
  • t (number) Number in the range from 0 to 1 that parametrizes the location on the curve.

# quadraticBezierXY(p0, p1, p2, t) ⇒ array

Computes the coordinate of a point in a quadratic Bézier curve parametrized in the range t from 0 to 1.

Algorithm: B(t) = (1-t) * 2 * p0 + 2*(1-t)*t * p1 + t2 * p2 , 0 <= t <= 1

  • p0 (array) Start point coordinate.
  • p1 (array) Coordinate of the control point.
  • p2 (array) End point coordinate.
  • t (number) Number in the range from 0 to 1 that parametrizes the location on the curve.

# ellipticalArcXY(p0, rx, ry, xAxisRotation, largeArc, sweep, p1, t) ⇒ array

Computes the coordinate of a point in a elliptical arc parametrized in the range t from 0 to 1.

  • p0 (array) Start point coordinate.
  • rx (number) X radius of the arc.
  • ry (number) Y radius of the arc.
  • xAxisRotation (number) Rotation in X of the arc in degrees.
  • largeArc (boolean) large-arc flag that specifies how the arc is drawn.
  • sweep (boolean) sweep flag that specifies how the arc is drawn.
  • p1 (array) End point coordinate.
  • t (number) Number in the range from 0 to 1 that parametrizes the location on the arc.

Utility functions

# angleBetween(v0, v1) ⇒ number

Computes the angle between two vectors.

  • v0 (array) First vector in comparison.
  • v1 (array) Second vector in comparison.

Keywords

FAQs

Package last updated on 05 Apr 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc