JavaScript
JXG.Options.text.useMathJax = true;
var board = JXG.JSXGraph.initBoard('jxgbox', {
boundingbox: [-8, 8, 8, -10],
keepaspectratio: false,
axis: false
});
var box = [-2, 2];
var view = board.create('view3d',
[
[-6, -6],
[8, 8],
[box, box, box]
], {
xPlaneRear: {
visible: false
},
xPlaneRearYAxis: {
visible: false
},
xPlaneRearZAxis: {
visible: false
},
yPlaneRear: {
visible: false
},
yPlaneRearXAxis: {
visible: false
},
yPlaneRearZAxis: {
visible: false
},
});
//slider-based curve
var xlabel = view.create(
"point3d",
[0.9 * box[1], 0, 0.6 * box[0] + 0.4 * box[1]], {
size: 0,
name: "x"
}
);
var Ylabel = view.create(
"point3d",
[0, 0.9 * box[1], 0.6 * box[0] + 0.4 * box[1]], {
size: 0,
name: "y"
}
);
var Zlabel = view.create(
"point3d",
[
0.7 * (0.6 * box[0] + 0.4 * box[1]),
0.7 * (0.6 * box[0] + 0.4 * box[1]),
0.9 * box[1],
], {
size: 0,
name: "z"
}
);
board.renderer.container.style.backgroundColor = '#f9f9fb';
// set variable names
var F, txtFx, txtFy, cl, c, cimp, c3d, c3d1;
var inputFun = board.create("input", [-5, 7,
"sin(2*x)*cos(2*y)"
//"x^2+y^2"
, "\\(f(x,y)=\\)"
], {
cssStyle: "width: 100px",
});
var inputPlot = board.create("button", [0.5, 7, "Plot", function() {
plot();
}], {
cssStyle: "width: 50px",
});
var inputLevelTxt = board.create("input", [3, 7, "0.5", "\\(c=\\)"], {
cssStyle: "width: 25px",
});
var inputLevel = board.create("button", [5, 7, "set level", () => {
plotContourLine();
}], {
cssStyle: "width: 70px",
});
/* object to hold the implicit curve of a level set*/
cimp = board.create('curve', [
[],
[]
]);
/* hold the countour line in xy-plane*/
c3d = view.create('curve3d', [
[],
[],
[]
], {
strokeWidth: 3
});
/* hold the countour line on graph */
c3d1 = view.create('curve3d', [
[],
[],
[]
], {
strokeWidth: 3
});
c3d.updateDataArray =...