Code cleanup in 0.97

While we implemented the AMD pattern in JSXGraph version 0.97 we also cleaned up our code base. There were a few math functions which you could access as “shortcuts” as methods of our JXG.Board class defined in src/Wrappers.js.

Wrappers.js is gone now and the shortcuts were moved to more appropriate locations. This blog post lists all board method wrappers that were removed and where you can find the original functions if you used the wrappers.

JavaScript Math methods

Math functions that are available in plain JavaScript should be used directly. There used to be wrappers for these Math functions in JXG.Board:

round, abs, acos, asin, atan, ceil, cos, exp, floor, log, max, min, random, pow, sin, sqrt, tan

Example

    var i = Math.sin(Math.PI);

General math functions in JXG.Math

We provide a collection of general Math routines in our JXG.Math namespace. Please use them directly if you used to access these functions via the board wrapper:

factorial, binomial, cosh, sinh

Example

    var b = JXG.Math.binomial(4, 3);

Geometry helper functions

Functions related to geometric calculations can be found in the JXG.Math.Geometry namespace. This is where you can find these methods now if you did use the corresponding board wrappers before:

angle, rad, distance

Example

    var r = JXG.Math.Geometry.rad(A, B, C);

Numerical algorithms

There were also a few numerical algorithm wrappers you can now only use directly via JXG.Math.Numerics:

D, I, root, lagrangePolynomial, neville, riemannsum

Example

    var Df = JXG.Math.Numerics.D(f); board.create('plot', [Df]);

Removed or renamed

  • JXG.Board.trunc() was removed, please use Math.floor() instead.
  • The JXG.Board.sgn() wrapper was removed.
  • The board methods intersection, intersectionFunc, and otherintersection were removed. Instead we now provide two elements intersection and otherintersection.