GithubHelp home page GithubHelp logo

maxty99 / ftfiles Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 121 KB

Fourier Transform Files are files that aim to encode simple vector image data

License: MIT License

TypeScript 82.36% JavaScript 17.64%

ftfiles's Introduction

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

ftfiles's People

Contributors

maxty99 avatar

Stargazers

Blobcode avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.