that = this,\r
bezier = function (x1, y1, x2, y2, x3, y3, x4, y4) {\r
return function (t) {\r
- x = (x4-3*(x3+x2)-x1)*t*t*t + 3*(x3-2*x2+x1)*t*t + 3*(x2-x1)*t + x1;\r
- y = (y4-3*(y3+y2)-y1)*t*t*t + 3*(y3-2*y2+y1)*t*t + 3*(y2-y1)*t + y1;\r
+ x = (x4-3*(x3-x2)-x1)*t*t*t + 3*(x3-2*x2+x1)*t*t + 3*(x2-x1)*t + x1;\r
+ y = (y4-3*(y3-y2)-y1)*t*t*t + 3*(y3-2*y2+y1)*t*t + 3*(y2-y1)*t + y1;\r
return f(y);\r
};\r
},\r
\r
/*splineモードの境界条件を調べておく (limit value analysis)*/\r
it("should be this for the value (spline mode limit value analysis)", function() {\r
- /*3次ベジェ曲線の数式はこのページを参考にした http://geom.web.fc2.com/geometry/bezier/cubic.html*/\r
+ /*3次ベジェ曲線の数式はこのページを参考にした http://opentype.jp/fontguide_doc3.htm*/\r
var x = 0,\r
y = 0,\r
bezier = function (x1, y1, x2, y2, x3, y3, x4, y4) {\r
return function (t) {\r
- x = (x4-3*(x3+x2)-x1)*t*t*t + 3*(x3-2*x2+x1)*t*t + 3*(x2-x1)*t + x1;\r
- y = (y4-3*(y3+y2)-y1)*t*t*t + 3*(y3-2*y2+y1)*t*t + 3*(y2-y1)*t + y1;\r
+ x = (x4-3*(x3-x2)-x1)*t*t*t + 3*(x3-2*x2+x1)*t*t + 3*(x2-x1)*t + x1;\r
+ y = (y4-3*(y3-y2)-y1)*t*t*t + 3*(y3-2*y2+y1)*t*t + 3*(y2-y1)*t + y1;\r
return y;\r
};\r
};\r
y = 0,\r
bezier = function (x1, y1, x2, y2, x3, y3, x4, y4) {\r
return function (t) {\r
- x = (x4-3*(x3+x2)-x1)*t*t*t + 3*(x3-2*x2+x1)*t*t + 3*(x2-x1)*t + x1;\r
- y = (y4-3*(y3+y2)-y1)*t*t*t + 3*(y3-2*y2+y1)*t*t + 3*(y2-y1)*t + y1;\r
+ x = (x4-3*(x3-x2)-x1)*t*t*t + 3*(x3-2*x2+x1)*t*t + 3*(x2-x1)*t + x1;\r
+ y = (y4-3*(y3-y2)-y1)*t*t*t + 3*(y3-2*y2+y1)*t*t + 3*(y2-y1)*t + y1;\r
return y;\r
};\r
};\r
calc.mode = "spline";\r
calc.keySplines = [0, 0.5, 0.5, 1];\r
calc.to.degit = 1;\r
- expect(calc.call()(0)).toBe(bezier(0,0, 0,0, 1,1, 1,1)(0)+".0");\r
+ var b = bezier(0,0, 0,0.5, 0.5,1, 1,1);\r
+ expect(calc.call()(0)).toBe(b(0)+".0");\r
calc.to.from = from;\r
- expect(calc.call()(1)).toBe(bezier(0,0, 0,0, 1,1, 1,1)(1)+".0");\r
+ expect(calc.call()(1)).toBe(b(1)+".0");\r
calc.to.from = from;\r
} );\r
/*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r