frenet-serret-frames

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Compute Frenet-Serret frames for a path of 3D points and tangents.

paypal coinbase twitter

Installation

npm install frenet-serret-frames

Usage

import frenetSerretFrames from "frenet-serret-frames";
import pathTangents from "path-tangents";

const isClosed = true;
const tangents = pathTangents(path, isClosed);
const frames = frenetSerretFrames(path, tangents, {
  closed: isClosed,
  initialNormal: [0, 1, 0],
});

API

Functions

frenetSerretFrames(points, tangents, [options])Array.<Frame>

Compute Frenet-Serret frames for a path of 3D points and tangents

Typedefs

vec3 : Array.<number>
Options : Object

Options for frames computation. All optional.

Frame : Object

frenetSerretFrames(points, tangents, [options]) ⇒ Array.<Frame>

Compute Frenet-Serret frames for a path of 3D points and tangents

Kind: global function
See: Frenet–Serret formulas

Param Type Default Description
points Array.<vec3> Array of 3D points [x, y, z].
tangents Array.<vec3> Array of 3D points [x, y, z] corresponding to the tangents of the path.
[options] Options {}

vec3 : Array.<number>

Kind: global typedef

Options : Object

Options for frames computation. All optional.

Kind: global typedef
Properties

Name Type Default Description
[closed] boolean false Specify is the path is closed.
[initialNormal] vec3 Specify a starting normal for the frames. Default to the direction of the minimum tangent component.

Frame : Object

Kind: global typedef
Properties

Name Type
position vec3
normal vec3
binormal vec3
tangent vec3

License

MIT. See license file.