Why is jsxgraph parabola not rendering the dashed line well

55 Views Asked by At

Compare the parabola rendering to that of the directrix - which has rendered the dash properly. I have only seen this issue with parabolas. All other objects seem to work fine with dash.

https://jsfiddle.net/8df1n2me/

var point1 = board.create('point', [0,3])
var point2 = board.create('point', [-3,1])
var point3 = board.create('point', [3,1])

var directrix = board.create('line', [point2, point3], {fixed:false,dash:2, strokeWidth:1})

var parabola2Params = {
    dash: 2,
    strokeWidth: 1,
  fixed: false
}
var parabola2 = board.create('parabola', [point1, directrix],parabola2Params)
1

There are 1 best solutions below

0
On

This is a bug in all versions up to 1.2.2. The bug is fixed now in the 1.2.3 branch at https://github.com/jsxgraph/jsxgraph. A quick workaround is to restrict the plot to the interval [0, 2 π], i.e change the code to:

var point1 = board.create('point', [0,3])
var point2 = board.create('point', [-3,1])
var point3 = board.create('point', [3,1])

var directrix = board.create('line', [point2, point3], {fixed:false,dash:2, strokeWidth:1})

var parabola2Params = {
    dash: 2,
    strokeWidth: 1,
  fixed: false
}
var parabola2 = board.create('parabola', [point1, directrix, 0, 2*Math.PI], parabola2Params);