
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
vector-field
Advanced tools
A data structure and lookup for 3D vector fields (flow fields).

See the example and its source.
npm install vector-field
import VectorField from "vector-field";
let time = 0;
const directionFn = ([x, y, z]) => {
const n = myNoise4D(x, y, z, time);
const theta = n;
const phi = n;
return [
Math.sin(theta) * Math.cos(phi),
Math.sin(theta) * Math.sin(phi),
Math.cos(theta),
];
};
const vectorField = new VectorField(directionFn, [12, 6, 6], 1);
const frame = () => {
time += 0.001;
vectorField.update();
requestAnimationFrame(frame);
};
requestAnimationFrame(() => {
frame();
});
A data structure and lookup for 3D vector fields (flow fields).
Array.<number>objectfunctionThe custom function to compute the cell direction (often a noise function)
A data structure and lookup for 3D vector fields (flow fields).
Kind: global class Properties
| Name | Type |
|---|---|
| directionFn | VectorFieldDirectionFn |
| steps | vec3 |
| bounds | vec3 |
| halfBounds | vec3 |
| field | Array.<VectorFieldCell> |
Creates an instance of VectorField.
| Param | Type | Default | Description |
|---|---|---|---|
| directionFn | VectorFieldDirectionFn | The custom function to compute the cell direction (often a noise function) | |
| [steps] | number | vec3 | 10 | The number of steps on each dimension (all positive integer). Use integer for identical dimensions. |
| [bounds] | number | vec3 | 1 | The size of a containing box for the field. Is divided into steps for each dimension (all positive). Use integer for identical dimensions. |
Create/update the field according to the provided noise function.
Kind: instance method of VectorField
VectorFieldCell | undefinedFind a VectorFieldCell at specified position. Useful to compute a particle's velocity for instance.
Kind: instance method of VectorField
| Param | Type | Description |
|---|---|---|
| cell | vec3 | [cx, cy, cz] |
Array.<number>objectKind: global typedef Properties
| Name | Type |
|---|---|
| position | vec3 |
| direction | vec3 |
functionThe custom function to compute the cell direction (often a noise function)
Kind: global typedef
| Param | Type |
|---|---|
| position | vec3 |
| stepPosition | vec3 |
MIT. See license file.
FAQs
A data structure and lookup for 3D vector fields (flow fields).
We found that vector-field demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.