JSXGraph logo
JSXGraph
JSXGraph share

Share

3D point
QR code
<iframe 
    src="http://jsxgraph.org/share/iframe/3d-point" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: 3D point" 
    allowfullscreen
></iframe>
This code has to
<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution ShareAlike 4.0 International License.
    https://creativecommons.org/licenses/by-sa/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID = 'board-0';

    var board = JXG.JSXGraph.initBoard(BOARDID, {
        boundingbox: [-8, 8, 8, -8],
        keepaspectratio: false,
        axis: false
    });
    
    var view = board.create('view3d',
        [
            [-6, -3],
            [8, 8], // 2D box of view
            [
                [-5, 5],
                [-5, 5],
                [-5, 5]
            ]
        ], // 3D bounding cube
        {});
    
    // Point A (free point)                       
    var p = view.create('point3d', [1, 1, 2], {size: 5, name:'A'});
    
    view.create('line3d', [p, [1, 0, 0],  [0, () => -p.X() - 5]], {dash: 1});
    view.create('line3d', [p, [0, 1, 0],  [0, () => -p.Y() - 5]], {dash: 1});
    view.create('line3d', [p, [0, 0, 1],  [0, () => -p.Z() - 5]], {dash: 1});
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution ShareAlike 4.0 International License.
https://creativecommons.org/licenses/by-sa/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID = 'your_div_id'; // Insert your id here!

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

var view = board.create('view3d',
    [
        [-6, -3],
        [8, 8], // 2D box of view
        [
            [-5, 5],
            [-5, 5],
            [-5, 5]
        ]
    ], // 3D bounding cube
    {});

// Point A (free point)                       
var p = view.create('point3d', [1, 1, 2], {size: 5, name:'A'});

view.create('line3d', [p, [1, 0, 0],  [0, () => -p.X() - 5]], {dash: 1});
view.create('line3d', [p, [0, 1, 0],  [0, () => -p.Y() - 5]], {dash: 1});
view.create('line3d', [p, [0, 0, 1],  [0, () => -p.Z() - 5]], {dash: 1});
<jsxgraph width="100%" aspect-ratio="1 / 1" title="3D point" description="This construction was copied from JSXGraph examples database: BTW HERE SHOULD BE A GENERATED LINKuseGlobalJS="false">
   /*
   This example is licensed under a 
   Creative Commons Attribution ShareAlike 4.0 International License.
   https://creativecommons.org/licenses/by-sa/4.0/
   
   Please note you have to mention 
   The Center of Mobile Learning with Digital Technology
   in the credits.
   */
   
   var board = JXG.JSXGraph.initBoard(BOARDID, {
       boundingbox: [-8, 8, 8, -8],
       keepaspectratio: false,
       axis: false
   });
   
   var view = board.create('view3d',
       [
           [-6, -3],
           [8, 8], // 2D box of view
           [
               [-5, 5],
               [-5, 5],
               [-5, 5]
           ]
       ], // 3D bounding cube
       {});
   
   // Point A (free point)                       
   var p = view.create('point3d', [1, 1, 2], {size: 5, name:'A'});
   
   view.create('line3d', [p, [1, 0, 0],  [0, () => -p.X() - 5]], {dash: 1});
   view.create('line3d', [p, [0, 1, 0],  [0, () => -p.Y() - 5]], {dash: 1});
   view.create('line3d', [p, [0, 0, 1],  [0, () => -p.Z() - 5]], {dash: 1});
</jsxgraph>

3D point

A simple,free 3D point. Usual dragging does not change the $z$-coordinate of the point. Shift+drag changes the $z$-coordinate. Additionally, three helper lines are displayed.
// 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], // 2D box of view
        [
            [-5, 5],
            [-5, 5],
            [-5, 5]
        ]
    ], // 3D bounding cube
    {});

// Point A (free point)                       
var p = view.create('point3d', [1, 1, 2], {size: 5, name:'A'});

view.create('line3d', [p, [1, 0, 0],  [0, () => -p.X() - 5]], {dash: 1});
view.create('line3d', [p, [0, 1, 0],  [0, () => -p.Y() - 5]], {dash: 1});
view.create('line3d', [p, [0, 0, 1],  [0, () => -p.Z() - 5]], {dash: 1});

license

This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.