New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cubic-hermite-spline

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cubic-hermite-spline

Cubic Hermite spline interpolation

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5K
decreased by-76.94%
Maintainers
1
Weekly downloads
 
Created
Source

cubic-hermite-spline

Cubic Hermite spline interpolation

Cubic Hermite spline interpolation of points / tangeants in any dimension with optional derivative computation. The interpolator can also take a knot-like vector as an optional parameter, which may be useful to enforce time at control points when used for position / velocity interpolation.

Install

$ npm install cubic-hermite-spline

Example

Basic usage

var hermite = require('cubic-hermite-spline');

var points = [
  [-1, 0],
  [ 0, 0],
  [ 1, 0]
];

var tangents = [
  [1, 1],
  [0, 1],
  [1, 1]
];

for(var t=0; t<1; t+=0.01) {
  var point = hermite(t, points, tangents);
  var tangent = hermite(t, points, tangents, null, true);
}

With a knot vector

var hermite = require('cubic-hermite-spline');

var points = [
  [-1, 0],
  [ 0, 0],
  [ 1, 0]
];

var tangents = [
  [1, 1],
  [0, 1],
  [1, 1]
];

var knots = [
  0, 1.5, 2
];

for(var t=0; t<1; t+=0.01) {
  var point = hermite(t, points, tangents);
  var tangent = hermite(t, points, tangents, knots, true);
}

Usage

hermite(t, points, tangents[, knots, derivative])

Computes the interpolation at t for the provided set of points and tangents, and optional knots.

  • t position along the curve: in the [0, 1] range for regular use, and [0, last-knot-value] when using knots
  • points vectors to interpolate
  • tangents tangents at provided points
  • knots enforced values of t at provided points
  • derivative if true return the tangeant at t instead of the position

FAQs

Package last updated on 19 Mar 2015

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