Reformat code a bit.

This commit is contained in:
Jürg Lehni 2015-09-26 07:41:03 -04:00
parent 3fa810a557
commit ea3cc63e2e

View file

@ -622,12 +622,15 @@ statics: {
var txs = [],
tys = [],
sx = Curve.solveCubic(v, 0, x, txs, 0, 1),
sy = sx === 0 ? null : Curve.solveCubic(v, 1, y, tys, 0, 1),
// Only solve for y if x actually has some solutions
sy = sx !== 0 ? Curve.solveCubic(v, 1, y, tys, 0, 1) : 0,
tx, ty;
// sx, sy === -1 means infinite solutions.
// sx === -1 && sy === -1 means the curve is a point and there is
// an infinite number of solutions.
if (sx === -1 && sy === -1) return 0;
// sx === -1 && sy === -1 means the curve is a point and there really is
// an infinite number of solutions. Let's just return t = 0, as they are
// all valid and actually end up being the same position.
if (sx === -1 && sy === -1)
return 0;
// Loop through all solutions for x and match with solutions for y,
// to see if we either have a matching pair, or infinite solutions
// for one or the other.