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); }