public void rotate(NumberValue r) {

    if (tmpMatrix4x4 == null) {
      tmpMatrix4x4 = new CoordMatrix4x4();
    }
    CoordMatrix4x4.Rotation4x4(r.getDouble(), tmpMatrix4x4);
    transform(tmpMatrix4x4);
  }
  public void rotate(NumberValue r, GeoPointND S) {

    if (tmpMatrix4x4 == null) {
      tmpMatrix4x4 = new CoordMatrix4x4();
    }
    CoordMatrix4x4.Rotation4x4(r.getDouble(), S.getInhomCoordsInD3(), tmpMatrix4x4);
    transform(tmpMatrix4x4);
  }
  public void rotate(NumberValue r, GeoPointND S, GeoDirectionND orientation) {

    if (tmpMatrix4x4 == null) {
      tmpMatrix4x4 = new CoordMatrix4x4();
    }
    CoordMatrix4x4.Rotation4x4(
        orientation.getDirectionInD3().normalized(),
        r.getDouble(),
        S.getInhomCoordsInD3(),
        tmpMatrix4x4);
    transform(tmpMatrix4x4);
  }
  public void rotate(NumberValue r, GeoLineND line) {

    if (tmpMatrix4x4 == null) {
      tmpMatrix4x4 = new CoordMatrix4x4();
    }

    CoordMatrix4x4.Rotation4x4(
        line.getDirectionInD3().normalized(),
        r.getDouble(),
        line.getStartInhomCoords(),
        tmpMatrix4x4);
    transform(tmpMatrix4x4);
  }
  private void transform(CoordMatrix4x4 m) {

    // current expressions
    ExpressionNode[] expr = new ExpressionNode[3];
    for (int i = 0; i < 3; i++) {
      expr[i] = ((Function) fun[i].deepCopy(kernel)).getExpression();
    }

    for (int row = 0; row < 3; row++) {
      MyDouble[] coeff = new MyDouble[4];
      for (int i = 0; i < 4; i++) {
        coeff[i] = new MyDouble(kernel, m.get(row + 1, i + 1));
      }

      ExpressionNode trans = new ExpressionNode(kernel, coeff[3]);
      for (int i = 0; i < 3; i++) {
        trans = trans.plus(expr[i].multiply(coeff[i]));
      }

      fun[row].setExpression(trans);
    }
  }
  public void mirror(GeoCoordSys2D plane) {

    CoordMatrix4x4 m = plane.getCoordSys().getMatrixOrthonormal();
    transform(CoordMatrix4x4.PlaneSymetry(m.getVz(), m.getOrigin()));
  }
  public void mirror(GeoLineND line) {

    transform(
        CoordMatrix4x4.AxialSymetry(
            line.getDirectionInD3().normalized(), line.getStartInhomCoords()));
  }