我正在尝试对 JSXGraph 中的 Line 应用一次性转换。
根据文档,我正在尝试像这样转换 Line:
var f = function(x) {
return x;
};
var l1 = board.create('functiongraph', [f], {
name: 'line 1',
withLabel: true,
strokeWidth: 2,
strokeColor: 'orange',
fixed: false
});
// Rotate about an intersection point with another line
var i = board.create('intersection', [l1, l2, 0], {
name: 'intersection',
fixed: true,
showInfobox: false
});
var rot = board.create(
'transform', [
function() {
// This gets the value from a slider
return s.Value();
}, i
], {
type:'rotate'
});
rot.applyOnce(l1);
board.update();
完整的来源在这里: http: //maldive.ccnmtl.columbia.edu/js/ncustom.js你可以看到我在这里描述的错误:http: //maldive.ccnmtl.columbia.edu/js/functiongraph -rotation.html
我得到错误:t[n].coords is undefined
。在我正在尝试的完整应用程序中,我收到错误:TypeError: Cannot read property 'usrCoords' of undefined
那么,无论如何,有没有其他人尝试过像这样改造一条线?
更新:查看源代码后,很明显这种方法只适用于点。所以,我不知道我的函数图是否可以做到这一点。我只是在这里使用一条直线,所以我可以用点做点什么。