UNPKG

@thi.ng/viz

Version:

Declarative, functional & multi-format data visualization toolkit based around @thi.ng/hiccup

57 lines 1.8 kB
import { type ReadonlyVec } from "@thi.ng/vectors"; import type { PlotFn } from "../api.js"; export interface VectorFieldOpts { /** * Group attributes. */ attribs?: any; /** * Offset vector (in domain/grid coords), used to compute projected screen * coords. * * @defaultValue [0.5, 0.5] */ offset: ReadonlyVec; /** * Vector scale factor (applied to original field vectors) * * @defaultValue 1 */ scale: number; /** * Shape definition for visualizing individual vectors. Uses * {@link vectorShapeLine} by default. */ shape: VectorFieldShape; } export interface VectorFieldShape { /** * Optional marker for easy vector arrow visualization & reuse by shape function. */ marker?: any[]; /** * Shape function to represent a vector in the diagram as thi.ng/hiccup * compatible shape/element. * * @param a - vector start point (in screen coords) * @param b - vector end point (in screen coords) * @param v - original vector */ fn: (a: ReadonlyVec, b: ReadonlyVec, v: ReadonlyVec) => any; } /** * Vectorfield plot function. * * @remarks * IMPORTANT: Domain ranges for this plot function MUST be zero-based and * integer-sized, corresponding to the shape of the supplied field data. The * field vectors should be normalized, but don't have to be... * * @param data * @param opts */ export declare const vectorField: (data: ReadonlyVec[][], opts?: Partial<VectorFieldOpts>) => PlotFn; export declare const vectorShapeLine: (size?: number) => VectorFieldShape; export declare const vectorShapeLineHSL: (size?: number) => VectorFieldShape; export declare const vectorShapeDial: VectorFieldShape; //# sourceMappingURL=vector-field.d.ts.map