1

我在 JSXGraph 中定义了函数图和直线之间的交集。当我移动直线时,交叉点会按预期更新其位置。但是当我移动函数图时,交叉点消失了。我需要在这里做一些特殊的配置吗?这是 jsxgraph 的错误吗?这是该问题的实时说明:

http://maldive.ccnmtl.columbia.edu/js/functiongraph-intersection.html

这是代码:

var l1 = board.create('line', [                                                                                                     
    [2.5, 2.5],                                                                                                                     
    [3.5, 3.5]                                                                                                                      
], {                                                                                                                                
    name: 'line 1',                                                                                                                 
    withLabel: true,                                                                                                                
    label: { position: 'rt', offset: [10, -20] },                                                                                   
    strokeColor: 'blue',                                                                                                            
    strokeWidth: 2,                                                                                                                 
    fixed: false                                                                                                                    
});                                                                                                                                 

var f = function(x) {                                                                                                               
    var alpha = 0.3;                                                                                                                
    return (1 - alpha) *                                                                                                            
        (1.4 *                                                                                                                      
         1.6 ** alpha) *                                                                                                            
        (x ** -alpha);                                                                                                              
};                                                                                                                                  

var l2 = board.create('functiongraph', [f], {                                                                                       
    name: 'line 2',                                                                                                                 
    withLabel: true,                                                                                                                
    strokeWidth: 2,                                                                                                                 
    strokeColor: 'orange',                                                                                                          
    fixed: false                                                                                                                    
});                                                                                                                                 

var i = board.create('intersection', [l1, l2, 0], {                                                                                 
    name: 'intersection',                                                                                                           
    fixed: true,                                                                                                                    
    showInfobox: false                                                                                                              
}); 
4

1 回答 1

2

是的,这确实是 JSXGraph 中的一个错误。在 0.99.6 及之前的版本中,直线和连续曲线之间的交点由求根算法确定。现在,问题是通过对曲线点(这是绘图算法的输出)应用变换来实现拖动曲线。在求根算法中不考虑这种变换,因为使用了函数项。

相反,两条曲线之间的交点是使用作为曲线绘图算法输出的点来确定的。在这里,已经应用了转换。这就是为什么交点对曲线起作用的原因y = x

源代码现在包含一个错误修复,该修复将在今天的夜间版本中提供。从现在开始,线和曲线之间的交点就像曲线/曲线交点一样。精度会有一点损失,但这不会是可见的。

感谢您指出这一点!

于 2018-02-14T10:13:33.407 回答