3.1.0 • Published 2 months ago

frenet-serret-frames v3.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
2 months ago

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 geometry of 3D positions and optionally provided tangents.

paypal coinbase twitter

npm.io

Installation

npm install frenet-serret-frames

Usage

import frenetSerretFrames from "frenet-serret-frames";

const geometry = { positions, cells };
frenetSerretFrames(geometry, {
  closed: true,
  initialNormal: [0, 1, 0],
});
console.log(geometry);
// {
//   positions: Float32Array [x, y, z, x, y, z,  ...],
//   tangents: Float32Array [x, y, z, x, y, z, ...]
//   normals: Float32Array [x, y, z, x, y, z, ...]
//   binormals: Float32Array [x, y, z, x, y, z, ...]
//   cells: Uint8/16/32/Array [a, b, c, a, b, c, ...],
// }

API

Functions

Typedefs

frenetSerretFrames(geometry, options) ⇒ SimplicialComplexWithTNB

Compute Frenet-Serret frames for a geometry of 3D positions and optionally provided tangents.

Kind: global function See: Frenet–Serret formulas

ParamTypeDefault
geometrySimplicialComplex
optionsOptions{}

vec2 : Array.<number>

Kind: global typedef

vec3 : Array.<number>

Kind: global typedef

SimplicialComplex : object

Geometry definition.

Kind: global typedef Properties

NameType
positionsFloat32Array | Array | Array.<vec3>
tangentsFloat32Array | Array | Array.<vec3>
normalsFloat32Array | Array | Array.<vec3>
uvsFloat32Array | Array | Array.<vec2>
cellsUint8Array | Uint16Array | Uint32Array | Array | Array.<vec3>

SimplicialComplexWithTNB : object

Geometry definition augmented with tangents, normals and binormals.

Kind: global typedef Properties

NameType
positionsFloat32Array | Array | Array.<vec3>
tangentsFloat32Array | Array | Array.<vec3>
normalsFloat32Array | Array | Array.<vec3>
binormalsFloat32Array | Array | Array.<vec3>
uvsFloat32Array | Array | Array.<vec2>
cellsUint8Array | Uint16Array | Uint32Array | Array | Array.<vec3>

Options : object

Options for frames computation. All optional.

Kind: global typedef Properties

NameTypeDefaultDescription
closedbooleanfalseSpecify is the path is closed.
initialNormalvec3Specify a starting normal for the frames. Default to the direction of the minimum tangent component.

License

MIT. See license file.

3.1.0

2 months ago

3.0.3

9 months ago

3.0.2

9 months ago

3.0.1

9 months ago

3.0.0

9 months ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

5 years ago

1.0.0

6 years ago