AlgoTangentCurve(Construction cons, String label, GeoPoint P, GeoCurveCartesian f) {
    super(cons);
    this.P = P;
    this.f = f;
    tangent = new GeoLine(cons);

    // check if P is defined as a point of the curve's graph
    pointOnCurve = false;
    if (P.getParentAlgorithm() instanceof AlgoPointOnPath) {
      AlgoPointOnPath algo = (AlgoPointOnPath) P.getParentAlgorithm();
      pointOnCurve = algo.getPath() == f;
    }

    if (pointOnCurve) T = P;
    else T = new GeoPoint(cons);
    tangent.setStartPoint(T);

    // First derivative of curve f
    AlgoDerivative algo = new AlgoDerivative(cons, f);
    this.df = (GeoCurveCartesian) algo.getDerivative();

    cons.removeFromConstructionList(algo);
    setInputOutput(); // for AlgoElement
    compute();
    tangent.setLabel(label);
  }
Example #2
0
  AlgoDirectrix(Construction cons, String label, GeoConic c) {
    super(cons);
    this.c = c;

    eigenvec = c.eigenvec;
    b = c.b;

    directrix = new GeoLine(cons);
    P = new GeoPoint(cons);
    directrix.setStartPoint(P);

    setInputOutput(); // for AlgoElement
    compute();
    directrix.setLabel(label);
  }