1.2.4 • Published 3 years ago

ftfiles v1.2.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

FTFiles

Npm Downloads


Fourier Transform Files are files that aim to encode simple vector image data. The goal of this library is to provide a way to take a svg file with a single svg path. Then it will calculate and re-encode it into a set of coefficients that apply to a complex fourier series.

Usage

This can be done client side the following way:

import { FTProcessor } from 'ftfiles';

// Create a SVGProcessor instance
const ftProc = new FTProcessor(path); // Path must be an SVGPathElement

ftProc.processPoints(numberOfPoints); // Doing discrete integration basically, you have to do this before transforming
ftProc.dft(); // Does the transformation

ftProc.getCoefficients(); // used to retreive the coefficients of the series

Then the coefficients can be read in order to draw it with the drawing module

import { FTDrawer } from 'ftfiles';

// Say we already have coefficents (be it serialized and sent from backend, calculated client side)
const coefficients = ftProc.getCoefficients();

const drawer = new FTDrawer(coefficients);
drawer.setCanvas(canvas); // Set the canvas to which to draw (Param must be Canvas element)
drawer.setScale(1); // Set the scale at which to draw
drawer.draw(); // Draws

Heres a sample repo using this library: https://github.com/Maxty99/FTFileWeb

Thanks

1.2.0

3 years ago

1.1.9

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.2.4

3 years ago

1.1.5

3 years ago

1.2.3

3 years ago

1.1.4

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.2-beta

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.16

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.13

3 years ago

1.1.18

3 years ago

1.2.1-beta

3 years ago

1.1.17

3 years ago

1.2.0-beta

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago