Ejemplo n.º 1
0
  protected GeoElement[] processConic(Equation equ) {
    double a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
    GeoElement[] ret = new GeoElement[1];
    GeoConic conic;
    String label = equ.getLabel();
    Polynomial lhs = equ.getNormalForm();

    boolean isExplicit = equ.isExplicit("y");
    boolean isSpecific = !isExplicit && (equ.isExplicit("yy") || equ.isExplicit("xx"));
    boolean isIndependent = lhs.isConstant();

    if (isIndependent) {
      a = lhs.getCoeffValue("xx");
      b = lhs.getCoeffValue("xy");
      c = lhs.getCoeffValue("yy");
      d = lhs.getCoeffValue("x");
      e = lhs.getCoeffValue("y");
      f = lhs.getCoeffValue("");
      conic = kernel.Conic(label, a, b, c, d, e, f);
    } else conic = kernel.DependentConic(label, equ);
    if (isExplicit) {
      conic.setToExplicit();
      conic.updateRepaint();
    } else if (isSpecific || conic.getType() == GeoConic.CONIC_CIRCLE) {
      conic.setToSpecific();
      conic.updateRepaint();
    }
    ret[0] = conic;
    return ret;
  }
Ejemplo n.º 2
0
 protected GeoElement[] processImplicitPoly(Equation equ) {
   GeoElement[] ret = new GeoElement[1];
   String label = equ.getLabel();
   Polynomial lhs = equ.getNormalForm();
   boolean isIndependent = !equ.isFunctionDependent() && lhs.isConstant();
   GeoImplicitPoly poly;
   GeoElement geo = null;
   if (isIndependent) {
     poly = kernel.ImplicitPoly(label, lhs);
     poly.setUserInput(equ);
     geo = poly;
   } else {
     geo = kernel.DependentImplicitPoly(label, equ); // might also return Line or Conic
     if (geo instanceof GeoUserInputElement) {
       ((GeoUserInputElement) geo).setUserInput(equ);
     }
   }
   ret[0] = geo;
   //		Application.debug("User Input: "+equ);
   ret[0].updateRepaint();
   return ret;
 }
Ejemplo n.º 3
0
  protected GeoElement[] processLine(Equation equ, boolean inequality) {
    double a = 0, b = 0, c = 0;
    GeoLine line;
    GeoElement[] ret = new GeoElement[1];
    String label = equ.getLabel();
    Polynomial lhs = equ.getNormalForm();
    boolean isExplicit = equ.isExplicit("y");
    boolean isIndependent = lhs.isConstant();

    if (isIndependent) {
      // get coefficients
      a = lhs.getCoeffValue("x");
      b = lhs.getCoeffValue("y");
      c = lhs.getCoeffValue("");
      line = kernel.Line(label, a, b, c);
    } else line = kernel.DependentLine(label, equ);

    if (isExplicit) {
      line.setToExplicit();
      line.updateRepaint();
    }
    ret[0] = line;
    return ret;
  }