this.keyTime = this.to.distance(this.to.from) / this.norm;\r
return f;\r
} else if (this.mode === "spline") {\r
+ var tk = this.keySplines;\r
+ for (var i=0;i<4;++i) {\r
+ if (isNaN(tk[i])) {\r
+ throw new Error("A keySplines attribute error");\r
+ }\r
+ }\r
this.to.call();\r
- var tk = this.keySplines,\r
- x2 = tk[0],\r
+ var x2 = tk[0],\r
y2 = tk[1],\r
x3 = tk[2],\r
y3 = tk[3],\r
calc.keySplines = k;\r
calc.to.degit = 10;\r
var b = bezier(0,0, k[0],k[1], k[2],k[3], 1,1),\r
- epsiron = 1e-6; //誤差\r
+ epsilon = 1e-6; //誤差\r
expect(calc.call()(0)).toBe(b(0).y.toFixed(10));\r
calc.to.from = from;\r
expect(calc.call()(1)).toBe(b(1).y.toFixed(10));\r
calc.to.from = from;\r
b = b(Math.random());\r
- expect(Math.abs(calc.call()(b.x) - b.y.toFixed(10))).toBeLessThan(epsiron);\r
+ expect(Math.abs(calc.call()(b.x) - b.y.toFixed(10))).toBeLessThan(epsilon);\r
};\r
for (var i=0;i<10000;++i) {\r
var rand = [Math.random(), Math.random(), Math.random(), Math.random()].sort(function(a,b){return a-b;});\r
} );\r
/*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
it("should be this for the value (the invalid partion on a spline mode )", function() {\r
+ calc.mode = "spline";\r
+ calc.keySplines = [0, NaN, 1, 1];\r
+ calc.to.degit = 1;\r
+ calc.to.from = from;\r
+ expect( function() {\r
+ calc.up().call();\r
+ } ).toThrow();\r
} );\r
} );\r
} );\r