In other words, a company or client makes a request for something in Actionscript. My general reply would be along the lines of ‘oh yeah, I can do that’ followed by digging up some old Fortran, C, or C++ code and then converting it into the fab language of the day. Even when I wrote something new in a new language, it was only a matter of time before it became something in a library of ‘past code’ to be ported to some new language when the demand arose.
Not only has the front-end dev. pendulum swung back to native from plugins, I’m seeing a number of devs. running into problems that are not programming problems as much as they are mathematical software issues. Well, that’s where I come in and this time I decided to approach my value proposition in a different manner.
jsMathToolkit is an attempt to produce an organized, high-quality math library for front-end developers that encompasses practically everything I’ve worked on since I began my business in 1997. I expect the effort to be ongoing and driven by client demands, but my primary objective is to change my pat response from ‘oh yeah, I can do that’ to ‘oh yeah, I’ve ALREADY DONE THAT.’ And, btw, that solution is already packaged into a modular, documented, well-tested library.
jsMathToolkit is currently organized around RequireJS. I am looking into supporting CommonJS in the future, although there are a number of challenges dealing with both environments from the same code base. So, my intent is to move the library to a solid release-candidate state before circling back and working on CommonJS support.
Once development reaches a solid beta state, I will reach out to existing clients and solicit a beta test team. I have not decided on how the library will be distributed, but at this stage it will most likely be a client-only library because of the required support level. I’ve received a few inquiries about releasing the library for sale to the general public, but I’m very wary about such a path because I believe that support requirements could get out of hand.
After reaching the beta development goal, I will create a PDF file that documents all the classes and methods in the library for clients wishing to contract me out for development services.
Currently, the library contains 107 ‘classes’, encompassing well over 500 methods ranging from basic data structures to splines to simple physics to matrix analysis, and more. There are 72 demos in the library, many of which could be split out into separate usable components such as a zoomable/pannable number line and some spline-based data visualization.
Here is a very brief list of the library layout and contents. Look to future blog posts for announcements on new development.
– Deal with basic operations (add, subtract, multiply, divide, etc.) on complex types; current models are Fractions and Clock Time.
– AI methods for game programmers, business intelligence, and advanced user interaction. Current methods are pathfinding (A* for waypoints and tiles). The future is wide open and will be heavily driven by client demand.
– Complex shapes are planar shapes defined by a draw stack. This stack is similar to SVG in that it defines a sequence of move, line, and curve commands that define the shape. A core method is provided for rendering/transforming the stack using EaselJS, although rendering is completely decoupled from shape description.
– The core package contains classes used across the entire library. Line decorators (i.e. dashed and dotted) and data structures are here along with visual graph helper classes and the draw stack renderer (which contains a complete set of transformation tools).
– This will be a subset of the freehand drawing library I created in Flex. Currently under development.
– Various geometric tools such as convex hull and line simplification.
– Helper classes for drawing 2D graphs such as managing axes with tic marks, zoom/pan, etc. Computations are decoupled from rendering so that you could use these classes with any visual environment.
– Forward and inverse. Currently under development.
– Anything math-related that does not seem to fit elsewhere. Currently contains cubic root finder, derivative methods, easing classes, a robust matrix class (with LU decomposition and backsolve), random number generation, and Quaternions (with SLERP and NLERP).
– Lines, very deep quadratic and cubic Beziers, and a two-point Bezier curve with adjustable parameters.
– Everything is built on top of the Polygon class. All the things you expect are here and you can solve point-in-polygon and polygon-polygon intersection problems.
– For basic game development and complex UI components with a need for physics behaviors. Various physics-based motions now and behaviors in the near future.
– Natural Cubic, Catmull-Rom, Quad Bezier, Cubic Bezier and a very rich set of spline-to-Bezier utilities. Catmull-Rom and Cubic Bezier support closed-loop as well.
– A general-purpose data statistics class along with all the familiar distributions, carefully coded to avoid numerical issues and work with large sample sizes. This stuff was not coded out of a book or from Wikipedia NormInv works the way it should (f**k Excel) and you even get a fast quad. Bezier approximation for graphing the normal, which is useful for educational applications. Linear least squares with polynomials (lines handled as a separate, optimized case).
Data analysis will be a huge focus of this library. There is already a robust data-stats class and I’m adding table-based analysis as well with generous cross-tab facilities. Bayesian analysis and machine learning classes are on the way.
– This is probably the deepest area of development at this stage of the library. Includes a very robust set of Bezier curve utilities, practically every geometric utility you can think of (if not, let me know and I’ll code it), polygon utilities, number formatting, root finders, numerical integration, math utilities, circle utilities. It goes on and on …
My goal for jsMathToolkit is to address important problems ranging from games to engineering to business intelligence to data analysis and visualization to complex UI’s to educational applications. All with a focus on the needs of front-end developers.
Thanks to everyone who encouraged me to start this project and I hope you will follow the blog regularly for updates.