## / root / Beispiele für geometrische Orte / Simson-Steiner-Theorem

Control the results

## Quelltext der Konstruktion

      board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-4, 6, 8, -4], axis: true, grid: false,
                                     keepaspectratio: true, showcopyright: false});
      p1 = board.createElement('point', [0, 0]);
      p2 = board.createElement('point', [6, 0]);
      p3 = board.createElement('point', [4, 4]);

      t1 = board.createElement('triangle', [p1, p2, p3], {strokeWidth: '1px'});

      m1 = board.createElement('point', [4, 1.5], {style:2,name:"X"});

      l1 = board.createElement('perpendicularpoint', [m1, t1.c]);
      l2 = board.createElement('perpendicularpoint', [m1, t1.a]);
      l3 = board.createElement('perpendicularpoint', [m1, t1.b]);

      t2 = board.createElement('triangle', [l1, l2, l3], {strokeWidth: '1px'});

      // Get area of triangle given by the three points A, B, C
      getTriangleArea = function(A, B, C, square) {
        var a = B.coords.distance(JXG.COORDS_BY_USER, C.coords),
            b = A.coords.distance(JXG.COORDS_BY_USER, C.coords),
            c = B.coords.distance(JXG.COORDS_BY_USER, A.coords),
            s = (typeof square == 'undefined' ? true : square);

        if (s)
          return (4*a*a*c*c-(a*a+c*c-b*b)*(a*a+c*c-b*b));
        else
          return Math.sqrt((4*a*a*c*c-(a*a+c*c-b*b)*(a*a+c*c-b*b))/16.);
      };

      te = board.createElement('text', [-3.8, 5.5, function () { return ("Fl&auml;che des Dreiecks EDF: " + getTriangleArea(l1, l2, l3, false)); }]);

      // dependency and polynomial generation hacking
      m1.ancestors[l1.id] = l1;
      m1.ancestors[l2.id] = l2;
      m1.ancestors[l3.id] = l3;
      m1.ancestors[p1.id] = p1;
      m1.ancestors[p2.id] = p2;
      m1.ancestors[p3.id] = p3;

      m1.generatePolynomial = function () {
        var as16 = getTriangleArea(l1, l2, l3),
            as = '((('+l2.symbolic.x+')-('+l3.symbolic.x+'))^2+(('+l2.symbolic.y+')-('+l3.symbolic.y+'))^2)',
            bs = '((('+l1.symbolic.x+')-('+l3.symbolic.x+'))^2+(('+l1.symbolic.y+')-('+l3.symbolic.y+'))^2)',
            cs = '((('+l2.symbolic.x+')-('+l1.symbolic.x+'))^2+(('+l2.symbolic.y+')-('+l1.symbolic.y+'))^2)',
            poly = '4*'+as+'*'+cs+'-('+as+'+'+cs+'-'+bs+')*('+as+'+'+cs+'-'+bs+')-('+as16+')';

        return ['4*'+as+'*'+cs+'-('+as+'+'+cs+'-'+bs+')*('+as+'+'+cs+'-'+bs+')-('+as16+')'];
      };

      loc = board.createElement('locus', [m1], {strokeColor: 'red', strokeWidth: '1px'});

      createControlElements = function () {
        glider = board.createElement('glider', [0, 5, loc]);
        lg1 = board.createElement('perpendicularpoint', [glider, t1.a]);
        lg2 = board.createElement('perpendicularpoint', [glider, t1.b]);
        lg3 = board.createElement('perpendicularpoint', [glider, t1.c]);

        tecontrol = board.createElement('text', [-3.8, 5, function () { return ("Fl&auml;che des Dreiecks HIJ: " + getTriangleArea(lg1, lg2, lg3, false)); }]);
      }