0

有一个反射点的选项(链接)。是否有其他形状(如多边形、圆形、线、角度等)的反射选项。我已经尝试过了,但它不适用于圆形,但对点工作正常。

        var board = JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-5, 5, 5, -5], axis: true });
    linePt1 = board.create('point',[0,0],{name:''});
    linePt2 = board.create('point',[2,2],{name:''});

    p1 = board.create('point',[1,3],{name:''});
    p2 = board.create('point',[1,2],{name:''});
    c1 = board.create('circle', [p1, p2]);

    theLine = board.create('line',[linePt1,linePt2],{dash:1});


    i1 = board.create('point',[3,3],{name:''});
    i2 = board.create('point',[3,2],{name:''});
    c2 = board.create('circle', [i1, i2]);

    initialPt = board.create('point',[3,1],{name:'initial pt'});
    transform = board.create('transform',[theLine],{type:'reflect'});
    board.create('point',[initialPt,transform],{name:'reflection'});

    transform1 = board.create('transform',[theLine],{type:'reflect'});
    board.create('circle',[c2,transform1],{name:'reflection1'});
    board.update();

谢谢

4

2 回答 2

1

今晚的夜间构建将包含对弧、扇区、圆和角度应用变换的可能性。此外,元素和reflection允许mirrorelement这些元素arc、、sector和作为输入元素。缺点 - 至少目前 - 是生成的元素是弧、扇区和角度的曲线。当输入元素是圆时,结果元素是圆锥截面。原因是当对例如圆应用任意变换时,圆将是圆锥曲线。circleangle

这是一个扩展示例:

var board = JXG.JSXGraph.initBoard("jxgbox", {
    boundingbox: [-5, 5, 5, -5],
    axis: true
});

// reflection line
var li = board.create('line', [1,1,1], {
    strokeColor: '#aaaaaa', name: 'reflection line', withLabel: true});
var reflect = board.create('transform', [li], {type: 'reflect'});
var t = board.create('transform', [2, 1.5], {type: 'scale'});

// Mirror point
var p1 = board.create('point', [-0.5, 0], {name: "Mirror point"});

var c1 = board.create('circle', [[1.3, 1.3], [0, 1.3]], 
    {strokeColor: 'black', center: {visible:true}});
var c2 = board.create('circle', [c1, t], {strokeColor: 'black'});
var c3 = board.create('reflection', [c1, li], {strokeColor: 'black'});
var c4 = board.create('mirrorelement', [c1, p1], {strokeColor: 'black'});
// c2, c3, c4 are conics

var a1 = board.create('arc', [[1, 1], [0, 1], [1, 0]], 
    {strokeColor: 'red'});
var a2 = board.create('curve', [a1, t], {strokeColor: 'red'});
var a3 = board.create('mirrorelement', [a1, p1], {strokeColor: 'red'});
var a4 = board.create('reflection', [a2, li], {strokeColor: 'red'});
// a2, a3, a4 are curves

var s1 = board.create('sector', [[-3.5,-3], [-3.5, -2], [-3.5,-4]], 
    {
        anglepoint: {visible:true}, 
        center: {visible: true}, 
        radiuspoint: {visible: true}, 
        fillColor: 'yellow', strokeColor: 'black'});
var s2 = board.create('curve', [s1, reflect], 
    {fillColor: 'yellow', strokeColor: 'black'});
var s3 = board.create('mirrorelement', [s1, p1], 
    {fillColor: 'yellow', strokeColor: 'black'});
var s4 = board.create('reflection', [s2, li], 
    {fillColor: 'yellow', strokeColor: 'black', fillOpacity: 0.5});
// s2, s3, s4 are curves
var an1 = board.create('angle', [[-4,3.9], [-3, 4], [-3, 3]]);
var an2 = board.create('curve', [an1, t]);
var an3 = board.create('reflection', [an1, li]);
// an2, an3 are curves 

请试一试。

最好的祝愿,阿尔弗雷德

于 2018-05-29T10:35:57.340 回答
0

几周以来,每晚构建已经包含对线、多边形和曲线应用转换的能力。下周我们将添加圆、弧、扇区和角度。

于 2018-05-11T15:02:14.770 回答