コード例 #1
0
  @Override
  public final GeoElement[] process(Command c) throws MyError {
    int n = c.getArgumentNumber();
    GeoElement[] arg;

    boolean ok;

    switch (n) {
      case 2:
        arg = resArgs(c);
        if ((ok = arg[0].isGeoNumeric()) && arg[1].isGeoText()) {

          GeoNumeric num = (GeoNumeric) arg[0];
          String str = ((GeoText) arg[1]).getTextString();

          try {
            num.setValue(kernelA.getAlgebraProcessor().evaluateToNumeric(str, true).getDouble());
            num.updateCascade();
          } catch (Exception e) {
            num.setUndefined();
            num.updateCascade();
          }

          GeoElement[] ret = {num};
          return ret;
        } else if (!ok) throw argErr(app, c.getName(), arg[0]);
        else throw argErr(app, c.getName(), arg[1]);

      default:
        throw argNumErr(app, c.getName(), n);
    }
  }
コード例 #2
0
  @Override
  public final void compute() {
    double a = t0.getValue();
    double b = t1.getValue();

    double lenVal = Math.abs(AlgoIntegralDefinite.numericIntegration(lengthCurve, a, b));
    length.setValue(lenVal);
  }
コード例 #3
0
  // calc length of vector v
  @Override
  public final void compute() {

    num.setValue(seg.getLength());
  }
コード例 #4
0
 // calc length of vector v
 @Override
 public final void compute() {
   v.getInhomCoords(coords);
   num.setValue(MyMath.length(coords[0], coords[1]));
 }