// calc tangent at x=a @Override public final void compute() { double a = n.getDouble(); if (!f.isDefined() || !deriv.isDefined() || Double.isInfinite(a) || Double.isNaN(a)) { tangent.setUndefined(); return; } // calc the tangent; double fa = f.evaluate(a); double slope = deriv.evaluate(a); tangent.setCoords(-slope, 1.0, a * slope - fa); T.setCoords(a, fa, 1.0); }
@Override public final void compute() { if (input[0].isDefined() && point.isDefined()) { if (path instanceof GeoFunction) { Function fun = (Function) ((GeoFunction) path).getFunction().deepCopy(kernel); Coords coords = point.getCoordsInD2(); double val = AlgoDistancePointObject.getClosestFunctionValueToPoint( fun, coords.getX(), coords.getY()); ((GeoPoint) P).setCoords(val, fun.evaluate(val), 1.0); } else { setCoords(); path.pointChanged(P); } P.updateCoords(); } else { P.setUndefined(); } }
/** set coords of closest point to input point coords */ protected void setCoords() { ((GeoPoint) P).setCoords((GeoPoint) point); }