JSXGraph logo
JSXGraph
JSXGraph share

Share

Barycenter
QR code
<iframe 
    src="http://jsxgraph.uni-bayreuth.de/share/iframe/barycenter" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Barycenter" 
    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 4.0 International License.
    https://creativecommons.org/licenses/by/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID = 'board-0';

    JXG.Options.label.autoPosition = true;
    JXG.Options.text.fontSize = 16;
    
    const board = JXG.JSXGraph.initBoard(BOARDID, {
        boundingbox: [-2, 7, 7, -2],
        keepaspectratio: true,
        axis: true
    });
    
    var p0 = board.create('point', [0, 0], {name: 'p_0', fixed: true});
    var p0s = board.create('point', [2, 1], {name: "p_0'"});
    var p1s = board.create('point', [4, 4], {name: "p_1'"});
    var p2s = board.create('point', [1, 2], {name: "p_2'"});
    
    var l1 = board.create('line', [p0s, p1s], {lastArrow: true, color: 'orange'});
    var l2 = board.create('line', [p0s, p2s], {lastArrow: true, color: 'orange'});
    
    var v1 = board.create('arrow', [p0s, p1s], {
        color: 'black', strokeWidth: 1, layer: 8,
        lastArrow: {
            size: 10
        }
    });
    var v2 = board.create('arrow', [p0s, p2s], {
        color: 'black', strokeWidth: 1, layer: 8,
        lastArrow: {
            size: 10
        }
    });
    
    var v3 = board.create('arrow', [p0, p0s], {
        color: 'black', strokeWidth: 1, layer: 8,
        lastArrow: {
            size: 10
        }
    });
    
    var q = board.create('point', [3, 5], {name: 'q'});
    
    var par1 = board.create('parallel', [l1, q], {strokeWidth: 1, dash: 1});
    var par2 = board.create('parallel', [l2, q], {strokeWidth: 1, dash: 1});
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution 4.0 International License.
https://creativecommons.org/licenses/by/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!

JXG.Options.label.autoPosition = true;
JXG.Options.text.fontSize = 16;

const board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-2, 7, 7, -2],
    keepaspectratio: true,
    axis: true
});

var p0 = board.create('point', [0, 0], {name: 'p_0', fixed: true});
var p0s = board.create('point', [2, 1], {name: "p_0'"});
var p1s = board.create('point', [4, 4], {name: "p_1'"});
var p2s = board.create('point', [1, 2], {name: "p_2'"});

var l1 = board.create('line', [p0s, p1s], {lastArrow: true, color: 'orange'});
var l2 = board.create('line', [p0s, p2s], {lastArrow: true, color: 'orange'});

var v1 = board.create('arrow', [p0s, p1s], {
    color: 'black', strokeWidth: 1, layer: 8,
    lastArrow: {
        size: 10
    }
});
var v2 = board.create('arrow', [p0s, p2s], {
    color: 'black', strokeWidth: 1, layer: 8,
    lastArrow: {
        size: 10
    }
});

var v3 = board.create('arrow', [p0, p0s], {
    color: 'black', strokeWidth: 1, layer: 8,
    lastArrow: {
        size: 10
    }
});

var q = board.create('point', [3, 5], {name: 'q'});

var par1 = board.create('parallel', [l1, q], {strokeWidth: 1, dash: 1});
var par2 = board.create('parallel', [l2, q], {strokeWidth: 1, dash: 1});
<jsxgraph width="100%" aspect-ratio="1 / 1" title="Barycenter" 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 4.0 International License.
   https://creativecommons.org/licenses/by/4.0/
   
   Please note you have to mention 
   The Center of Mobile Learning with Digital Technology
   in the credits.
   */
   
   JXG.Options.label.autoPosition = true;
   JXG.Options.text.fontSize = 16;
   
   const board = JXG.JSXGraph.initBoard(BOARDID, {
       boundingbox: [-2, 7, 7, -2],
       keepaspectratio: true,
       axis: true
   });
   
   var p0 = board.create('point', [0, 0], {name: 'p_0', fixed: true});
   var p0s = board.create('point', [2, 1], {name: "p_0'"});
   var p1s = board.create('point', [4, 4], {name: "p_1'"});
   var p2s = board.create('point', [1, 2], {name: "p_2'"});
   
   var l1 = board.create('line', [p0s, p1s], {lastArrow: true, color: 'orange'});
   var l2 = board.create('line', [p0s, p2s], {lastArrow: true, color: 'orange'});
   
   var v1 = board.create('arrow', [p0s, p1s], {
       color: 'black', strokeWidth: 1, layer: 8,
       lastArrow: {
           size: 10
       }
   });
   var v2 = board.create('arrow', [p0s, p2s], {
       color: 'black', strokeWidth: 1, layer: 8,
       lastArrow: {
           size: 10
       }
   });
   
   var v3 = board.create('arrow', [p0, p0s], {
       color: 'black', strokeWidth: 1, layer: 8,
       lastArrow: {
           size: 10
       }
   });
   
   var q = board.create('point', [3, 5], {name: 'q'});
   
   var par1 = board.create('parallel', [l1, q], {strokeWidth: 1, dash: 1});
   var par2 = board.create('parallel', [l2, q], {strokeWidth: 1, dash: 1});
</jsxgraph>

Barycenter

// Define the id of your board in BOARDID

JXG.Options.label.autoPosition = true;
JXG.Options.text.fontSize = 16;

const board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-2, 7, 7, -2],
    keepaspectratio: true,
    axis: true
});

var p0 = board.create('point', [0, 0], {name: 'p_0', fixed: true});
var p0s = board.create('point', [2, 1], {name: "p_0'"});
var p1s = board.create('point', [4, 4], {name: "p_1'"});
var p2s = board.create('point', [1, 2], {name: "p_2'"});

var l1 = board.create('line', [p0s, p1s], {lastArrow: true, color: 'orange'});
var l2 = board.create('line', [p0s, p2s], {lastArrow: true, color: 'orange'});

var v1 = board.create('arrow', [p0s, p1s], {
    color: 'black', strokeWidth: 1, layer: 8,
    lastArrow: {
        size: 10
    }
});
var v2 = board.create('arrow', [p0s, p2s], {
    color: 'black', strokeWidth: 1, layer: 8,
    lastArrow: {
        size: 10
    }
});

var v3 = board.create('arrow', [p0, p0s], {
    color: 'black', strokeWidth: 1, layer: 8,
    lastArrow: {
        size: 10
    }
});

var q = board.create('point', [3, 5], {name: 'q'});

var par1 = board.create('parallel', [l1, q], {strokeWidth: 1, dash: 1});
var par2 = board.create('parallel', [l2, q], {strokeWidth: 1, dash: 1});

license

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