Geometric constructions with JessieScript: Difference between revisions
From JSXGraph Wiki
|  New page: <jsxgraph width="400" height="400" box="box">         var cons1, cons2;         board = JXG.JSXGraph.initBoard('jxgbox', {grid:true, originX: 50, originY: 300, unitX: 50, unitY: 50, axis:t... | No edit summary | ||
| Line 1: | Line 1: | ||
| Easy JSXGraph constructions with geometric elements can be created by a mathematical syntax by using the function | |||
| <source> | |||
| board.construct(...); | |||
| </source> | |||
| Possible elements: | |||
| {| cellpadding="8" cellspacing="0" border="1" | |||
| ! Construction !! Description | |||
| |- | |||
| | A(1,1)    || Point with name 'A' at the position (1,1) | |||
| |- | |||
| | XY(1|1)    || Point with name 'XY' at the position (1,1) | |||
| |- | |||
| | ]AB[    || straight line through the points A and B | |||
| |- | |||
| | [AB[    || ray through the points A and B, stopping at A | |||
| |- | |||
| | ]AB]    || ray through the points A and B, stopping at B | |||
| |- | |||
| | [AB]    || segment through the points A and B | |||
| |- | |||
| | g=[AB]    || segment through the points A and B, named by 'g' | |||
| |- | |||
| | k(A,1)    || circle with midpoint A and radius 1 | |||
| |- | |||
| | k(A,B)    || circle with midpoint A through the point B on the circle line | |||
| |- | |||
| | k(A,[BC])    || circle with midpoint A and radius defined by the length of the (not necessarily existing) segement [BC] | |||
| |- | |||
| | k_1=k(A,1)    || circle with midpoint A and radius 1, named by 'k_1' | |||
| |} | |||
| The different elements have to be separated by semicolon. | |||
| Example: | |||
| <jsxgraph width="400" height="400" box="box"> | <jsxgraph width="400" height="400" box="box"> | ||
|          var cons1, cons2; |          var cons1, cons2; | ||
Revision as of 14:24, 21 March 2010
Easy JSXGraph constructions with geometric elements can be created by a mathematical syntax by using the function
board.construct(...);Possible elements:
| Construction | Description | 
|---|---|
| A(1,1) | Point with name 'A' at the position (1,1) | 
| 1) | Point with name 'XY' at the position (1,1) | 
| ]AB[ | straight line through the points A and B | 
| [AB[ | ray through the points A and B, stopping at A | 
| ]AB] | ray through the points A and B, stopping at B | 
| [AB] | segment through the points A and B | 
| g=[AB] | segment through the points A and B, named by 'g' | 
| k(A,1) | circle with midpoint A and radius 1 | 
| k(A,B) | circle with midpoint A through the point B on the circle line | 
| k(A,[BC]) | circle with midpoint A and radius defined by the length of the (not necessarily existing) segement [BC] | 
| k_1=k(A,1) | circle with midpoint A and radius 1, named by 'k_1' | 
The different elements have to be separated by semicolon.
Example:
The JavaScript code
<jsxgraph width="500" height="400" box="box">
        var cons1, cons2;
        board = JXG.JSXGraph.initBoard('box', {grid:true, originX: 50, originY: 300, unitX: 50, unitY: 50, axis:true});
        
        cons1 = board.construct("A(1,1);B(2,2.5);C(1,3);G(5,3);H(6,4);[GH];k(G,1);AB(5,-1);X(6,-1);Y(7,-2);k(Y,X);k(A,[BC]);k(B,[AC]);");
        cons2 = board.construct("J(7,4);[GJ[;K(8,4);]GK[;L(2.4|5);f=[AC];k1=k(C,0.5);C_1(4|4);l_2=[BC]");
        
        cons1.points[0].setProperty({face:'diamond',size:7,strokeColor:'#8B2252',fillColor:'#8B2252'});
        cons1.circles[1].setProperty({strokeColor:'#BA55D3'});
        cons2.J.setProperty({face:'triangleUp',size:8,strokeColor:'black',fillColor:'#EE82EE'});
        cons2.lines[1].setProperty({strokeColor:'#32CD32',shadow:true});
        
        cons1.X.strokeColor('black');
        cons1.X.fillColor('#FFB90F');
        cons1.X.shadow(true);
        cons1.Y.visible(false);
        cons2.l_2.strokeWidth(4);
        cons1.X.face('>');
        cons1.X.size(8);
        cons1.X.labelColor('#FFB90F');
        cons2.k1.dash(2);
</jsxgraph>
