Share JSXGraph: example "3D curve"

JSXGraph
Share JSXGraph: example "3D curve"
This website is a beta version. The official release will be in **2024**.

3D curve

In this example, the function $$ f: {\mathbb R} \to {\mathbb R}^3, \; t \mapsto \begin{pmatrix} (2 + \cos(3t))\cos(2t)\\ (2 + \cos(3t))\sin(2t)\\ \sin(3t) \end{pmatrix} $$ is plotted.
// Define the id of your board in BOARDID

var board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-8, 8, 8, -8],
    keepaspectratio: false,
    axis: false
});

var view = board.create('view3d',
    [
        [-6, -3],
        [8, 8],
        [
            [-5, 5],
            [-5, 5],
            [-5, 5]
        ]
    ], {
        xPlaneRear: {
            visible: false
        },
        yPlaneRear: {
            visible: false
        },
        zPlaneRear: {
            fillColor: 'blue'
        }
    });

var curve = view.create('curve3d', [
    (t) => (2 + Math.cos(3 * t)) * Math.cos(2 * t),
    (t) => (2 + Math.cos(3 * t)) * Math.sin(2 * t),
    (t) => Math.sin(3 * t),
    [-Math.PI, Math.PI]
], {
    strokeWidth: 4
});