frenet-serret-frames
Compute Frenet-Serret frames for a path of 3D points and tangents.
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
Array.<Frame>
frenetSerretFrames(points, tangents, [options]) ⇒ 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 |
{} |
Array.<number>
vec3 :
Object
Options : 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. |
Object
Frame : Kind: global typedef
Properties
Name | Type |
---|---|
position | vec3 |
normal | vec3 |
binormal | vec3 |
tangent | vec3 |
License
MIT. See license file.