jsxgraph:函数图和线之间的交点消失了

jsxgraph: intersection between functiongraph and line disappears

我在函数图和 JSXGraph 中的直线之间定义了一个 intersection。当我移动直线时,交点会按预期更新其位置。但是当我移动功能图时,交叉点消失了。我需要在这里做一些特殊的配置吗?这是 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                                                                                                              
}); 

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

相比之下,两条曲线之间的交点是使用作为曲线绘制算法输出的点来确定的。在这里,已经应用了转换。这就是交叉点适用于曲线 y = x.

的原因

源代码现在包含一个错误修复,将在今天的夜间构建中可用。从现在开始,直线和曲线之间的交点就像曲线/曲线交点一样完成。精度会有小的损失,但是不会被看到。

感谢您指出这一点!